Skip to content

Commit

Permalink
Merge pull request #261 from APIDevTools/feat/fix-ci
Browse files Browse the repository at this point in the history
fix: bump dependencies, fix tests, fix imports from deps
  • Loading branch information
jonluca authored Oct 14, 2024
2 parents 7a2245b + d3b4d91 commit 3ebf612
Show file tree
Hide file tree
Showing 27 changed files with 7,714 additions and 65,012 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://jstools.dev/eslint-config/

root: true
extends: "@jsdevtools"
extends: "./eslint-config/lib/index.js"
env:
node: true
browser: true
53 changes: 6 additions & 47 deletions .github/workflows/CI-CD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ jobs:
- macos-latest
- windows-latest
node:
- 16
# - 18 TODO bring this back
- 20

steps:
- name: Checkout source
Expand All @@ -33,7 +32,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
cache: "npm"

- name: Install dependencies
run: npm ci
Expand All @@ -53,52 +52,13 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true

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

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

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

- name: Install dependencies
run: npm ci

- 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
- name: Send code coverage results to Coveralls
uses: coverallsapp/github-action@v1.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true

coverage:
name: Code Coverage
runs-on: ubuntu-latest
timeout-minutes: 10
needs:
- node_tests
- browser_tests
steps:
- name: Let Coveralls know that all tests have finished
uses: coverallsapp/github-action@v1.1.0
Expand All @@ -113,17 +73,16 @@ jobs:
timeout-minutes: 10
needs:
- node_tests
- browser_tests

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: 20
cache: "npm"

- name: Install dependencies
run: npm ci
Expand Down
16 changes: 16 additions & 0 deletions build-website.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {build} from "esbuild";
import {polyfillNode} from "esbuild-plugin-polyfill-node";

await build({
entryPoints: ["online/src/js/index.js"],
bundle: true,
minify: true,
sourcemap: 'external',
target: 'chrome60',
outfile: "online/js/bundle.js",
plugins: [
polyfillNode({
// Options (optional)
}),
],
});
69 changes: 69 additions & 0 deletions eslint-config/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
"use strict";

const universalRules = require("./universal-rules");
const universalJSDocRules = require("./universal-jsdoc-rules");
const javascriptRules = require("./javascript-rules");
const javascriptJSDocRules = require("./javascript-jsdoc-rules");
const javascriptTestRules = require("./javascript-test-rules");

module.exports = {
plugins: [
"jsdoc",
],
overrides: [
/**
* JavaScript source files
*/
{
files: ["**/*.{js,jsx}"],
excludedFiles: "test/**",
parserOptions: {
sourceType: "script",
ecmaVersion: 2020,
ecmaFeatures: {
jsx: true,
},
},
plugins: [
"jsdoc",
],
env: {
es2020: true,
commonjs: true,
"shared-node-browser": true,
},
rules: {
...universalRules,
...universalJSDocRules,
...javascriptRules,
...javascriptJSDocRules,
}
},

/**
* JavaScript test files
*/
{
files: ["test/**/*.{js,jsx}"],
parserOptions: {
sourceType: "script",
ecmaVersion: 2020,
},
ecmaFeatures: {
jsx: true,
},
env: {
es2020: true,
commonjs: true,
"shared-node-browser": true,
mocha: true,
jasmine: true,
},
rules: {
...universalRules,
...javascriptRules,
...javascriptTestRules,
}
},
],
};
36 changes: 36 additions & 0 deletions eslint-config/lib/javascript-jsdoc-rules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"use strict";

/**
* JSDoc rules for JavaScript and TypeScript
*/
module.exports = {
/**
* @see https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-types
*/
"jsdoc/check-types": "warn",

/**
* @see https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-undefined-types
*/
"jsdoc/no-undefined-types": "warn",

/**
* @see https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-param-type
*/
"jsdoc/require-param-type": "warn",

/**
* @see https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-property-type
*/
"jsdoc/require-property-type": "warn",

/**
* @see https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns-type
*/
"jsdoc/require-returns-type": "warn",

/**
* @see https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-valid-types
*/
"jsdoc/valid-types": "warn",
};
Loading

0 comments on commit 3ebf612

Please sign in to comment.