Skip to content

Commit 970881f

Browse files
committed
Build both dev and prod versions of the localization plugin test projects.
1 parent 32f0c49 commit 970881f

File tree

9 files changed

+36
-21
lines changed

9 files changed

+36
-21
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist-*

build-tests/localization-plugin-test-01/build.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ function executeCommand(command) {
1010

1111
// Clean the old build outputs
1212
console.log(`==> Starting build.js for ${path.basename(process.cwd())}`);
13-
FileSystem.ensureEmptyFolder('dist');
13+
FileSystem.ensureEmptyFolder('dist-dev');
14+
FileSystem.ensureEmptyFolder('dist-prod');
1415
FileSystem.ensureEmptyFolder('lib');
1516
FileSystem.ensureEmptyFolder('temp');
1617

build-tests/localization-plugin-test-01/webpack.config.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ const { SetPublicPathPlugin } = require('@rushstack/set-webpack-public-path-plug
88
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
99
const HtmlWebpackPlugin = require('html-webpack-plugin');
1010

11-
module.exports = function(env) {
12-
const configuration = {
13-
mode: 'production',
11+
function generateConfiguration(mode, outputFolderName) {
12+
return {
13+
mode: mode,
1414
module: {
1515
rules: [
1616
{
@@ -33,7 +33,7 @@ module.exports = function(env) {
3333
'localization-test-B': path.join(__dirname, 'src', 'indexB.ts'),
3434
},
3535
output: {
36-
path: path.join(__dirname, 'dist'),
36+
path: path.join(__dirname, outputFolderName),
3737
filename: '[name]_[locale]_[contenthash].js',
3838
chunkFilename: '[id].[name]_[locale]_[contenthash].js'
3939
},
@@ -75,6 +75,9 @@ module.exports = function(env) {
7575
new HtmlWebpackPlugin()
7676
]
7777
};
78-
79-
return configuration;
8078
}
79+
80+
module.exports = [
81+
generateConfiguration('development', 'dist-dev'),
82+
generateConfiguration('production', 'dist-prod'),
83+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist-*

build-tests/localization-plugin-test-02/build.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ function executeCommand(command) {
1010

1111
// Clean the old build outputs
1212
console.log(`==> Starting build.js for ${path.basename(process.cwd())}`);
13-
FileSystem.ensureEmptyFolder('dist');
13+
FileSystem.ensureEmptyFolder('dist-dev');
14+
FileSystem.ensureEmptyFolder('dist-prod');
1415
FileSystem.ensureEmptyFolder('lib');
1516
FileSystem.ensureEmptyFolder('temp');
1617

build-tests/localization-plugin-test-02/webpack.config.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ const { SetPublicPathPlugin } = require('@rushstack/set-webpack-public-path-plug
88
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
99
const HtmlWebpackPlugin = require('html-webpack-plugin');
1010

11-
module.exports = function(env) {
12-
const configuration = {
13-
mode: 'development',
11+
function generateConfiguration(mode, outputFolderName) {
12+
return {
13+
mode: mode,
1414
module: {
1515
rules: [
1616
{
@@ -34,7 +34,7 @@ module.exports = function(env) {
3434
'localization-test-C': path.join(__dirname, 'src', 'indexC.ts'),
3535
},
3636
output: {
37-
path: path.join(__dirname, 'dist'),
37+
path: path.join(__dirname, outputFolderName),
3838
filename: '[name]_[locale]_[contenthash].js',
3939
chunkFilename: '[id].[name]_[locale]_[contenthash].js'
4040
},
@@ -93,6 +93,9 @@ module.exports = function(env) {
9393
new HtmlWebpackPlugin()
9494
]
9595
};
96-
97-
return configuration;
9896
}
97+
98+
module.exports = [
99+
generateConfiguration('development', 'dist-dev'),
100+
generateConfiguration('production', 'dist-prod'),
101+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist-*

build-tests/localization-plugin-test-03/build.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ function executeCommand(command) {
1010

1111
// Clean the old build outputs
1212
console.log(`==> Starting build.js for ${path.basename(process.cwd())}`);
13-
FileSystem.ensureEmptyFolder('dist');
13+
FileSystem.ensureEmptyFolder('dist-dev');
14+
FileSystem.ensureEmptyFolder('dist-prod');
1415
FileSystem.ensureEmptyFolder('lib');
1516
FileSystem.ensureEmptyFolder('temp');
1617

build-tests/localization-plugin-test-03/webpack.config.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ function resolveMissingString(localeNames, localizedResourcePath) {
3232
return result;
3333
}
3434

35-
module.exports = function(env) {
36-
const configuration = {
37-
mode: 'production',
35+
function generateConfiguration(mode, outputFolderName) {
36+
return {
37+
mode: mode,
3838
module: {
3939
rules: [
4040
{
@@ -59,7 +59,7 @@ module.exports = function(env) {
5959
'localization-test-D': path.join(__dirname, 'src', 'indexD.ts')
6060
},
6161
output: {
62-
path: path.join(__dirname, 'dist'),
62+
path: path.join(__dirname, outputFolderName),
6363
filename: '[name]_[locale]_[contenthash].js',
6464
chunkFilename: '[id].[name]_[locale]_[contenthash].js'
6565
},
@@ -132,6 +132,9 @@ module.exports = function(env) {
132132
new HtmlWebpackPlugin()
133133
]
134134
};
135-
136-
return configuration;
137135
}
136+
137+
module.exports = [
138+
generateConfiguration('development', 'dist-dev'),
139+
generateConfiguration('production', 'dist-prod'),
140+
];

0 commit comments

Comments
 (0)