@eziapp-org/builder 0.0.0-beta.3 → 0.0.0-beta.5

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.
@@ -9,7 +9,6 @@ export declare class Builder {
9
9
  private eziConfig;
10
10
  private mode;
11
11
  private platform;
12
- private eziDevExePath;
13
12
  constructor(config: {
14
13
  viteConfigPath?: string;
15
14
  eziConfigPath?: string;
@@ -50,9 +50,11 @@ const { red, green, yellow, blue, bold } = chalk_1.default;
50
50
  const packagers = {
51
51
  windows: "../packagers/windows/main"
52
52
  };
53
+ const eziDevExePaths = {
54
+ windows: path.join(__dirname, "../bin/eziapp-npm-dev-winx64.exe")
55
+ };
53
56
  class Builder {
54
57
  constructor(config) {
55
- this.eziDevExePath = path.join(__dirname, "../bin/eziapp-npm-dev-winx64.exe");
56
58
  this.mode = config.mode || (0, utils_1.getArg)("--mode") || 'debug';
57
59
  this.platform = config.platform || (0, utils_1.getArg)("--platform") || (0, utils_1.getCurrentPlatformName)();
58
60
  this.viteConfigPath = path.join(process.cwd(), config.viteConfigPath ?? "vite.config.js");
@@ -141,10 +143,10 @@ class Builder {
141
143
  console.log(green("✓ assets generated."));
142
144
  }
143
145
  async genIcon() {
144
- const iconPath = "public/" + this.eziConfig.application.icon;
145
- if (!iconPath) {
146
+ if (!(this.eziConfig.application.icon)) {
146
147
  return;
147
148
  }
149
+ const iconPath = path.join("public", this.eziConfig.application.icon);
148
150
  try {
149
151
  const resizedPngBuffer = await (0, sharp_1.default)(iconPath)
150
152
  .resize(256, 256, { fit: 'cover' })
@@ -181,6 +183,11 @@ class Builder {
181
183
  await packager.package();
182
184
  }
183
185
  async dev() {
186
+ const devExePath = eziDevExePaths[this.platform];
187
+ if (!devExePath) {
188
+ console.error(red(`✗ Unsupported platform: ${this.platform}`));
189
+ process.exit(1);
190
+ }
184
191
  const startTime = Date.now();
185
192
  const server = await (0, vite_1.createServer)();
186
193
  await server.listen();
@@ -202,7 +209,7 @@ class Builder {
202
209
  }
203
210
  fs.writeFileSync(eziConfigJsonPath, JSON.stringify(devEziConfig, null, 4), { encoding: "utf-8" });
204
211
  const appName = devEziConfig?.application?.name || "EziApplication";
205
- const child = (0, child_process_1.spawn)(this.eziDevExePath, [
212
+ const child = (0, child_process_1.spawn)(devExePath, [
206
213
  '--configpath',
207
214
  eziConfigJsonPath,
208
215
  '--cwd',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eziapp-org/builder",
3
- "version": "0.0.0-beta.3",
3
+ "version": "0.0.0-beta.5",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,4 +31,4 @@
31
31
  "png-to-ico": "^3.0.1",
32
32
  "sharp": "^0.34.5"
33
33
  }
34
- }
34
+ }