@polylith/builder 0.0.40 → 0.0.42
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 +23 -9
- package/ConfigApp.js +3 -3
- package/package.json +1 -1
- package/plugin-config.js +1 -5
package/App.js
CHANGED
|
@@ -97,17 +97,31 @@ export default class App {
|
|
|
97
97
|
*/
|
|
98
98
|
getCodeVariablesValue() {
|
|
99
99
|
var names = Object.keys(this.codeVariables);
|
|
100
|
-
if (names.length === 0) return '';
|
|
101
|
-
|
|
102
|
-
var members = names.map(function(name) {
|
|
103
|
-
return ` ${name}: ${JSON.stringify(this.codeVariables[name])},`
|
|
104
|
-
}, this);
|
|
105
100
|
|
|
101
|
+
// also include this process stuff, React seems to think it will always
|
|
102
|
+
// be there. Consider moving this into a plugin/feature of some sort
|
|
106
103
|
var codeBlock =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
`<script>
|
|
105
|
+
window.process = {env: {NODE_ENV: 'dev'}};
|
|
106
|
+
`;
|
|
107
|
+
|
|
108
|
+
if (names.length !== 0) {
|
|
109
|
+
var members = names.map(function(name) {
|
|
110
|
+
return ` ${name}: ${JSON.stringify(this.codeVariables[name])},`
|
|
111
|
+
}, this);
|
|
112
|
+
|
|
113
|
+
codeBlock +=
|
|
114
|
+
` window.process = {env: {NODE_ENV: 'dev'}};
|
|
115
|
+
window.${this.ns} = {
|
|
116
|
+
${members.join('\n')}
|
|
117
|
+
}
|
|
110
118
|
`;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
codeBlock +=
|
|
122
|
+
` </script>
|
|
123
|
+
`
|
|
124
|
+
|
|
111
125
|
return codeBlock;
|
|
112
126
|
}
|
|
113
127
|
|
|
@@ -129,7 +143,7 @@ ${members.join('\n')}
|
|
|
129
143
|
* Call this method with true to reload the browser when any files in the
|
|
130
144
|
* destination folder have changed.
|
|
131
145
|
*
|
|
132
|
-
* @param {
|
|
146
|
+
* @param {Boolean} on set to true to turn on destination watching
|
|
133
147
|
*/
|
|
134
148
|
setLiveReload(on) {
|
|
135
149
|
this.liveReload = on;
|
package/ConfigApp.js
CHANGED
|
@@ -15,10 +15,10 @@ export default class ConfigApp extends App {
|
|
|
15
15
|
super(name, root, index, dest);
|
|
16
16
|
this.config = config;
|
|
17
17
|
|
|
18
|
-
if (!
|
|
18
|
+
if (!config.template || !config.template.source) throw new Error('html source not defined in config file');
|
|
19
19
|
var source = index.template.source;
|
|
20
20
|
var sourceFilename = path.basename(source);
|
|
21
|
-
var destination =
|
|
21
|
+
var destination = config.template.destination || path.join(dest, sourceFilename);
|
|
22
22
|
this.setHtmlTemplate(source, destination);
|
|
23
23
|
|
|
24
24
|
if (config.manualChunks) {
|
|
@@ -34,7 +34,7 @@ export default class ConfigApp extends App {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
if (config.resources && Array.isArray(config.resources)) this.addResources('', config.resources);
|
|
37
|
-
if (config.css) this.addMainCss(css);
|
|
37
|
+
if (config.css) this.addMainCss(config.css);
|
|
38
38
|
|
|
39
39
|
if (config.variables) {
|
|
40
40
|
var names = Object.keys(config.variables);
|
package/package.json
CHANGED
package/plugin-config.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import config from '@polylith/config-store';
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
function makeSource(configs) {
|
|
5
2
|
|
|
6
3
|
var configBody = ''
|
|
@@ -15,11 +12,10 @@ ${JSON.stringify(config, null, ' ')})
|
|
|
15
12
|
|
|
16
13
|
var source =
|
|
17
14
|
`import config from '@polylith/config-store';
|
|
18
|
-
export
|
|
15
|
+
export default config;
|
|
19
16
|
|
|
20
17
|
${configBody}
|
|
21
18
|
`
|
|
22
|
-
console.log(source);
|
|
23
19
|
return source;
|
|
24
20
|
}
|
|
25
21
|
|