glyphix 1.0.34 → 1.0.37

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 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");
@@ -142,17 +126,18 @@ var GxGenerate = class {
142
126
  // 正在构建的应用的 src 目录路径
143
127
  this.sourceRoot = (0, import_node_path3.resolve)(
144
128
  this.workspaceRoot,
145
- process.env["VITE_SOURCE_DIR"]
129
+ process.env["VITE_SOURCE_DIR"] ?? process.env["GLYPHIX_SOURCE_DIR"]
146
130
  );
147
131
  // 构建的 build 目录路径
148
132
  this.buildRoot = (0, import_node_path3.resolve)(
149
133
  this.workspaceRoot,
150
- process.env["VITE_BUILD_DIR"]
134
+ process.env["VITE_BUILD_DIR"] ?? process.env["GLYPHIX_BUILD_DIR"]
151
135
  );
152
136
  // gx 工具传递过来的入口文件,包括 app.{t,j}s 和各个页面的 js 文件路径
153
137
  this.entries = [];
138
+ const entryFile = process.env["GLYPHIX_BUILD_DIR"] ? ".node-entry.json" : "entry.vite.json";
154
139
  const content = JSON.parse(
155
- (0, import_node_fs.readFileSync)((0, import_node_path3.resolve)(this.buildRoot, "entry.vite.json")).toString()
140
+ (0, import_node_fs.readFileSync)((0, import_node_path3.resolve)(this.buildRoot, entryFile)).toString()
156
141
  );
157
142
  this.entries = content.entry.map(
158
143
  (item) => (0, import_node_path3.resolve)(this.buildRoot, item)
@@ -194,12 +179,13 @@ var GxGenerate = class {
194
179
  generateEsbuildConfig() {
195
180
  const resolveExtensions = [".ts", ".js"];
196
181
  const that = this;
182
+ 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
183
  const internalConfig = {
198
184
  entryPoints: this.entries,
199
185
  // 入口文件
200
186
  bundle: true,
201
187
  // 启用打包
202
- outdir: (0, import_node_path3.resolve)(this.buildRoot, ".vite-dist"),
188
+ outdir,
203
189
  // 输出目录
204
190
  splitting: true,
205
191
  // 启用代码分割
@@ -277,18 +263,10 @@ var GxGenerate = class {
277
263
  /**
278
264
  * 安装依赖
279
265
  * 1. 判断是否是 workspace, 非 workspace 不用安装
280
- * 2. workspace 项目,需要将 package.json 拷贝到构建目录,在构建目录安装依赖
281
266
  * @returns
282
267
  */
283
268
  installDependencies() {
284
269
  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
270
  if (!this.judgeIsWorkspace(
293
271
  (0, import_node_path3.resolve)(this.sourceRoot, ".."),
294
272
  this.buildRoot
@@ -304,15 +282,11 @@ var GxGenerate = class {
304
282
  );
305
283
  process.chdir((0, import_node_path3.resolve)(this.sourceRoot, ".."));
306
284
  const installDepProcess = (0, import_node_child_process.spawn)("npm", ["install"]);
307
- installDepProcess.on("message", (msg) => {
308
- console.debug(msg);
309
- });
310
285
  installDepProcess.on("error", (err) => {
311
286
  console.error(err);
312
287
  });
313
288
  installDepProcess.on("close", (code) => {
314
289
  if (code === 0) {
315
- console.info("dependencies install complete");
316
290
  process.chdir(curDir);
317
291
  resolve3();
318
292
  } else {
@@ -333,15 +307,17 @@ var GxGenerate = class {
333
307
  return import_esbuild.default.build(config);
334
308
  }).then(() => {
335
309
  process.chdir(curDir);
336
- console.log("Build completed!");
337
310
  }).catch((error) => {
338
311
  console.error("Build failed:", error);
339
312
  });
340
313
  }
341
314
  };
342
315
  function generateGlyphix() {
343
- console.info("start gen", process.env["VITE_SOURCE_DIR"]);
344
- if (!process.env["VITE_BUILD_DIR"] || !process.env["VITE_SOURCE_DIR"])
316
+ console.log(
317
+ "process",
318
+ !process.env["VITE_BUILD_DIR"] || !process.env["VITE_SOURCE_DIR"]
319
+ );
320
+ if ((!process.env["VITE_BUILD_DIR"] || !process.env["VITE_SOURCE_DIR"]) && (!process.env["GLYPHIX_BUILD_DIR"] || !process.env["GLYPHIX_SOURCE_DIR"]))
345
321
  throw Error("not set glyphix project path");
346
322
  const generate = new GxGenerate();
347
323
  generate.build();
package/package.json CHANGED
@@ -1,38 +1,63 @@
1
1
  {
2
- "name": "glyphix",
3
- "version": "1.0.34",
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
- "scripts": {},
14
- "bin": {
15
- "glyphix": "./bin/glyphix.js"
16
- },
17
- "sideEffects": false,
18
- "exports": {
19
- ".": {
20
- "import": {
21
- "types": "./types/index.d.ts",
22
- "default": "./libs/index.js"
23
- }
24
- }
25
- },
26
- "dependencies": {
27
- "adm-zip": "^0.5.16",
28
- "chalk": "^4.1.2",
29
- "dotenv": "^16.4.7",
30
- "esbuild": "^0.24.2",
31
- "esbuild-plugin-d.ts": "^1.3.1",
32
- "eslint": "^9.18.0",
33
- "fs-extra": "^11.2.0",
34
- "glob": "^11.0.1",
35
- "lodash": "^4.17.21",
36
- "yargs": "^17.7.2"
37
- }
38
- }
2
+ "name": "glyphix",
3
+ "version": "1.0.37",
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")])});