create-asaje-go-vue 0.3.2 → 0.3.4
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 +90 -23
- package/package.json +1 -1
|
@@ -1264,10 +1264,11 @@ async function runSetupRailway(argv) {
|
|
|
1264
1264
|
const projectConfig = await loadProjectConfig(projectDir);
|
|
1265
1265
|
const projectSlug = resolveProjectSlug(projectDir, projectConfig);
|
|
1266
1266
|
const appServiceSpecs = resolveRailwayAppServiceSpecs(projectConfig);
|
|
1267
|
+
const selectedSpecs = resolveDeployRailwaySpecs(answers.services, appServiceSpecs);
|
|
1267
1268
|
const requestedRailwayEnvironment = resolveRequestedRailwayEnvironmentRef(projectConfig, answers.environment);
|
|
1268
1269
|
|
|
1269
1270
|
await ensureProjectStructure(projectDir);
|
|
1270
|
-
await ensureRailwayAppServiceTargets(projectDir,
|
|
1271
|
+
await ensureRailwayAppServiceTargets(projectDir, selectedSpecs);
|
|
1271
1272
|
await ensureRailwayCliInstalled();
|
|
1272
1273
|
await ensureRailwayAuthenticated(projectDir, requestedRailwayEnvironment);
|
|
1273
1274
|
await ensureRailwayEnvironmentLinked(projectDir, requestedRailwayEnvironment);
|
|
@@ -1343,7 +1344,7 @@ async function runSetupRailway(argv) {
|
|
|
1343
1344
|
|
|
1344
1345
|
console.log(pc.bold("\nApplication services"));
|
|
1345
1346
|
manifest.appServices ||= {};
|
|
1346
|
-
for (const spec of
|
|
1347
|
+
for (const spec of selectedSpecs) {
|
|
1347
1348
|
const serviceName = resolveRailwayServiceName(spec, projectSlug);
|
|
1348
1349
|
const serviceResult = await ensureRailwayAppService({
|
|
1349
1350
|
aliases: spec.aliases,
|
|
@@ -1388,7 +1389,7 @@ async function runSetupRailway(argv) {
|
|
|
1388
1389
|
projectDir,
|
|
1389
1390
|
projectSlug,
|
|
1390
1391
|
railwayContext,
|
|
1391
|
-
selectedSpecs
|
|
1392
|
+
selectedSpecs,
|
|
1392
1393
|
services: servicesAfterProvision,
|
|
1393
1394
|
});
|
|
1394
1395
|
deploySummary.push(...deploymentResults);
|
|
@@ -1758,10 +1759,12 @@ function parseDirectoryArgs(argv) {
|
|
|
1758
1759
|
function parseSetupRailwayArgs(argv) {
|
|
1759
1760
|
const options = {
|
|
1760
1761
|
bucket: DEFAULT_RAILWAY_BUCKET,
|
|
1762
|
+
bucketProvided: false,
|
|
1761
1763
|
directory: ".",
|
|
1762
1764
|
diff: false,
|
|
1763
1765
|
dryRun: false,
|
|
1764
1766
|
environment: undefined,
|
|
1767
|
+
services: [],
|
|
1765
1768
|
yes: false,
|
|
1766
1769
|
};
|
|
1767
1770
|
const positionals = [];
|
|
@@ -1786,12 +1789,14 @@ function parseSetupRailwayArgs(argv) {
|
|
|
1786
1789
|
|
|
1787
1790
|
if (arg === "--bucket") {
|
|
1788
1791
|
options.bucket = argv[index + 1] || options.bucket;
|
|
1792
|
+
options.bucketProvided = true;
|
|
1789
1793
|
index += 1;
|
|
1790
1794
|
continue;
|
|
1791
1795
|
}
|
|
1792
1796
|
|
|
1793
1797
|
if (arg.startsWith("--bucket=")) {
|
|
1794
1798
|
options.bucket = arg.split("=")[1] || options.bucket;
|
|
1799
|
+
options.bucketProvided = true;
|
|
1795
1800
|
continue;
|
|
1796
1801
|
}
|
|
1797
1802
|
|
|
@@ -1806,10 +1811,33 @@ function parseSetupRailwayArgs(argv) {
|
|
|
1806
1811
|
continue;
|
|
1807
1812
|
}
|
|
1808
1813
|
|
|
1814
|
+
if (arg === "--service") {
|
|
1815
|
+
options.services.push(argv[index + 1] || "");
|
|
1816
|
+
index += 1;
|
|
1817
|
+
continue;
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
if (arg.startsWith("--service=")) {
|
|
1821
|
+
options.services.push(arg.split("=")[1] || "");
|
|
1822
|
+
continue;
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
if (arg === "--services") {
|
|
1826
|
+
options.services.push(...splitCsv(argv[index + 1] || ""));
|
|
1827
|
+
index += 1;
|
|
1828
|
+
continue;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
if (arg.startsWith("--services=")) {
|
|
1832
|
+
options.services.push(...splitCsv(arg.split("=")[1] || ""));
|
|
1833
|
+
continue;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1809
1836
|
positionals.push(arg);
|
|
1810
1837
|
}
|
|
1811
1838
|
|
|
1812
1839
|
options.directory = positionals[0] || options.directory;
|
|
1840
|
+
options.services = [...new Set(options.services.map((service) => service.trim()).filter(Boolean))];
|
|
1813
1841
|
return options;
|
|
1814
1842
|
}
|
|
1815
1843
|
|
|
@@ -2200,19 +2228,23 @@ function parseDestroyRailwayArgs(argv) {
|
|
|
2200
2228
|
}
|
|
2201
2229
|
|
|
2202
2230
|
async function collectSetupRailwayAnswers(args) {
|
|
2231
|
+
const directory = args.directory;
|
|
2232
|
+
const bucketState = await resolveSetupRailwayBucketState(args, directory);
|
|
2233
|
+
|
|
2203
2234
|
if (args.yes) {
|
|
2204
2235
|
return {
|
|
2205
|
-
bucket:
|
|
2206
|
-
directory
|
|
2236
|
+
bucket: bucketState.bucket,
|
|
2237
|
+
directory,
|
|
2207
2238
|
diff: args.diff,
|
|
2208
2239
|
dryRun: args.dryRun,
|
|
2209
2240
|
environment: args.environment,
|
|
2241
|
+
services: args.services,
|
|
2210
2242
|
};
|
|
2211
2243
|
}
|
|
2212
2244
|
|
|
2213
|
-
const
|
|
2245
|
+
const selectedDirectory = await prompt(
|
|
2214
2246
|
text({
|
|
2215
|
-
defaultValue:
|
|
2247
|
+
defaultValue: directory,
|
|
2216
2248
|
message: "Project directory to configure on Railway?",
|
|
2217
2249
|
placeholder: ".",
|
|
2218
2250
|
validate(value) {
|
|
@@ -2221,18 +2253,23 @@ async function collectSetupRailwayAnswers(args) {
|
|
|
2221
2253
|
}),
|
|
2222
2254
|
);
|
|
2223
2255
|
|
|
2224
|
-
const
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2256
|
+
const selectedBucketState = await resolveSetupRailwayBucketState(args, selectedDirectory);
|
|
2257
|
+
let bucket = selectedBucketState.bucket;
|
|
2258
|
+
|
|
2259
|
+
if (!args.bucketProvided && !selectedBucketState.hasStoredBucket) {
|
|
2260
|
+
bucket = await prompt(
|
|
2261
|
+
text({
|
|
2262
|
+
defaultValue: selectedBucketState.bucket,
|
|
2263
|
+
message: "Object storage bucket name?",
|
|
2264
|
+
placeholder: DEFAULT_RAILWAY_BUCKET,
|
|
2265
|
+
validate(value) {
|
|
2266
|
+
return /^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/.test(value)
|
|
2267
|
+
? undefined
|
|
2268
|
+
: "Use 3-63 lowercase letters, numbers, dots, or hyphens";
|
|
2269
|
+
},
|
|
2270
|
+
}),
|
|
2271
|
+
);
|
|
2272
|
+
}
|
|
2236
2273
|
|
|
2237
2274
|
let environment = args.environment;
|
|
2238
2275
|
if (!environment) {
|
|
@@ -2247,10 +2284,28 @@ async function collectSetupRailwayAnswers(args) {
|
|
|
2247
2284
|
|
|
2248
2285
|
return {
|
|
2249
2286
|
bucket,
|
|
2250
|
-
directory,
|
|
2287
|
+
directory: selectedDirectory,
|
|
2251
2288
|
diff: args.diff,
|
|
2252
2289
|
dryRun: args.dryRun,
|
|
2253
2290
|
environment: environment?.trim() || undefined,
|
|
2291
|
+
services: args.services,
|
|
2292
|
+
};
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
async function resolveSetupRailwayBucketState(args, directory) {
|
|
2296
|
+
if (args.bucketProvided) {
|
|
2297
|
+
return {
|
|
2298
|
+
bucket: args.bucket,
|
|
2299
|
+
hasStoredBucket: true,
|
|
2300
|
+
};
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
const projectDir = path.resolve(process.cwd(), directory || ".");
|
|
2304
|
+
const manifest = await readRailwayManifest(projectDir);
|
|
2305
|
+
const existingBucket = typeof manifest.bucket === "string" ? manifest.bucket.trim() : "";
|
|
2306
|
+
return {
|
|
2307
|
+
bucket: existingBucket || DEFAULT_RAILWAY_BUCKET,
|
|
2308
|
+
hasStoredBucket: Boolean(existingBucket),
|
|
2254
2309
|
};
|
|
2255
2310
|
}
|
|
2256
2311
|
|
|
@@ -3256,9 +3311,9 @@ async function wireRailwayVariables(config) {
|
|
|
3256
3311
|
|
|
3257
3312
|
async function loadRailwayLocalEnvDefaults(projectDir) {
|
|
3258
3313
|
const [apiEnv, realtimeEnv, adminEnv] = await Promise.all([
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3314
|
+
loadServiceEnvDefaults(projectDir, "api"),
|
|
3315
|
+
loadServiceEnvDefaults(projectDir, "realtime-gateway"),
|
|
3316
|
+
loadServiceEnvDefaults(projectDir, "admin"),
|
|
3262
3317
|
]);
|
|
3263
3318
|
|
|
3264
3319
|
return {
|
|
@@ -3268,6 +3323,18 @@ async function loadRailwayLocalEnvDefaults(projectDir) {
|
|
|
3268
3323
|
};
|
|
3269
3324
|
}
|
|
3270
3325
|
|
|
3326
|
+
async function loadServiceEnvDefaults(projectDir, serviceDir) {
|
|
3327
|
+
const [exampleEnv, localEnv] = await Promise.all([
|
|
3328
|
+
tryReadEnvFile(path.join(projectDir, serviceDir, ".env.example")),
|
|
3329
|
+
tryReadEnvFile(path.join(projectDir, serviceDir, ".env")),
|
|
3330
|
+
]);
|
|
3331
|
+
|
|
3332
|
+
return {
|
|
3333
|
+
...exampleEnv,
|
|
3334
|
+
...localEnv,
|
|
3335
|
+
};
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3271
3338
|
function buildRailwaySharedSecrets(localEnv, existingVariables) {
|
|
3272
3339
|
const jwtSecret =
|
|
3273
3340
|
sanitizeSecret(localEnv.api.JWT_SECRET, "change-me") ||
|