create-node-lib 2.13.3 → 2.14.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/CHANGELOG.md +15 -0
- package/__tests__/generator.test.js +7 -0
- package/package.json +1 -1
- package/saofile.js +2 -1
- package/template/.devcontainer/README.md +56 -0
- package/template/.devcontainer/devcontainer.json +11 -5
- package/template/.devcontainer/post-create.sh +3 -0
- package/template/.devcontainer/start.sh +10 -0
- package/template/apm.yml +9 -0
- package/template/npmrc +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# [2.14.0](https://github.com/lirantal/create-node-lib/compare/v2.13.4...v2.14.0) (2026-03-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add apm manifest ([583ed58](https://github.com/lirantal/create-node-lib/commit/583ed58987e0c4644477fed879d8b55f543be69b))
|
|
7
|
+
|
|
8
|
+
## [2.13.4](https://github.com/lirantal/create-node-lib/compare/v2.13.3...v2.13.4) (2026-03-26)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* include template npmrc in npm package like gitignore ([2614557](https://github.com/lirantal/create-node-lib/commit/2614557c961c7414920ce94f20d2388aba075b97))
|
|
14
|
+
* more featuredful devcontainer setup ([2645559](https://github.com/lirantal/create-node-lib/commit/26455598878ba76d6420bcbead552465a13f6179))
|
|
15
|
+
|
|
1
16
|
## [2.13.3](https://github.com/lirantal/create-node-lib/compare/v2.13.2...v2.13.3) (2026-03-26)
|
|
2
17
|
|
|
3
18
|
|
|
@@ -26,6 +26,7 @@ describe('all the template files are accountable for', () => {
|
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
expect(stream.fileList).toContain('.gitignore')
|
|
29
|
+
expect(stream.fileList).toContain('.npmrc')
|
|
29
30
|
expect(stream.fileList).toContain('.prettierignore')
|
|
30
31
|
expect(stream.fileList).toContain('.prettierrc.json')
|
|
31
32
|
expect(stream.fileList).toContain('.github/workflows/ci.yml')
|
|
@@ -33,6 +34,7 @@ describe('all the template files are accountable for', () => {
|
|
|
33
34
|
expect(stream.fileList).toContain('README.md')
|
|
34
35
|
expect(stream.fileList).toContain('__tests__/app.test.ts')
|
|
35
36
|
expect(stream.fileList).toContain('package.json')
|
|
37
|
+
expect(stream.fileList).toContain('apm.yml')
|
|
36
38
|
})
|
|
37
39
|
|
|
38
40
|
test('Generator input creates a valid package.json file', async () => {
|
|
@@ -62,6 +64,11 @@ describe('all the template files are accountable for', () => {
|
|
|
62
64
|
)
|
|
63
65
|
|
|
64
66
|
const pkg = JSON.parse(await stream.readFile('package.json'))
|
|
67
|
+
const apmYaml = await stream.readFile('apm.yml')
|
|
68
|
+
expect(apmYaml).toContain(`name: "${mockProjectName}"`)
|
|
69
|
+
expect(apmYaml).toContain(`description: "${mockProjectDescription}"`)
|
|
70
|
+
expect(apmYaml).toContain(`author: "${mockProjectAuthor}"`)
|
|
71
|
+
|
|
65
72
|
expect(pkg.name).toBe(mockProjectName)
|
|
66
73
|
expect(pkg.description).toBe(mockProjectDescription)
|
|
67
74
|
expect(pkg.author.name).toBe(mockProjectAuthor)
|
package/package.json
CHANGED
package/saofile.js
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Dev container
|
|
2
|
+
|
|
3
|
+
Run this project in a **consistent Node.js 24 + TypeScript** environment without installing toolchains on your machine. Dependencies install automatically; your repo is the workspace inside the container.
|
|
4
|
+
|
|
5
|
+
## Why use it?
|
|
6
|
+
|
|
7
|
+
- **Same stack for everyone** — Node 24, pnpm, and tooling match CI and collaborators.
|
|
8
|
+
- **Fast onboarding** — Open the folder in a container; `pnpm install` and local git tweaks run once after create.
|
|
9
|
+
- **Host secrets, container dev** — `ANTHROPIC_API_KEY` and `SNYK_TOKEN` are passed from your Mac/Linux session into the container when set locally (see below).
|
|
10
|
+
- **Optional CLI workflow** — Use `start.sh` if you prefer a terminal-driven container instead of only the editor.
|
|
11
|
+
|
|
12
|
+
## What’s here
|
|
13
|
+
|
|
14
|
+
| File | Role |
|
|
15
|
+
|------|------|
|
|
16
|
+
| `devcontainer.json` | Image, mounts (e.g. your `~/.gitconfig`), lifecycle commands, env forwarding. |
|
|
17
|
+
| `post-create.sh` | Runs once after the container is created — e.g. installs [APM](https://github.com/microsoft/apm) (Agent Package Manager) for agent-related tooling. |
|
|
18
|
+
| `start.sh` | Brings the dev container up with the Dev Containers CLI, then opens a shell **inside** the container. |
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Editor (recommended)
|
|
23
|
+
|
|
24
|
+
1. Install the **Dev Containers** extension (VS Code) or use Cursor’s dev container support.
|
|
25
|
+
2. **Command Palette** → *Dev Containers: Reopen in Container* (or *Rebuild Container* after config changes).
|
|
26
|
+
3. Wait for create/start; the editor attaches when ready. `pnpm run dev` runs on each start when `package.json` exists.
|
|
27
|
+
|
|
28
|
+
### Terminal only
|
|
29
|
+
|
|
30
|
+
From the **repository root** on your host:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
bash .devcontainer/start.sh
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Requires Docker running. Uses `npx @devcontainers/cli` to `up` the workspace, then `exec` into `bash`.
|
|
37
|
+
|
|
38
|
+
## Environment variables (host → container)
|
|
39
|
+
|
|
40
|
+
Set these **on your machine** before opening/rebuilding the container so they appear inside:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
export ANTHROPIC_API_KEY=sk-...
|
|
44
|
+
export SNYK_TOKEN=...
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
They are wired in `devcontainer.json` under `containerEnv` via `localEnv`.
|
|
48
|
+
|
|
49
|
+
## Optional customization
|
|
50
|
+
|
|
51
|
+
- **Agent config on the host** — Uncomment the `mounts` entries in `devcontainer.json` to bind `~/.claude`, `~/.gemini`, or `~/.codex` into the container so coding agents see your existing settings.
|
|
52
|
+
- **1Password / other CLIs** — Follow the commented blocks in `devcontainer.json` and `post-create.sh` if you need them; keep the image lean by default.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
After scaffolding, edit paths and secrets to match your team’s policies; this folder is yours to extend.
|
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"mounts": [
|
|
14
|
-
"source=${localEnv:HOME}/.gitconfig,target=/home/node/.gitconfig,type=bind,consistency=cached"
|
|
14
|
+
"source=${localEnv:HOME}/.gitconfig,target=/home/node/.gitconfig,type=bind,consistency=cached",
|
|
15
|
+
// mount host user home directories for agents:
|
|
16
|
+
// "source=${localEnv:HOME}/.claude,target=/home/node/.claude,type=bind,consistency=cached",
|
|
17
|
+
// "source=${localEnv:HOME}/.gemini,target=/home/node/.claude,type=bind,consistency=cached",
|
|
18
|
+
// "source=${localEnv:HOME}/.codex,target=/home/node/.codex,type=bind,consistency=cached"
|
|
15
19
|
],
|
|
16
20
|
// Initialize access to 1Password CLI in the container
|
|
17
21
|
// "initializeCommand": "echo OP_SERVICE_ACCOUNT_TOKEN=$(op read 'op://Private/1Password op CLI Service Account for DevContainers/password') > .env.development",
|
|
@@ -22,16 +26,18 @@
|
|
|
22
26
|
// --
|
|
23
27
|
"postCreateCommand": {
|
|
24
28
|
"git-setup": "git config --local commit.gpgsign false; git config --local core.pager \"less -R\";",
|
|
25
|
-
"pnpm-install": "pnpm install
|
|
29
|
+
"pnpm-install": "[ -f package.json ] && pnpm install || true",
|
|
26
30
|
"post-create": "bash .devcontainer/post-create.sh"
|
|
27
31
|
},
|
|
28
32
|
"postStartCommand": {
|
|
29
|
-
// "rm-env-file": "rm -f ./.env.development",
|
|
30
|
-
"start-dev": "pnpm run dev"
|
|
33
|
+
// "rm-env-file": "if [ -n './.env.development' ]; then rm -f './.env.development'; fi;",
|
|
34
|
+
"start-dev": "[ -f package.json ] && pnpm run dev || true"
|
|
31
35
|
},
|
|
32
36
|
"remoteUser": "node",
|
|
33
37
|
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
|
34
38
|
"containerEnv": {
|
|
35
|
-
"NODE_ENV": "development"
|
|
39
|
+
"NODE_ENV": "development",
|
|
40
|
+
"ANTHROPIC_API_KEY": "${localEnv:ANTHROPIC_API_KEY}",
|
|
41
|
+
"SNYK_TOKEN": "${localEnv:SNYK_TOKEN}"
|
|
36
42
|
}
|
|
37
43
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
WORKSPACE_FOLDER="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
|
|
6
|
+
echo "Starting devcontainer for: $WORKSPACE_FOLDER"
|
|
7
|
+
npx --yes @devcontainers/cli@0.84.1 up --workspace-folder "$WORKSPACE_FOLDER"
|
|
8
|
+
|
|
9
|
+
echo "Dropping into container shell..."
|
|
10
|
+
npx --yes @devcontainers/cli@0.84.1 exec --workspace-folder "$WORKSPACE_FOLDER" bash
|
package/template/apm.yml
ADDED
package/template/npmrc
ADDED