create-node-lib 2.15.2 → 2.15.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [2.15.3](https://github.com/lirantal/create-node-lib/compare/v2.15.2...v2.15.3) (2026-04-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * port mapping in devcontainer ([a0277a5](https://github.com/lirantal/create-node-lib/commit/a0277a59370f66e332d11231bcaab2f11eca41c9))
7
+
1
8
  ## [2.15.2](https://github.com/lirantal/create-node-lib/compare/v2.15.1...v2.15.2) (2026-04-12)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-node-lib",
3
- "version": "2.15.2",
3
+ "version": "2.15.3",
4
4
  "description": "Scaffolding out a Node.js library module",
5
5
  "bin": "./bin/cli.js",
6
6
  "engines": {
@@ -10,6 +10,15 @@
10
10
  "shellautocompletion": true
11
11
  }
12
12
  },
13
+ // forwardPorts: VS Code / Cursor Ports UI, auto-forward, portsAttributes (spec “forwarding”).
14
+ "forwardPorts": [
15
+ 5959
16
+ ],
17
+ // appPort: Docker publish (127.0.0.1:port:port) for @devcontainers/cli — e.g. .devcontainer/start.sh.
18
+ // Editors still apply appPort when they create the container; keep this list aligned with forwardPorts.
19
+ "appPort": [
20
+ 5959
21
+ ],
13
22
  "mounts": [
14
23
  "source=${localEnv:HOME}/.gitconfig,target=/home/node/.gitconfig,type=bind,consistency=cached",
15
24
  // mount host user home directories for agents:
@@ -1,10 +1,80 @@
1
- #!/bin/bash
1
+ #!/usr/bin/env bash
2
+ #
3
+ # @file start.sh
4
+ # @summary Start the Dev Container for this workspace and attach an interactive shell.
5
+ #
6
+ # Uses @devcontainers/cli to run `devcontainer up` then `devcontainer exec bash`.
7
+ # Host port publishing for this script comes from **appPort** — @devcontainers/cli maps it
8
+ # to `docker -p`. It does **not** map **forwardPorts** to Docker (editors use forwardPorts
9
+ # for Ports UI / tunneling; they still apply **appPort** when creating the container).
10
+ #
11
+ # @usage
12
+ # .devcontainer/start.sh [options]
13
+ #
14
+ # @options
15
+ # --recreate Remove the existing dev container for this workspace before `up`, so
16
+ # changes to appPort (or other create-time settings) take effect.
17
+ # --help, -h Print usage and exit.
18
+ #
19
+ # @example
20
+ # .devcontainer/start.sh
21
+ # .devcontainer/start.sh --recreate
22
+ #
23
+
2
24
  set -e
3
25
 
4
- WORKSPACE_FOLDER="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
26
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
27
+ WORKSPACE_FOLDER="$(cd "$SCRIPT_DIR/.." && pwd)"
28
+ CLI_VERSION="0.84.1"
29
+
30
+ usage() {
31
+ cat <<EOF
32
+ Usage: $(basename "$0") [options]
33
+
34
+ Start the dev container for:
35
+ $WORKSPACE_FOLDER
36
+
37
+ Then open an interactive bash session inside the container.
38
+
39
+ Options:
40
+ --recreate Remove the existing dev container for this workspace before starting,
41
+ so Docker picks up new settings (e.g. appPort / port mappings).
42
+ --help, -h Show this help and exit.
43
+
44
+ Notes:
45
+ For devcontainer up from the terminal, Docker publish uses appPort. Keep appPort and
46
+ forwardPorts lists in sync if you use both this script and VS Code / Cursor.
47
+ EOF
48
+ }
49
+
50
+ RECREATE=false
51
+ while [ $# -gt 0 ]; do
52
+ case "$1" in
53
+ --help | -h)
54
+ usage
55
+ exit 0
56
+ ;;
57
+ --recreate)
58
+ RECREATE=true
59
+ shift
60
+ ;;
61
+ *)
62
+ echo "Unknown option: $1" >&2
63
+ echo "Run with --help for usage." >&2
64
+ exit 1
65
+ ;;
66
+ esac
67
+ done
5
68
 
6
69
  echo "Starting devcontainer for: $WORKSPACE_FOLDER"
7
- npx --yes @devcontainers/cli@0.84.1 up --workspace-folder "$WORKSPACE_FOLDER"
70
+
71
+ UP_ARGS=(--workspace-folder "$WORKSPACE_FOLDER")
72
+ if [ "$RECREATE" = true ]; then
73
+ UP_ARGS+=(--remove-existing-container)
74
+ echo "Removing existing dev container so create-time settings (e.g. appPort) apply."
75
+ fi
76
+
77
+ npx --yes "@devcontainers/cli@${CLI_VERSION}" up "${UP_ARGS[@]}"
8
78
 
9
79
  echo "Dropping into container shell..."
10
- npx --yes @devcontainers/cli@0.84.1 exec --workspace-folder "$WORKSPACE_FOLDER" bash
80
+ npx --yes "@devcontainers/cli@${CLI_VERSION}" exec --workspace-folder "$WORKSPACE_FOLDER" bash