@insforge/cli 0.1.24 → 0.1.26
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/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1800,7 +1800,10 @@ async function readEnvFile(cwd) {
|
|
|
1800
1800
|
const eqIndex = trimmed.indexOf("=");
|
|
1801
1801
|
if (eqIndex === -1) continue;
|
|
1802
1802
|
const key = trimmed.slice(0, eqIndex).trim();
|
|
1803
|
-
|
|
1803
|
+
let value = trimmed.slice(eqIndex + 1).trim();
|
|
1804
|
+
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
1805
|
+
value = value.slice(1, -1);
|
|
1806
|
+
}
|
|
1804
1807
|
if (key) vars.push({ key, value });
|
|
1805
1808
|
}
|
|
1806
1809
|
return vars;
|
|
@@ -2032,7 +2035,11 @@ function registerCreateCommand(program2) {
|
|
|
2032
2035
|
if (clack10.isCancel(name)) process.exit(0);
|
|
2033
2036
|
projectName = name;
|
|
2034
2037
|
}
|
|
2038
|
+
const validTemplates = ["react", "nextjs", "chatbot", "empty"];
|
|
2035
2039
|
let template = opts.template;
|
|
2040
|
+
if (template && !validTemplates.includes(template)) {
|
|
2041
|
+
throw new CLIError(`Invalid template "${template}". Valid options: ${validTemplates.join(", ")}`);
|
|
2042
|
+
}
|
|
2036
2043
|
if (!template) {
|
|
2037
2044
|
if (json) {
|
|
2038
2045
|
template = "empty";
|
|
@@ -2206,11 +2213,12 @@ async function downloadGitHubTemplate(templateName, projectConfig, json) {
|
|
|
2206
2213
|
const anonKey = await getAnonKey();
|
|
2207
2214
|
const envExample = await fs3.readFile(envExamplePath, "utf-8");
|
|
2208
2215
|
const envContent = envExample.replace(
|
|
2209
|
-
/^([A-
|
|
2216
|
+
/^([A-Z][A-Z0-9_]*=)(.*)$/gm,
|
|
2210
2217
|
(_, prefix, _value) => {
|
|
2211
2218
|
const key = prefix.slice(0, -1);
|
|
2212
2219
|
if (/INSFORGE.*(URL|BASE_URL)$/.test(key)) return `${prefix}${projectConfig.oss_host}`;
|
|
2213
2220
|
if (/INSFORGE.*ANON_KEY$/.test(key)) return `${prefix}${anonKey}`;
|
|
2221
|
+
if (key === "NEXT_PUBLIC_APP_URL") return `${prefix}https://${projectConfig.appkey}.insforge.site`;
|
|
2214
2222
|
return `${prefix}${_value}`;
|
|
2215
2223
|
}
|
|
2216
2224
|
);
|