Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix exit code #606

Merged
merged 2 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ jobs:
strategy:
matrix:
node-version: [14, 16, 18]

include:
- node-version: 14
npm-version: 7
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`).

Expand Down
10 changes: 8 additions & 2 deletions bin/build-vendor.mjs
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -13,8 +15,10 @@ 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.`)
process.exit()
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)
}
const vendorTargetDir = path.join(root, 'vendor')

Expand Down Expand Up @@ -87,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'],
})

Expand All @@ -106,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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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. <[email protected]>",
"homepage": "https://github.com/anvilco/spectaql",
Expand Down