@polylith/builder 0.2.20 → 0.2.22
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/App.js +11 -5
- package/package.json +3 -2
package/App.js
CHANGED
|
@@ -19,7 +19,7 @@ import resources from "./plugin-copy-resources.js";
|
|
|
19
19
|
import jsconfig from "./plugin-jsconfig.js";
|
|
20
20
|
import loadConfigs from "./plugin-config.js";
|
|
21
21
|
import watchLog from "./plugin-watch.js";
|
|
22
|
-
|
|
22
|
+
import { terser } from "rollup-plugin-terser";
|
|
23
23
|
import {forceToPosix, fileExists} from './utils.js'
|
|
24
24
|
import ConfigFeature from './ConfigFeature.js';
|
|
25
25
|
import Files from './Files.js';
|
|
@@ -32,7 +32,8 @@ export default class App {
|
|
|
32
32
|
* Construct the app object.
|
|
33
33
|
*
|
|
34
34
|
* @param {String} name a name for the app
|
|
35
|
-
* @param {Object} config
|
|
35
|
+
* @param {Object} config polylith configuration file
|
|
36
|
+
* @param {Object} setup
|
|
36
37
|
* @property {String} root the full path to the root directory of the project.
|
|
37
38
|
* All other paths will be relative to this path.
|
|
38
39
|
* @proprty {String} index the relative path to the main source file from the
|
|
@@ -45,9 +46,11 @@ export default class App {
|
|
|
45
46
|
* @property {String} testDest the relative path to the testing destination
|
|
46
47
|
* folder from the root for rolled up files
|
|
47
48
|
*/
|
|
48
|
-
constructor(name, config) {
|
|
49
|
-
var {root, index, dest, spec, testDest=''} =
|
|
49
|
+
constructor(name, config, setup) {
|
|
50
|
+
var {root, index, dest, spec, testDest=''} = setup;
|
|
50
51
|
|
|
52
|
+
this.polylithConfig = config;
|
|
53
|
+
this.setup = setup;
|
|
51
54
|
root = forceToPosix(root);
|
|
52
55
|
this.root = root;
|
|
53
56
|
this.routerRoot = '/' + name;
|
|
@@ -590,7 +593,7 @@ export default class App {
|
|
|
590
593
|
await this.findMainCss();
|
|
591
594
|
|
|
592
595
|
this.cssFiles.forEach(function(uri) {
|
|
593
|
-
cssTags += ` <link rel="stylesheet" href="${uri}"></link
|
|
596
|
+
cssTags += ` <link rel="stylesheet" href="${uri}"></link>\n`
|
|
594
597
|
}, this);
|
|
595
598
|
|
|
596
599
|
return cssTags;
|
|
@@ -686,6 +689,7 @@ export default class App {
|
|
|
686
689
|
|
|
687
690
|
async generateBuildConfiguration() {
|
|
688
691
|
var input = [this.fullIndexPath];
|
|
692
|
+
var env = process.env.NODE_ENV || 'dev';
|
|
689
693
|
|
|
690
694
|
// using a for loop because we are making an async call
|
|
691
695
|
for (let loadable of this.loadables) {
|
|
@@ -733,6 +737,8 @@ export default class App {
|
|
|
733
737
|
watchLog(),
|
|
734
738
|
];
|
|
735
739
|
|
|
740
|
+
if (this.polylithConfig.minify) plugins.push(terser());
|
|
741
|
+
|
|
736
742
|
if (this.liveReload) {
|
|
737
743
|
let plugin;
|
|
738
744
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polylith/builder",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.22",
|
|
4
4
|
"description": "The polylith builder",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"@babel/preset-env": "^7.16.11",
|
|
20
20
|
"@babel/preset-react": "^7.16.7",
|
|
21
21
|
"@ondohers/console-colors": "^0.1.1",
|
|
22
|
-
"@polylith/core": "^0.1.9",
|
|
23
22
|
"@polylith/config-store": "0.1.2",
|
|
23
|
+
"@polylith/core": "^0.1.9",
|
|
24
24
|
"@rollup/plugin-babel": "^5.3.0",
|
|
25
25
|
"@rollup/plugin-commonjs": "^24.0.0",
|
|
26
26
|
"@rollup/plugin-json": "^5.0.2",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"rollup-plugin-livereload": "^2.0.5",
|
|
39
39
|
"rollup-plugin-polyfill-node": "^0.11.0",
|
|
40
40
|
"rollup-plugin-styles": "^4.0.0",
|
|
41
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
41
42
|
"sass": "^1.43.4"
|
|
42
43
|
}
|
|
43
44
|
}
|