@a3t/rapid 0.1.8 → 0.1.9

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/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  program
4
- } from "./chunk-VWXN2TG5.js";
4
+ } from "./chunk-C6XSZWFT.js";
5
5
 
6
6
  // src/bin.ts
7
7
  program.parse(process.argv);
@@ -1071,6 +1071,16 @@ async function isRunning(name = RAPID_LIMA_INSTANCE) {
1071
1071
  const instance = await getInstance(name);
1072
1072
  return instance?.status === "Running";
1073
1073
  }
1074
+ function insertProjectMount(config, projectDir) {
1075
+ const projectMount = ` - location: "${projectDir}"
1076
+ writable: true
1077
+ `;
1078
+ const homeMountRegex = /mounts:\s*\n(\s*- location: ['"]~['"]\n(?:\s{2,}[^-][^\n]*\n)*)/;
1079
+ return config.replace(homeMountRegex, (_match, homeMount) => {
1080
+ return `mounts:
1081
+ ${homeMount}${projectMount}`;
1082
+ });
1083
+ }
1074
1084
  async function createLimaConfig(projectDir, options = {}) {
1075
1085
  const templatePath = getLimaTemplatePath();
1076
1086
  const configDir = RAPID_LIMA_DIR;
@@ -1083,14 +1093,7 @@ async function createLimaConfig(projectDir, options = {}) {
1083
1093
  template = getMinimalLimaConfig();
1084
1094
  }
1085
1095
  let config = template;
1086
- const projectMount = `
1087
- - location: "${projectDir}"
1088
- writable: true`;
1089
- config = config.replace(
1090
- /mounts:\s*\n\s*- location: "~"/,
1091
- `mounts:
1092
- - location: "~"${projectMount}`
1093
- );
1096
+ config = insertProjectMount(config, projectDir);
1094
1097
  if (options.cpus) {
1095
1098
  config = config.replace(/cpus: \d+/, `cpus: ${options.cpus}`);
1096
1099
  }
@@ -1112,9 +1115,12 @@ ${envLines}
1112
1115
  function getMinimalLimaConfig() {
1113
1116
  return `
1114
1117
  vmType: "vz"
1115
- rosetta:
1116
- enabled: true
1117
- binfmt: true
1118
+ vmOpts:
1119
+ vz:
1120
+ rosetta:
1121
+ enabled: true
1122
+ binfmt: true
1123
+
1118
1124
  cpus: 4
1119
1125
  memory: "8GiB"
1120
1126
  disk: "50GiB"
@@ -3615,4 +3621,4 @@ program.action(() => {
3615
3621
  export {
3616
3622
  program
3617
3623
  };
3618
- //# sourceMappingURL=chunk-VWXN2TG5.js.map
3624
+ //# sourceMappingURL=chunk-C6XSZWFT.js.map