glyphix 1.0.36 → 1.0.38
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/bin/glyphix.js +13 -9
- package/package.json +1 -1
package/bin/glyphix.js
CHANGED
|
@@ -126,17 +126,18 @@ var GxGenerate = class {
|
|
|
126
126
|
// 正在构建的应用的 src 目录路径
|
|
127
127
|
this.sourceRoot = (0, import_node_path3.resolve)(
|
|
128
128
|
this.workspaceRoot,
|
|
129
|
-
process.env["VITE_SOURCE_DIR"]
|
|
129
|
+
process.env["VITE_SOURCE_DIR"] ?? process.env["GLYPHIX_SOURCE_DIR"]
|
|
130
130
|
);
|
|
131
131
|
// 构建的 build 目录路径
|
|
132
132
|
this.buildRoot = (0, import_node_path3.resolve)(
|
|
133
133
|
this.workspaceRoot,
|
|
134
|
-
process.env["VITE_BUILD_DIR"]
|
|
134
|
+
process.env["VITE_BUILD_DIR"] ?? process.env["GLYPHIX_BUILD_DIR"]
|
|
135
135
|
);
|
|
136
136
|
// gx 工具传递过来的入口文件,包括 app.{t,j}s 和各个页面的 js 文件路径
|
|
137
137
|
this.entries = [];
|
|
138
|
+
const entryFile = process.env["GLYPHIX_BUILD_DIR"] ? ".node-entry.json" : "entry.vite.json";
|
|
138
139
|
const content = JSON.parse(
|
|
139
|
-
(0, import_node_fs.readFileSync)((0, import_node_path3.resolve)(this.buildRoot,
|
|
140
|
+
(0, import_node_fs.readFileSync)((0, import_node_path3.resolve)(this.buildRoot, entryFile)).toString()
|
|
140
141
|
);
|
|
141
142
|
this.entries = content.entry.map(
|
|
142
143
|
(item) => (0, import_node_path3.resolve)(this.buildRoot, item)
|
|
@@ -242,7 +243,11 @@ var GxGenerate = class {
|
|
|
242
243
|
}
|
|
243
244
|
]
|
|
244
245
|
};
|
|
245
|
-
const customConfigPath = (0, import_node_path3.resolve)(
|
|
246
|
+
const customConfigPath = (0, import_node_path3.resolve)(
|
|
247
|
+
this.sourceRoot,
|
|
248
|
+
"..",
|
|
249
|
+
"glyphix.config.js"
|
|
250
|
+
);
|
|
246
251
|
if (!(0, import_node_fs.existsSync)(customConfigPath)) return internalConfig;
|
|
247
252
|
try {
|
|
248
253
|
const useConfig = require(customConfigPath);
|
|
@@ -274,11 +279,6 @@ var GxGenerate = class {
|
|
|
274
279
|
return;
|
|
275
280
|
}
|
|
276
281
|
const curDir = process.cwd();
|
|
277
|
-
const userConfig = (0, import_node_path3.resolve)(
|
|
278
|
-
this.sourceRoot,
|
|
279
|
-
"..",
|
|
280
|
-
"glyphix.config.js"
|
|
281
|
-
);
|
|
282
282
|
process.chdir((0, import_node_path3.resolve)(this.sourceRoot, ".."));
|
|
283
283
|
const installDepProcess = (0, import_node_child_process.spawn)("npm", ["install"]);
|
|
284
284
|
installDepProcess.on("error", (err) => {
|
|
@@ -312,6 +312,10 @@ var GxGenerate = class {
|
|
|
312
312
|
}
|
|
313
313
|
};
|
|
314
314
|
function generateGlyphix() {
|
|
315
|
+
console.log(
|
|
316
|
+
"process",
|
|
317
|
+
!process.env["VITE_BUILD_DIR"] || !process.env["VITE_SOURCE_DIR"]
|
|
318
|
+
);
|
|
315
319
|
if ((!process.env["VITE_BUILD_DIR"] || !process.env["VITE_SOURCE_DIR"]) && (!process.env["GLYPHIX_BUILD_DIR"] || !process.env["GLYPHIX_SOURCE_DIR"]))
|
|
316
320
|
throw Error("not set glyphix project path");
|
|
317
321
|
const generate = new GxGenerate();
|