@polylith/builder 0.2.14 → 0.2.16
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 +9 -4
- package/package.json +2 -1
package/App.js
CHANGED
|
@@ -117,13 +117,13 @@ export default class App {
|
|
|
117
117
|
* @param {express.Router} appRouter
|
|
118
118
|
* @returns {Promise}
|
|
119
119
|
*/
|
|
120
|
-
async router(
|
|
120
|
+
async router(express, router) {
|
|
121
121
|
if (!this.modulePath) return;
|
|
122
122
|
|
|
123
123
|
try {
|
|
124
124
|
let module = await import(this.modulePath)
|
|
125
125
|
let router = module.default;
|
|
126
|
-
await router(
|
|
126
|
+
await router(express, router, this);
|
|
127
127
|
return true;
|
|
128
128
|
} catch(e) {
|
|
129
129
|
console.error(cc.set('fg_red;, error while building router'), this.modulePath);
|
|
@@ -131,6 +131,10 @@ export default class App {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
getIndexFile() {
|
|
135
|
+
return path.posix.join(this.root, this.htmlTemplate.destination);
|
|
136
|
+
}
|
|
137
|
+
|
|
134
138
|
async sendIndex(res) {
|
|
135
139
|
var indexPath = path.posix.join(this.root, this.htmlTemplate.destination);
|
|
136
140
|
res.sendFile(indexPath);
|
|
@@ -161,9 +165,10 @@ export default class App {
|
|
|
161
165
|
|
|
162
166
|
// also include this process stuff, React seems to think it will always
|
|
163
167
|
// be there. Consider moving this into a plugin/feature of some sort
|
|
168
|
+
var env = process.env.NODE_ENV || 'dev';
|
|
164
169
|
var codeBlock =
|
|
165
170
|
`<script>
|
|
166
|
-
window.process = {env: {NODE_ENV:
|
|
171
|
+
window.process = {env: {NODE_ENV: "${env}"}};
|
|
167
172
|
`;
|
|
168
173
|
|
|
169
174
|
if (names.length !== 0) {
|
|
@@ -172,7 +177,7 @@ export default class App {
|
|
|
172
177
|
}, this);
|
|
173
178
|
|
|
174
179
|
codeBlock +=
|
|
175
|
-
`
|
|
180
|
+
`
|
|
176
181
|
window.${this.ns} = {
|
|
177
182
|
${members.join('\n')}
|
|
178
183
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polylith/builder",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"description": "The polylith builder",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"@babel/preset-react": "^7.16.7",
|
|
21
21
|
"@ondohers/console-colors": "^0.1.1",
|
|
22
22
|
"@polylith/core": "^0.1.9",
|
|
23
|
+
"@polylith/config-store": "0.1.2",
|
|
23
24
|
"@rollup/plugin-babel": "^5.3.0",
|
|
24
25
|
"@rollup/plugin-commonjs": "^24.0.0",
|
|
25
26
|
"@rollup/plugin-json": "^5.0.2",
|