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

Add combined assets #59

Merged
merged 1 commit into from
Jun 19, 2020
Merged
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
25 changes: 25 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true,
},
"extends": [
"eslint:recommended",
"plugin:import/warnings",
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"import",
],
"settings": {
},
"rules": {}
};
1 change: 1 addition & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ branches:
enforce_admins: false
required_status_checks:
contexts:
- "Webpack build"
- "Coding Standards (7.4)"
- "Static Code Analysis (7.4)"
- "Tests (7.3, lowest, ~4.2)"
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ on:
name: "Continuous Integration"

jobs:
webpack:
name: "Webpack build"

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/[email protected]

- name: "Using Node"
uses: actions/setup-node@v1

- name: "Install dependencies"
run: |
yarn

- name: "Build"
run: yarn build

- name: "Check size"
run: |
yarn size

coding-standards:
name: "Coding Standards"

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ coverage
composer.lock
phpunit.xml
/build
/node_modules
/vendor
/vendor-bin
!/vendor-bin/*/composer.json
2 changes: 2 additions & 0 deletions assets/npm.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import GdprPopup from './js/GdprPopup';

console.warn('Including npm.js is deprecated');

export default GdprPopup
3 changes: 3 additions & 0 deletions assets/widget.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import GdprPopup from './js/GdprPopup';

export {GdprPopup}
47 changes: 39 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,41 @@
{
"name": "@nucleos/gdpr-bundle",
"version": "1.0.0",
"homepage": "https://nucleos.de",
"author": "Christian Gripp <[email protected]>",
"main": "assets/npm.js",
"files": [
"assets/"
]
"name": "@nucleos/gdpr-bundle",
"version": "1.0.0",
"homepage": "https://nucleos.de",
"author": "Christian Gripp <[email protected]>",
"devDependencies": {
"@babel/core": "^7.7.4",
"@babel/preset-env": "^7.7.4",
"@size-limit/preset-small-lib": "^4.1.1",
"@size-limit/webpack": "^4.1.1",
"@symfony/webpack-encore": "^0.27.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-plugin-import": "^2.20.2",
"eslint-loader": "^2.1.2",
"eslint-watch": "^6.0.1",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.2",
"size-limit": "^4.1.1"
},
"main": "assets/widget.js",
"files": [
"src/Resources/public/"
],
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"size": "size-limit",
"watch": "encore dev --watch",
"build": "encore production --progress"
},
"size-limit": [
{
"path": "src/Resources/public/widget.js",
"gzip": false,
"limit": "3 KB"
}
]
}
12 changes: 12 additions & 0 deletions src/Resources/public/entrypoints.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"entrypoints": {
"widget": {
"css": [
"/bundles/nucleosgdpr/widget.css"
],
"js": [
"/bundles/nucleosgdpr/widget.js"
]
}
}
}
4 changes: 4 additions & 0 deletions src/Resources/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"widget.css": "/bundles/nucleosgdpr/widget.css",
"widget.js": "/bundles/nucleosgdpr/widget.js"
}
1 change: 1 addition & 0 deletions src/Resources/public/widget.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/Resources/public/widget.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const Encore = require('@symfony/webpack-encore');

Encore
.setOutputPath('src/Resources/public')
.setPublicPath('/bundles/nucleosgdpr')
.setManifestKeyPrefix('')
.cleanupOutputBeforeBuild()
.disableSingleRuntimeChunk()
.enableSourceMaps(!Encore.isProduction())
.enableEslintLoader()
.addEntry('widget', './assets/widget.js')
;

module.exports = Encore.getWebpackConfig();
Loading