create-asaje-go-vue 0.2.3 → 0.2.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.
@@ -919,6 +919,7 @@ async function runSetupRailway(argv) {
919
919
  await ensureProjectStructure(projectDir);
920
920
  await ensureRailwayCliInstalled();
921
921
  await ensureRailwayAuthenticated(projectDir, answers.environment);
922
+ await ensureRailwayEnvironmentLinked(projectDir, answers.environment);
922
923
 
923
924
  const manifest = await readRailwayManifest(projectDir);
924
925
  manifest.resources ||= {};
@@ -1040,6 +1041,7 @@ async function runSyncRailwayEnv(argv) {
1040
1041
  await ensureProjectStructure(projectDir);
1041
1042
  await ensureRailwayCliInstalled();
1042
1043
  await ensureRailwayAuthenticated(projectDir, answers.environment);
1044
+ await ensureRailwayEnvironmentLinked(projectDir, answers.environment);
1043
1045
 
1044
1046
  const manifest = await readRailwayManifest(projectDir);
1045
1047
  manifest.resources ||= {};
@@ -1212,6 +1214,21 @@ async function ensureRailwayAuthenticated(projectDir, environment) {
1212
1214
  }
1213
1215
  }
1214
1216
 
1217
+ async function ensureRailwayEnvironmentLinked(projectDir, environment) {
1218
+ if (!environment) {
1219
+ return;
1220
+ }
1221
+
1222
+ const result = await execa("railway", ["environment", "link", environment], {
1223
+ cwd: projectDir,
1224
+ reject: false,
1225
+ });
1226
+
1227
+ if (result.exitCode !== 0) {
1228
+ throw new Error(`Unable to link Railway environment ${environment}. Make sure it exists and try again.`);
1229
+ }
1230
+ }
1231
+
1215
1232
  async function readRailwayManifest(projectDir) {
1216
1233
  const manifestPath = path.join(projectDir, RAILWAY_MANIFEST_FILENAME);
1217
1234
  if (!(await fs.pathExists(manifestPath))) {
@@ -2020,6 +2037,17 @@ function buildRailwayArgs(args, environment) {
2020
2037
  return args;
2021
2038
  }
2022
2039
 
2040
+ const commandKey = args.slice(0, 2).join(" ");
2041
+ const supportsEnvironmentFlag =
2042
+ commandKey === "service status" ||
2043
+ commandKey === "variable list" ||
2044
+ commandKey === "variable set" ||
2045
+ args[0] === "up";
2046
+
2047
+ if (!supportsEnvironmentFlag) {
2048
+ return args;
2049
+ }
2050
+
2023
2051
  return [...args, "--environment", environment];
2024
2052
  }
2025
2053
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-asaje-go-vue",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "CLI to scaffold, configure, and run the Asaje Go + Vue boilerplate",
5
5
  "type": "module",
6
6
  "bin": {