Skip to content

Commit 4a2d9b7

Browse files
authored
Merge pull request #27 from icelam/test/v4-simple
test: add test for simple webpack 4 build
2 parents 8bcd85f + c632cbe commit 4a2d9b7

File tree

8 files changed

+58
-7
lines changed

8 files changed

+58
-7
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"overrides": [
4141
{
42-
"files": ["scripts/*.js"],
42+
"files": ["scripts/*.js", "test/**/*.js"],
4343
"env": { "node": true },
4444
"rules": {
4545
"@typescript-eslint/no-var-requires": ["off"],

.github/workflows/pull-request.yml renamed to .github/workflows/ci.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
name: Build test
2-
on: [pull_request]
1+
name: ci
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- develop
7+
tags-ignore:
8+
- '**' #prevent double build on release tag
9+
pull_request:
10+
branches:
11+
- '**'
312

413
jobs:
5-
check:
6-
name: Build
14+
test:
15+
name: Test
716
runs-on: ubuntu-18.04
817
steps:
918
- name: Checkout repo
@@ -23,9 +32,15 @@ jobs:
2332
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
2433
restore-keys: |
2534
${{ runner.os }}-yarn-
35+
- name: Install webpack-cli
36+
run: |
37+
yarn add -P webpack-cli
2638
- name: Install dependencies
2739
run: |
2840
yarn install --frozen-lockfile
29-
- name: Build
41+
- name: Build package
3042
run: |
3143
yarn build
44+
- name: Test
45+
run: |
46+
webpack --config test/cases/v4/simple/webpack.config.js

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ yarn-debug.log*
55
yarn-error.log*
66

77
/dist
8+
/test/**/*/dist

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ yarn-error.log
1212
yarn.lock
1313
.github
1414
lgtm.yml
15+
/test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Latest version](https://img.shields.io/github/v/release/icelam/html-inline-script-webpack-plugin.svg?sort=semver&label=latest)](https://github.com/icelam/html-inline-script-webpack-plugin/releases)
44
[![Download count](https://img.shields.io/npm/dm/html-inline-script-webpack-plugin)](https://www.npmjs.com/package/html-inline-script-webpack-plugin)
55
[![Install size](https://packagephobia.com/badge?p=html-inline-script-webpack-plugin)](https://packagephobia.com/result?p=html-inline-script-webpack-plugin)
6-
![Build test](https://github.com/icelam/html-inline-script-webpack-plugin/workflows/Build%20test/badge.svg)
6+
![ci](https://github.com/icelam/html-inline-script-webpack-plugin/workflows/ci/badge.svg)
77
[![Package quality](https://npm.packagequality.com/shield/html-inline-script-webpack-plugin.svg)](https://packagequality.com/#?package=html-inline-script-webpack-plugin)
88

99
A webpack plugin for converting external script files `<script src="app.js"></script>` to inline script block `<script>...</script>`. Requires [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) to work.

test/cases/v4/simple/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6+
<meta name="language" content="English" />
7+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
8+
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no" />
9+
<title>webpack test</title>
10+
</head>
11+
<body>
12+
<p>This is minimal code to demonstrate webpack usage</p>
13+
</body>
14+
</html>

test/cases/v4/simple/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// eslint-disable-next-line no-console
2+
console.log('Hello world');
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const path = require('path');
2+
const HtmlWebpackPlugin = require('html-webpack-plugin');
3+
const Self = require('../../../../dist');
4+
5+
module.exports = {
6+
mode: 'production',
7+
entry: path.join(__dirname, './index.js'),
8+
output: {
9+
path: path.join(__dirname, './dist'),
10+
filename: 'index.js'
11+
},
12+
plugins: [
13+
new HtmlWebpackPlugin({
14+
template: path.resolve(__dirname, './index.html')
15+
}),
16+
new Self()
17+
]
18+
};

0 commit comments

Comments
 (0)