@emeryld/manager 0.1.1 → 0.1.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.
@@ -8,12 +8,20 @@ const __filename = fileURLToPath(import.meta.url)
8
8
  const __dirname = path.dirname(__filename)
9
9
  const packageRoot = path.resolve(__dirname, '..')
10
10
  const tsconfigPath = path.join(packageRoot, 'tsconfig.base.json')
11
- const entryPoint = path.join(packageRoot, 'src', 'publish.ts')
11
+ const entryPoint = path.join(packageRoot, 'src', 'publish.js')
12
12
 
13
13
  const require = createRequire(import.meta.url)
14
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(
19
+ path.dirname(entryPoint),
20
+ )}));`,
21
+ ].join(' ')
22
+ const registerImport = `data:text/javascript,${encodeURIComponent(registerCode)}`
15
23
 
16
- const nodeArgs = ['--loader', tsNodeLoader, entryPoint, ...process.argv.slice(2)]
24
+ const nodeArgs = ['--import', registerImport, entryPoint, ...process.argv.slice(2)]
17
25
  const execOptions = {
18
26
  env: { ...process.env, TS_NODE_PROJECT: tsconfigPath },
19
27
  stdio: 'inherit',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emeryld/manager",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Interactive manager for pnpm monorepos (update/test/build/publish).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,6 +27,10 @@
27
27
  "ts-node": "^10.9.1",
28
28
  "typescript": "^5.3.0"
29
29
  },
30
+ "devDependencies": {
31
+ "@types/node": "^20.17.0",
32
+ "@types/semver": "^7.7.1"
33
+ },
30
34
  "ts-node": {
31
35
  "esm": true,
32
36
  "project": "tsconfig.base.json",
package/src/git.ts CHANGED
@@ -1,8 +1,8 @@
1
- // src/git.ts
1
+ // src/git.js
2
2
  import { spawn } from 'node:child_process'
3
- import { run } from './utils/run.ts'
4
- import { logGlobal, colors } from './utils/log.ts'
5
- import { rootDir } from './utils/run.ts'
3
+ import { run } from './utils/run.js'
4
+ import { logGlobal, colors } from './utils/log.js'
5
+ import { rootDir } from './utils/run.js'
6
6
 
7
7
  export async function collectGitStatus(): Promise<string[]> {
8
8
  return new Promise<string[]>((resolve, reject) => {
package/src/helper-cli.ts CHANGED
@@ -16,6 +16,18 @@ function getTsNodeLoaderPath() {
16
16
  return tsNodeLoaderPath
17
17
  }
18
18
 
19
+ function buildTsNodeRegisterImport(baseDir: string) {
20
+ const loader = getTsNodeLoaderPath()
21
+ const code = [
22
+ 'import { register } from "node:module";',
23
+ 'import { pathToFileURL } from "node:url";',
24
+ `register(${JSON.stringify(
25
+ loader,
26
+ )}, pathToFileURL(${JSON.stringify(baseDir)}));`,
27
+ ].join(' ')
28
+ return `data:text/javascript,${encodeURIComponent(code)}`
29
+ }
30
+
19
31
  const ansi = (code: number) => (text: string) => `\x1b[${code}m${text}\x1b[0m`
20
32
  const colors = {
21
33
  cyan: ansi(36),
@@ -312,10 +324,15 @@ function runEntry(entry: ResolvedScriptEntry, forwardedArgs: string[]) {
312
324
  const scriptPath = entry.absoluteScript
313
325
  const tsConfigPath = path.join(rootDir, 'tsconfig.base.json')
314
326
  const extension = path.extname(scriptPath).toLowerCase()
315
- const isTypeScript = extension === '.ts' || extension === '.mts' || extension === '.cts'
327
+ const isTypeScript = extension === '.js' || extension === '.mts' || extension === '.cts'
316
328
  const command = process.execPath
317
329
  const execArgs = isTypeScript
318
- ? ['--loader', getTsNodeLoaderPath(), scriptPath, ...forwardedArgs]
330
+ ? [
331
+ '--import',
332
+ buildTsNodeRegisterImport(path.dirname(scriptPath)),
333
+ scriptPath,
334
+ ...forwardedArgs,
335
+ ]
319
336
  : [scriptPath, ...forwardedArgs]
320
337
  return new Promise<void>((resolve, reject) => {
321
338
  const child = spawn(command, execArgs, {
package/src/menu.ts CHANGED
@@ -1,19 +1,19 @@
1
- // src/menu.ts
2
- import type { HelperScriptEntry } from './helper-cli.ts'
3
- import type { LoadedPackage } from './utils/log.ts'
4
- import { colors, globalEmoji } from './utils/log.ts'
1
+ // src/menu.js
2
+ import type { HelperScriptEntry } from './helper-cli.js'
3
+ import type { LoadedPackage } from './utils/log.js'
4
+ import { colors, globalEmoji } from './utils/log.js'
5
5
  import {
6
6
  updateDependencies,
7
7
  testAll,
8
8
  testSingle,
9
9
  buildAll,
10
10
  buildSingle,
11
- } from './workspace.ts'
11
+ } from './workspace.js'
12
12
 
13
- import { releaseMultiple, releaseSingle } from './release.ts'
14
- import { getOrderedPackages } from './packages.ts'
15
- import { runHelperCli } from './helper-cli.ts'
16
- import { ensureWorkingTreeCommitted } from './preflight.ts'
13
+ import { releaseMultiple, releaseSingle } from './release.js'
14
+ import { getOrderedPackages } from './packages.js'
15
+ import { runHelperCli } from './helper-cli.js'
16
+ import { ensureWorkingTreeCommitted } from './preflight.js'
17
17
 
18
18
  export type StepKey = 'update' | 'test' | 'build' | 'publish' | 'full' | 'back'
19
19
 
package/src/packages.ts CHANGED
@@ -1,8 +1,8 @@
1
- // src/packages.ts
1
+ // src/packages.js
2
2
  import path from 'node:path'
3
3
  import { pathToFileURL } from 'node:url'
4
4
  import { readdir, readFile } from 'node:fs/promises'
5
- import type { PackageColor, LoadedPackage } from './utils/log.ts'
5
+ import type { PackageColor, LoadedPackage } from './utils/log.js'
6
6
 
7
7
  const rootDir = process.cwd()
8
8
  export const packagesDir = path.join(rootDir, 'packages')
@@ -123,7 +123,7 @@ function mergeManifestEntries(
123
123
  const name = override.name || baseEntry.name
124
124
  const color = override.color ?? baseEntry.color ?? colorFromSeed(name)
125
125
  const substitute =
126
- override.substitute ?? baseEntry.substitute ?? deriveSubstitute(name) || name
126
+ override.substitute ?? baseEntry.substitute ?? deriveSubstitute(name) ?? name
127
127
  merged.push({ name, path: normalized, color, substitute })
128
128
  } else {
129
129
  merged.push({ ...baseEntry, path: normalized })
@@ -133,7 +133,7 @@ function mergeManifestEntries(
133
133
  normalizedOverrides.forEach((entry) => {
134
134
  const name = entry.name || path.basename(entry.path) || 'package'
135
135
  const color = entry.color ?? colorFromSeed(name)
136
- const substitute = entry.substitute ?? deriveSubstitute(name) || name
136
+ const substitute = entry.substitute ?? deriveSubstitute(name) ?? name
137
137
  merged.push({ name, path: entry.path, color, substitute })
138
138
  })
139
139
 
@@ -176,7 +176,7 @@ export async function loadPackages(): Promise<LoadedPackage[]> {
176
176
  byPath.get(relativePath.toLowerCase()) ??
177
177
  byName.get(pkgName.toLowerCase())
178
178
  const substitute =
179
- meta?.substitute ?? deriveSubstitute(pkgName) || entry.name
179
+ meta?.substitute ?? deriveSubstitute(pkgName) ?? entry.name
180
180
  const color = meta?.color ?? colorFromSeed(pkgName)
181
181
  packages.push({
182
182
  dirName: entry.name,
package/src/preflight.ts CHANGED
@@ -1,10 +1,10 @@
1
- // src/preflight.ts
2
- import { collectGitStatus } from './git.ts'
1
+ // src/preflight.js
2
+ import { collectGitStatus } from './git.js'
3
3
 
4
- import { colors, logGlobal } from './utils/log.ts'
5
- import { run } from './utils/run.ts'
6
- import { gitAdd, gitCommit } from './git.ts'
7
- import { askLine } from './prompts.ts'
4
+ import { colors, logGlobal } from './utils/log.js'
5
+ import { run } from './utils/run.js'
6
+ import { gitAdd, gitCommit } from './git.js'
7
+ import { askLine } from './prompts.js'
8
8
 
9
9
  export async function ensureWorkingTreeCommitted() {
10
10
  const changes = await collectGitStatus()
package/src/prompts.ts CHANGED
@@ -1,7 +1,7 @@
1
- // src/prompts.ts
1
+ // src/prompts.js
2
2
  import readline from 'node:readline/promises'
3
3
  import { stdin as input, stdout as output } from 'node:process'
4
- import { colors } from './utils/log.ts'
4
+ import { colors } from './utils/log.js'
5
5
 
6
6
  export type YesNoAll = 'yes' | 'no' | 'all'
7
7
 
package/src/publish.ts CHANGED
@@ -1,14 +1,14 @@
1
- // src/publish.ts
2
- import { runHelperCli } from './helper-cli.ts'
3
- import { buildPackageSelectionMenu, runStepLoop, type StepKey } from './menu.ts'
4
- import { getOrderedPackages, loadPackages, resolvePackage } from './packages.ts'
1
+ // src/publish.js
2
+ import { runHelperCli } from './helper-cli.js'
3
+ import { buildPackageSelectionMenu, runStepLoop, type StepKey } from './menu.js'
4
+ import { getOrderedPackages, loadPackages, resolvePackage } from './packages.js'
5
5
  import {
6
6
  releaseMultiple,
7
7
  releaseSingle,
8
8
  type PublishOptions,
9
- } from './release.ts'
10
- import { ensureWorkingTreeCommitted } from './preflight.ts'
11
- import { publishCliState } from './prompts.ts'
9
+ } from './release.js'
10
+ import { ensureWorkingTreeCommitted } from './preflight.js'
11
+ import { publishCliState } from './prompts.js'
12
12
 
13
13
  type Parsed = {
14
14
  selectionArg?: string
package/src/release.ts CHANGED
@@ -1,14 +1,14 @@
1
- // src/release.ts
1
+ // src/release.js
2
2
  import { readFile, writeFile } from 'node:fs/promises'
3
3
  import path from 'node:path'
4
- import { stageCommitPush } from './git.ts'
5
- import { askLine, promptSingleKey, promptYesNoAll } from './prompts.ts'
6
- import { bumpVersion, isSemver, type BumpType } from './semver.ts'
7
- import type { LoadedPackage } from './utils/log.ts'
8
- import { colors, formatPkgName, logGlobal, logPkg } from './utils/log.ts'
9
- import { run } from './utils/run.ts'
10
-
11
- // in release.ts
4
+ import { stageCommitPush } from './git.js'
5
+ import { askLine, promptSingleKey, promptYesNoAll } from './prompts.js'
6
+ import { bumpVersion, isSemver, type BumpType } from './semver.js'
7
+ import type { LoadedPackage } from './utils/log.js'
8
+ import { colors, formatPkgName, logGlobal, logPkg } from './utils/log.js'
9
+ import { run } from './utils/run.js'
10
+
11
+ // in release.js
12
12
 
13
13
  type VersionStrategy =
14
14
  | { mode: 'bump'; bumpType: BumpType; preid?: string }
package/src/semver.ts CHANGED
@@ -1,5 +1,5 @@
1
- // src/semver.ts
2
- import { inc, valid } from 'semver'
1
+ // src/semver.js
2
+ import { inc, valid, } from 'semver'
3
3
 
4
4
  export type BumpType =
5
5
  | 'patch'
@@ -1,4 +1,4 @@
1
- // src/utils/colors.ts
1
+ // src/utils/colors.js
2
2
  const ansi = (code: number) => (text: string) => `\x1b[${code}m${text}\x1b[0m`
3
3
  export const colors = {
4
4
  cyan: ansi(36),
package/src/utils/log.ts CHANGED
@@ -1,5 +1,5 @@
1
- // src/utils/log.ts
2
- import { colors } from './colors.ts'
1
+ // src/utils/log.js
2
+ import { colors } from './colors.js'
3
3
 
4
4
  export type PackageColor = 'cyan' | 'green' | 'yellow' | 'magenta' | 'red'
5
5
  export const defaultPackageColor: PackageColor = 'cyan'
package/src/utils/run.ts CHANGED
@@ -1,4 +1,4 @@
1
- // src/utils/run.ts
1
+ // src/utils/run.js
2
2
  import { spawn, type SpawnOptions } from 'node:child_process'
3
3
  import path from 'node:path'
4
4
  import { fileURLToPath } from 'node:url'
package/src/workspace.ts CHANGED
@@ -1,10 +1,11 @@
1
- // src/workspace.ts
1
+ // src/workspace.js
2
2
  import { spawnSync } from 'node:child_process'
3
- import { run, rootDir } from './utils/run.ts'
4
- import type { LoadedPackage } from './utils/log.ts'
5
- import { logGlobal, logPkg, colors } from './utils/log.ts'
6
- import { collectGitStatus, gitAdd, gitCommit } from './git.ts'
7
- import { askLine, promptSingleKey } from './prompts.ts'
3
+ import { run, rootDir } from './utils/run.js'
4
+ import type { LoadedPackage } from './utils/log.js'
5
+ import { logGlobal, logPkg, colors } from './utils/log.js'
6
+ import { collectGitStatus, gitAdd, gitCommit } from './git.js'
7
+ import { askLine, promptSingleKey } from './prompts.js'
8
+
8
9
 
9
10
  const dependencyFiles = new Set([
10
11
  'package.json',