@sasjs/lint 4.1.0 → 4.1.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.
@@ -79,6 +79,25 @@ jobs:
79
79
  env:
80
80
  GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} # <-- app token, not secrets.GITHUB_TOKEN
81
81
 
82
+ # semantic-release only releases when it finds a releasable commit, and the
83
+ # angular convention this repo is configured with does not treat `chore:` or
84
+ # `docs:` as one. This step ran on `if: success()` regardless, so a merge with
85
+ # no releasable commit published the version already in package.json, which
86
+ # npm rejects with "You cannot publish over the previously published
87
+ # versions". Compare against the registry instead, and publish only when
88
+ # there is something new.
82
89
  - name: Publish to npm with trusted publisher
90
+ id: publish
83
91
  if: success()
84
- run: npm publish --access public
92
+ run: |
93
+ local_version=$(node -p "require('./package.json').version")
94
+ published_version=$(npm view @sasjs/lint version 2>/dev/null || echo "")
95
+
96
+ if [ "$local_version" = "$published_version" ]; then
97
+ echo "released=false" >> "$GITHUB_OUTPUT"
98
+ echo "Nothing to publish - $local_version is already on npm"
99
+ exit 0
100
+ fi
101
+
102
+ npm publish --access public
103
+ echo "released=true" >> "$GITHUB_OUTPUT"
@@ -1,9 +1,23 @@
1
1
  const result = process.versions
2
+
3
+ // Mirrors engines.node. @sasjs/utils pulls in consola 3, which declares
4
+ // ^14.18.0 || >=16.10.0, so a major-only floor would admit versions whose own
5
+ // dependencies reject them - 14.0-14.17 and all of 15.x.
6
+ const satisfiesNode = (version) => {
7
+ const [major, minor] = version.split('.').map(Number)
8
+
9
+ if (major === 14) return minor >= 18
10
+ if (major === 15) return false
11
+ if (major === 16) return minor >= 10
12
+
13
+ return major > 16
14
+ }
15
+
2
16
  if (result && result.node) {
3
- if (parseInt(result.node) < 14) {
17
+ if (!satisfiesNode(result.node)) {
4
18
  console.log(
5
19
  '\x1b[31m%s\x1b[0m',
6
- `❌ Process failed due to Node Version,\nPlease install and use Node Version >= 14\nYour current Node Version is: ${result.node}`
20
+ `❌ Process failed due to Node Version,\nPlease install and use Node Version ^14.18.0 || >=16.10.0\nYour current Node Version is: ${result.node}`
7
21
  )
8
22
  process.exit(1)
9
23
  }
package/package.json CHANGED
@@ -1,17 +1,18 @@
1
1
  {
2
2
  "name": "@sasjs/lint",
3
3
  "description": "Linting and formatting for SAS code",
4
+ "engines": {
5
+ "node": "^14.18.0 || >=16.10.0"
6
+ },
4
7
  "scripts": {
5
8
  "test": "jest --coverage",
6
9
  "build": "rimraf build && tsc",
7
10
  "generate:macros": "node ./scripts/generate-macro-names.mjs",
8
- "preinstall": "node checkNodeVersion",
9
11
  "prebuild": "node checkNodeVersion",
10
12
  "publishInit": "cp -r ./build/* . && rm -rf ./build && rm -rf ./src && rm tsconfig.json",
11
13
  "package:lib": "npm run build && cp ./package.json ./checkNodeVersion.js build && cp README.md build && cd build && npm version \"5.0.0\" && npm pack",
12
14
  "lint:fix": "npx prettier --write \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
13
- "lint": "npx prettier --check \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
14
- "prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks || true"
15
+ "lint": "npx prettier --check \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\""
15
16
  },
16
17
  "publishConfig": {
17
18
  "access": "public"
@@ -69,8 +70,8 @@
69
70
  "typescript": "6.0.3"
70
71
  },
71
72
  "dependencies": {
72
- "@sasjs/utils": "3.6.2",
73
+ "@sasjs/utils": "3.6.4",
73
74
  "ignore": "7.0.11"
74
75
  },
75
- "version": "4.1.0"
76
+ "version": "4.1.2"
76
77
  }