@zohodesk/client_build_tool 0.0.6-exp.1 → 0.0.6-exp.3
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/CHANGELOG.md +3 -1
- package/README.md +3 -1
- package/lib/schemas/defaultConfigValues.js +6 -1
- package/lib/shared/babel/babelWebConfig.js +1 -1
- package/lib/shared/babel/runBabelForTsFile.js +30 -0
- package/lib/shared/bundler/webpack/tsLoaders.js +23 -0
- package/lib/shared/bundler/webpack/webpackConfig.js +3 -1
- package/lib/shared/fileUtils/watchRun.js +13 -1
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Changelog and Release Notes
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
**Feature:-**
|
|
4
6
|
- externals was added to Prevent bundling of certain imported packages and retrieve these external dependencies at runtime.
|
|
5
7
|
- to use externals, we use the following pattern in `app > externals` :
|
|
6
8
|
|
package/README.md
CHANGED
|
@@ -84,7 +84,9 @@ These commands provide flexibility and control over your client-side build proce
|
|
|
84
84
|
For more [Details](ConfigurationDocumentation.md)
|
|
85
85
|
# Changelog and Release Notes
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
**Feature:-**
|
|
88
90
|
- externals was added to Prevent bundling of certain imported packages and retrieve these external dependencies at runtime.
|
|
89
91
|
- to use externals, we use the following pattern in `app > externals` :
|
|
90
92
|
|
|
@@ -26,7 +26,7 @@ function babelWebConfig(options, mode) {
|
|
|
26
26
|
browserList
|
|
27
27
|
} = options.babelCustomizations;
|
|
28
28
|
return {
|
|
29
|
-
presets: [getBabelPresetEnvConfig(browserList, mode), require.resolve('@babel/preset-react')],
|
|
29
|
+
presets: [getBabelPresetEnvConfig(browserList, mode), require.resolve('@babel/preset-react'), require.resolve('@babel/preset-typescript')],
|
|
30
30
|
plugins: customBabelPlugins(babelPlugins).concat((0, _getBabelPlugin.getBabelPlugin)(options)).filter(Boolean)
|
|
31
31
|
};
|
|
32
32
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.runBabelForTSFile = runBabelForTSFile;
|
|
7
|
+
|
|
8
|
+
var _core = require("@babel/core");
|
|
9
|
+
|
|
10
|
+
var _babelWebConfig = require("./babelWebConfig");
|
|
11
|
+
|
|
12
|
+
var _copyFile = require("../fileUtils/copyFile");
|
|
13
|
+
|
|
14
|
+
function runBabelForTSFile({
|
|
15
|
+
filename,
|
|
16
|
+
outputFile,
|
|
17
|
+
options,
|
|
18
|
+
mode = 'es'
|
|
19
|
+
}) {
|
|
20
|
+
const {
|
|
21
|
+
enable
|
|
22
|
+
} = options.typeScript;
|
|
23
|
+
|
|
24
|
+
if (enable) {
|
|
25
|
+
// const jsSourceCode = readFileSync(filename).toString();
|
|
26
|
+
const babelConfig = (0, _babelWebConfig.babelWebConfig)(options, mode);
|
|
27
|
+
const result = (0, _core.transformFileSync)(filename, babelConfig);
|
|
28
|
+
(0, _copyFile.writeFile)(outputFile.replace('.ts', '.js'), result.code);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.tsLoaders = tsLoaders;
|
|
7
|
+
|
|
8
|
+
function tsLoaders(options) {
|
|
9
|
+
const {
|
|
10
|
+
enable
|
|
11
|
+
} = options.typeScript;
|
|
12
|
+
|
|
13
|
+
if (enable) {
|
|
14
|
+
return [{
|
|
15
|
+
test: /\.js$/,
|
|
16
|
+
exclude: /node_modules/,
|
|
17
|
+
use: 'ts-loader' // include: path.join(appPath, folder)
|
|
18
|
+
|
|
19
|
+
}];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
@@ -11,6 +11,8 @@ var _outputConfig = require("./outputConfig");
|
|
|
11
11
|
|
|
12
12
|
var _jsLoaders = require("./jsLoaders");
|
|
13
13
|
|
|
14
|
+
var _tsLoaders = require("./tsLoaders");
|
|
15
|
+
|
|
14
16
|
var _cssLoaders = require("./cssLoaders");
|
|
15
17
|
|
|
16
18
|
var _assetLoaders = require("./loaderConfigs/assetLoaders");
|
|
@@ -46,7 +48,7 @@ function webpackConfigCreator(options) {
|
|
|
46
48
|
module: {
|
|
47
49
|
/* strictExportPresence for break the build when imported module not present in respective file */
|
|
48
50
|
// strictExportPresence: true,
|
|
49
|
-
rules: [...(0, _jsLoaders.jsLoaders)(options), ...(0, _cssLoaders.cssLoaders)(options), (0, _configWebWorkerLoader.configWebWorkerLoader)(options), (0, _configHtmlTemplateLoader.configHtmlTemplateLoader)(options), ...(0, _assetLoaders.assetLoaders)(options), ...(0, _configCustomLoaders.configCustomLoaders)(options)]
|
|
51
|
+
rules: [...(0, _jsLoaders.jsLoaders)(options), ...(0, _tsLoaders.tsLoaders)(options), ...(0, _cssLoaders.cssLoaders)(options), (0, _configWebWorkerLoader.configWebWorkerLoader)(options), (0, _configHtmlTemplateLoader.configHtmlTemplateLoader)(options), ...(0, _assetLoaders.assetLoaders)(options), ...(0, _configCustomLoaders.configCustomLoaders)(options)]
|
|
50
52
|
},
|
|
51
53
|
plugins: (0, _plugins.plugins)(options),
|
|
52
54
|
externals: (0, _externals.externals)(options),
|
|
@@ -11,6 +11,8 @@ var _watcher = _interopRequireDefault(require("watcher"));
|
|
|
11
11
|
|
|
12
12
|
var _runBabelForJSFile = require("../babel/runBabelForJSFile");
|
|
13
13
|
|
|
14
|
+
var _runBabelForTsFile = require("../babel/runBabelForTsFile");
|
|
15
|
+
|
|
14
16
|
var _runPostCssForCssFile = require("../postcss/runPostCssForCssFile");
|
|
15
17
|
|
|
16
18
|
var _directoryIterator = require("./directoryIterator");
|
|
@@ -23,6 +25,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
25
|
|
|
24
26
|
const isJs = ext => ext === '.js';
|
|
25
27
|
|
|
28
|
+
const isTs = ext => ext === '.ts';
|
|
29
|
+
|
|
26
30
|
const isCss = ext => ext === '.css';
|
|
27
31
|
|
|
28
32
|
function watchRun({
|
|
@@ -54,6 +58,13 @@ function watchRun({
|
|
|
54
58
|
outputFile,
|
|
55
59
|
options
|
|
56
60
|
});
|
|
61
|
+
} else if (isTs(ext)) {
|
|
62
|
+
(0, _runBabelForTsFile.runBabelForTSFile)({
|
|
63
|
+
filename,
|
|
64
|
+
outputFile,
|
|
65
|
+
options,
|
|
66
|
+
mode
|
|
67
|
+
});
|
|
57
68
|
} else {
|
|
58
69
|
(0, _copyFile.copyFile)(filename, outputFile);
|
|
59
70
|
}
|
|
@@ -81,7 +92,8 @@ function watchRun({
|
|
|
81
92
|
const watcher = new _watcher.default(src, {
|
|
82
93
|
recursive: true,
|
|
83
94
|
ignoreInitial: true,
|
|
84
|
-
ignore: filename => filename.indexOf('__tests__') !== -1
|
|
95
|
+
ignore: filename => filename.indexOf('__tests__') !== -1 // remove the test cases
|
|
96
|
+
|
|
85
97
|
});
|
|
86
98
|
watcher.on('all', (event, filename) => {
|
|
87
99
|
if (event === 'unlink' || event === 'unlinkDir') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/client_build_tool",
|
|
3
|
-
"version": "0.0.6-exp.
|
|
3
|
+
"version": "0.0.6-exp.3",
|
|
4
4
|
"description": "A CLI tool to build web applications and client libraries",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -55,6 +55,9 @@
|
|
|
55
55
|
"webpack": "5.79.0",
|
|
56
56
|
"webpack-bundle-analyzer": "4.8.0",
|
|
57
57
|
"webpack-cli": "4.10.0",
|
|
58
|
-
"webpack-dev-middleware": "6.1.1"
|
|
58
|
+
"webpack-dev-middleware": "6.1.1",
|
|
59
|
+
"typescript": "5.2.2",
|
|
60
|
+
"ts-loader": "8.2.0",
|
|
61
|
+
"@babel/preset-typescript": "7.23.2"
|
|
59
62
|
}
|
|
60
63
|
}
|