@skilldeck/migrate 0.1.0 → 1.0.0

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "migrate",
3
- "version": "0.1.0",
3
+ "version": "1.0.0",
4
4
  "description": "Guardrailed workflows for risky changes: zero-downtime database migrations with a DDL lock linter, dependency and framework upgrades with a lockfile report, and API contract diffs that flag breaking changes. Zero-dependency Node.js.",
5
5
  "author": {
6
6
  "name": "SkillDeck"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skilldeck/migrate",
3
- "version": "0.1.0",
3
+ "version": "1.0.0",
4
4
  "description": "Change things without breaking prod: zero-downtime schema migrations, dependency upgrades and API contract diffs, each backed by a zero-dependency checker script.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,7 +19,7 @@
19
19
  "LICENSE"
20
20
  ],
21
21
  "dependencies": {
22
- "@skilldeck/core": "^0.1.0"
22
+ "@skilldeck/core": "^1.0.0"
23
23
  },
24
24
  "engines": {
25
25
  "node": ">=20"
@@ -11,11 +11,12 @@
11
11
  // Exit 0 when nothing breaks, 1 on breaking changes, 2 on bad usage.
12
12
  // Zero dependencies. Node 20+.
13
13
 
14
+ import { realpathSync } from 'node:fs'
15
+ import { fileURLToPath } from 'node:url'
14
16
  import fs from 'node:fs'
15
17
  import os from 'node:os'
16
18
  import path from 'node:path'
17
19
  import { spawnSync } from 'node:child_process'
18
- import { pathToFileURL } from 'node:url'
19
20
 
20
21
  const HELP = `contract-diff: breaking-change check for API contracts
21
22
 
@@ -459,6 +460,13 @@ function main(argv) {
459
460
  return counts.breaking ? 1 : 0
460
461
  }
461
462
 
462
- if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) {
463
+ // Run only when this file is the entry point. Real paths are compared because
464
+ // the path Node was given can be a symlink (macOS /tmp and /var, a linked
465
+ // skills folder), and then it never equals the module's own URL.
466
+ function isEntryPoint(url) {
467
+ try { return Boolean(process.argv[1]) && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(url)) } catch { return false }
468
+ }
469
+
470
+ if (isEntryPoint(import.meta.url)) {
463
471
  process.exitCode = main(process.argv.slice(2))
464
472
  }
@@ -9,10 +9,11 @@
9
9
  //
10
10
  // Zero dependencies. Node 20+. Needs git for `diff`, and npm or pnpm for `outdated`.
11
11
 
12
+ import { realpathSync } from 'node:fs'
13
+ import { fileURLToPath } from 'node:url'
12
14
  import fs from 'node:fs'
13
15
  import path from 'node:path'
14
16
  import { spawnSync } from 'node:child_process'
15
- import { pathToFileURL } from 'node:url'
16
17
 
17
18
  const HELP = `upgrade-report: groundwork for dependency upgrades
18
19
 
@@ -330,6 +331,13 @@ function main(argv) {
330
331
  }
331
332
  }
332
333
 
333
- if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) {
334
+ // Run only when this file is the entry point. Real paths are compared because
335
+ // the path Node was given can be a symlink (macOS /tmp and /var, a linked
336
+ // skills folder), and then it never equals the module's own URL.
337
+ function isEntryPoint(url) {
338
+ try { return Boolean(process.argv[1]) && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(url)) } catch { return false }
339
+ }
340
+
341
+ if (isEntryPoint(import.meta.url)) {
334
342
  process.exitCode = main(process.argv.slice(2))
335
343
  }
@@ -8,9 +8,10 @@
8
8
  // Exit 0 when clean or warnings only, 1 when any error-level finding, 2 on bad usage.
9
9
  // Zero dependencies. Node 20+.
10
10
 
11
+ import { realpathSync } from 'node:fs'
12
+ import { fileURLToPath } from 'node:url'
11
13
  import fs from 'node:fs'
12
14
  import path from 'node:path'
13
- import { pathToFileURL } from 'node:url'
14
15
 
15
16
  const HELP = `lint-ddl: zero-downtime checks for SQL migrations
16
17
 
@@ -351,6 +352,13 @@ function main(argv) {
351
352
  return errors ? 1 : 0
352
353
  }
353
354
 
354
- if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) {
355
+ // Run only when this file is the entry point. Real paths are compared because
356
+ // the path Node was given can be a symlink (macOS /tmp and /var, a linked
357
+ // skills folder), and then it never equals the module's own URL.
358
+ function isEntryPoint(url) {
359
+ try { return Boolean(process.argv[1]) && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(url)) } catch { return false }
360
+ }
361
+
362
+ if (isEntryPoint(import.meta.url)) {
355
363
  process.exitCode = main(process.argv.slice(2))
356
364
  }