@akanjs/devkit 0.0.150 → 0.0.152

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.
@@ -60,6 +60,7 @@ class Builder {
60
60
  format,
61
61
  outdir: `${this.#distExecutor.cwdPath}/${format}`,
62
62
  logLevel: "error",
63
+ // external: ["react", "react-dom"],
63
64
  loader: assetLoader
64
65
  };
65
66
  }
@@ -279,7 +279,6 @@ const runCommands = async (...commands) => {
279
279
  } catch (e) {
280
280
  const errMsg = e instanceof Error ? e.message : typeof e === "string" ? e : JSON.stringify(e);
281
281
  import_common.Logger.error(`Command Error: ${import_chalk.default.red(errMsg)}`);
282
- console.error(e);
283
282
  throw e;
284
283
  }
285
284
  });
@@ -108,19 +108,19 @@ class Executor {
108
108
  ...options
109
109
  });
110
110
  let stdout = "";
111
+ let stderr = "";
111
112
  proc.stdout?.on("data", (data) => {
112
113
  stdout += data;
113
- });
114
- proc.stdout?.on("data", (data) => {
115
114
  this.#stdout(data);
116
115
  });
117
116
  proc.stderr?.on("data", (data) => {
117
+ stderr += data;
118
118
  this.#stdout(data);
119
119
  });
120
120
  return new Promise((resolve, reject) => {
121
121
  proc.on("exit", (code, signal) => {
122
122
  if (!!code || signal)
123
- reject({ code, signal, stdout });
123
+ reject({ code, signal, stdout, stderr });
124
124
  else
125
125
  resolve(stdout);
126
126
  });
@@ -307,11 +307,12 @@ class Executor {
307
307
  dict = {},
308
308
  overwrite = true
309
309
  }) {
310
- const templatePath = `${__dirname}/src/templates${template ? `/${template}` : ""}`.replace(".ts", ".js");
311
- if (import_fs.default.statSync(templatePath).isFile()) {
312
- const filename = import_path.default.basename(templatePath);
310
+ const templatePath = `${__dirname}/src/templates${template ? `/${template}` : ""}`;
311
+ const prefixTemplatePath = templatePath.endsWith(".tsx") ? templatePath : templatePath.replace(".ts", ".js");
312
+ if (import_fs.default.statSync(prefixTemplatePath).isFile()) {
313
+ const filename = import_path.default.basename(prefixTemplatePath);
313
314
  const fileContent = await this.#applyTemplateFile(
314
- { templatePath, targetPath: import_path.default.join(basePath, filename), scanResult, overwrite },
315
+ { templatePath: prefixTemplatePath, targetPath: import_path.default.join(basePath, filename), scanResult, overwrite },
315
316
  dict
316
317
  );
317
318
  return fileContent ? [fileContent] : [];
@@ -28,6 +28,7 @@ class Builder {
28
28
  format,
29
29
  outdir: `${this.#distExecutor.cwdPath}/${format}`,
30
30
  logLevel: "error",
31
+ // external: ["react", "react-dom"],
31
32
  loader: assetLoader
32
33
  };
33
34
  }
@@ -247,7 +247,6 @@ const runCommands = async (...commands) => {
247
247
  } catch (e) {
248
248
  const errMsg = e instanceof Error ? e.message : typeof e === "string" ? e : JSON.stringify(e);
249
249
  Logger.error(`Command Error: ${chalk.red(errMsg)}`);
250
- console.error(e);
251
250
  throw e;
252
251
  }
253
252
  });
@@ -73,19 +73,19 @@ class Executor {
73
73
  ...options
74
74
  });
75
75
  let stdout = "";
76
+ let stderr = "";
76
77
  proc.stdout?.on("data", (data) => {
77
78
  stdout += data;
78
- });
79
- proc.stdout?.on("data", (data) => {
80
79
  this.#stdout(data);
81
80
  });
82
81
  proc.stderr?.on("data", (data) => {
82
+ stderr += data;
83
83
  this.#stdout(data);
84
84
  });
85
85
  return new Promise((resolve, reject) => {
86
86
  proc.on("exit", (code, signal) => {
87
87
  if (!!code || signal)
88
- reject({ code, signal, stdout });
88
+ reject({ code, signal, stdout, stderr });
89
89
  else
90
90
  resolve(stdout);
91
91
  });
@@ -272,11 +272,12 @@ class Executor {
272
272
  dict = {},
273
273
  overwrite = true
274
274
  }) {
275
- const templatePath = `${__dirname}/src/templates${template ? `/${template}` : ""}`.replace(".ts", ".js");
276
- if (fs.statSync(templatePath).isFile()) {
277
- const filename = path.basename(templatePath);
275
+ const templatePath = `${__dirname}/src/templates${template ? `/${template}` : ""}`;
276
+ const prefixTemplatePath = templatePath.endsWith(".tsx") ? templatePath : templatePath.replace(".ts", ".js");
277
+ if (fs.statSync(prefixTemplatePath).isFile()) {
278
+ const filename = path.basename(prefixTemplatePath);
278
279
  const fileContent = await this.#applyTemplateFile(
279
- { templatePath, targetPath: path.join(basePath, filename), scanResult, overwrite },
280
+ { templatePath: prefixTemplatePath, targetPath: path.join(basePath, filename), scanResult, overwrite },
280
281
  dict
281
282
  );
282
283
  return fileContent ? [fileContent] : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/devkit",
3
- "version": "0.0.150",
3
+ "version": "0.0.152",
4
4
  "sourceType": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"