From d0b2933048369fcc1d6d8c6fa932d3c0bf0afcbd Mon Sep 17 00:00:00 2001 From: newhouse Date: Fri, 9 Dec 2022 09:38:31 -0800 Subject: [PATCH 1/2] fix exit code --- .github/workflows/lint-and-test.yml | 11 +++++++---- bin/build-vendor.mjs | 4 +++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index b29fa320..e7af7689 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -76,7 +76,9 @@ jobs: strategy: matrix: node-version: [14, 16, 18] - + include: + - node-version: 14 + npm-version: 7 steps: - uses: actions/checkout@v3 @@ -121,10 +123,11 @@ jobs: path: ${{ env.TARBALL_PATH }} key: ${{ runner.os }}-node-${{ steps.setup-node.outputs.node-version }}-${{ env.GITHUB_SHA }} - # Node 14 ships with a version of NPM that does not work for us + # Some versions of Node (like Node 14) ships with a version of NPM that does not work for us + # so we need to install a specific version - name: Optionally update NPM if needed - if: ${{ matrix.node-version == '14' }} - run: npm i -g npm@7 + if: ${{ matrix.npm-version }} + run: npm i -g npm@${{ matrix.npm-version }} - run: yarn test-e2e:install-and-test - run: yarn install - run: yarn test diff --git a/bin/build-vendor.mjs b/bin/build-vendor.mjs index 576ee5b1..3fbef04c 100644 --- a/bin/build-vendor.mjs +++ b/bin/build-vendor.mjs @@ -14,7 +14,9 @@ const vendorSrcDir = path.join(root, 'vendor-src') if (!pathExists(vendorSrcDir)) { console.warn(`No vendor-src directory. Not building vendor packages.`) - process.exit() + // Need to pass 0 here explicitly just to be safe: + // https://github.com/nodejs/node/issues/40808 + process.exit(0) } const vendorTargetDir = path.join(root, 'vendor') From 9d42550d2169625d35ade2359767e04c264dc03e Mon Sep 17 00:00:00 2001 From: newhouse Date: Fri, 9 Dec 2022 09:57:31 -0800 Subject: [PATCH 2/2] log not warn, etc --- CHANGELOG.md | 3 +++ bin/build-vendor.mjs | 6 +++++- package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 608905cd..dd5a068a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### 2.0.2 + - Exit with an explicit `0` code when no need to build vendor packages. https://github.com/anvilco/spectaql/pull/606 + ### 2.0.1 - All lifecycle scripts only use `npm` (never `yarn`). diff --git a/bin/build-vendor.mjs b/bin/build-vendor.mjs index 3fbef04c..c6a732a2 100644 --- a/bin/build-vendor.mjs +++ b/bin/build-vendor.mjs @@ -1,3 +1,5 @@ +// TODO: Don't require building the vendor packages anymore. Somehow make them output properly by Babel +// or something import path from 'path' import fs from 'fs' import { readdir } from 'fs/promises' @@ -13,7 +15,7 @@ const CACHE_FILE_NAME = '.spectaql-cache' const vendorSrcDir = path.join(root, 'vendor-src') if (!pathExists(vendorSrcDir)) { - console.warn(`No vendor-src directory. Not building vendor packages.`) + console.log(`No vendor-src directory. Not building vendor packages.`) // Need to pass 0 here explicitly just to be safe: // https://github.com/nodejs/node/issues/40808 process.exit(0) @@ -89,6 +91,7 @@ ensureDirectory(vendorTargetDir) let tarballName = await exec(command, { cwd: path.join(vendorSrcDir, sourceDirectoryName), + // TODO: don't ignore STDERR but only log it if there's a problem stdio: [undefined, undefined, 'ignore'], }) @@ -108,6 +111,7 @@ ensureDirectory(vendorTargetDir) continue } + // TODO: don't ignore STDERR but only log it if there's a problem await exec(command, { stdio: [undefined, undefined, 'ignore'] }) // Remove the tarball diff --git a/package.json b/package.json index d64d25c8..fbefe1eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "spectaql", - "version": "2.0.1", + "version": "2.0.2", "description": "A powerful library for autogenerating static GraphQL API documentation", "author": "Anvil Foundry Inc. ", "homepage": "https://github.com/anvilco/spectaql",