create-asaje-go-vue 0.3.6 → 0.3.8
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/create-asaje-go-vue.js +52 -16
- package/package.json +1 -1
|
@@ -421,6 +421,7 @@ async function runCreate(argv) {
|
|
|
421
421
|
console.log(pc.dim("\nScaffolding project from GitHub template..."));
|
|
422
422
|
await cloneTemplate(answers.template, answers.branch, destinationDir);
|
|
423
423
|
await cleanupTemplateFiles(destinationDir);
|
|
424
|
+
await ensureScaffoldedSurfaces(destinationDir, answers);
|
|
424
425
|
await writeProjectConfig(destinationDir, answers);
|
|
425
426
|
await writeEnvFiles(destinationDir, answers);
|
|
426
427
|
await writeProjectReadme(destinationDir, answers);
|
|
@@ -1180,6 +1181,7 @@ function buildCreateRailwayEnvironments(answers) {
|
|
|
1180
1181
|
}
|
|
1181
1182
|
|
|
1182
1183
|
async function writeEnvFiles(destinationDir, answers) {
|
|
1184
|
+
await fs.ensureDir(path.join(destinationDir, "admin"));
|
|
1183
1185
|
await fs.writeFile(
|
|
1184
1186
|
path.join(destinationDir, "admin/.env"),
|
|
1185
1187
|
toEnvContent({
|
|
@@ -1248,8 +1250,10 @@ async function writeEnvFiles(destinationDir, answers) {
|
|
|
1248
1250
|
RABBITMQ_WORKER_CONSUMER_TAG: `${answers.slug || "asaje-app"}-api-worker`,
|
|
1249
1251
|
};
|
|
1250
1252
|
|
|
1253
|
+
await fs.ensureDir(path.join(destinationDir, "api"));
|
|
1251
1254
|
await fs.writeFile(path.join(destinationDir, "api/.env"), toEnvContent(apiEnv));
|
|
1252
1255
|
|
|
1256
|
+
await fs.ensureDir(path.join(destinationDir, "realtime-gateway"));
|
|
1253
1257
|
await fs.writeFile(
|
|
1254
1258
|
path.join(destinationDir, "realtime-gateway/.env"),
|
|
1255
1259
|
toEnvContent({
|
|
@@ -1265,22 +1269,28 @@ async function writeEnvFiles(destinationDir, answers) {
|
|
|
1265
1269
|
}),
|
|
1266
1270
|
);
|
|
1267
1271
|
|
|
1268
|
-
|
|
1269
|
-
path.join(destinationDir, "landing
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1272
|
+
if (answers.includeLanding) {
|
|
1273
|
+
await fs.ensureDir(path.join(destinationDir, "landing"));
|
|
1274
|
+
await fs.writeFile(
|
|
1275
|
+
path.join(destinationDir, "landing/.env"),
|
|
1276
|
+
toEnvContent({
|
|
1277
|
+
API_BASE_URL: `http://localhost:${answers.apiPort}`,
|
|
1278
|
+
PWA_BASE_URL: "http://localhost:4174",
|
|
1279
|
+
}),
|
|
1280
|
+
);
|
|
1281
|
+
}
|
|
1275
1282
|
|
|
1276
|
-
|
|
1277
|
-
path.join(destinationDir, "pwa
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1283
|
+
if (answers.includePwa) {
|
|
1284
|
+
await fs.ensureDir(path.join(destinationDir, "pwa"));
|
|
1285
|
+
await fs.writeFile(
|
|
1286
|
+
path.join(destinationDir, "pwa/.env"),
|
|
1287
|
+
toEnvContent({
|
|
1288
|
+
VITE_APP_NAME: `${answers.appName} PWA`,
|
|
1289
|
+
VITE_API_BASE_URL: `http://localhost:${answers.apiPort}/api/v1`,
|
|
1290
|
+
VITE_REALTIME_BASE_URL: `http://localhost:${answers.realtimePort}`,
|
|
1291
|
+
}),
|
|
1292
|
+
);
|
|
1293
|
+
}
|
|
1284
1294
|
}
|
|
1285
1295
|
|
|
1286
1296
|
async function writeGithubWorkflow(destinationDir, answers) {
|
|
@@ -5656,6 +5666,32 @@ async function cleanupTemplateFiles(destinationDir) {
|
|
|
5656
5666
|
}
|
|
5657
5667
|
}
|
|
5658
5668
|
|
|
5669
|
+
async function ensureScaffoldedSurfaces(destinationDir, answers) {
|
|
5670
|
+
const requiredDirectories = ["admin", "api", "realtime-gateway"];
|
|
5671
|
+
|
|
5672
|
+
if (answers.includeLanding) {
|
|
5673
|
+
requiredDirectories.push("landing");
|
|
5674
|
+
}
|
|
5675
|
+
if (answers.includePwa) {
|
|
5676
|
+
requiredDirectories.push("pwa");
|
|
5677
|
+
}
|
|
5678
|
+
|
|
5679
|
+
const missing = [];
|
|
5680
|
+
for (const relativeDir of requiredDirectories) {
|
|
5681
|
+
if (!(await fs.pathExists(path.join(destinationDir, relativeDir)))) {
|
|
5682
|
+
missing.push(relativeDir);
|
|
5683
|
+
}
|
|
5684
|
+
}
|
|
5685
|
+
|
|
5686
|
+
if (missing.length > 0) {
|
|
5687
|
+
throw new Error(
|
|
5688
|
+
`Template scaffold is missing expected directories: ${missing.join(", ")}. ` +
|
|
5689
|
+
`This usually means the selected template/branch does not include the requested surfaces. ` +
|
|
5690
|
+
`Try another branch or update the template repository before running create again.`,
|
|
5691
|
+
);
|
|
5692
|
+
}
|
|
5693
|
+
}
|
|
5694
|
+
|
|
5659
5695
|
async function ensureDestinationIsAvailable(destinationDir) {
|
|
5660
5696
|
const exists = await fs.pathExists(destinationDir);
|
|
5661
5697
|
if (!exists) {
|
|
@@ -5664,7 +5700,7 @@ async function ensureDestinationIsAvailable(destinationDir) {
|
|
|
5664
5700
|
|
|
5665
5701
|
const files = await fs.readdir(destinationDir);
|
|
5666
5702
|
if (files.length > 0) {
|
|
5667
|
-
throw new Error(`Destination already exists and is not empty: ${destinationDir}
|
|
5703
|
+
throw new Error(`Destination already exists and is not empty: ${destinationDir}. Choose another directory or empty it before running create.`);
|
|
5668
5704
|
}
|
|
5669
5705
|
}
|
|
5670
5706
|
|