@osdlc/command-seam 0.4.0 → 0.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 4fa373f: The npm package no longer contains `smoke.mjs`. It was a check for this
8
+ repository's CI, not part of the API.
9
+
3
10
  ## 0.4.0
4
11
 
5
12
  ### Minor Changes
package/CONTRIBUTING.md CHANGED
@@ -30,8 +30,9 @@ pnpm test
30
30
  ```
31
31
 
32
32
  Build before testing: the examples import the package by name, and under Node
33
- that name resolves to `dist/`. After a build, `pnpm run smoke` runs a short
34
- check of the built package under Node.
33
+ that name resolves to `dist/`. After a build, `pnpm run smoke` runs
34
+ `tests/smoke.mjs`, a short check of the built package under Node. It is not
35
+ published.
35
36
 
36
37
  Other checks:
37
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdlc/command-seam",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Injectable subprocess runner for Node: capture, stream and managed-process runners, hard timeouts, failures as results.",
5
5
  "license": "MIT",
6
6
  "author": "SK Sizer",
@@ -49,7 +49,6 @@
49
49
  },
50
50
  "files": [
51
51
  "dist/",
52
- "smoke.mjs",
53
52
  "index.ts",
54
53
  "sync.ts",
55
54
  "async.ts",
@@ -88,7 +87,7 @@
88
87
  "build": "tsc -p tsconfig.build.json",
89
88
  "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
90
89
  "test": "bun test",
91
- "smoke": "node smoke.mjs",
90
+ "smoke": "node tests/smoke.mjs",
92
91
  "format": "prettier --write .",
93
92
  "format:check": "prettier --check .",
94
93
  "lint": "oxlint .",
package/smoke.mjs DELETED
@@ -1,61 +0,0 @@
1
- // Runs the BUILT package under Node, which no other check does: `bun test`
2
- // resolves the `bun` export condition to the TypeScript sources, so dist/ is
3
- // compiled and never executed. A broken emit — an unrewritten `.ts` import, a
4
- // dependency with no dist/ of its own — passes every other gate and fails on
5
- // the consumer's machine.
6
- //
7
- // Deliberately not a test-runner suite: it must run from the extracted
8
- // snapshot with only `dist/` and production dependencies present.
9
-
10
- import { strict as assert } from 'node:assert'
11
- import { spawnRunner, runChecked, CommandFailed, asAsync, withDefaults } from './dist/index.js'
12
- import { fakeProcess, fakeRunner } from './dist/testing.js'
13
-
14
- const runner = spawnRunner('node')
15
- const ok = runner.run(['-e', "process.stdout.write('hi')"], { cwd: process.cwd() })
16
- assert.equal(ok.exitCode, 0)
17
- assert.equal(ok.stdout, 'hi')
18
-
19
- const bad = runner.run(['-e', "process.stderr.write('boom'); process.exit(3)"], {
20
- cwd: process.cwd(),
21
- })
22
- assert.equal(bad.exitCode, 3)
23
- assert.match(bad.stderr, /boom/)
24
-
25
- // `run` never throws; `runChecked` does.
26
- assert.throws(
27
- () => runChecked(runner, ['-e', 'process.exit(1)'], { cwd: process.cwd() }),
28
- (e) => e instanceof CommandFailed && e.argv.length === 2,
29
- )
30
-
31
- // detail joins both streams, empty ones dropped — the reason it exists is a
32
- // command that explains itself on stdout while git reports failure on stderr.
33
- const both = new CommandFailed(['x'], { exitCode: 1, stdout: 'why\n', stderr: 'what\n' })
34
- assert.equal(both.detail, 'what\nwhy')
35
- assert.equal(new CommandFailed(['x'], { exitCode: 1, stdout: 'only\n', stderr: '' }).detail, 'only')
36
-
37
- // env merges over the parent environment.
38
- const withEnv = runner.run(['-e', "process.stdout.write(process.env.SMOKE_VAR ?? '')"], {
39
- cwd: process.cwd(),
40
- env: { SMOKE_VAR: 'set' },
41
- })
42
- assert.equal(withEnv.stdout, 'set')
43
-
44
- const async = asAsync(runner)
45
- const viaAsync = await async.run(['-e', "process.stdout.write('async')"], { cwd: process.cwd() })
46
- assert.equal(viaAsync.stdout, 'async')
47
-
48
- // An invalid timeoutMs is a caller error.
49
- assert.throws(() => runner.run(['-e', ''], { cwd: process.cwd(), timeoutMs: 0 }), RangeError)
50
-
51
- const bound = withDefaults(runner, { cwd: process.cwd() })
52
- assert.equal(bound.run(['-e', "process.stdout.write('bound')"]).stdout, 'bound')
53
-
54
- // The /testing entry point, built.
55
- const fake = fakeRunner({ 'rev-parse HEAD': { stdout: 'abc\n' } })
56
- assert.equal(runChecked(fake.runner, ['rev-parse', 'HEAD'], { cwd: '/' }).stdout, 'abc\n')
57
- const proc = fakeProcess()
58
- proc.kill()
59
- assert.equal((await proc.exited).reason, 'abort')
60
-
61
- console.log('command-seam smoke: OK')