@decohere/create 0.0.1-dev.20261123.408 → 0.0.1-dev.20261125.414

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.
@@ -48,7 +48,9 @@ export function containerArgvFromHost(argv) {
48
48
  i++;
49
49
  continue;
50
50
  }
51
- if (arg != null) stripped.push(arg);
51
+ if (arg != null) {
52
+ stripped.push(arg);
53
+ }
52
54
  }
53
55
  return toProductArgv(stripped);
54
56
  }
@@ -74,7 +76,9 @@ export function containerArgvFromHost(argv) {
74
76
  i++;
75
77
  continue;
76
78
  }
77
- if (arg != null) withoutD.push(arg);
79
+ if (arg != null) {
80
+ withoutD.push(arg);
81
+ }
78
82
  }
79
83
  const product = toProductArgv(withoutD);
80
84
  const isAdd = product[0] === "add";
package/es6/src/runner.js CHANGED
@@ -20,7 +20,9 @@ const SIGNAL_EXIT_CODES = {
20
20
  * the scaffolder image. Commands on an existing project need that project's Dev Container.
21
21
  */ export async function launch(argv) {
22
22
  const plan = resolveLaunch(argv);
23
- if (hasDecohereTools()) runHere(plan);
23
+ if (hasDecohereTools()) {
24
+ runHere(plan);
25
+ }
24
26
  if (plan.kind === "project") {
25
27
  console.error(OPEN_DEV_CONTAINER_MESSAGE);
26
28
  process.exit(1);
@@ -35,9 +37,13 @@ const SIGNAL_EXIT_CODES = {
35
37
  ].includes(arg));
36
38
  }
37
39
  /** A new project only goes into an empty folder, so a copy can never overwrite someone's files. */ function refuseFolderWithFiles(targetDir) {
38
- if (!existsSync(targetDir)) return;
40
+ if (!existsSync(targetDir)) {
41
+ return;
42
+ }
39
43
  const files = readdirSync(targetDir).filter((name)=>name !== ".git");
40
- if (files.length === 0) return;
44
+ if (files.length === 0) {
45
+ return;
46
+ }
41
47
  console.error(`\n ${targetDir} already has files in it.\n` + " Choose a new folder. To change an existing project, run `pnpm decohere add` in its Dev Container.\n");
42
48
  process.exit(1);
43
49
  }
@@ -45,7 +51,9 @@ const SIGNAL_EXIT_CODES = {
45
51
  return `${randomBytes(18).toString("base64url")}aA1!`;
46
52
  }
47
53
  /** Store it in the Linux key store, if there is one. The value goes over stdin, never in argv. */ function saveToKeyStore(projectName, password) {
48
- if (process.platform !== "linux") return false;
54
+ if (process.platform !== "linux") {
55
+ return false;
56
+ }
49
57
  const stored = spawnSync("secret-tool", [
50
58
  "store",
51
59
  `--label=Decohere ${projectName} Auth0 admin`,
@@ -77,7 +85,9 @@ function keyStoreAttributes(projectName) {
77
85
  */ function saveAdminPassword(targetDir, projectName, password) {
78
86
  const env = join(targetDir, ".env");
79
87
  const email = existsSync(env) ? readFileSync(env, "utf8").match(/^AUTH0_ADMIN_USER_EMAIL=(.+)$/m)?.[1] : undefined;
80
- if (email == null) return;
88
+ if (email == null) {
89
+ return;
90
+ }
81
91
  const folder = join(homedir(), ".config", "decohere");
82
92
  const file = join(folder, `${projectName}.env`);
83
93
  if (saveToKeyStore(projectName, password)) {
@@ -225,7 +235,9 @@ function attach(name) {
225
235
  const plan = resolveLaunch(argv);
226
236
  const { targetDir, containerArgv, projectName } = plan;
227
237
  const copyOut = writesProject(plan);
228
- if (copyOut) refuseFolderWithFiles(targetDir);
238
+ if (copyOut) {
239
+ refuseFolderWithFiles(targetDir);
240
+ }
229
241
  assertDockerAvailable();
230
242
  const name = `decohere-create-${randomBytes(6).toString("hex")}`;
231
243
  const adminPassword = generateAdminPassword();
@@ -261,7 +273,9 @@ function attach(name) {
261
273
  [ADMIN_PASSWORD_ENV]: adminPassword
262
274
  }
263
275
  });
264
- if (created.status !== 0) process.exit(created.status ?? 1);
276
+ if (created.status !== 0) {
277
+ process.exit(created.status ?? 1);
278
+ }
265
279
  for (const [signal, code] of Object.entries(SIGNAL_EXIT_CODES)){
266
280
  process.once(signal, ()=>{
267
281
  removeContainer(name);
@@ -17,7 +17,9 @@ function resolveCreateMetadata() {
17
17
  }
18
18
  } catch {}
19
19
  const parent = dirname(dir);
20
- if (parent === dir) break;
20
+ if (parent === dir) {
21
+ break;
22
+ }
21
23
  dir = parent;
22
24
  }
23
25
  return {
@@ -30,13 +30,17 @@ export function collectWorkspacePackages(rootDir) {
30
30
  return;
31
31
  }
32
32
  for (const entry of entries) {
33
- if (entry.name === "node_modules" || entry.name === ".git") continue;
33
+ if (entry.name === "node_modules" || entry.name === ".git") {
34
+ continue;
35
+ }
34
36
  const path = join(dir, entry.name);
35
37
  if (entry.isDirectory()) {
36
38
  walk(path);
37
39
  continue;
38
40
  }
39
- if (entry.name !== "package.json") continue;
41
+ if (entry.name !== "package.json") {
42
+ continue;
43
+ }
40
44
  const pkg = JSON.parse(readFileSync(path, "utf8"));
41
45
  if (typeof pkg.name === "string" && pkg.name.startsWith("@decohere/")) {
42
46
  found.push({ name: pkg.name, dir });
@@ -54,7 +58,9 @@ export function collectWorkspacePackages(rootDir) {
54
58
  export function fileSpec(fromDir, pkgDir) {
55
59
  let rel = relative(fromDir, pkgDir) || ".";
56
60
  rel = rel.replaceAll("\\", "/");
57
- if (!rel.startsWith(".")) rel = `./${rel}`;
61
+ if (!rel.startsWith(".")) {
62
+ rel = `./${rel}`;
63
+ }
58
64
  return `file:${rel}`;
59
65
  }
60
66
 
@@ -71,11 +77,15 @@ export function rewriteDecohereDepsToFile(pkg, fromDir, packages) {
71
77
  const byName = new Map(packages.map((item) => [item.name, item.dir]));
72
78
  const from = resolve(fromDir);
73
79
  const rewrite = (deps) => {
74
- if (deps == null || typeof deps !== "object" || Array.isArray(deps)) return deps;
80
+ if (deps == null || typeof deps !== "object" || Array.isArray(deps)) {
81
+ return deps;
82
+ }
75
83
  const next = { .../** @type {Record<string, unknown>} */ (deps) };
76
84
  for (const name of Object.keys(next)) {
77
85
  const dir = byName.get(name);
78
- if (dir == null || resolve(dir) === from) continue;
86
+ if (dir == null || resolve(dir) === from) {
87
+ continue;
88
+ }
79
89
  next[name] = fileSpec(fromDir, dir);
80
90
  }
81
91
  return next;
@@ -147,7 +157,9 @@ function parseArgs(argv) {
147
157
  const parsed = {};
148
158
  for (let i = 0; i < argv.length; i++) {
149
159
  const arg = argv[i];
150
- if (arg == null || !arg.startsWith("--")) continue;
160
+ if (arg == null || !arg.startsWith("--")) {
161
+ continue;
162
+ }
151
163
  const key = arg.slice(2);
152
164
  const value = argv[i + 1];
153
165
  if (value == null || value.startsWith("--")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decohere/create",
3
- "version": "0.0.1-dev.20261123.408",
3
+ "version": "0.0.1-dev.20261125.414",
4
4
  "description": "Download the Decohere scaffolder image and run it (npm create @decohere)",
5
5
  "keywords": [
6
6
  "decohere",