-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
22,847 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"airbnb-base", | ||
"airbnb-typescript/base" | ||
], | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"simple-import-sort" | ||
], | ||
|
||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "./tsconfig.json", | ||
"sourceType": "module" | ||
}, | ||
"ignorePatterns": ["build/**"], | ||
|
||
"rules": { | ||
"@typescript-eslint/prefer-readonly": "error", | ||
"simple-import-sort/exports": "error", | ||
"simple-import-sort/imports": "error" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | ||
|
||
name: Publish Package to npmjs | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
# Setup .npmrc file to publish to npm | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm ci | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
# https://hanxiao.io/2021/01/24/Speedup-CI-Workflow-in-Github-Actions-via-Strategy-Matrix/ | ||
|
||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
test-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Setup and install | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: 'npm' | ||
- run: npm ci | ||
|
||
# Lint the source files | ||
- run: ./node_modules/.bin/ts-node ./index.ts --help | ||
- run: npm run lint | ||
|
||
test-unit: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
# TODO(cemmer): os.devNull in tests needs v14.18.0+ or v16.3.0+, test-e2e can cover 12.x | ||
node-version: [ lts/*, lts/-1 ] | ||
steps: | ||
# Setup and install | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- run: npm ci | ||
|
||
# Test the source files | ||
- run: npm run test:unit | ||
|
||
test-e2e: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [ lts/*, lts/-1, lts/-2 ] | ||
steps: | ||
# Setup and install | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- run: npm ci | ||
|
||
# Test the built files | ||
- run: npm run build | ||
- run: ./test/endToEndTest.sh | ||
|
||
test-package: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [ lts/*, lts/-1, lts/-2 ] | ||
steps: | ||
# Setup and install | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- run: npm ci | ||
|
||
# Test the packaging | ||
- run: | | ||
npm pack | ||
tar -xvzf igir-*.tgz | ||
cd package | ||
npm install --ignore-scripts | ||
./build/index.js --help | ||
cd .. | ||
rm -rf package | ||
codecov: | ||
needs: | ||
- test-lint | ||
- test-unit | ||
- test-e2e | ||
- test-package | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Setup and install | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: 'npm' | ||
- run: npm ci | ||
|
||
# Run test coverage | ||
- run: npm run test:coverage | ||
- uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: true | ||
verbose: true | ||
|
||
status-check: | ||
needs: | ||
- test-lint | ||
- test-unit | ||
- test-e2e | ||
- test-package | ||
- codecov | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo ok | ||
|
||
# version-check: | ||
# if: github.ref_name == 'main' | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# # Setup and install | ||
# - uses: actions/checkout@v3 | ||
# | ||
# # Check if version has changed | ||
# - name: Check if version has been updated | ||
# id: check | ||
# uses: EndBug/version-check@v1 | ||
# - name: Log when changed | ||
# if: steps.check.outputs.changed == 'true' | ||
# run: 'echo "Version change found in commit ${{ steps.check.outputs.commit }}! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"' | ||
# - run: echo ::set-output changed=${{steps.check.outputs.changed}} | ||
# | ||
# github-release: | ||
# if: github.ref_name == 'main' && jobs.version-check.outputs.changed == 'true' | ||
# needs: | ||
# - status-check | ||
# - version-check | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# # Setup and install | ||
# - uses: actions/checkout@v3 | ||
# - uses: actions/setup-node@v3 | ||
# with: | ||
# cache: 'npm' | ||
# - run: npm ci | ||
# - run: npm run release:patch -- --ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
# Change to the project's root directory | ||
cd "$(dirname -- "$0")/.." || exit 1 | ||
|
||
# Ensure node is available | ||
if [[ ! -x "$(command -v node)" ]]; then | ||
if [[ ! -x "$(command -v nvm)" && -f ~/.nvm/nvm.sh ]]; then | ||
. ~/.nvm/nvm.sh | ||
fi | ||
if [[ ! -x "$(command -v nvm)" ]]; then | ||
nvm use || exit 1 | ||
fi | ||
fi | ||
node --version &> /dev/null || exit 1 | ||
|
||
# Follow the linter | ||
npm run lint:fix | ||
|
||
# Make sure igir is symlinked | ||
npm link --force | ||
|
||
# Update the help text in README.md | ||
npm run build | ||
README="README.md" | ||
README_BEFORE=$(cat "${README}") | ||
(awk 'BEGIN {msg=ARGV[1]; delete ARGV[1]; p=1} /^```help/ {print; print msg; p=0} /^```$/ {p=1} p' \ | ||
"$(igir --help)" \ | ||
"${README}" > "${README}.temp" || exit 1) && mv -f "${README}.temp" "${README}" | ||
README_AFTER=$(cat "${README}") | ||
if [[ "${README_AFTER}" != "${README_BEFORE}" ]]; then | ||
# TODO(cemmer): way to not commit the entire file when the help text changes? | ||
git add "${README}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
16.16.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"hooks": { | ||
"after:npm:bump": "npm pack", | ||
"after:git:release": "echo After git push, before github release", | ||
"after:release": "echo Successfully released ${name} v${version} to ${repo.repository}." | ||
}, | ||
"git": { | ||
"requireBranch": "main", | ||
"commit": false, | ||
"tagName": "v${version}" | ||
}, | ||
"github": { | ||
"release": true, | ||
"releaseName": "${version}", | ||
"assets": ["igir-${version}.tgz"] | ||
}, | ||
"npm": false | ||
} |
Oops, something went wrong.