@ingram-tech/nk-dev 0.6.0 → 0.6.1

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/bin/nk.js CHANGED
@@ -20,7 +20,7 @@ Commands:
20
20
  dev Start the Next dev server (Turbopack). Boots local PGlite
21
21
  first when @ingram-tech/nk-db is installed (no Docker).
22
22
  format [--check] Format code with oxfmt. --check verifies without writing.
23
- lint Lint with oxlint.
23
+ lint [...] Lint with oxlint (extra args passed through, e.g. --fix).
24
24
  knip Find unused dependencies / exports / files with knip.
25
25
  ast-grep [...] Structural search & rewrite of TS/TSX by AST pattern
26
26
  (vendored ast-grep; args passed through). For large
@@ -50,7 +50,7 @@ switch (cmd) {
50
50
  format({ check: rest.includes("--check") });
51
51
  break;
52
52
  case "lint":
53
- lint();
53
+ lint(rest);
54
54
  break;
55
55
  case "knip":
56
56
  knip(rest);
package/lib/dev.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { spawnSync } from "node:child_process";
2
2
  import { createRequire } from "node:module";
3
- import { resolve } from "node:path";
3
+ import { dirname, resolve } from "node:path";
4
4
 
5
5
  /**
6
6
  * Whether `@ingram-tech/nk-db` is resolvable from the site — the signal that
@@ -19,6 +19,32 @@ function hasPgliteDev() {
19
19
  }
20
20
  }
21
21
 
22
+ /**
23
+ * If `@ingram-tech/nk-auth` is installed, the `nk-pglite-dev` flag that makes
24
+ * the local database apply its shipped auth-table migration chain (see
25
+ * docs/db-package.md § "The nk-auth migration chain"). Returned as
26
+ * `--dep-migrations <folder>#<table>` args, or `[]` when nk-auth is absent.
27
+ *
28
+ * This resolution lives here, not in nk-db: `nk` is the orchestrator that
29
+ * already knows both packages, so nk-db's harness stays generic and the
30
+ * dependency graph stays acyclic (nk-auth → nk-db, never the reverse).
31
+ */
32
+ function authMigrationArgs() {
33
+ try {
34
+ const require = createRequire(resolve(process.cwd(), "package.json"));
35
+ // Resolve the shipped journal via nk-auth's `./migrations/*` export (its
36
+ // `exports` deliberately does not expose `./package.json`). A successful
37
+ // resolve both locates the folder AND confirms the chain is shipped; the
38
+ // folder is the journal's grandparent (…/migrations/meta/_journal.json).
39
+ const journal =
40
+ require.resolve("@ingram-tech/nk-auth/migrations/meta/_journal.json");
41
+ const folder = dirname(dirname(journal));
42
+ return ["--dep-migrations", `${folder}#__nkauth_migrations`];
43
+ } catch {
44
+ return [];
45
+ }
46
+ }
47
+
22
48
  /**
23
49
  * `nk dev` — start the Next dev server on the golden-path local database.
24
50
  *
@@ -33,7 +59,7 @@ function hasPgliteDev() {
33
59
  */
34
60
  export function dev(extraArgs = []) {
35
61
  const command = hasPgliteDev()
36
- ? ["nk-pglite-dev", ...extraArgs]
62
+ ? ["nk-pglite-dev", ...authMigrationArgs(), ...extraArgs]
37
63
  : ["next", "dev", "--turbopack", ...extraArgs];
38
64
  if (command[0] === "nk-pglite-dev") {
39
65
  console.log("nk: @ingram-tech/nk-db found — booting local PGlite (no Docker)…");
@@ -4,9 +4,9 @@ import { FORMATTER } from "./formatter.js";
4
4
  import { hasKnipConfig, runKnip } from "./knip.js";
5
5
  import { run } from "./run.js";
6
6
 
7
- /** `nk lint` — oxlint. */
8
- export function lint() {
9
- process.exit(run(FORMATTER.lint[0], FORMATTER.lint[1]));
7
+ /** `nk lint [...]` — oxlint, with extra args passed through (e.g. `--fix`). */
8
+ export function lint(extraArgs = []) {
9
+ process.exit(run(FORMATTER.lint[0], [...FORMATTER.lint[1], ...extraArgs]));
10
10
  }
11
11
 
12
12
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ingram-tech/nk-dev",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "The nextkit dev toolchain in one package: the `nk` CLI plus shared oxlint/oxfmt, TypeScript, and Vitest config, the format-on-commit hook, and the AI agent guide. `nk init` scaffolds a site to use it.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -49,9 +49,9 @@
49
49
  "@testing-library/jest-dom": "^6.9.1",
50
50
  "@typescript/native": "npm:typescript@^7.0.2",
51
51
  "jsdom": "^29.1.1",
52
- "knip": "^6.25.0",
53
- "oxfmt": "^0.58.0",
54
- "oxlint": "^1.73.0",
52
+ "knip": "^6.27.0",
53
+ "oxfmt": "^0.59.0",
54
+ "oxlint": "^1.74.0",
55
55
  "typescript": "npm:@typescript/typescript6@^6.0.2",
56
56
  "vitest": "^4.1.10"
57
57
  },