komplian 0.3.7 → 0.3.8
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/README.md +1 -1
- package/komplian-onboard.mjs +80 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
3. `npx komplian onboard --yes`
|
|
8
8
|
|
|
9
9
|
No OAuth App registration — `gh` uses GitHub’s built-in flow. **Default workspace:** current working directory (`process.cwd()`), not `~/komplian`. Pass a path as last argument to clone elsewhere.
|
|
10
|
-
**npm
|
|
10
|
+
**Dependencies:** repos with `package-lock.json` use **`npm ci`** (does not modify the lockfile, so no spurious git changes). Repos without a lockfile use **`npm install --no-package-lock`** so onboarding does not create a new `package-lock.json`. Yarn / pnpm repos use frozen lock installs when `yarn` / `pnpm` is on PATH. Unless `KOMPLIAN_NPM_AUDIT=1`, npm runs with `--no-audit --no-fund`.
|
|
11
11
|
|
|
12
12
|
**Maintainers:** publish from **`scripts/`** (folder with `package.json`), not the monorepo root:
|
|
13
13
|
|
package/komplian-onboard.mjs
CHANGED
|
@@ -304,29 +304,91 @@ function copyCursorPack(workspace, cursorRepoUrl) {
|
|
|
304
304
|
);
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
log(`${c.cyan}━━ npm install por repo ━━${c.reset}`);
|
|
310
|
-
if (!canRun("npm", ["--version"])) {
|
|
311
|
-
log(`${c.yellow}○${c.reset} npm no está en PATH — omito installs`);
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
307
|
+
/** Sin esto, `npm install` crea o retoca package-lock.json y git muestra cambios sin querer. */
|
|
308
|
+
function npmQuietFlags() {
|
|
314
309
|
const audit =
|
|
315
310
|
process.env.KOMPLIAN_NPM_AUDIT === "1" || process.env.KOMPLIAN_NPM_AUDIT === "true";
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
311
|
+
return audit ? [] : ["--no-audit", "--no-fund"];
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function npmInstallOneRepo(dir, name) {
|
|
315
|
+
const pkg = join(dir, "package.json");
|
|
316
|
+
if (!existsSync(pkg)) return { ok: true, skipped: true };
|
|
317
|
+
|
|
318
|
+
const yarnLock = join(dir, "yarn.lock");
|
|
319
|
+
const pnpmLock = join(dir, "pnpm-lock.yaml");
|
|
320
|
+
const npmLock = join(dir, "package-lock.json");
|
|
321
|
+
|
|
322
|
+
if (existsSync(yarnLock)) {
|
|
323
|
+
if (!canRun("yarn", ["--version"])) {
|
|
324
|
+
log(
|
|
325
|
+
`${c.yellow}○${c.reset} ${name} ${c.dim}(yarn.lock; instala yarn o ejecuta yarn install a mano)${c.reset}`
|
|
326
|
+
);
|
|
327
|
+
return { ok: true, skipped: true };
|
|
328
|
+
}
|
|
329
|
+
log(`${c.dim}→${c.reset} ${name} ${c.dim}(yarn)${c.reset}`);
|
|
330
|
+
const r = spawnSync(
|
|
331
|
+
"yarn",
|
|
332
|
+
["install", "--frozen-lockfile"],
|
|
333
|
+
spawnWin({ cwd: dir, stdio: "inherit" })
|
|
334
|
+
);
|
|
335
|
+
return { ok: r.status === 0, skipped: false };
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
if (existsSync(pnpmLock)) {
|
|
339
|
+
if (!canRun("pnpm", ["--version"])) {
|
|
340
|
+
log(
|
|
341
|
+
`${c.yellow}○${c.reset} ${name} ${c.dim}(pnpm-lock; instala pnpm o pnpm install a mano)${c.reset}`
|
|
342
|
+
);
|
|
343
|
+
return { ok: true, skipped: true };
|
|
344
|
+
}
|
|
345
|
+
log(`${c.dim}→${c.reset} ${name} ${c.dim}(pnpm)${c.reset}`);
|
|
346
|
+
const r = spawnSync(
|
|
347
|
+
"pnpm",
|
|
348
|
+
["install", "--frozen-lockfile"],
|
|
349
|
+
spawnWin({ cwd: dir, stdio: "inherit" })
|
|
350
|
+
);
|
|
351
|
+
return { ok: r.status === 0, skipped: false };
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
if (!canRun("npm", ["--version"])) {
|
|
355
|
+
log(`${c.yellow}○${c.reset} npm no está en PATH — omito ${name}`);
|
|
356
|
+
return { ok: true, skipped: true };
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const quiet = npmQuietFlags();
|
|
360
|
+
|
|
361
|
+
if (existsSync(npmLock)) {
|
|
362
|
+
log(`${c.dim}→${c.reset} ${name} ${c.dim}(npm ci — lock sin cambios)${c.reset}`);
|
|
363
|
+
const r = spawnSync("npm", ["ci", ...quiet], spawnWin({ cwd: dir, stdio: "inherit" }));
|
|
364
|
+
if (r.status === 0) return { ok: true, skipped: false };
|
|
365
|
+
log(
|
|
366
|
+
`${c.yellow}○${c.reset} ${name}: npm ci falló (¿lock desincronizado?). ${c.dim}Revisa con npm install en ese repo.${c.reset}`
|
|
367
|
+
);
|
|
368
|
+
return { ok: false, skipped: false };
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
log(`${c.dim}→${c.reset} ${name} ${c.dim}(npm install — sin crear package-lock)${c.reset}`);
|
|
372
|
+
const r = spawnSync(
|
|
373
|
+
"npm",
|
|
374
|
+
["install", ...quiet, "--no-package-lock"],
|
|
375
|
+
spawnWin({ cwd: dir, stdio: "inherit" })
|
|
376
|
+
);
|
|
377
|
+
return { ok: r.status === 0, skipped: false };
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
function npmInstallEach(workspace) {
|
|
381
|
+
log("");
|
|
382
|
+
log(`${c.cyan}━━ Dependencias por repo ━━${c.reset}`);
|
|
319
383
|
for (const ent of readdirSync(workspace)) {
|
|
320
384
|
const d = join(workspace, ent);
|
|
321
385
|
if (!statSync(d).isDirectory()) continue;
|
|
322
|
-
const
|
|
323
|
-
if (
|
|
324
|
-
|
|
325
|
-
const ir = spawnSync("npm", installArgs, spawnWin({ cwd: d, stdio: "inherit" }));
|
|
326
|
-
if (ir.status !== 0) {
|
|
327
|
-
log(`${c.yellow}○${c.reset} npm install con avisos en ${ent}`);
|
|
328
|
-
} else {
|
|
386
|
+
const { ok, skipped } = npmInstallOneRepo(d, ent);
|
|
387
|
+
if (skipped) continue;
|
|
388
|
+
if (ok) {
|
|
329
389
|
log(`${c.green}✓${c.reset} ${ent}`);
|
|
390
|
+
} else {
|
|
391
|
+
log(`${c.yellow}○${c.reset} ${ent}`);
|
|
330
392
|
}
|
|
331
393
|
}
|
|
332
394
|
}
|
|
@@ -521,7 +583,7 @@ async function main() {
|
|
|
521
583
|
}
|
|
522
584
|
log(`${c.green}✓${c.reset} Cursor: ${c.bold}File → Open Folder → ${abs}${c.reset}`);
|
|
523
585
|
log(
|
|
524
|
-
`${c.dim}
|
|
586
|
+
`${c.dim} Con package-lock.json: npm ci (no retoca el lock). Sin lock: npm install --no-package-lock. yarn/pnpm: lock congelado. KOMPLIAN_NPM_AUDIT=1 activa auditoría en npm.${c.reset}`
|
|
525
587
|
);
|
|
526
588
|
log(`${c.dim} .env.example → .env por proyecto; secretos en 1Password — nunca commit.${c.reset}`);
|
|
527
589
|
}
|
package/package.json
CHANGED