Skip to content

Commit 1729b26

Browse files
committed
wp-inherit is now layer-pack
1 parent 394ac18 commit 1729b26

23 files changed

Lines changed: 206 additions & 203 deletions

.wi.json renamed to .layers.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"start": "./etc/cli/start"
66
},
77
"templates": {
8+
"default": "./templates/SSRApp",
89
"SSRApp": "./templates/SSRApp",
910
"StaticApp": "./templates/StaticApp",
1011
"RSApp": "./templates/RSApp"
@@ -23,7 +24,7 @@
2324
},
2425
"api": {
2526
"clearBefore": "dist/api",
26-
"run": "wpi :api -w",
27+
"run": "lpack :api -w",
2728
"vars": {
2829
"production": false,
2930
"DefinePluginCfg": {
@@ -33,7 +34,7 @@
3334
},
3435
"www": {
3536
"clearBefore": "dist/www",
36-
"run": "wpi-dev-server :www --hot --host 0.0.0.0",
37+
"run": "lpack-dev-server :www --hot --host 0.0.0.0",
3738
"vars": {
3839
"devServer": true,
3940
"production": false,
@@ -52,14 +53,14 @@
5253
"commands": {
5354
"www": {
5455
"clearBefore": "dist/www",
55-
"run": "wpi :www",
56+
"run": "lpack :www",
5657
"vars": {
5758
}
5859
},
5960
"api": {
6061
"wait": "www",
6162
"clearBefore": "dist/api",
62-
"run": "wpi :api"
63+
"run": "lpack :api"
6364
},
6465
"server": {
6566
"wait": "api",

etc/cli/start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const program = require('commander'),
3535
argz = process.argv.slice(2),
3636
Profile = require('../utils/Profile');
3737

38-
let profileId = process.env.__WPI_PROFILE__ || "default";
38+
let profileId = process.env.__LPACK_PROFILE__ || "default";
3939

4040
if ( argz[0] && /^\:.*$/.test(argz[0]) )
4141
profileId = argz.shift().replace(/^\:(.*)$/, '$1');

etc/utils/Profile.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*/
1818

19-
const wpi = require('webpack-inherit'),
19+
const lpack = require('layer-pack'),
2020
fs = require('fs'),
2121
fkill = require('fkill'),
2222
waitOn = require('wait-on'),
@@ -31,7 +31,7 @@ function getConfigKey( config, key ) {
3131
};
3232

3333
module.exports = function Profile( profileId ) {
34-
let config = wpi.getConfig(profileId),
34+
let config = lpack.getConfig(profileId),
3535
commands = getConfigKey(config, "commands"),
3636
logs = {},
3737
watchers = {},
@@ -171,8 +171,8 @@ module.exports = function Profile( profileId ) {
171171
stdio: 'inherit',
172172
env : {
173173
...process.env,
174-
'__WPI_PROFILE__': undefined,
175-
...(task.vars && { '__WPI_VARS_OVERRIDE__': JSON.stringify(task.vars) })
174+
'__LPACK_PROFILE__': undefined,
175+
...(task.vars && { '__LPACK_VARS_OVERRIDE__': JSON.stringify(task.vars) })
176176
}
177177
},
178178
( err ) => {

etc/wp/webpack.config.api.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,27 @@
2424
* @contact : n8tz.js@gmail.com
2525
*/
2626

27-
var wpInherit = require('webpack-inherit');
27+
var lPack = require('layer-pack');
2828
var fs = require("fs");
2929
var webpack = require("webpack");
3030
var path = require("path");
3131
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
3232

3333
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
34-
const wpiCfg = wpInherit.getConfig(),
35-
isExcluded = wpInherit.isFileExcluded();
34+
const lpackCfg = lPack.getConfig(),
35+
isExcluded = lPack.isFileExcluded();
3636

3737
module.exports = [
3838
{
39-
mode : wpiCfg.vars.production ? "production" : "development",
39+
mode : lpackCfg.vars.production ? "production" : "development",
4040
entry : {
4141
App: [
42-
wpiCfg.vars.rootAlias + '/index.server'
42+
lpackCfg.vars.rootAlias + '/index.server'
4343
] // default to 'App'
4444
},
4545
target : 'async-node',
4646
output : {
47-
path : wpInherit.getHeadRoot() + "/" + (wpiCfg.vars.targetDir || 'dist'),
47+
path : lPack.getHeadRoot() + "/" + (lpackCfg.vars.targetDir || 'dist'),
4848
filename : "[name].server.js",
4949
publicPath : "/",
5050
libraryTarget: "commonjs2"
@@ -69,11 +69,11 @@ module.exports = [
6969
rules: [
7070
{
7171
test : /\.jsx?$/,
72-
exclude: wpiCfg.vars.babelInclude
72+
exclude: lpackCfg.vars.babelInclude
7373
?
7474
(
7575
includeRE => ({ test: path => (isExcluded.test(path) && !includeRE.test(path)) })
76-
)(new RegExp(wpiCfg.vars.babelInclude))
76+
)(new RegExp(lpackCfg.vars.babelInclude))
7777
:
7878
isExcluded,
7979
use : {
@@ -83,7 +83,7 @@ module.exports = [
8383
presets : [
8484
['@babel/preset-env',
8585
{
86-
...(wpiCfg.vars.babelPreset || {})
86+
...(lpackCfg.vars.babelPreset || {})
8787
}],
8888
'@babel/preset-react',
8989
],
@@ -122,20 +122,20 @@ module.exports = [
122122
},
123123
plugins:
124124
[
125-
wpInherit.plugin(),
125+
lPack.plugin(),
126126

127127
//new HardSourceWebpackPlugin(),
128128
...(fs.existsSync("./LICENCE.HEAD.MD") && [
129129
new webpack.BannerPlugin(fs.readFileSync("./LICENCE.HEAD.MD").toString())
130130
] || []
131131
),
132132

133-
...(wpiCfg.vars.production && [
133+
...(lpackCfg.vars.production && [
134134
new BundleAnalyzerPlugin({
135135
analyzerMode : 'static',
136-
reportFilename: './' + wpiCfg.vars.rootAlias + '.stats.html',
136+
reportFilename: './' + lpackCfg.vars.rootAlias + '.stats.html',
137137
openAnalyzer : false,
138-
...wpiCfg.vars.BundleAnalyzerPlugin
138+
...lpackCfg.vars.BundleAnalyzerPlugin
139139
})
140140

141141
] || [new webpack.NamedModulesPlugin()])

etc/wp/webpack.config.comp.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* @contact : n8tz.js@gmail.com
2525
*/
2626

27-
var wpInherit = require('webpack-inherit');
27+
var lPack = require('layer-pack');
2828
var fs = require("fs");
2929
var webpack = require("webpack");
3030
var path = require("path");
@@ -35,35 +35,35 @@ const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
3535
var autoprefixer = require('autoprefixer');
3636

3737

38-
const wpiCfg = wpInherit.getConfig(),
39-
isExcluded = wpInherit.isFileExcluded();
38+
const lpackCfg = lPack.getConfig(),
39+
isExcluded = lPack.isFileExcluded();
4040
module.exports = [
4141
{
42-
mode: wpiCfg.vars.production ? "production" : "development",
42+
mode: lpackCfg.vars.production ? "production" : "development",
4343

4444
// The jsx App entry point
4545
entry: {
4646

47-
[wpiCfg.vars.rootAlias]: [
48-
...(wpiCfg.vars.devServer && ['webpack/hot/dev-server'] || []),
47+
[lpackCfg.vars.rootAlias]: [
48+
...(lpackCfg.vars.devServer && ['webpack/hot/dev-server'] || []),
4949

50-
wpiCfg.vars.entryPoint ?
51-
wpiCfg.vars.entryPoint
50+
lpackCfg.vars.entryPoint ?
51+
lpackCfg.vars.entryPoint
5252
:
53-
wpiCfg.vars.rootAlias + "/index" // default to 'App'
53+
lpackCfg.vars.rootAlias + "/index" // default to 'App'
5454
]
5555
},
5656

5757
// The resulting build
5858
output: {
59-
path : wpInherit.getHeadRoot() + "/" + (wpiCfg.vars.targetDir || 'dist'),
59+
path : lPack.getHeadRoot() + "/" + (lpackCfg.vars.targetDir || 'dist'),
6060
filename : "[name].js",
6161
publicPath : "/",
6262
"libraryTarget": "commonjs-module"
6363
},
6464

6565
// add sourcemap in a dedicated file (.map)
66-
devtool: !wpiCfg.vars.production && 'source-map',
66+
devtool: !lpackCfg.vars.production && 'source-map',
6767

6868
// required files resolving options
6969
resolve: {
@@ -74,21 +74,21 @@ module.exports = [
7474
".scss",
7575
".css",
7676
],
77-
alias : wpiCfg.vars.devServer && {
77+
alias : lpackCfg.vars.devServer && {
7878
'react-dom': '@hot-loader/react-dom'
7979
},
8080
},
8181

8282
// Global build plugin & option
8383
plugins: (
8484
[
85-
wpInherit.plugin(),
85+
lPack.plugin(),
8686

8787
//new HardSourceWebpackPlugin(),
88-
...((wpiCfg.vars.indexTpl || wpiCfg.vars.HtmlWebpackPlugin) && [
88+
...((lpackCfg.vars.indexTpl || lpackCfg.vars.HtmlWebpackPlugin) && [
8989
new HtmlWebpackPlugin({
90-
template: wpiCfg.vars.indexTpl || (wpiCfg.vars.rootAlias + '/index.html.tpl'),
91-
...wpiCfg.vars.HtmlWebpackPlugin
90+
template: lpackCfg.vars.indexTpl || (lpackCfg.vars.rootAlias + '/index.html.tpl'),
91+
...lpackCfg.vars.HtmlWebpackPlugin
9292
})
9393
] || []
9494
),
@@ -97,17 +97,17 @@ module.exports = [
9797
] || []
9898
),
9999

100-
...(wpiCfg.vars.production && [
100+
...(lpackCfg.vars.production && [
101101
new webpack.DefinePlugin({
102102
'process.env': {
103103
'NODE_ENV': JSON.stringify('production')
104104
}
105105
}),
106106
new BundleAnalyzerPlugin({
107107
analyzerMode : 'static',
108-
reportFilename: './' + wpiCfg.vars.rootAlias + '.stats.html',
108+
reportFilename: './' + lpackCfg.vars.rootAlias + '.stats.html',
109109
openAnalyzer : false,
110-
...wpiCfg.vars.BundleAnalyzerPlugin
110+
...lpackCfg.vars.BundleAnalyzerPlugin
111111
})
112112

113113
] || [new webpack.NamedModulesPlugin()])
@@ -118,7 +118,7 @@ module.exports = [
118118
// the requirable files and what manage theirs parsing
119119
module: {
120120
rules: [
121-
...(wpiCfg.vars.devServer && [
121+
...(lpackCfg.vars.devServer && [
122122
{
123123
test : /\.jsx?$/,
124124
exclude: isExcluded,
@@ -129,11 +129,11 @@ module.exports = [
129129
] || []),
130130
{
131131
test : /\.jsx?$/,
132-
exclude: wpiCfg.vars.babelInclude
132+
exclude: lpackCfg.vars.babelInclude
133133
?
134134
(
135135
includeRE => ({ test: path => (isExcluded.test(path) && !includeRE.test(path)) })
136-
)(new RegExp(wpiCfg.vars.babelInclude))
136+
)(new RegExp(lpackCfg.vars.babelInclude))
137137
:
138138
isExcluded,
139139
use : [
@@ -144,7 +144,7 @@ module.exports = [
144144
presets : [
145145
['@babel/preset-env',
146146
{
147-
...(wpiCfg.vars.babelPreset || {})
147+
...(lpackCfg.vars.babelPreset || {})
148148
}],
149149
'@babel/preset-react'
150150
],
@@ -154,23 +154,23 @@ module.exports = [
154154
"loose": true
155155
}],
156156
["@babel/plugin-transform-runtime", {}],
157-
...(wpiCfg.vars.devServer && [[require.resolve("react-hot-loader/babel"), {}]] || []),
157+
...(lpackCfg.vars.devServer && [[require.resolve("react-hot-loader/babel"), {}]] || []),
158158
]
159159
}
160160
},
161161
]
162162
},
163163
{
164164
test: /\.(scss|css)$/,
165-
use : wpiCfg.vars.extractCss ?
165+
use : lpackCfg.vars.extractCss ?
166166
[
167167
{
168168
loader : MiniCssExtractPlugin.loader,
169169
options: {
170170
// you can specify a publicPath here
171171
// by default it uses publicPath in webpackOptions.output
172172
publicPath: '../',
173-
hmr : !wpiCfg.vars.production,
173+
hmr : !lpackCfg.vars.production,
174174
},
175175
},
176176
{ loader: 'css-loader', options: { importLoaders: 1 } },
@@ -196,7 +196,7 @@ module.exports = [
196196
loader : "sass-loader",
197197
options: {
198198
minimize : true,
199-
importer : wpInherit.plugin().sassImporter(),
199+
importer : lPack.plugin().sassImporter(),
200200
sourceMaps: true,
201201
}
202202
}
@@ -225,7 +225,7 @@ module.exports = [
225225
{
226226
loader : "sass-loader",
227227
options: {
228-
importer : wpInherit.plugin().sassImporter(),
228+
importer : lPack.plugin().sassImporter(),
229229
sourceMaps: true
230230
}
231231
}

0 commit comments

Comments
 (0)