mirror of
https://github.com/n8n-io/n8n
synced 2026-04-21 15:47:20 +00:00
chore: Remove dependency on run-script-os (#25282)
This commit is contained in:
parent
38b267baed
commit
813429cb68
6 changed files with 73 additions and 17 deletions
14
.github/workflows/build-windows.yml
vendored
14
.github/workflows/build-windows.yml
vendored
|
|
@ -39,6 +39,20 @@ jobs:
|
|||
with:
|
||||
build-command: pnpm build
|
||||
|
||||
- name: Smoke test pnpm start -- -- --version
|
||||
shell: pwsh
|
||||
run: |
|
||||
Write-Host "Running smoke test: pnpm start -- -- --version"
|
||||
|
||||
pnpm start -- -- --version
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "`n❌ Smoke test failed (exit code: $LASTEXITCODE)"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
Write-Host "`n✓ Smoke test passed"
|
||||
|
||||
- name: Send Slack notification on failure
|
||||
if: failure() && inputs.notify_on_failure == true
|
||||
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
|
||||
|
|
|
|||
|
|
@ -36,9 +36,7 @@
|
|||
"optimize-svg": "find ./packages -name '*.svg' ! -name 'pipedrive.svg' -print0 | xargs -0 -P16 -L20 npx svgo",
|
||||
"generate:third-party-licenses": "node scripts/generate-third-party-licenses.mjs",
|
||||
"setup-backend-module": "node scripts/ensure-zx.mjs && zx scripts/backend-module/setup.mjs",
|
||||
"start": "run-script-os",
|
||||
"start:default": "cd packages/cli/bin && ./n8n",
|
||||
"start:windows": "cd packages/cli/bin && n8n",
|
||||
"start": "node scripts/os-normalize.mjs --dir packages/cli/bin n8n",
|
||||
"test": "JEST_JUNIT_CLASSNAME={filepath} turbo run test",
|
||||
"test:ci": "turbo run test --continue --concurrency=1",
|
||||
"test:ci:frontend": "turbo run test --continue --filter='./packages/frontend/**'",
|
||||
|
|
@ -75,7 +73,6 @@
|
|||
"npm-run-all2": "^7.0.2",
|
||||
"p-limit": "^3.1.0",
|
||||
"rimraf": "^5.0.1",
|
||||
"run-script-os": "^1.0.7",
|
||||
"supertest": "^7.1.1",
|
||||
"ts-jest": "^29.1.1",
|
||||
"tsc-alias": "^1.8.10",
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@
|
|||
"format:check": "biome ci .",
|
||||
"lint": "eslint . --quiet",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"start": "run-script-os",
|
||||
"start:default": "cd bin && ./n8n",
|
||||
"start:windows": "cd bin && n8n",
|
||||
"start": "node ../../scripts/os-normalize.mjs --dir bin n8n",
|
||||
"test": "N8N_LOG_LEVEL=silent DB_SQLITE_POOL_SIZE=4 DB_TYPE=sqlite jest",
|
||||
"test:unit": "N8N_LOG_LEVEL=silent DB_SQLITE_POOL_SIZE=4 DB_TYPE=sqlite jest --config=jest.config.unit.js",
|
||||
"test:integration": "N8N_LOG_LEVEL=silent DB_SQLITE_POOL_SIZE=4 DB_TYPE=sqlite jest --config=jest.config.integration.js",
|
||||
|
|
|
|||
|
|
@ -459,9 +459,6 @@ importers:
|
|||
rimraf:
|
||||
specifier: ^5.0.1
|
||||
version: 5.0.1
|
||||
run-script-os:
|
||||
specifier: ^1.0.7
|
||||
version: 1.1.6
|
||||
supertest:
|
||||
specifier: ^7.1.1
|
||||
version: 7.1.1
|
||||
|
|
@ -16804,10 +16801,6 @@ packages:
|
|||
run-parallel@1.2.0:
|
||||
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
|
||||
|
||||
run-script-os@1.1.6:
|
||||
resolution: {integrity: sha512-ql6P2LzhBTTDfzKts+Qo4H94VUKpxKDFz6QxxwaUZN0mwvi7L3lpOI7BqPCq7lgDh3XLl0dpeXwfcVIitlrYrw==}
|
||||
hasBin: true
|
||||
|
||||
rusha@0.8.14:
|
||||
resolution: {integrity: sha512-cLgakCUf6PedEu15t8kbsjnwIFFR2D4RfL+W3iWFJ4iac7z4B0ZI8fxy4R3J956kAI68HclCFGL8MPoUVC3qVA==}
|
||||
|
||||
|
|
@ -35979,8 +35972,6 @@ snapshots:
|
|||
dependencies:
|
||||
queue-microtask: 1.2.3
|
||||
|
||||
run-script-os@1.1.6: {}
|
||||
|
||||
rusha@0.8.14: {}
|
||||
|
||||
rw@1.3.3: {}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ catalog:
|
|||
picocolors: 1.0.1
|
||||
reflect-metadata: 0.2.2
|
||||
rimraf: 6.0.1
|
||||
run-script-os: 1.1.6
|
||||
simple-git: 3.28.0
|
||||
tsdown: ^0.16.5
|
||||
tsx: ^4.19.3
|
||||
|
|
|
|||
57
scripts/os-normalize.mjs
Normal file
57
scripts/os-normalize.mjs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Created to ease the running of binaries on cross-platform teams.
|
||||
* Enabled writing startup scripts once, but defaulting to platform specific runners.
|
||||
*
|
||||
* Usage: node scripts/os-normalize.mjs --dir packages/cli/bin n8n
|
||||
* Usage (with args): node scripts/os-normalize.mjs --dir packages/cli/bin -- n8n --help
|
||||
* */
|
||||
|
||||
import { $, argv, cd, chalk, echo, usePowerShell, fs } from 'zx';
|
||||
|
||||
const isWindows = process.platform === 'win32';
|
||||
|
||||
/**
|
||||
* @param { string } baseName
|
||||
* */
|
||||
function normalizeCommand(baseName) {
|
||||
if (!isWindows) {
|
||||
return `./${baseName}`;
|
||||
}
|
||||
|
||||
const candidates = [`${baseName}.cmd`, `${baseName}.exe`, baseName];
|
||||
const found = candidates.find((c) => fs.existsSync(c));
|
||||
return found ? `./${found}` : `./${baseName}.cmd`; // last resort: try .cmd anyway
|
||||
}
|
||||
|
||||
function determineShell() {
|
||||
if (!isWindows) {
|
||||
return;
|
||||
}
|
||||
usePowerShell();
|
||||
}
|
||||
|
||||
function printUsage() {
|
||||
echo(chalk.red('Usage: node scripts/os-normalize.mjs --dir <dir> <run>'));
|
||||
echo(
|
||||
chalk.red('Usage (with args): node scripts/os-normalize.mjs --dir <dir> -- <run> [args...]'),
|
||||
);
|
||||
}
|
||||
|
||||
const { dir = '.' } = argv;
|
||||
const [run, ...args] = argv._;
|
||||
|
||||
if (!dir || !run) {
|
||||
printUsage();
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
determineShell();
|
||||
$.verbose = true;
|
||||
|
||||
cd(dir);
|
||||
const cmd = normalizeCommand(run);
|
||||
|
||||
echo(chalk.cyan(`$ Running (dir: ${dir}) ${cmd} ${args.join(' ')}`));
|
||||
await $({ stdio: 'inherit' })`${cmd} ${args}`;
|
||||
Loading…
Reference in a new issue