Skip to content

Commit

Permalink
DEP Upgrade frontend build stack
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Feb 16, 2023
1 parent 49e7197 commit e85e5b8
Show file tree
Hide file tree
Showing 7 changed files with 4,733 additions and 3,911 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10
18
6 changes: 6 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
]
}
2 changes: 1 addition & 1 deletion client/dist/js/fluent.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/styles/fluent.css

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

23 changes: 15 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "tractorcow-fluent",
"version": "4.0.0",
"description": "Fluent localisation module for SilverStrip CMS",
"engines": {
"node": "^10.x"
"node": "^18.x"
},
"scripts": {
"build": "NODE_ENV=production webpack -p --bail --progress",
"build": "yarn && yarn lint && rm -rf client/dist/* && NODE_ENV=production webpack --mode production --bail --progress",
"dev": "NODE_ENV=development webpack --progress",
"watch": "NODE_ENV=development webpack --watch --progress",
"css": "WEBPACK_CHILD=css npm run build",
"lint": "eslint client/src && sass-lint -v"
Expand All @@ -27,12 +27,19 @@
},
"homepage": "https://github.com/tractorcow-farm/silverstripe-fluent",
"devDependencies": {
"@silverstripe/eslint-config": "^0.0.5",
"@silverstripe/webpack-config": "^0.4.1"
"@silverstripe/eslint-config": "^1.0.0-alpha6",
"@silverstripe/webpack-config": "^2.0.0-alpha6",
"webpack": "^5.74.0",
"webpack-cli": "^5.0.0"
},
"dependencies": {
"jquery": "^3.5.0",
"query-string": "^5.0.0",
"query-string": "^8.1.0",
"url": "^0.11.0"
}
},
"resolutions": {
"colors": "1.4.0"
},
"browserslist": [
"defaults"
]
}
51 changes: 12 additions & 39 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,28 @@
const Path = require('path');
const webpackConfig = require('@silverstripe/webpack-config');
const {
resolveJS,
externalJS,
moduleJS,
pluginJS,
moduleCSS,
pluginCSS,
} = webpackConfig;
const { JavascriptWebpackConfig, CssWebpackConfig } = require('@silverstripe/webpack-config');

const ENV = process.env.NODE_ENV;
const PATHS = {
MODULES: 'node_modules',
FILES_PATH: '../',
ROOT: Path.resolve(),
SRC: Path.resolve('client/src'),
DIST: Path.resolve('client/dist'),
};

const config = [
{
name: 'js',
entry: {
// Main JS bundles
new JavascriptWebpackConfig('js', PATHS, 'tractorcow/silverstripe-fluent')
.setEntry({
fluent: `${PATHS.SRC}/bundles/fluent.js`,
},
output: {
path: PATHS.DIST,
filename: 'js/[name].js',
},
devtool: (ENV !== 'production') ? 'source-map' : '',
resolve: resolveJS(ENV, PATHS),
externals: externalJS(ENV, PATHS),
module: moduleJS(ENV, PATHS),
plugins: pluginJS(ENV, PATHS),
},
{
name: 'css',
entry: {
})
.getConfig(),
// sass to css
new CssWebpackConfig('css', PATHS)
.setEntry({
fluent: `${PATHS.SRC}/styles/fluent.scss`,
},
output: {
path: PATHS.DIST,
filename: 'styles/[name].css',
},
devtool: (ENV !== 'production') ? 'source-map' : '',
module: moduleCSS(ENV, PATHS),
plugins: pluginCSS(ENV, PATHS),
},
})
.getConfig(),
];

// Use WEBPACK_CHILD=js or WEBPACK_CHILD=css env var to run a single config
module.exports = (process.env.WEBPACK_CHILD)
? config.find((entry) => entry.name === process.env.WEBPACK_CHILD)
: module.exports = config;
: config;
Loading

0 comments on commit e85e5b8

Please sign in to comment.