esm.dev 1.7.1 → 1.7.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.
@@ -1,4 +1,5 @@
1
1
  import { Command } from 'clipanion';
2
+ import { readFile } from 'node:fs/promises';
2
3
  export class VersionCommand extends Command {
3
4
  static paths = [['version']];
4
5
  static usage = Command.Usage({
@@ -6,7 +7,7 @@ export class VersionCommand extends Command {
6
7
  });
7
8
  async execute() {
8
9
  const path = await import('node:path');
9
- const pckg = await Bun.file(path.resolve(import.meta.dirname, '..', '..', 'package.json')).json();
10
+ const pckg = JSON.parse(await readFile(path.resolve(import.meta.dirname, '..', '..', 'package.json'), 'utf-8'));
10
11
  this.context.stdout.write(`${pckg.version}\n`);
11
12
  }
12
13
  }
@@ -1,5 +1,7 @@
1
- import { $ } from 'bun';
1
+ import { $ } from 'zx';
2
2
  import * as path from 'node:path';
3
3
  export async function publish({ packageRoot, registry, }) {
4
- await $ `bunx npm publish --registry ${registry}`.cwd(path.resolve(packageRoot));
4
+ await $({
5
+ cwd: path.resolve(packageRoot),
6
+ }) `bunx npm publish --registry ${registry}`;
5
7
  }
@@ -1,4 +1,4 @@
1
- import { $ } from 'bun';
1
+ import { $, ProcessOutput } from 'zx';
2
2
  import { glob } from 'glob';
3
3
  import { rm } from 'node:fs/promises';
4
4
  export async function unpublish({ registry, esmStoragePath, name, }) {
@@ -12,8 +12,8 @@ async function unpublishPackage(registry, name) {
12
12
  await $ `bunx npm unpublish --registry ${registry} --force ${name}`;
13
13
  }
14
14
  catch (error) {
15
- if (!(error instanceof $.ShellError &&
16
- error.stderr.includes('npm error code E404')))
15
+ if (error instanceof ProcessOutput &&
16
+ !error.stderr.includes('npm error code E404'))
17
17
  throw error;
18
18
  }
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esm.dev",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "description": "TypeScript library template",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -62,6 +62,8 @@
62
62
  "ramda": "^0.30.1",
63
63
  "throat": "^6.0.2",
64
64
  "tslib": "^2.8.1",
65
- "zod": "^3.25.13"
65
+ "typanion": "^3.14.0",
66
+ "zod": "^3.25.13",
67
+ "zx": "^8.5.4"
66
68
  }
67
69
  }
@@ -1,4 +1,5 @@
1
1
  import { Command } from 'clipanion'
2
+ import { readFile } from 'node:fs/promises'
2
3
 
3
4
  export class VersionCommand extends Command {
4
5
  static override paths = [['version']]
@@ -9,9 +10,12 @@ export class VersionCommand extends Command {
9
10
 
10
11
  override async execute(): Promise<number | void> {
11
12
  const path = await import('node:path')
12
- const pckg = await Bun.file(
13
- path.resolve(import.meta.dirname, '..', '..', 'package.json'),
14
- ).json()
13
+ const pckg = JSON.parse(
14
+ await readFile(
15
+ path.resolve(import.meta.dirname, '..', '..', 'package.json'),
16
+ 'utf-8',
17
+ ),
18
+ )
15
19
  this.context.stdout.write(`${pckg.version}\n`)
16
20
  }
17
21
  }
@@ -1,4 +1,4 @@
1
- import { $ } from 'bun'
1
+ import { $ } from 'zx'
2
2
  import * as path from 'node:path'
3
3
 
4
4
  export async function publish({
@@ -8,7 +8,7 @@ export async function publish({
8
8
  packageRoot: string
9
9
  registry: string
10
10
  }) {
11
- await $`bunx npm publish --registry ${registry}`.cwd(
12
- path.resolve(packageRoot),
13
- )
11
+ await $({
12
+ cwd: path.resolve(packageRoot),
13
+ })`bunx npm publish --registry ${registry}`
14
14
  }
@@ -1,4 +1,4 @@
1
- import { $ } from 'bun'
1
+ import { $, ProcessOutput } from 'zx'
2
2
  import { glob } from 'glob'
3
3
  import { rm } from 'node:fs/promises'
4
4
 
@@ -22,10 +22,8 @@ async function unpublishPackage(registry: string, name: string) {
22
22
  await $`bunx npm unpublish --registry ${registry} --force ${name}`
23
23
  } catch (error) {
24
24
  if (
25
- !(
26
- error instanceof $.ShellError &&
27
- error.stderr.includes('npm error code E404')
28
- )
25
+ error instanceof ProcessOutput &&
26
+ !error.stderr.includes('npm error code E404')
29
27
  )
30
28
  throw error
31
29
  }