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

WIP: Typescript rewrite, test migration, code modernization #253

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
27 changes: 0 additions & 27 deletions .editorconfig

This file was deleted.

46 changes: 46 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true,
"node": true,
"amd": true
},
"settings": {
"react": { "version": "detect" }
},
"extends": ["prettier", "eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["prettier", "unused-imports", "@typescript-eslint"],
"rules": {
"prefer-rest-params": "off",
"prefer-const": "error",
"prefer-spread": "off",
"no-case-declarations": "off",
"curly": ["error", "all"],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"@typescript-eslint/consistent-type-imports": [
"error",
{
"prefer": "type-imports"
}
],
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-use-before-define": ["off"],
"object-shorthand": "error",
"@typescript-eslint/no-unused-vars": [
"warn",
{ "varsIgnorePattern": "^_", "argsIgnorePattern": "^_", "ignoreRestSiblings": true }
],
"unused-imports/no-unused-imports-ts": "error"
}
}
9 changes: 0 additions & 9 deletions .eslintrc.yml

This file was deleted.

90 changes: 33 additions & 57 deletions .github/workflows/CI-CD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,126 +22,102 @@ jobs:
- macos-latest
- windows-latest
node:
- 14
- 16
# - 18 TODO bring this back
- 18
- lts/*
- current

steps:
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Node ${{ matrix.node }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'

- name: Install dependencies
run: npm ci
run: yarn install --frozen-lockfile

- name: Run linter
run: npm run lint

- name: Run TypeScript tests
run: npm run test:typescript
run: yarn lint

- name: Run Node tests
run: npm run coverage:node
run: yarn test:node

- name: Send code coverage results to Coveralls
uses: coverallsapp/github-action@v1.1.0
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true

browser_tests:
name: Browser Tests
runs-on: ${{ matrix.os }}
timeout-minutes: 10
timeout-minutes: 15
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest # Chrome, Firefox, Safari (TODO)
# - windows-latest # Internet Explorer, Edge
- ubuntu-latest # Chrome, Firefox
- windows-latest # Internet Explorer

steps:
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 12
cache: 'npm'
node-version: lts/*

- name: Install dependencies
run: npm ci
run: yarn install --frozen-lockfile

- name: Run tests
run: npm run coverage:browser

- name: Combine code coverage data into a single file
shell: bash
run: |
ls -Rlh coverage/*/lcov.info
cat coverage/*/lcov.info > ./coverage/lcov.info
run: yarn test:browser

- name: Send code coverage results to Coveralls
uses: coverallsapp/github-action@v1.1.0
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true

coverage:
name: Code Coverage
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 5
needs:
- node_tests
- browser_tests
steps:
- name: Let Coveralls know that all tests have finished
uses: coverallsapp/github-action@v1.1.0
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

deploy:
name: Publish to NPM
release:
name: Release
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 10
needs:
- node_tests
- browser_tests

steps:
- name: Checkout source
uses: actions/checkout@v3

- name: Install Node
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 12
cache: 'npm'
node-version: lts/*

- name: Install dependencies
run: npm ci

- name: Publish to NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
run: yarn install --frozen-lockfile

- name: Prepare the non-scoped packaged
run: |
cp LICENSE *.md dist
VERSION=$(node -e "console.log(require('./package.json').version)")
sed -i "s/X.X.X/${VERSION}/g" dist/package.json
- name: Prepare Unscoped Package
run: yarn build

- name: Publish the non-scoped package to NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: dist/package.json
- name: Publish to NPM
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ node_modules
# Jekyll output
_site
.sass-cache
coverage
13 changes: 3 additions & 10 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,17 @@
"request": "launch",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"stopOnEntry": false,
"args": [
"--quick-test",
"--timeout=600000"
],
"args": ["--quick-test", "--timeout=600000"],
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"runtimeArgs": ["--nolazy"],
"env": {
"NODE_ENV": "development"
},
"console": "internalConsole",
"sourceMaps": false,
"skipFiles": [
"<node_internals>/**/*.js"
]
"skipFiles": ["<node_internals>/**/*.js"]
}
]
}
Binary file added .yarn/install-state.gz
Binary file not shown.
Loading
Loading