glyphix 1.0.33 → 1.0.36
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 +3 -35
- package/package.json +62 -37
- package/script/install.js +0 -1
package/bin/glyphix.js
CHANGED
|
@@ -26,22 +26,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
// src/cli/index.ts
|
|
27
27
|
var import_yargs = __toESM(require("yargs"));
|
|
28
28
|
|
|
29
|
-
// src/cli/utils/logger.ts
|
|
30
|
-
var import_chalk = __toESM(require("chalk"));
|
|
31
|
-
var { log: originLog } = console;
|
|
32
|
-
console.debug = function(...args) {
|
|
33
|
-
originLog(import_chalk.default.gray(...args));
|
|
34
|
-
};
|
|
35
|
-
console.info = function(...args) {
|
|
36
|
-
originLog(import_chalk.default.white(...args));
|
|
37
|
-
};
|
|
38
|
-
console.warn = function(...args) {
|
|
39
|
-
originLog(import_chalk.default.yellow(...args));
|
|
40
|
-
};
|
|
41
|
-
console.error = function(...args) {
|
|
42
|
-
originLog(import_chalk.default.red(...args));
|
|
43
|
-
};
|
|
44
|
-
|
|
45
29
|
// src/cli/command/new.ts
|
|
46
30
|
var import_fs_extra = require("fs-extra");
|
|
47
31
|
var import_child_process = require("child_process");
|
|
@@ -181,7 +165,6 @@ var GxGenerate = class {
|
|
|
181
165
|
].filter((item) => {
|
|
182
166
|
return (0, import_node_fs.existsSync)(item);
|
|
183
167
|
});
|
|
184
|
-
console.info(dotenvFiles);
|
|
185
168
|
dotenvFiles.reverse().forEach((dotenvFile) => {
|
|
186
169
|
import_dotenv.default.config({ path: (0, import_node_path3.resolve)(this.sourceRoot, "..", dotenvFile) });
|
|
187
170
|
});
|
|
@@ -195,12 +178,13 @@ var GxGenerate = class {
|
|
|
195
178
|
generateEsbuildConfig() {
|
|
196
179
|
const resolveExtensions = [".ts", ".js"];
|
|
197
180
|
const that = this;
|
|
181
|
+
const outdir = process.env["GLYPHIX_BUILD_DIR"] ? (0, import_node_path3.resolve)(this.buildRoot, ".node-dist") : (0, import_node_path3.resolve)(this.buildRoot, ".vite-dist");
|
|
198
182
|
const internalConfig = {
|
|
199
183
|
entryPoints: this.entries,
|
|
200
184
|
// 入口文件
|
|
201
185
|
bundle: true,
|
|
202
186
|
// 启用打包
|
|
203
|
-
outdir
|
|
187
|
+
outdir,
|
|
204
188
|
// 输出目录
|
|
205
189
|
splitting: true,
|
|
206
190
|
// 启用代码分割
|
|
@@ -278,18 +262,10 @@ var GxGenerate = class {
|
|
|
278
262
|
/**
|
|
279
263
|
* 安装依赖
|
|
280
264
|
* 1. 判断是否是 workspace, 非 workspace 不用安装
|
|
281
|
-
* 2. workspace 项目,需要将 package.json 拷贝到构建目录,在构建目录安装依赖
|
|
282
265
|
* @returns
|
|
283
266
|
*/
|
|
284
267
|
installDependencies() {
|
|
285
268
|
return new Promise((resolve3, reject) => {
|
|
286
|
-
console.log(
|
|
287
|
-
"is workspace project",
|
|
288
|
-
this.judgeIsWorkspace(
|
|
289
|
-
(0, import_node_path3.resolve)(this.sourceRoot, ".."),
|
|
290
|
-
this.buildRoot
|
|
291
|
-
)
|
|
292
|
-
);
|
|
293
269
|
if (!this.judgeIsWorkspace(
|
|
294
270
|
(0, import_node_path3.resolve)(this.sourceRoot, ".."),
|
|
295
271
|
this.buildRoot
|
|
@@ -305,15 +281,11 @@ var GxGenerate = class {
|
|
|
305
281
|
);
|
|
306
282
|
process.chdir((0, import_node_path3.resolve)(this.sourceRoot, ".."));
|
|
307
283
|
const installDepProcess = (0, import_node_child_process.spawn)("npm", ["install"]);
|
|
308
|
-
installDepProcess.on("message", (msg) => {
|
|
309
|
-
console.debug(msg);
|
|
310
|
-
});
|
|
311
284
|
installDepProcess.on("error", (err) => {
|
|
312
285
|
console.error(err);
|
|
313
286
|
});
|
|
314
287
|
installDepProcess.on("close", (code) => {
|
|
315
288
|
if (code === 0) {
|
|
316
|
-
console.info("dependencies install complete");
|
|
317
289
|
process.chdir(curDir);
|
|
318
290
|
resolve3();
|
|
319
291
|
} else {
|
|
@@ -331,20 +303,16 @@ var GxGenerate = class {
|
|
|
331
303
|
this.installDependencies().then(() => {
|
|
332
304
|
const config = this.generateEsbuildConfig();
|
|
333
305
|
process.chdir((0, import_node_path3.resolve)(this.sourceRoot, ".."));
|
|
334
|
-
console.info("cur build directory", process.cwd());
|
|
335
|
-
console.log(JSON.stringify(config));
|
|
336
306
|
return import_esbuild.default.build(config);
|
|
337
307
|
}).then(() => {
|
|
338
308
|
process.chdir(curDir);
|
|
339
|
-
console.log("Build completed!");
|
|
340
309
|
}).catch((error) => {
|
|
341
310
|
console.error("Build failed:", error);
|
|
342
311
|
});
|
|
343
312
|
}
|
|
344
313
|
};
|
|
345
314
|
function generateGlyphix() {
|
|
346
|
-
|
|
347
|
-
if (!process.env["VITE_BUILD_DIR"] || !process.env["VITE_SOURCE_DIR"])
|
|
315
|
+
if ((!process.env["VITE_BUILD_DIR"] || !process.env["VITE_SOURCE_DIR"]) && (!process.env["GLYPHIX_BUILD_DIR"] || !process.env["GLYPHIX_SOURCE_DIR"]))
|
|
348
316
|
throw Error("not set glyphix project path");
|
|
349
317
|
const generate = new GxGenerate();
|
|
350
318
|
generate.build();
|
package/package.json
CHANGED
|
@@ -1,38 +1,63 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
2
|
+
"name": "glyphix",
|
|
3
|
+
"version": "1.0.36",
|
|
4
|
+
"main": "lib/index.js",
|
|
5
|
+
"types": "types/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"glyphix.js",
|
|
8
|
+
"types/",
|
|
9
|
+
"template/",
|
|
10
|
+
"script/",
|
|
11
|
+
"libs/"
|
|
12
|
+
],
|
|
13
|
+
"bin": {
|
|
14
|
+
"glyphix": "./bin/glyphix.js"
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"import": {
|
|
20
|
+
"types": "./types/index.d.ts",
|
|
21
|
+
"default": "./libs/index.js"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"dev": "cross-env NODE_ENV=development ts-node src/index.ts generate",
|
|
27
|
+
"build": "rimraf dist && ts-node script/build.ts",
|
|
28
|
+
"dev:local": "ts-node script/build.ts && sudo npm install /Users/hui/Documents/workspaces/work/appstore/develop-tools/gxTools/dist -g"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"glyphix"
|
|
32
|
+
],
|
|
33
|
+
"author": "xfaith",
|
|
34
|
+
"license": "ISC",
|
|
35
|
+
"description": "",
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/adm-zip": "^0.5.7",
|
|
38
|
+
"@types/fs-extra": "^11.0.4",
|
|
39
|
+
"@types/lodash": "^4.17.15",
|
|
40
|
+
"@types/node": "^22.10.5",
|
|
41
|
+
"@types/ramda": "^0.30.2",
|
|
42
|
+
"@types/yargs": "^17.0.33",
|
|
43
|
+
"cross-env": "^7.0.3",
|
|
44
|
+
"globals": "^15.14.0",
|
|
45
|
+
"ramda": "^0.30.1",
|
|
46
|
+
"rimraf": "^6.0.1",
|
|
47
|
+
"ts-node": "^10.9.2",
|
|
48
|
+
"typescript": "^5.7.3"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"adm-zip": "^0.5.16",
|
|
52
|
+
"chalk": "^4.1.2",
|
|
53
|
+
"dotenv": "^16.4.7",
|
|
54
|
+
"esbuild": "^0.24.2",
|
|
55
|
+
"esbuild-plugin-d.ts": "^1.3.1",
|
|
56
|
+
"eslint": "^9.18.0",
|
|
57
|
+
"fs-extra": "^11.2.0",
|
|
58
|
+
"glob": "^11.0.1",
|
|
59
|
+
"lodash": "^4.17.21",
|
|
60
|
+
"yargs": "^17.7.2"
|
|
61
|
+
},
|
|
62
|
+
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
|
|
63
|
+
}
|
package/script/install.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var f=Object.create;var c=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var w=(o,i,n,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let m of h(i))!_.call(o,m)&&m!==n&&c(o,m,{get:()=>i[m],enumerable:!(r=p(i,m))||r.enumerable});return o};var d=(o,i,n)=>(n=o!=null?f(x(o)):{},w(i||!o||!o.__esModule?c(n,"default",{value:o,enumerable:!0}):n,o));var u=d(require("http")),l=d(require("fs")),a=require("child_process"),s=require("fs-extra"),e=require("path"),g=d(require("adm-zip"));function b(o,i){let n=l.default.createWriteStream(i);return new Promise((r,m)=>{u.default.get(o,t=>{if(t.statusCode!==200){console.error(`Failed to download file: ${t.statusCode}`),t.resume(),m();return}t.pipe(n),n.on("finish",()=>{n.close(()=>{console.log("Download completed."),r(i)})})}).on("error",t=>{l.default.unlink(i,()=>{}),console.error(`Error downloading file: ${t.message}`),m()})})}function y(){let o="http://10.147.18.10:9012/download/gx-build-mac-arm64-test-0.0.1.zip",i=(0,e.parse)(o),n=`${i.name}${i.ext}`,r=(0,e.resolve)(__dirname,"../emu/");return(0,s.existsSync)(r)||(0,s.mkdirSync)(r),b(o,(0,e.resolve)(r,n))}function P(o,i){new g.default(o).extractAllTo(i,!0)}(0,s.existsSync)((0,e.resolve)(__dirname,"emu/bin"))||y().then(o=>{P(o,(0,e.dirname)(o)),(0,a.spawn)("chmod",["+x",(0,e.resolve)(__dirname,"../emu/bin/gx")]),(0,a.spawn)("chmod",["+x",(0,e.resolve)(__dirname,"../emu/bin/glyphix-emu")]),(0,a.spawn)("chmod",["+x",(0,e.resolve)(__dirname,"../emu/bin/glyphix-jsc")]),(0,a.spawn)("chmod",["+x",(0,e.resolve)(__dirname,"../emu/bin/image-forge")])});
|