@jsenv/github-release-package 1.4.0 → 1.5.0
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/package.json +8 -12
- package/src/ensureGithubReleaseForPackage.js +3 -11
- package/src/internal/readProjectPackage.js +7 -6
- package/src/main.js +1 -0
- package/main.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/github-release-package",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Create github release when package version changes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -23,23 +23,19 @@
|
|
|
23
23
|
"type": "module",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
-
"import": "./main.js"
|
|
26
|
+
"import": "./src/main.js"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
-
"main": "./main.js",
|
|
29
|
+
"main": "./src/main.js",
|
|
30
30
|
"files": [
|
|
31
|
-
"/src/"
|
|
32
|
-
"/main.js"
|
|
31
|
+
"/src/"
|
|
33
32
|
],
|
|
34
33
|
"scripts": {
|
|
35
|
-
"
|
|
36
|
-
"test": "node ./script/test/test.mjs",
|
|
37
|
-
"test-with-coverage": "npm run test -- --coverage",
|
|
38
|
-
"prettier": "prettier --write ."
|
|
34
|
+
"test": "node ./scripts/test.mjs"
|
|
39
35
|
},
|
|
40
36
|
"dependencies": {
|
|
41
|
-
"@jsenv/filesystem": "
|
|
42
|
-
"@jsenv/
|
|
43
|
-
"@jsenv/github-pull-request-impact": "1.
|
|
37
|
+
"@jsenv/filesystem": "4.1.0",
|
|
38
|
+
"@jsenv/log": "2.1.0",
|
|
39
|
+
"@jsenv/github-pull-request-impact": "1.7.0"
|
|
44
40
|
}
|
|
45
41
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assertAndNormalizeDirectoryUrl } from "@jsenv/filesystem"
|
|
2
|
-
import { createLogger } from "@jsenv/
|
|
2
|
+
import { createLogger } from "@jsenv/log"
|
|
3
3
|
import * as githubRESTAPI from "@jsenv/github-pull-request-impact/src/internal/github_rest_api.js"
|
|
4
4
|
|
|
5
5
|
import { readProjectPackage } from "./internal/readProjectPackage.js"
|
|
@@ -27,9 +27,8 @@ export const ensureGithubReleaseForPackage = async ({
|
|
|
27
27
|
} = getOptionsFromGithubAction()
|
|
28
28
|
|
|
29
29
|
logger.debug(`reading project package.json`)
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
})
|
|
30
|
+
const projectPackage = readProjectPackage({ rootDirectoryUrl })
|
|
31
|
+
const packageVersion = projectPackage.version
|
|
33
32
|
logger.debug(`${packageVersion} found in package.json`)
|
|
34
33
|
if (
|
|
35
34
|
packageVersion.includes("alpha") ||
|
|
@@ -120,10 +119,3 @@ const getOptionsFromGithubAction = () => {
|
|
|
120
119
|
githubSha,
|
|
121
120
|
}
|
|
122
121
|
}
|
|
123
|
-
|
|
124
|
-
const getOptionsFromProjectPackage = async ({ rootDirectoryUrl }) => {
|
|
125
|
-
const projectPackage = await readProjectPackage({ rootDirectoryUrl })
|
|
126
|
-
return {
|
|
127
|
-
packageVersion: projectPackage.version,
|
|
128
|
-
}
|
|
129
|
-
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fileURLToPath } from "node:url"
|
|
2
|
+
import { readFileSync } from "node:fs"
|
|
2
3
|
|
|
3
|
-
export const readProjectPackage =
|
|
4
|
-
const
|
|
4
|
+
export const readProjectPackage = ({ rootDirectoryUrl }) => {
|
|
5
|
+
const packageFileUrlObject = new URL("./package.json", rootDirectoryUrl)
|
|
5
6
|
let packageInProject
|
|
6
7
|
try {
|
|
7
|
-
const packageString =
|
|
8
|
+
const packageString = String(readFileSync(packageFileUrlObject))
|
|
8
9
|
try {
|
|
9
10
|
packageInProject = JSON.parse(packageString)
|
|
10
11
|
} catch (e) {
|
|
@@ -13,7 +14,7 @@ export const readProjectPackage = async ({ rootDirectoryUrl }) => {
|
|
|
13
14
|
--- syntax error stack ---
|
|
14
15
|
${e.stack}
|
|
15
16
|
--- package.json path ---
|
|
16
|
-
${
|
|
17
|
+
${fileURLToPath(packageFileUrlObject)}`)
|
|
17
18
|
}
|
|
18
19
|
throw e
|
|
19
20
|
}
|
|
@@ -22,7 +23,7 @@ ${urlToFileSystemPath(packageFileUrl)}`)
|
|
|
22
23
|
throw new Error(
|
|
23
24
|
`cannot find project package.json
|
|
24
25
|
--- package.json path ---
|
|
25
|
-
${
|
|
26
|
+
${fileURLToPath(packageFileUrlObject)}`,
|
|
26
27
|
)
|
|
27
28
|
}
|
|
28
29
|
throw e
|
package/src/main.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ensureGithubReleaseForPackage } from "./ensureGithubReleaseForPackage.js"
|
package/main.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ensureGithubReleaseForPackage } from "./src/ensureGithubReleaseForPackage.js"
|