@sasjs/lint 4.1.1 → 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.
- package/.github/workflows/publish.yml +20 -1
- package/checkNodeVersion.js +16 -2
- package/package.json +4 -5
|
@@ -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:
|
|
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"
|
package/checkNodeVersion.js
CHANGED
|
@@ -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 (
|
|
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 >=
|
|
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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sasjs/lint",
|
|
3
3
|
"description": "Linting and formatting for SAS code",
|
|
4
4
|
"engines": {
|
|
5
|
-
"node": ">=
|
|
5
|
+
"node": "^14.18.0 || >=16.10.0"
|
|
6
6
|
},
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "jest --coverage",
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"publishInit": "cp -r ./build/* . && rm -rf ./build && rm -rf ./src && rm tsconfig.json",
|
|
13
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",
|
|
14
14
|
"lint:fix": "npx prettier --write \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
|
|
15
|
-
"lint": "npx prettier --check \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\""
|
|
16
|
-
"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}\""
|
|
17
16
|
},
|
|
18
17
|
"publishConfig": {
|
|
19
18
|
"access": "public"
|
|
@@ -71,8 +70,8 @@
|
|
|
71
70
|
"typescript": "6.0.3"
|
|
72
71
|
},
|
|
73
72
|
"dependencies": {
|
|
74
|
-
"@sasjs/utils": "3.6.
|
|
73
|
+
"@sasjs/utils": "3.6.4",
|
|
75
74
|
"ignore": "7.0.11"
|
|
76
75
|
},
|
|
77
|
-
"version": "4.1.
|
|
76
|
+
"version": "4.1.2"
|
|
78
77
|
}
|