esm.dev 1.5.3 → 1.6.0
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/README.md +13 -38
- package/dist/cli.js +2 -0
- package/dist/commands/InitCommand.js +1 -0
- package/dist/commands/VersionCommand.js +12 -0
- package/package.json +7 -6
- package/src/cli.ts +2 -0
- package/src/commands/InitCommand.ts +4 -0
- package/src/commands/VersionCommand.ts +17 -0
- package/templates/init/docker-compose.yml.mustache +1 -1
package/README.md
CHANGED
|
@@ -6,48 +6,23 @@ It expects you to have a local version of ESM.sh and verdaccio running. It will
|
|
|
6
6
|
|
|
7
7
|
## Usage
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### Prerequisites
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- You have [docker](https://www.docker.com/) installed
|
|
12
|
+
- You have [docker compose](https://docs.docker.com/compose/) installed
|
|
13
|
+
- You have a JavaScript runtime installed ([Node.js](https://nodejs.org/), [Deno](https://deno.com/), [Bun](https://bun.sh/) etc)
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
services:
|
|
15
|
-
esm.dev:
|
|
16
|
-
image: ghcr.io/johngeorgewright/esm.dev:latest
|
|
17
|
-
depends_on:
|
|
18
|
-
- esm.sh
|
|
19
|
-
- npm
|
|
20
|
-
environment:
|
|
21
|
-
- NPM_REGISTRY=http://npm:4873
|
|
22
|
-
- ESM_ORIGIN=http://esm.sh:8080
|
|
23
|
-
- ESM_STORAGE_PATH=/esmd
|
|
24
|
-
- PORT=3000
|
|
25
|
-
command:
|
|
26
|
-
- start
|
|
27
|
-
- /watch/*
|
|
28
|
-
ports:
|
|
29
|
-
- '3000:3000'
|
|
30
|
-
volumes:
|
|
31
|
-
- ./docker-storage/esm/esmd:/esmd
|
|
32
|
-
# The following are paths to all the packages you wish to auto publish
|
|
33
|
-
- ./packages/package-1:/watch/package-1:ro
|
|
34
|
-
- ./packages/package-2:/watch/package-2:ro
|
|
15
|
+
### Installation
|
|
35
16
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
ports:
|
|
43
|
-
- '8080:8080'
|
|
44
|
-
volumes:
|
|
45
|
-
- ./docker-storage/esm/esmd:/esmd
|
|
17
|
+
```bash
|
|
18
|
+
# Node.js
|
|
19
|
+
npx esm.dev init ./packages/my-local-package-1 ./packages/my-local-package-2 ...
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This will create a docker-compose file in your cwd. Now run it:
|
|
46
23
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
ports:
|
|
50
|
-
- '4873:4873'
|
|
24
|
+
```bash
|
|
25
|
+
docker compose up
|
|
51
26
|
```
|
|
52
27
|
|
|
53
28
|
Once the above is running point your ESM modules to `localhost:3000`:
|
package/dist/cli.js
CHANGED
|
@@ -7,12 +7,14 @@ import { TokenCommand } from './commands/TokenCommand.js';
|
|
|
7
7
|
import { WaitForRegistryCommand } from './commands/WaitForRegistryCommand.js';
|
|
8
8
|
import { StartCommand } from './commands/StartCommand.js';
|
|
9
9
|
import { InitCommand } from './commands/InitCommand.js';
|
|
10
|
+
import { VersionCommand } from './commands/VersionCommand.js';
|
|
10
11
|
runExit([
|
|
11
12
|
InitCommand,
|
|
12
13
|
LoginCommand,
|
|
13
14
|
TokenCommand,
|
|
14
15
|
RepublishCommand,
|
|
15
16
|
StartCommand,
|
|
17
|
+
VersionCommand,
|
|
16
18
|
WaitForRegistryCommand,
|
|
17
19
|
WatchCommand,
|
|
18
20
|
]);
|
|
@@ -35,6 +35,7 @@ export class InitCommand extends PackagePathSpecific(MustacheGeneratorCommand) {
|
|
|
35
35
|
path: packagePath,
|
|
36
36
|
basename: path.basename(packagePath),
|
|
37
37
|
}));
|
|
38
|
+
await this.removeDestinationFile('docker-compose.yaml', 'docker-compose.yml.mustache');
|
|
38
39
|
await super.execute();
|
|
39
40
|
}
|
|
40
41
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from 'clipanion';
|
|
2
|
+
export class VersionCommand extends Command {
|
|
3
|
+
static paths = [['version']];
|
|
4
|
+
static usage = Command.Usage({
|
|
5
|
+
description: 'Display the version of esm.dev',
|
|
6
|
+
});
|
|
7
|
+
async execute() {
|
|
8
|
+
const path = await import('node:path');
|
|
9
|
+
const pckg = await Bun.file(path.resolve(import.meta.dirname, '..', '..', 'package.json')).json();
|
|
10
|
+
this.context.stdout.write(`${pckg.version}\n`);
|
|
11
|
+
}
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "esm.dev",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "TypeScript library template",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"esm.dev": "./dist/cli.js"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "tsc",
|
|
14
|
+
"build": "bun run clean && tsc",
|
|
15
|
+
"clean": "rimraf dist",
|
|
15
16
|
"esm.dev": "bun ./src/cli.ts",
|
|
16
17
|
"prepare": "husky",
|
|
17
18
|
"start": "docker compose up --detach --remove-orphans",
|
|
@@ -41,7 +42,7 @@
|
|
|
41
42
|
"lint-staged": "16.0.0",
|
|
42
43
|
"prettier": "3.5.3",
|
|
43
44
|
"rimraf": "6.0.1",
|
|
44
|
-
"semantic-release": "^24.2.
|
|
45
|
+
"semantic-release": "^24.2.4",
|
|
45
46
|
"typescript": "5.8.3"
|
|
46
47
|
},
|
|
47
48
|
"lint-staged": {
|
|
@@ -51,16 +52,16 @@
|
|
|
51
52
|
},
|
|
52
53
|
"dependencies": {
|
|
53
54
|
"clipanion": "^4.0.0-rc.4",
|
|
54
|
-
"clipanion-generator-command": "^1.
|
|
55
|
+
"clipanion-generator-command": "^1.3.0",
|
|
55
56
|
"escape-string-regexp": "^5.0.0",
|
|
56
57
|
"glob": "^11.0.2",
|
|
57
58
|
"http-proxy": "^1.18.1",
|
|
58
59
|
"lodash.debounce": "^4.0.8",
|
|
59
60
|
"mustache": "^4.2.0",
|
|
60
|
-
"npm": "^11.
|
|
61
|
+
"npm": "^11.4.0",
|
|
61
62
|
"ramda": "^0.30.1",
|
|
62
63
|
"throat": "^6.0.2",
|
|
63
64
|
"tslib": "^2.8.1",
|
|
64
|
-
"zod": "^3.
|
|
65
|
+
"zod": "^3.25.13"
|
|
65
66
|
}
|
|
66
67
|
}
|
package/src/cli.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { TokenCommand } from './commands/TokenCommand.js'
|
|
|
7
7
|
import { WaitForRegistryCommand } from './commands/WaitForRegistryCommand.js'
|
|
8
8
|
import { StartCommand } from './commands/StartCommand.js'
|
|
9
9
|
import { InitCommand } from './commands/InitCommand.js'
|
|
10
|
+
import { VersionCommand } from './commands/VersionCommand.js'
|
|
10
11
|
|
|
11
12
|
runExit([
|
|
12
13
|
InitCommand,
|
|
@@ -14,6 +15,7 @@ runExit([
|
|
|
14
15
|
TokenCommand,
|
|
15
16
|
RepublishCommand,
|
|
16
17
|
StartCommand,
|
|
18
|
+
VersionCommand,
|
|
17
19
|
WaitForRegistryCommand,
|
|
18
20
|
WatchCommand,
|
|
19
21
|
])
|
|
@@ -58,6 +58,10 @@ export class InitCommand extends PackagePathSpecific(MustacheGeneratorCommand) {
|
|
|
58
58
|
path: packagePath,
|
|
59
59
|
basename: path.basename(packagePath),
|
|
60
60
|
}))
|
|
61
|
+
await this.removeDestinationFile(
|
|
62
|
+
'docker-compose.yaml',
|
|
63
|
+
'docker-compose.yml.mustache',
|
|
64
|
+
)
|
|
61
65
|
await super.execute()
|
|
62
66
|
}
|
|
63
67
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from 'clipanion'
|
|
2
|
+
|
|
3
|
+
export class VersionCommand extends Command {
|
|
4
|
+
static override paths = [['version']]
|
|
5
|
+
|
|
6
|
+
static override usage = Command.Usage({
|
|
7
|
+
description: 'Display the version of esm.dev',
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
override async execute(): Promise<number | void> {
|
|
11
|
+
const path = await import('node:path')
|
|
12
|
+
const pckg = await Bun.file(
|
|
13
|
+
path.resolve(import.meta.dirname, '..', '..', 'package.json'),
|
|
14
|
+
).json()
|
|
15
|
+
this.context.stdout.write(`${pckg.version}\n`)
|
|
16
|
+
}
|
|
17
|
+
}
|