@sasjs/sas-language 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +47 -6
  2. package/package.json +30 -5
package/README.md CHANGED
@@ -21,17 +21,17 @@ something cheap to load, and keep it current with a scheduled job.
21
21
  npm install @sasjs/sas-language
22
22
  ```
23
23
 
24
- Until the package is on the registry it can be taken from git, pinned to a
25
- commit:
24
+ The registry tarball ships the compiled output, so nothing is built on install.
25
+
26
+ A git install also works, but needs lifecycle scripts enabled, because the build
27
+ output is not committed and `prepare` compiles it:
26
28
 
27
29
  ```
28
30
  npm install git+https://github.com/sasjs/sas-language.git#<commit>
29
31
  ```
30
32
 
31
- That works because `dist/` is committed, not built on install. It has to be: a
32
- consumer that sets `ignore-scripts=true` - as sasjs/server does - never runs the
33
- package's `prepare` script, so a git install would otherwise arrive with no
34
- compiled API at all.
33
+ Note that npm rewrites a github git dependency to an ssh URL in the lockfile,
34
+ which a CI without an ssh key cannot fetch, so prefer the registry.
35
35
 
36
36
  ## Use
37
37
 
@@ -116,6 +116,47 @@ not degrade somebody's editor.
116
116
  npm run build # transform into data/ and compile
117
117
  npm test # validate the data and the transforms
118
118
 
119
+ ## Repository hardening
120
+
121
+ `.npmrc` installs without running lifecycle scripts, writes exact versions, enforces the `engines` field, and keeps the lockfile honest.
122
+
123
+ `.git-hooks/` carries the org's checks: a `pre-commit` that scans the staged diff with gitleaks and refuses a commit over 2MB, and a `commit-msg` that enforces Conventional Commits. `npm run prepare` wires them up, but `.npmrc` sets `ignore-scripts=true`, which suppresses it - so after a fresh clone:
124
+
125
+ ```
126
+ git config core.hooksPath ./.git-hooks
127
+ ```
128
+
129
+ A hook is best-effort, so CI enforces the same things from the other side: a full-history `gitleaks detect`, `npm audit --omit=dev --audit-level=low` for the shipped surface, and `npm run audit` for everything else, dev dependencies included. That last one fails on any advisory outside two documented exemptions - see `scripts/audit.mjs` - so a new advisory anywhere else cannot land quietly.
130
+
131
+ ## Releasing
132
+
133
+ `.github/workflows/publish.yml` publishes on every push to `main`.
134
+
135
+ Versioning is semantic-release's job: it reads the conventional commits since the
136
+ last tag, bumps the version, tags the release and writes the release notes.
137
+ Publishing is a separate step, and it uses the npm trusted publisher, so no token
138
+ is stored anywhere.
139
+
140
+ Setup, once: on npmjs.com, add a trusted publisher for `@sasjs/sas-language` -
141
+ repository `sasjs/sas-language`, workflow `publish.yml`, environment blank.
142
+
143
+ semantic-release is configured **not** to push to `main`: `@semantic-release/git`
144
+ is deliberately absent, so the version commit is never made and nothing needs to
145
+ bypass branch protection. The release notes and the semantic versioning are
146
+ unaffected - `@semantic-release/github` still publishes the grouped notes as the
147
+ release body, and `@semantic-release/commit-analyzer` still maps `fix:` to a
148
+ patch, `feat:` to a minor and a breaking change to a major. The one consequence
149
+ is that `package.json` on `main` keeps the last committed version rather than the
150
+ released one.
151
+
152
+ Which commits cut a release follows the usual convention: `fix:` and `feat:` on
153
+ `main` do, `chore:` and `ci:` do not. The refresh workflow opens a pull request,
154
+ so merging it with a `fix:` or `feat:` subject is what cuts the next release.
155
+
156
+ The publish step asks the registry first, so a push that produces no release
157
+ reports that the version is already published and stays green, rather than
158
+ failing with E403.
159
+
119
160
  ## Licence
120
161
 
121
162
  The package is MIT. The data is derived from the SAS extension for Visual Studio
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sasjs/sas-language",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "SAS language data for editors: completions, hover documentation and signatures, resolved from the SAS extension for VS Code",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,6 +25,26 @@
25
25
  "README.md"
26
26
  ],
27
27
  "sideEffects": false,
28
+ "overrides": {
29
+ "ip-address": "^10.5.1",
30
+ "undici": "^6.28.1"
31
+ },
32
+ "release": {
33
+ "branches": [
34
+ "main"
35
+ ],
36
+ "plugins": [
37
+ "@semantic-release/commit-analyzer",
38
+ "@semantic-release/release-notes-generator",
39
+ [
40
+ "@semantic-release/exec",
41
+ {
42
+ "prepareCmd": "npm version ${nextRelease.version} --no-git-tag-version"
43
+ }
44
+ ],
45
+ "@semantic-release/github"
46
+ ]
47
+ },
28
48
  "publishConfig": {
29
49
  "access": "public"
30
50
  },
@@ -38,14 +58,19 @@
38
58
  "build:ts": "tsc -p ./tsconfig.json",
39
59
  "build": "npm run build:data && npm run build:ts",
40
60
  "refresh": "npm run fetch && npm run build:data",
41
- "prepare": "npm run build:ts",
42
- "test": "node --test ./test/*.test.mjs",
61
+ "audit": "node ./scripts/audit.mjs",
62
+ "prepare": "npm run build:ts && (git rev-parse --git-dir >/dev/null 2>&1 && git config core.hooksPath ./.git-hooks || true)",
63
+ "prepack": "npm run build:ts",
64
+ "test": "npm run build:ts && node --test ./test/*.test.mjs",
43
65
  "lint": "prettier --check .",
44
66
  "lint:fix": "prettier --write ."
45
67
  },
46
68
  "devDependencies": {
47
- "prettier": "^3.9.0",
48
- "typescript": "^5.6.0"
69
+ "@nogoo9/gitleaks": "8.30.1-post.2",
70
+ "@semantic-release/exec": "7.1.0",
71
+ "prettier": "3.9.9",
72
+ "semantic-release": "25.0.9",
73
+ "typescript": "5.9.3"
49
74
  },
50
75
  "engines": {
51
76
  "node": ">=20"