@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.
package/cjs/src/builder.js
CHANGED
|
@@ -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
|
});
|
package/cjs/src/executors.js
CHANGED
|
@@ -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}` : ""}
|
|
311
|
-
|
|
312
|
-
|
|
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] : [];
|
package/esm/src/builder.js
CHANGED
|
@@ -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
|
});
|
package/esm/src/executors.js
CHANGED
|
@@ -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}` : ""}
|
|
276
|
-
|
|
277
|
-
|
|
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] : [];
|