forked from adierkens/webpack-inject-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from namecheap/feature/webpackv5
feat: support webpack v5
- Loading branch information
Showing
24 changed files
with
12,325 additions
and
11,939 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,61 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags-ignore: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.x] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- run: npm ci | ||
- if: github.event_name == 'pull_request' | ||
name: Lint commit messages | ||
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose | ||
- run: npm run lint | ||
- run: npm run build | ||
- run: npm run test | ||
- run: npm run test:example | ||
- if: matrix.node-version == '20.x' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Code coverage | ||
path: coverage/ | ||
|
||
publish: | ||
name: 'Publish' | ||
needs: build | ||
runs-on: ubuntu-latest | ||
environment: npm_publish | ||
if: github.ref == 'refs/heads/master' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
cache: 'npm' | ||
- run: npm ci | ||
- name: Publish new version | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npx semantic-release | ||
# run: npx semantic-release --dry-run --branches "$GITHUB_REF_NAME" |
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 @@ | ||
npx --no -- commitlint --edit $1 |
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,3 @@ | ||
npx lint-staged | ||
npm run build | ||
npm test |
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,7 @@ | ||
{ | ||
"printWidth": 120, | ||
"trailingComma": "all", | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"arrowParens": "avoid" | ||
} |
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,6 @@ | ||
/** | ||
* @type {import('@commitlint/types').UserConfig} | ||
*/ | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional'], | ||
}; |
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,51 @@ | ||
import typescriptEslint from '@typescript-eslint/eslint-plugin'; | ||
import prettier from 'eslint-plugin-prettier'; | ||
import prettierConfig from 'eslint-config-prettier'; | ||
import noExplicitTypeExports from 'eslint-plugin-no-explicit-type-exports'; | ||
import globals from 'globals'; | ||
import tsParser from '@typescript-eslint/parser'; | ||
import js from '@eslint/js'; | ||
import xo from 'eslint-config-xo'; | ||
|
||
export default [ | ||
js.configs.recommended, | ||
...xo, | ||
prettierConfig, | ||
{ | ||
files: ['**/*.ts'], | ||
plugins: { | ||
'@typescript-eslint': typescriptEslint, | ||
prettier, | ||
'no-explicit-type-exports': noExplicitTypeExports, | ||
}, | ||
|
||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
}, | ||
|
||
parser: tsParser, | ||
ecmaVersion: 5, | ||
sourceType: 'module', | ||
|
||
parserOptions: { | ||
project: './tsconfig.json', | ||
}, | ||
}, | ||
|
||
settings: { | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.js', '.jsx', '.ts', '.tsx'], | ||
}, | ||
}, | ||
}, | ||
|
||
rules: { | ||
'no-explicit-type-exports/no-explicit-type-exports': 2, | ||
'no-unused-vars': ['off'], | ||
'no-undef': ['off'], | ||
'no-unused-expressions': ['off'], | ||
}, | ||
}, | ||
]; |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
const InjectPlugin = require('..').default; | ||
const { WebpackInjectPlugin } = require('..'); | ||
|
||
module.exports = { | ||
entry: './entry.js', | ||
mode: 'development', | ||
plugins: [ | ||
new InjectPlugin(() => `console.log('hello world');`), | ||
new InjectPlugin(() => `console.log('second injected code');`) | ||
] | ||
new WebpackInjectPlugin(() => `console.log('hello world');`), | ||
new WebpackInjectPlugin(() => `console.log('second injected code');`), | ||
], | ||
}; |
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 |
---|---|---|
@@ -1,15 +1,10 @@ | ||
module.exports = { | ||
moduleFileExtensions: ['ts', 'js'], | ||
transform: { | ||
'^.+\\.(ts|tsx)$': 'ts-jest' | ||
}, | ||
globals: { | ||
'ts-jest': { | ||
tsConfig: 'tsconfig.json' | ||
} | ||
}, | ||
collectCoverage: true, | ||
testPathIgnorePatterns: ['node_modules', 'dist'], | ||
coverageDirectory: './coverage', | ||
coverageReporters: ['cobertura', 'html', 'lcov'] | ||
}; | ||
module.exports = { | ||
moduleFileExtensions: ['ts', 'js'], | ||
transform: { | ||
'^.+\\.(ts|tsx)$': 'ts-jest', | ||
}, | ||
collectCoverage: true, | ||
testPathIgnorePatterns: ['node_modules', 'dist'], | ||
coverageDirectory: './coverage', | ||
coverageReporters: ['cobertura', 'html', 'lcov'], | ||
}; |
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,7 @@ | ||
/** | ||
* @type {import('lint-staged').Config} | ||
*/ | ||
module.exports = { | ||
'*': 'prettier --ignore-unknown --write', | ||
'*.ts': 'npm run lint -- --fix', | ||
}; |
Oops, something went wrong.