@emeryld/manager 0.2.2 → 0.2.3
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/dist/manager-cli.js +34 -0
- package/package.json +2 -2
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
5
|
+
import { createRequire } from 'node:module'
|
|
6
|
+
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
8
|
+
const __dirname = path.dirname(__filename)
|
|
9
|
+
const packageRoot = path.resolve(__dirname, '..')
|
|
10
|
+
const tsconfigPath = path.join(packageRoot, 'tsconfig.base.json')
|
|
11
|
+
const entryPoint = path.join(packageRoot, 'src', 'publish.ts')
|
|
12
|
+
|
|
13
|
+
const require = createRequire(import.meta.url)
|
|
14
|
+
const tsNodeLoader = require.resolve('ts-node/esm.mjs')
|
|
15
|
+
const registerCode = [
|
|
16
|
+
'import { register } from "node:module";',
|
|
17
|
+
'import { pathToFileURL } from "node:url";',
|
|
18
|
+
`register(${JSON.stringify(tsNodeLoader)}, pathToFileURL(${JSON.stringify(packageRoot + path.sep)}));`,
|
|
19
|
+
].join(' ')
|
|
20
|
+
const registerImport = `data:text/javascript,${encodeURIComponent(registerCode)}`
|
|
21
|
+
|
|
22
|
+
const nodeArgs = ['--import', registerImport, entryPoint, ...process.argv.slice(2)]
|
|
23
|
+
const execOptions = {
|
|
24
|
+
env: { ...process.env, TS_NODE_PROJECT: tsconfigPath },
|
|
25
|
+
stdio: 'inherit',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const child = spawnSync(process.execPath, nodeArgs, execOptions)
|
|
29
|
+
if (child.error) throw child.error
|
|
30
|
+
if (child.signal) {
|
|
31
|
+
process.kill(process.pid, child.signal)
|
|
32
|
+
} else {
|
|
33
|
+
process.exit(child.status ?? 0)
|
|
34
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emeryld/manager",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Interactive manager for pnpm monorepos (update/test/build/publish).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"swc": false
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
|
-
"build": "tsc -p tsconfig.base.json",
|
|
42
|
+
"build": "tsc -p tsconfig.base.json && node scripts/copy-manager-cli.mjs",
|
|
43
43
|
"typecheck": "tsc -p tsconfig.base.json --noEmit",
|
|
44
44
|
"test": "cross-env TS_NODE_PROJECT=tsconfig.test.json node --loader ts-node/esm test/helper-cli.test.ts"
|
|
45
45
|
}
|