create-node-lib 2.17.0 → 2.17.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [2.17.2](https://github.com/lirantal/create-node-lib/compare/v2.17.1...v2.17.2) (2026-05-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add Snyk CLI installation to post-create script ([5a40220](https://github.com/lirantal/create-node-lib/commit/5a40220e07daad422eac8a0666eb28602caa1043))
7
+
8
+ ## [2.17.1](https://github.com/lirantal/create-node-lib/compare/v2.17.0...v2.17.1) (2026-05-03)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * add initialization script for development environment ([40cfb83](https://github.com/lirantal/create-node-lib/commit/40cfb8357638c5d78f88359663f7a785118ad7d9))
14
+
1
15
  # [2.17.0](https://github.com/lirantal/create-node-lib/compare/v2.16.7...v2.17.0) (2026-05-03)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-node-lib",
3
- "version": "2.17.0",
3
+ "version": "2.17.2",
4
4
  "description": "Scaffolding out a Node.js library module",
5
5
  "bin": "./bin/cli.js",
6
6
  "engines": {
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env bash
2
+ # initialize: runs on host before container create/start (initializeCommand).
3
+ # Prepares .env.development and, when possible, injects OP_SERVICE_ACCOUNT_TOKEN from 1Password.
4
+
5
+ set -euo pipefail
6
+
7
+ WORKSPACE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
8
+ ENV_FILE="${WORKSPACE_DIR}/.env.development"
9
+ OP_TOKEN_REFERENCE="op://Private/1Password op CLI Service Account for DevContainers/password"
10
+
11
+ main() {
12
+ ensure_env_file_exists
13
+ maybe_inject_1password_service_account_token
14
+ }
15
+
16
+ ensure_env_file_exists() {
17
+ if [[ ! -f "${ENV_FILE}" ]]; then
18
+ : > "${ENV_FILE}"
19
+ fi
20
+ }
21
+
22
+ maybe_inject_1password_service_account_token() {
23
+ local token
24
+
25
+ if ! command -v op >/dev/null 2>&1; then
26
+ echo "initialize.sh: op CLI not found; leaving ${ENV_FILE} unchanged."
27
+ return 0
28
+ fi
29
+
30
+ if ! token="$(op read "${OP_TOKEN_REFERENCE}" 2>/dev/null)"; then
31
+ echo "initialize.sh: could not read OP service token from 1Password; leaving ${ENV_FILE} unchanged."
32
+ return 0
33
+ fi
34
+
35
+ if [[ -z "${token}" ]]; then
36
+ echo "initialize.sh: OP service token is empty; leaving ${ENV_FILE} unchanged."
37
+ return 0
38
+ fi
39
+
40
+ upsert_env_var "OP_SERVICE_ACCOUNT_TOKEN" "${token}"
41
+ }
42
+
43
+ upsert_env_var() {
44
+ local key="$1"
45
+ local value="$2"
46
+ local tmp_file
47
+
48
+ tmp_file="$(mktemp)"
49
+ awk -F= -v k="${key}" '$1 != k' "${ENV_FILE}" > "${tmp_file}"
50
+ printf '%s=%s\n' "${key}" "${value}" >> "${tmp_file}"
51
+ mv "${tmp_file}" "${ENV_FILE}"
52
+ }
53
+
54
+ main "$@"
@@ -8,6 +8,7 @@ main() {
8
8
  install_apm
9
9
  # install_opencode_cli
10
10
  install_1password_cli
11
+ install_snyk_cli
11
12
  run_deps_install
12
13
  }
13
14
 
@@ -28,9 +29,21 @@ install_opencode_cli() {
28
29
  curl -fsSL https://opencode.ai/install | bash
29
30
  }
30
31
 
31
- # Optional: Snyk CLI
32
- # curl --compressed https://static.snyk.io/cli/latest/snyk-linux-arm64 -o snyk
33
- # chmod +x ./snyk && sudo mv -f ./snyk /usr/local/bin/snyk
32
+ install_snyk_cli() {
33
+ # https://docs.snyk.io/snyk-cli/install-the-snyk-cli
34
+ local url
35
+ case "$(uname -m)" in
36
+ aarch64 | arm64) url="https://static.snyk.io/cli/latest/snyk-linux-arm64" ;;
37
+ x86_64 | amd64) url="https://static.snyk.io/cli/latest/snyk-linux" ;;
38
+ *)
39
+ echo "post-create: skipping Snyk CLI (unsupported arch: $(uname -m))" >&2
40
+ return 0
41
+ ;;
42
+ esac
43
+ curl --compressed -fsSL "${url}" -o /tmp/snyk
44
+ chmod +x /tmp/snyk
45
+ sudo mv -f /tmp/snyk /usr/local/bin/snyk
46
+ }
34
47
 
35
48
  install_1password_cli() {
36
49
  local op_version="2.32.1"