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

Separate public files into css/ and js/ #1895

Merged
merged 2 commits into from
Oct 8, 2022
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
8 changes: 4 additions & 4 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ jobs:
if: matrix.type == 'Chrome Slow'
run: |
mv public public.orig
mkdir public public/external
mkdir public public/css public/external
cp public.orig/.gitignore public
cp public.orig/agileui.less public
cp public.orig/logo.png public
cp public.orig/css/agileui.less public/css
cp public.orig/external/.gitignore public/external
cp public.orig/external/package.json public/external
cp public.orig/external/package-lock.json public/external
Expand All @@ -323,7 +323,7 @@ jobs:
- name: Compile CSS files (only for Slow)
if: matrix.type == 'Chrome Slow'
run: |
lessc public/agileui.less public/agileui.min.css --clean-css="--s1 --advanced" --source-map
lessc public/css/agileui.less public/css/agileui.min.css --clean-css="--s1 --advanced" --source-map

- name: Compile JS files (only for Slow)
if: matrix.type == 'Chrome Slow'
Expand All @@ -340,7 +340,7 @@ jobs:
- name: Instrument & recompile JS files (only for coverage)
if: env.LOG_COVERAGE
run: |
rm public/*.js
rm -r public/js
(cd js && npm install --package-lock-only --save-dev nyc && npm ci --loglevel=error)
(cd js && npx nyc instrument --in-place . && npx webpack --env production)

Expand Down
4 changes: 2 additions & 2 deletions js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ For development and debugging, simply use the "dev" script supply in package.jso
npm run dev
```

This command will output the atkjs-ui.js file inside the /public directory including the .map file need for debugging
This command will output the atkjs-ui.js file inside the ../public/js directory including the .map file need for debugging
the package. Once load in your page, code can be debugged in browser from the webpack source.

Any change made to the source, will also be re-compile automatically when using the "dev" script.
Expand Down Expand Up @@ -111,4 +111,4 @@ For production, simply use the "build" script supply in package.json.
npm run build
```

This command will output the atkjs-ui.min.js file, also in /public folder.
This command will output the atkjs-ui.min.js file in ../public/js directory.
4 changes: 2 additions & 2 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "atkjs-ui",
"version": "1.0.0",
"description": "Agile Toolkit Javascript library.",
"main": "../public/atkjs-ui.js",
"main": "../public/js/atkjs-ui.js",
"scripts": {
"build": "webpack --env development && webpack --env production && rm ../public/atk-vue-query-builder.min.js.map # 15.x vue-loader is producing sourcemap file with unstable/absolute path, remove rm once vue-loader is upgraded to at least 16.x",
"build": "webpack --env development && webpack --env production && rm ../public/js/atk-vue-query-builder.min.js.map # 15.x vue-loader is producing sourcemap file with unstable/absolute path, remove rm once vue-loader is upgraded to at least 16.x",
"dev": "webpack --progress --watch --env development",
"profile": "webpack --env production --profile --json > profile/atkjs-bundle-profile.json",
"analyze-profile": "webpack-bundle-analyzer profile/atkjs-bundle-profile.json",
Expand Down
16 changes: 12 additions & 4 deletions js/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = (env) => {
performance: isProduction ? prodPerformance : {},
output: {
path: publicDir,
filename: isProduction ? '[name].min.js' : '[name].js',
filename: isProduction ? 'js/[name].min.js' : 'js/[name].js',
library: libraryName,
libraryTarget: 'umd',
libraryExport: 'default',
Expand All @@ -53,9 +53,17 @@ module.exports = (env) => {
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'atk-vendor',
vendorFlatpickr: {
test: /[\\/]node_modules[\\/](flatpickr|vue-flatpickr-component)[\\/]/,
name: 'vendor-flatpickr',
},
vendorVue: {
test: /[\\/]node_modules[\\/](?!vue-flatpickr-component[\\/])(vue([-.][^\\/]+)?)[\\/]/,
name: 'vendor-vue',
},
vendorMain: {
test: /[\\/]node_modules[\\/](?!(vue([-.][^\\/]+)?|flatpickr)[\\/])/,
name: 'vendor-main',
},
},
},
Expand Down
15 changes: 9 additions & 6 deletions public/.gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/*
!/.gitignore
!/agileui.less
!/agileui.min.css
!/agileui.min.css.map
!/logo.png
!/*.js
!/*.js.map
!/external/
!/*/
/*/*

!/css/*.less
!/css/*.css
!/css/*.css.map

!/js/*.js
!/js/*.js.map
2 changes: 0 additions & 2 deletions public/atk-vendor.min.js

This file was deleted.

1 change: 0 additions & 1 deletion public/atk-vendor.min.js.map

This file was deleted.

1 change: 0 additions & 1 deletion public/atk-vue-inline-edit.min.js.map

This file was deleted.

1 change: 0 additions & 1 deletion public/atk-vue-item-search.min.js.map

This file was deleted.

1 change: 0 additions & 1 deletion public/atk-vue-multiline.min.js.map

This file was deleted.

Loading