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

fix build + deploy pipeline #11

Closed
wants to merge 11 commits into from
Closed
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
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ jobs:
html-webpack: 5
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.webpack < 5 && '16.20.2' || '20.8.0' }}
- run: npm install
- run: npm install -D webpack@${{ matrix.webpack }} html-webpack-plugin@${{ matrix.html-webpack }}
- run: npm run test
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,20 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
webpack: [4]
html-webpack: [4, 3]
include:
- webpack: 5
html-webpack: 5
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
- run: npm install
- run: npm install -D webpack@${{ matrix.webpack }} html-webpack-plugin@${{ matrix.html-webpack }}
- run: npm run test
- run: npm run build
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: '20.8.0'
- run: npm install
- uses: JS-DevTools/npm-publish@v1
with:
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "html-webpack-skip-assets-plugin",
"version": "1.0.3",
"version": "1.0.4",
"description": "a plugin for html-webpack-plugin to skip adding certain output files to the html",
"repository": {
"type": "git",
Expand All @@ -14,7 +14,7 @@
"scripts": {
"test": "mocha -r ts-node/register spec/**/*.spec.ts --exit",
"prebuild": "rimraf dist",
"build": "tsc",
"build": "tsc -p tsconfig.json",
"prepublishOnly": "npm run build"
},
"keywords": [
Expand All @@ -30,15 +30,15 @@
"devDependencies": {
"@types/chai": "4.2.14",
"@types/mocha": "8.2.0",
"@types/node": "13.13.4",
"@types/node": "20.11.30",
"chai": "4.2.0",
"css-loader": "5.0.1",
"html-webpack-plugin": ">=3.2.0",
"mini-css-extract-plugin": "1.3.5",
"mocha": "8.2.1",
"rimraf": "3.0.2",
"ts-node": "9.1.1",
"typescript": "4.1.3",
"typescript": "5.4.3",
"webpack": ">=3.0.0"
},
"dependencies": {
Expand Down
38 changes: 19 additions & 19 deletions spec/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ configs.forEach(c => {
it('should do nothing when no patterns are specified', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin(HtmlWebpackPluginOptions),
new HtmlWebpackSkipAssetsPlugin(),
]
Expand All @@ -120,7 +120,7 @@ configs.forEach(c => {
it('should not fail on meta links', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin({
...HtmlWebpackPluginOptions,
meta: {
Expand All @@ -133,7 +133,7 @@ configs.forEach(c => {
]
}, (err, stats) => {
expect(!!err).to.be.false;
expect(stats.hasErrors()).to.be.false;
expect(stats?.hasErrors()).to.be.false;
const html = getOutput();
expect(/script\s+.*?src\s*=\s*"(\/)?polyfill(\.[a-z0-9]+\.min)?\.js"/i.test(html), 'could not find polyfill bundle').to.be.true;
expect(/script\s+.*?src\s*=\s*"(\/)?app(\.[a-z0-9]+\.min)?\.js"/i.test(html), 'could not find app bundle').to.be.true;
Expand All @@ -147,7 +147,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - plugin.skipAssets.minimatch', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin(HtmlWebpackPluginOptions),
new HtmlWebpackSkipAssetsPlugin({
skipAssets: ['styles**.js']
Expand All @@ -167,7 +167,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - plugin.excludeAssets.minimatch', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin(HtmlWebpackPluginOptions),
new HtmlWebpackSkipAssetsPlugin({
excludeAssets: ['styles**.js']
Expand All @@ -187,7 +187,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - plugin.skipAssets.regex', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin(HtmlWebpackPluginOptions),
new HtmlWebpackSkipAssetsPlugin({
skipAssets: [/styles\..*js/i]
Expand All @@ -207,7 +207,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - plugin.excludeAssets.regex', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin(HtmlWebpackPluginOptions),
new HtmlWebpackSkipAssetsPlugin({
excludeAssets: [/styles\..*js/i]
Expand All @@ -227,7 +227,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - plugin.skipAssets.regex-global', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin(HtmlWebpackPluginOptions),
new HtmlWebpackSkipAssetsPlugin({
skipAssets: [/styles\./gi]
Expand All @@ -247,7 +247,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - plugin.excludeAssets.regex-global', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin(HtmlWebpackPluginOptions),
new HtmlWebpackSkipAssetsPlugin({
excludeAssets: [/styles\./gi]
Expand All @@ -267,7 +267,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - plugin.skipAssets.callback', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin(HtmlWebpackPluginOptions),
new HtmlWebpackSkipAssetsPlugin({
skipAssets: [(asset) => {
Expand All @@ -291,7 +291,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - plugin.excludeAssets.callback', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin(HtmlWebpackPluginOptions),
new HtmlWebpackSkipAssetsPlugin({
excludeAssets: [(asset) => {
Expand All @@ -315,7 +315,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - parent.skipAssets.minimatch', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin({
...HtmlWebpackPluginOptions,
skipAssets: ['styles**.js']
Expand All @@ -336,7 +336,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - parent.excludeAssets.minimatch', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin({
...HtmlWebpackPluginOptions,
excludeAssets: ['styles**.js']
Expand All @@ -357,7 +357,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - parent.skipAssets.regex', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin({
...HtmlWebpackPluginOptions,
skipAssets: [/styles\..*js/i]
Expand All @@ -378,7 +378,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - parent.excludeAssets.regex', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin({
...HtmlWebpackPluginOptions,
excludeAssets: [/styles\..*js/i]
Expand All @@ -399,7 +399,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - parent.skipAssets.regex-global', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin({
...HtmlWebpackPluginOptions,
skipAssets: [/styles\./gi]
Expand All @@ -420,7 +420,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - parent.excludeAssets.regex-global', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin({
...HtmlWebpackPluginOptions,
excludeAssets: [/styles\./gi]
Expand All @@ -441,7 +441,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - parent.skipAssets.callback', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin({
...HtmlWebpackPluginOptions,
skipAssets: [(asset) => {
Expand All @@ -466,7 +466,7 @@ configs.forEach(c => {
it('should skip adding asset if the pattern matches - parent.excludeAssets.callback', (done) => {
webpack({ ...c.options,
plugins: [
...c.options.plugins,
...c.options.plugins ?? [],
new HtmlWebpackPlugin({
...HtmlWebpackPluginOptions,
excludeAssets: [(asset) => {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
]
},
"exclude": [
"node_modules/",
"**/node_modules/",
"spec/",
"**/*.spec.js",
"**/*.spec.ts",
"**/*.d.ts"
]
}
Loading