create-asaje-go-vue 0.2.3 → 0.2.5

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 ||= {};
@@ -946,7 +947,19 @@ async function runSetupRailway(argv) {
946
947
 
947
948
  const rabbitMqResult = await ensureRailwayResource({
948
949
  aliases: ["rabbitmq"],
949
- commandArgs: ["deploy", "--template", "RabbitMQ"],
950
+ commandArgs: [
951
+ "add",
952
+ "--service",
953
+ "rabbitmq",
954
+ "--image",
955
+ "rabbitmq:4.1-management-alpine",
956
+ "--variables",
957
+ "RABBITMQ_DEFAULT_USER=app",
958
+ "--variables",
959
+ `RABBITMQ_DEFAULT_PASS=${randomSecret(18)}`,
960
+ "--variables",
961
+ `RABBITMQ_ERLANG_COOKIE=${randomSecret(24)}`,
962
+ ],
950
963
  dryRun: answers.dryRun,
951
964
  existingServices,
952
965
  key: "rabbitmq",
@@ -1040,6 +1053,7 @@ async function runSyncRailwayEnv(argv) {
1040
1053
  await ensureProjectStructure(projectDir);
1041
1054
  await ensureRailwayCliInstalled();
1042
1055
  await ensureRailwayAuthenticated(projectDir, answers.environment);
1056
+ await ensureRailwayEnvironmentLinked(projectDir, answers.environment);
1043
1057
 
1044
1058
  const manifest = await readRailwayManifest(projectDir);
1045
1059
  manifest.resources ||= {};
@@ -1212,6 +1226,21 @@ async function ensureRailwayAuthenticated(projectDir, environment) {
1212
1226
  }
1213
1227
  }
1214
1228
 
1229
+ async function ensureRailwayEnvironmentLinked(projectDir, environment) {
1230
+ if (!environment) {
1231
+ return;
1232
+ }
1233
+
1234
+ const result = await execa("railway", ["environment", "link", environment], {
1235
+ cwd: projectDir,
1236
+ reject: false,
1237
+ });
1238
+
1239
+ if (result.exitCode !== 0) {
1240
+ throw new Error(`Unable to link Railway environment ${environment}. Make sure it exists and try again.`);
1241
+ }
1242
+ }
1243
+
1215
1244
  async function readRailwayManifest(projectDir) {
1216
1245
  const manifestPath = path.join(projectDir, RAILWAY_MANIFEST_FILENAME);
1217
1246
  if (!(await fs.pathExists(manifestPath))) {
@@ -2020,6 +2049,17 @@ function buildRailwayArgs(args, environment) {
2020
2049
  return args;
2021
2050
  }
2022
2051
 
2052
+ const commandKey = args.slice(0, 2).join(" ");
2053
+ const supportsEnvironmentFlag =
2054
+ commandKey === "service status" ||
2055
+ commandKey === "variable list" ||
2056
+ commandKey === "variable set" ||
2057
+ args[0] === "up";
2058
+
2059
+ if (!supportsEnvironmentFlag) {
2060
+ return args;
2061
+ }
2062
+
2023
2063
  return [...args, "--environment", environment];
2024
2064
  }
2025
2065
 
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.5",
4
4
  "description": "CLI to scaffold, configure, and run the Asaje Go + Vue boilerplate",
5
5
  "type": "module",
6
6
  "bin": {