use engines config in order to support nix-shell (#5521)

* add shell.nix

* use engines

* fix engine range

* fix
This commit is contained in:
Jack Kavanagh 2023-01-05 14:17:34 +01:00 committed by GitHub
parent 9e1e05a8c3
commit ac0dd5e4b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 34 deletions

5
package-lock.json generated
View File

@ -7,7 +7,6 @@
"": {
"name": "insomnia",
"version": "1.0.0",
"hasInstallScript": true,
"license": "MIT",
"devDependencies": {
"@jest/globals": "^28.1.0",
@ -37,6 +36,10 @@
"ts-jest": "^28.0.1",
"type-fest": "^2.12.0",
"typescript": "^4.5.5"
},
"engines": {
"node": ">=16.17 <17",
"npm": ">=8.15.0"
}
},
"node_modules/@ampproject/remapping": {

View File

@ -10,12 +10,16 @@
"url": "https://github.com/kong/insomnia/issues"
},
"homepage": "https://github.com/kong/insomnia#readme",
"engines":{
"node": ">=16.17 <17",
"npm": ">=8.15.0"
},
"scripts": {
"build": "lerna run build --parallel",
"lint": "lerna run lint --stream --no-bail",
"lint:markdown": "markdownlint-cli2 \"**/*.md\" \"#**/node_modules\"",
"lint:fix": "lerna run lint:fix --stream --no-bail",
"bootstrap": "npm install && lerna bootstrap && lerna run --stream bootstrap",
"bootstrap": " npx -y check-engine && npm install && lerna bootstrap && lerna run --stream bootstrap",
"version": "lerna version",
"clean": "lerna run clean --parallel --stream && lerna clean --yes && rimraf node_modules **/*.tsbuildinfo",
"test": "lerna run --stream --parallel test",
@ -28,7 +32,6 @@
"app-build": "npm run build --prefix packages/insomnia",
"app-package": "npm run build --prefix packages/insomnia && npm run package --prefix packages/insomnia",
"app-bump-version": "npm run bump-version --prefix packages/insomnia",
"preinstall": "node ./scripts/check-version.js",
"test:smoke:dev": "npm run test:dev --prefix packages/insomnia-smoke-test -- --project=Smoke",
"test:smoke:build": "npm run test:build --prefix packages/insomnia-smoke-test -- --project=Smoke",
"test:smoke:package": "npm run test:package --prefix packages/insomnia-smoke-test -- --project=Smoke",

View File

@ -1,31 +0,0 @@
// TODO(TSCONVERSION) convert to TypeScript?
const fs = require('fs');
const GREEN_FG = '\x1b[32m';
const RED_FG = '\x1b[31m';
const YELLOW_FG = '\x1b[33m';
const UNDERSCORE = '\x1b[4m';
const BRIGHT = '\x1b[1m';
const RESET = '\x1b[0m';
const foundNodeVersion = process.versions.node;
const expectedNodeVersion = fs
.readFileSync('.nvmrc')
.toString()
.trim();
if (foundNodeVersion !== expectedNodeVersion) {
console.log(`${BRIGHT}${RED_FG}Incorrect node version installed ...${RESET}\n`);
console.log(`Current node version -> ${RED_FG}${foundNodeVersion}${RESET}`);
console.log(`Expected node version -> ${GREEN_FG}${expectedNodeVersion}${RESET}`);
console.log();
console.log(
`One solution to manage multiple versions of node is nvm, visit ${UNDERSCORE}https://github.com/nvm-sh/nvm${RESET}`,
);
console.log();
console.log(
`${BRIGHT}${YELLOW_FG}Remember to 'npm run clean && npm run bootstrap' after installing the expected version.${RESET}`,
);
console.log();
process.exit(1);
}

10
shell.nix Normal file
View File

@ -0,0 +1,10 @@
with import <nixpkgs> {};
mkShell {
nativeBuildInputs = [
nodejs-16_x
electron_22
];
ELECTRON_OVERRIDE_DIST_PATH = "${electron_22}/bin/";
}