@prettier-ai/dshp 0.1.1-rc.2
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.js +36 -0
- package/package.json +22 -0
package/bin.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process'
|
|
3
|
+
import { readFileSync } from 'node:fs'
|
|
4
|
+
import { createRequire } from 'node:module'
|
|
5
|
+
import { dirname, join } from 'node:path'
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url)
|
|
8
|
+
let dshPackageJson
|
|
9
|
+
try {
|
|
10
|
+
dshPackageJson = require.resolve('@prettier-ai/dsh/package.json')
|
|
11
|
+
} catch {
|
|
12
|
+
console.error('dshp: cannot find @prettier-ai/dsh; install the matching version of that package')
|
|
13
|
+
process.exit(1)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const manifest = JSON.parse(readFileSync(dshPackageJson, 'utf8'))
|
|
17
|
+
const bin = manifest.bin
|
|
18
|
+
const rel = typeof bin === 'string'
|
|
19
|
+
? bin
|
|
20
|
+
: (bin !== null && typeof bin === 'object' ? bin.dsh : undefined)
|
|
21
|
+
if (typeof rel !== 'string' || rel === '') {
|
|
22
|
+
console.error('dshp: @prettier-ai/dsh is missing bin.dsh')
|
|
23
|
+
process.exit(1)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const result = spawnSync(process.execPath, [join(dirname(dshPackageJson), rel), ...process.argv.slice(2)], {
|
|
27
|
+
stdio: 'inherit',
|
|
28
|
+
})
|
|
29
|
+
if (result.error !== undefined) {
|
|
30
|
+
console.error(result.error)
|
|
31
|
+
process.exit(1)
|
|
32
|
+
}
|
|
33
|
+
if (result.signal !== null) {
|
|
34
|
+
process.kill(process.pid, result.signal)
|
|
35
|
+
}
|
|
36
|
+
process.exit(result.status ?? 1)
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@prettier-ai/dshp",
|
|
3
|
+
"version": "0.1.1-rc.2",
|
|
4
|
+
"description": "Thin wrapper that installs a dshp command for the @prettier-ai/dsh CLI.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"dshp": "bin.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin.js"
|
|
12
|
+
],
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@prettier-ai/dsh": "0.1.1-rc.2"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=22.6"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
}
|
|
22
|
+
}
|