Skip to content

Commit

Permalink
Modern codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
JrMasterModelBuilder committed Sep 22, 2023
1 parent 80fc4ab commit a14a3a3
Show file tree
Hide file tree
Showing 41 changed files with 1,769 additions and 1,159 deletions.
16 changes: 0 additions & 16 deletions .babelrc

This file was deleted.

5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/lib
/module.mjs
/dts
/esm
/cjs
22 changes: 21 additions & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ rules:
MethodDefinition: true
checkGetters: true
checkSetters: true
jsdoc/tag-lines:
- warn
- never
- startLines: 1

# TypeScript Simple:
'@typescript-eslint/array-type': error
Expand Down Expand Up @@ -445,26 +449,42 @@ overrides:
rules:
'@typescript-eslint/no-unsafe-assignment': off
'@typescript-eslint/no-unsafe-member-access': off
'@typescript-eslint/no-unsafe-call': off
'@typescript-eslint/no-unsafe-return': off
- files:
- '*.ts'
- '*.tsx'
rules:
jsdoc/no-types: warn
- files:
- '*.test.js'
- '*.test.jsx'
- '*.test.mjs'
- '*.test.mjsx'
- '*.test.ts'
- '*.test.tsx'
- '*.spec.js'
- '*.spec.jsx'
- '*.spec.mjs'
- '*.spec.mjsx'
- '*.spec.ts'
- '*.spec.tsx'
rules:
no-void: off
jsdoc/require-jsdoc: off
'@typescript-eslint/no-floating-promises':
- error
- ignoreVoid: true
- files:
- 'gulpfile.babel.ts'
- 'babel.config.js'
rules:
import/no-extraneous-dependencies:
- error
- devDependencies: true
optionalDependencies: false
peerDependencies: false
jsdoc/require-jsdoc: off
'@typescript-eslint/no-require-imports': off
'@typescript-eslint/no-var-requires': off
parserOptions:
sourceType: script
26 changes: 12 additions & 14 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@ jobs:
strategy:
matrix:
config:
- node-version: '14.15.0' # LTS
NO_FORMATTED: 1
NO_LINT: 1
- runs-on: ubuntu-latest
node-version: '18.12.0' # LTS

- node-version: '16.13.0' # LTS
NO_FORMATTED: 1
NO_LINT: 1
- runs-on: ubuntu-latest
node-version: '18.18.0' # LTS (current)
CODE_CHECK: 1

- node-version: '18.12.0' # LTS (current)
- runs-on: ubuntu-latest
node-version: '20.7.0'

- node-version: '19.0.0' # Latest

runs-on: ubuntu-20.04
runs-on: ${{ matrix.config.runs-on }}

steps:
- name: Checkout
Expand All @@ -44,17 +42,17 @@ jobs:

- name: Lint
run: npm run lint
if: matrix.config.NO_LINT != 1
if: matrix.config.CODE_CHECK == 1

- name: Formatted
run: npm run formatted
if: matrix.config.NO_FORMATTED != 1
if: matrix.config.CODE_CHECK == 1

publish:
if: startsWith(github.ref, 'refs/tags/')
needs: build

runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- name: Checkout
Expand All @@ -63,7 +61,7 @@ jobs:
- name: Node
uses: actions/setup-node@v3
with:
node-version: '16.16.0'
node-version: '18.18.0'
registry-url: https://registry.npmjs.org/

- name: Dependencies
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ yarn.lock
.vscode

# Build files
/lib
/dts
/esm
/cjs
19 changes: 12 additions & 7 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,25 @@ yarn.lock
/.gitattributes
/.gitignore
/.github
/.babelrc
/.editorconfig
/.eslintignore
/.eslintrc.yaml
/.prettierrc.yaml
/.prettierignore
/babel.config.js
/tsconfig.json
/tsconfig.eslint.json
/gulpfile.babel.ts
/spec
/src

/lib/**/*.spec.d.ts
/lib/**/*.spec.js
/lib/**/*.spec.js.map
/lib/**/*.spec.mjs
/lib/**/*.spec.mjs.map
/dts/**/*.test.d.ts
/esm/**/*.test.mjs
/esm/**/*.test.mjs.map
/cjs/**/*.test.js
/cjs/**/*.test.js.map

/dts/**/*.spec.d.ts
/esm/**/*.spec.mjs
/esm/**/*.spec.mjs.map
/cjs/**/*.spec.js
/cjs/**/*.spec.js.map
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.12.0
18.18.0
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/package-lock.json
/lib
/dts
/esm
/cjs
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ If you find a bug or have compatibility issues, please open a ticket under issue

# License

Copyright (c) 2019-2022 JrMasterModelBuilder
Copyright (c) 2019-2023 JrMasterModelBuilder

Licensed under the Mozilla Public License, v. 2.0.

Expand Down
69 changes: 69 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
'use strict';

const {name, version, engines} = require('./package.json');

const node = engines.node
.split(/[^\d.]+/)
.filter(s => s.length)
.map(s => [...s.split('.').map(s => +s || 0), 0, 0].slice(0, 3))
.sort((a, b) => a[2] - b[2])
.sort((a, b) => a[1] - b[1])
.sort((a, b) => a[0] - b[0])[0]
.join('.');

module.exports = api => {
const env = api.env();
api.cache(() => env);
const modules = env === 'esm' ? false : 'commonjs';
const ext = modules ? '.js' : '.mjs';
const presets = [];
const plugins = [];
presets.push([
'@babel/preset-env',
{
modules,
exclude: ['proposal-dynamic-import'],
targets: {
node
}
}
]);
presets.push(['@babel/preset-typescript']);
if (modules === 'commonjs') {
plugins.push([
'@babel/plugin-transform-modules-commonjs',
{
importInterop: 'node'
}
]);
}
plugins.push([
'esm-resolver',
{
source: {
extensions: [
[['.js', '.mjs', '.jsx', '.mjsx', '.ts', '.tsx'], ext]
]
}
}
]);
plugins.push([
'search-and-replace',
{
rules: [
{
search: '#{NAME}',
replace: name
},
{
search: '#{VERSION}',
replace: version
}
]
}
]);
return {
presets,
plugins
};
};
Loading

0 comments on commit a14a3a3

Please sign in to comment.