Skip to content

Commit

Permalink
Add combined assets (#68)
Browse files Browse the repository at this point in the history
<!-- THE PR TEMPLATE IS NOT AN OPTION. DO NOT DELETE IT, MAKE SURE YOU READ AND EDIT IT! -->

<!--
    Specify which issues will be fixed/closed.
    Remove it if this is not related.
-->


## Subject

Add combined assets
  • Loading branch information
kodiakhq[bot] authored Jun 27, 2020
2 parents 5b5bbcd + 80247d5 commit be4dc06
Show file tree
Hide file tree
Showing 13 changed files with 8,410 additions and 4 deletions.
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/[email protected]

- 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: 1 addition & 1 deletion assets/js/Autocomplete.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'awesomplete';
import Awesomplete from 'awesomplete';
import 'awesomplete/awesomplete.css'

export default class Autocomplete {
Expand Down
2 changes: 1 addition & 1 deletion assets/npm.js → assets/widget.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import Autocomplete from './js/Autocomplete';

export default Autocomplete
export {Autocomplete};
35 changes: 33 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,39 @@
"dependencies": {
"awesomplete": "^1.1"
},
"main": "assets/npm.js",
"devDependencies": {
"@babel/core": "^7.10.3",
"@babel/preset-env": "^7.10.3",
"@size-limit/preset-small-lib": "^4.1.1",
"@size-limit/webpack": "^4.1.1",
"@symfony/webpack-encore": "^0.30.2",
"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": "^4.0.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": [
"assets/"
"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/Bridge/Symfony/Resources/public/widget.js",
"gzip": false,
"limit": "11 KB"
}
]
}
12 changes: 12 additions & 0 deletions src/Bridge/Symfony/Resources/public/entrypoints.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"entrypoints": {
"widget": {
"css": [
"/bundles/nucleosform/widget.css"
],
"js": [
"/bundles/nucleosform/widget.js"
]
}
}
}
4 changes: 4 additions & 0 deletions src/Bridge/Symfony/Resources/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"widget.css": "/bundles/nucleosform/widget.css",
"widget.js": "/bundles/nucleosform/widget.js"
}
1 change: 1 addition & 0 deletions src/Bridge/Symfony/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/Bridge/Symfony/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/Bridge/Symfony/Resources/public')
.setPublicPath('/bundles/nucleosform')
.setManifestKeyPrefix('')
.cleanupOutputBeforeBuild()
.disableSingleRuntimeChunk()
.enableSourceMaps(!Encore.isProduction())
.enableEslintLoader()
.addEntry('widget', './assets/widget.js')
;

module.exports = Encore.getWebpackConfig();
Loading

0 comments on commit be4dc06

Please sign in to comment.