b13-rocket 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +102 -0
- package/.gitlab-ci.yml +14 -0
- package/.nvmrc +1 -0
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +541 -0
- package/.yarn/releases/yarn-3.2.3.cjs +783 -0
- package/.yarnrc.yml +5 -0
- package/README.md +98 -0
- package/eslintrc.json +207 -0
- package/files/.ddev/commands/web/rocket.sh +10 -0
- package/files/.ddev/docker-compose.webpack.yaml +9 -0
- package/index.js +4 -0
- package/package.json +71 -0
- package/src/build.js +158 -0
- package/src/cli.js +57 -0
- package/src/create.js +65 -0
- package/src/help.js +36 -0
- package/src/hmr.js +84 -0
- package/src/notification.js +55 -0
- package/src/scss/lessBuild.js +104 -0
- package/src/scss/scssBuild.js +186 -0
- package/src/sites.js +53 -0
- package/src/stylelint.js +33 -0
- package/src/utility/env.js +49 -0
- package/src/version.js +6 -0
- package/src/webpack/webpack.config.base.js +113 -0
- package/src/webpack/webpack.config.js +83 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
const
|
|
2
|
+
path = require('path'),
|
|
3
|
+
merge = require('webpack-merge'),
|
|
4
|
+
fs = require('fs');
|
|
5
|
+
|
|
6
|
+
module.exports = (config, sitesConfigPath = sitesConfigPath, mode = 'development') => {
|
|
7
|
+
|
|
8
|
+
const webpackSiteBaseConfigPath = path.resolve(sitesConfigPath, 'webpack.config.base.js');
|
|
9
|
+
const webpackSiteBaseConfig = require(webpackSiteBaseConfigPath);
|
|
10
|
+
|
|
11
|
+
let babelPath = path.resolve(__dirname, './../../node_modules/@babel');
|
|
12
|
+
|
|
13
|
+
if (!fs.existsSync(babelPath)) {
|
|
14
|
+
babelPath = path.resolve(__dirname, './../../../../node_modules/@babel');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const webpackBaseConfig = merge.merge({
|
|
18
|
+
mode,
|
|
19
|
+
entry: [`${path.resolve(sitesConfigPath, config.js.path.source)}/${config.js.filename.main}.js`],
|
|
20
|
+
optimization: {
|
|
21
|
+
splitChunks: {
|
|
22
|
+
cacheGroups: {
|
|
23
|
+
commons: {
|
|
24
|
+
test: /[\\/]node_modules[\\/]/,
|
|
25
|
+
name: config.js.filename.commonVendor,
|
|
26
|
+
chunks: 'all',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
module: {
|
|
32
|
+
rules: [
|
|
33
|
+
{
|
|
34
|
+
test: /\.(js|ts)$/,
|
|
35
|
+
exclude: /(node_modules)/,
|
|
36
|
+
use: [{
|
|
37
|
+
loader: 'babel-loader',
|
|
38
|
+
options: {
|
|
39
|
+
cacheCompression: false,
|
|
40
|
+
cacheDirectory: true,
|
|
41
|
+
presets: [
|
|
42
|
+
'@babel/preset-env',
|
|
43
|
+
'@babel/preset-typescript',
|
|
44
|
+
],
|
|
45
|
+
plugins: [
|
|
46
|
+
'@babel/plugin-transform-runtime',
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
}],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
test: /\.vue$/,
|
|
53
|
+
use: [
|
|
54
|
+
'vue-loader',
|
|
55
|
+
'vue-svg-inline-loader',
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
test: /\.css$/,
|
|
60
|
+
use: [
|
|
61
|
+
'vue-style-loader',
|
|
62
|
+
{
|
|
63
|
+
loader: 'css-loader',
|
|
64
|
+
options: {
|
|
65
|
+
url: false,
|
|
66
|
+
|
|
67
|
+
// don't handle css @import
|
|
68
|
+
import: (url) => !url.includes('.css'),
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
test: /\.scss$/,
|
|
75
|
+
use: [
|
|
76
|
+
'vue-style-loader',
|
|
77
|
+
{
|
|
78
|
+
loader: 'css-loader',
|
|
79
|
+
options: {
|
|
80
|
+
url: false,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
'sass-loader',
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
test: /\.(png|jpg|gif)$/,
|
|
88
|
+
use: [
|
|
89
|
+
{
|
|
90
|
+
loader: 'file-loader',
|
|
91
|
+
options: {
|
|
92
|
+
emitFile: config.js.emitImageFile || false,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
test: /\.html$/i,
|
|
99
|
+
loader: 'html-loader',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
resolve: {
|
|
104
|
+
symlinks: true,
|
|
105
|
+
alias: {
|
|
106
|
+
'@babel': babelPath,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
plugins: [],
|
|
110
|
+
}, webpackSiteBaseConfig(config));
|
|
111
|
+
|
|
112
|
+
return webpackBaseConfig;
|
|
113
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const
|
|
2
|
+
webpackBaseConfig = require('./webpack.config.base'),
|
|
3
|
+
path = require('path'),
|
|
4
|
+
merge = require('webpack-merge'),
|
|
5
|
+
{ VueLoaderPlugin } = require('vue-loader'),
|
|
6
|
+
CompressionPlugin = require('compression-webpack-plugin'),
|
|
7
|
+
WorkboxWebpackPlugin = require('workbox-webpack-plugin'),
|
|
8
|
+
webpack = require('webpack');
|
|
9
|
+
|
|
10
|
+
export default function(config = {}, sitesConfigPath = __dirname, mode = 'production') {
|
|
11
|
+
|
|
12
|
+
// publicPath: 'auto' is working for all modern browsers
|
|
13
|
+
// https://webpack.js.org/guides/public-path/#automatic-publicpath
|
|
14
|
+
// IE8-11 requires a polyfill
|
|
15
|
+
let publicPath = 'auto';
|
|
16
|
+
if (config.js.path.public) {
|
|
17
|
+
publicPath = config.js.path.public;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const webpackConfig = merge.merge({
|
|
21
|
+
cache: {
|
|
22
|
+
type: 'filesystem',
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
output: {
|
|
26
|
+
filename: '[name].js',
|
|
27
|
+
chunkFilename: 'chunk.[contenthash].js',
|
|
28
|
+
library: {
|
|
29
|
+
name: config.js.filename.main,
|
|
30
|
+
type: 'umd',
|
|
31
|
+
},
|
|
32
|
+
umdNamedDefine: false,
|
|
33
|
+
path: path.resolve(sitesConfigPath, config.js.path.target),
|
|
34
|
+
publicPath,
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
plugins: [
|
|
38
|
+
new VueLoaderPlugin(),
|
|
39
|
+
new webpack.DefinePlugin({
|
|
40
|
+
B13_HMR_ENABLED: JSON.stringify(false),
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
}, webpackBaseConfig(config, sitesConfigPath, mode));
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
// add workbox webpack plugin manifest injection if service worker is enabled
|
|
47
|
+
// this will add all build files to the service worker pre-cache
|
|
48
|
+
if (config.sw) {
|
|
49
|
+
webpackConfig.plugins.push(
|
|
50
|
+
new WorkboxWebpackPlugin.InjectManifest({
|
|
51
|
+
swSrc: `${path.resolve(sitesConfigPath, config.sw.path.source)}/${config.sw.filename.main}.js`,
|
|
52
|
+
swDest: `${config.sw.filename.main}.js`,
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// bundle analyzer bundle?
|
|
58
|
+
if (config.bundleAnalyzer) {
|
|
59
|
+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
60
|
+
webpackConfig.plugins.push(new BundleAnalyzerPlugin());
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// run vue.js in production mode
|
|
64
|
+
if (mode === 'production') {
|
|
65
|
+
webpackConfig.resolve.alias.vue = path.resolve(sitesConfigPath, './../node_modules/vue/dist/vue.min');
|
|
66
|
+
webpackConfig.plugins.push(
|
|
67
|
+
new CompressionPlugin({
|
|
68
|
+
filename: '[path][base].gz',
|
|
69
|
+
algorithm: 'gzip',
|
|
70
|
+
test: /\.js$|\.css$/,
|
|
71
|
+
minRatio: 0.7,
|
|
72
|
+
}),
|
|
73
|
+
new CompressionPlugin({
|
|
74
|
+
filename: '[path][base].br',
|
|
75
|
+
algorithm: 'brotliCompress',
|
|
76
|
+
test: /\.js$|\.css$/,
|
|
77
|
+
minRatio: 0.7,
|
|
78
|
+
}),
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return webpackConfig;
|
|
83
|
+
}
|