diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 1409796097a..94ed310d68c 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -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 diff --git a/package.json b/package.json index 7de744bca92..ca45e67b639 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/cli/package.json b/packages/cli/package.json index a90a7b60e73..02378ecdd11 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cfe1313c435..429e3741a9b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 330b22f08bc..f5b707b097b 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -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 diff --git a/scripts/os-normalize.mjs b/scripts/os-normalize.mjs new file mode 100644 index 00000000000..0e26366cca8 --- /dev/null +++ b/scripts/os-normalize.mjs @@ -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