glyphix 1.0.34 → 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 -32
- 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");
|
|
@@ -194,12 +178,13 @@ var GxGenerate = class {
|
|
|
194
178
|
generateEsbuildConfig() {
|
|
195
179
|
const resolveExtensions = [".ts", ".js"];
|
|
196
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");
|
|
197
182
|
const internalConfig = {
|
|
198
183
|
entryPoints: this.entries,
|
|
199
184
|
// 入口文件
|
|
200
185
|
bundle: true,
|
|
201
186
|
// 启用打包
|
|
202
|
-
outdir
|
|
187
|
+
outdir,
|
|
203
188
|
// 输出目录
|
|
204
189
|
splitting: true,
|
|
205
190
|
// 启用代码分割
|
|
@@ -277,18 +262,10 @@ var GxGenerate = class {
|
|
|
277
262
|
/**
|
|
278
263
|
* 安装依赖
|
|
279
264
|
* 1. 判断是否是 workspace, 非 workspace 不用安装
|
|
280
|
-
* 2. workspace 项目,需要将 package.json 拷贝到构建目录,在构建目录安装依赖
|
|
281
265
|
* @returns
|
|
282
266
|
*/
|
|
283
267
|
installDependencies() {
|
|
284
268
|
return new Promise((resolve3, reject) => {
|
|
285
|
-
console.log(
|
|
286
|
-
"is workspace project",
|
|
287
|
-
this.judgeIsWorkspace(
|
|
288
|
-
(0, import_node_path3.resolve)(this.sourceRoot, ".."),
|
|
289
|
-
this.buildRoot
|
|
290
|
-
)
|
|
291
|
-
);
|
|
292
269
|
if (!this.judgeIsWorkspace(
|
|
293
270
|
(0, import_node_path3.resolve)(this.sourceRoot, ".."),
|
|
294
271
|
this.buildRoot
|
|
@@ -304,15 +281,11 @@ var GxGenerate = class {
|
|
|
304
281
|
);
|
|
305
282
|
process.chdir((0, import_node_path3.resolve)(this.sourceRoot, ".."));
|
|
306
283
|
const installDepProcess = (0, import_node_child_process.spawn)("npm", ["install"]);
|
|
307
|
-
installDepProcess.on("message", (msg) => {
|
|
308
|
-
console.debug(msg);
|
|
309
|
-
});
|
|
310
284
|
installDepProcess.on("error", (err) => {
|
|
311
285
|
console.error(err);
|
|
312
286
|
});
|
|
313
287
|
installDepProcess.on("close", (code) => {
|
|
314
288
|
if (code === 0) {
|
|
315
|
-
console.info("dependencies install complete");
|
|
316
289
|
process.chdir(curDir);
|
|
317
290
|
resolve3();
|
|
318
291
|
} else {
|
|
@@ -333,15 +306,13 @@ var GxGenerate = class {
|
|
|
333
306
|
return import_esbuild.default.build(config);
|
|
334
307
|
}).then(() => {
|
|
335
308
|
process.chdir(curDir);
|
|
336
|
-
console.log("Build completed!");
|
|
337
309
|
}).catch((error) => {
|
|
338
310
|
console.error("Build failed:", error);
|
|
339
311
|
});
|
|
340
312
|
}
|
|
341
313
|
};
|
|
342
314
|
function generateGlyphix() {
|
|
343
|
-
|
|
344
|
-
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"]))
|
|
345
316
|
throw Error("not set glyphix project path");
|
|
346
317
|
const generate = new GxGenerate();
|
|
347
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")])});
|