Skip to content

Commit 5a8e903

Browse files
committed
Initial creation of localization plugin projects.
1 parent 338e9ab commit 5a8e903

File tree

17 files changed

+434
-1
lines changed

17 files changed

+434
-1
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const fsx = require('fs-extra');
2+
const child_process = require('child_process');
3+
const path = require('path');
4+
const process = require('process');
5+
6+
function executeCommand(command) {
7+
console.log('---> ' + command);
8+
child_process.execSync(command, { stdio: 'inherit' });
9+
}
10+
11+
// Clean the old build outputs
12+
console.log(`==> Starting build.js for ${path.basename(process.cwd())}`);
13+
fsx.emptyDirSync('dist');
14+
fsx.emptyDirSync('lib');
15+
fsx.emptyDirSync('temp');
16+
17+
// Run the TypeScript compiler
18+
executeCommand('node node_modules/typescript/lib/tsc');
19+
20+
// Run Webpack
21+
executeCommand('node node_modules/webpack-cli/bin/cli');
22+
23+
console.log(`==> Finished build.js for ${path.basename(process.cwd())}`);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "localization-plugin-test",
3+
"description": "Building this project is a regression test for @microsoft/localization-plugin",
4+
"version": "0.1.0",
5+
"private": true,
6+
"scripts": {
7+
"build": "node build.js"
8+
},
9+
"dependencies": {
10+
"webpack": "~4.31.0",
11+
"@microsoft/localization-plugin": "0.1.0",
12+
"typescript": "~3.1.6",
13+
"fs-extra": "~7.0.1",
14+
"@microsoft/rush-stack-compiler-3.5": "0.4.2",
15+
"webpack-cli": "~3.3.2"
16+
}
17+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
console.log('test');
2+
3+
import(/* webpackChunkName: 'secondary-chunk' */ './secondaryChunk').then(({ SecondaryChunk }) => {
4+
const chunk = new SecondaryChunk();
5+
chunk.doStuff();
6+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export class SecondaryChunk {
2+
public doStuff(): void {
3+
console.log('foobar');
4+
}
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.5/includes/tsconfig-web.json"
3+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
'use strict';
2+
3+
const path = require('path');
4+
const webpack = require('webpack');
5+
6+
const { LocalizationPlugin } = require('@microsoft/localization-plugin');
7+
8+
module.exports = function(env) {
9+
const configuration = {
10+
mode: 'production',
11+
resolve: {
12+
extensions: ['.js', '.jsx', '.json'],
13+
},
14+
entry: {
15+
'localization-test': path.join(__dirname, 'lib', 'index.js')
16+
},
17+
output: {
18+
path: path.join(__dirname, 'dist'),
19+
filename: '[name]_[locale]_[contenthash].js',
20+
chunkFilename: '[id].[name]_[locale]_[contenthash].js'
21+
},
22+
optimization: {
23+
minimize: false
24+
},
25+
plugins: [
26+
new webpack.optimize.ModuleConcatenationPlugin(),
27+
new LocalizationPlugin({
28+
29+
})
30+
]
31+
};
32+
33+
return configuration;
34+
}

common/config/rush/nonbrowser-approved-packages.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
"name": "@microsoft/load-themed-styles",
5151
"allowedCategories": [ "libraries", "tests" ]
5252
},
53+
{
54+
"name": "@microsoft/localization-plugin",
55+
"allowedCategories": [ "tests" ]
56+
},
5357
{
5458
"name": "@microsoft/node-core-library",
5559
"allowedCategories": [ "libraries", "tests" ]
@@ -580,7 +584,11 @@
580584
},
581585
{
582586
"name": "webpack",
583-
"allowedCategories": [ "libraries" ]
587+
"allowedCategories": [ "libraries", "tests" ]
588+
},
589+
{
590+
"name": "webpack-cli",
591+
"allowedCategories": [ "tests" ]
584592
},
585593
{
586594
"name": "wordwrap",

0 commit comments

Comments
 (0)