@firefoxic/utils 2.1.0 → 2.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/dist/index.d.ts +21 -0
- package/dist/index.js +1 -0
- package/package.json +59 -47
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/getProjectRoot.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Get the path to the project root when deploying to GitHub Pages.
|
|
4
|
+
* Your action should set `REPO_NAME` and `PR_NUMBER` environment variables at the step you need
|
|
5
|
+
* (most likely when building the project).
|
|
6
|
+
* @returns {string} The path to the project directory from the domain root if working in a GitHub CI environment. If not, returns `/`.
|
|
7
|
+
*/
|
|
8
|
+
declare function getProjectRoot(): string;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/setGitHubEnvVar.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* Sets an environment variable in the GitHub Actions environment file.
|
|
13
|
+
* @async
|
|
14
|
+
* @param {string} varName - The name of the environment variable to set.
|
|
15
|
+
* @param {string} varValue - The value of the environment variable to set.
|
|
16
|
+
* @returns {Promise<void>} A promise that resolves when the environment variable has been set.
|
|
17
|
+
* @throws {Error} If the function is called outside of a GitHub Actions environment or if the GITHUB_ENV environment variable is not set.
|
|
18
|
+
*/
|
|
19
|
+
declare function setGitHubEnvVar(varName: string, varValue: string): Promise<void>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getProjectRoot, setGitHubEnvVar };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{env as e}from"node:process";import{appendFile as t}from"node:fs/promises";function n(){return!e.CI||!e.REPO_NAME?``:e.PR_NUMBER?`/${e.REPO_NAME}/${e.PR_NUMBER}`:`/${e.REPO_NAME}`}async function r(n,r){if(e.CI){if(!e.GITHUB_ENV)throw Error(`GITHUB_ENV environment variable is not set. This function should only be used in a GitHub Actions environment.`);await t(e.GITHUB_ENV,`\n${n}=${r}`)}}export{n as getProjectRoot,r as setGitHubEnvVar};
|
package/package.json
CHANGED
|
@@ -1,48 +1,60 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
2
|
+
"name": "@firefoxic/utils",
|
|
3
|
+
"description": "Collection of useful utilities for JavaScript and Node.js.",
|
|
4
|
+
"version": "2.1.2",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Sergey Artemov",
|
|
8
|
+
"email": "firefoxic.dev@gmail.com"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/firefoxic/utils#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/firefoxic/utils/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/firefoxic/utils.git"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"./dist/"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22.18"
|
|
30
|
+
},
|
|
31
|
+
"devEngines": {
|
|
32
|
+
"runtime": {
|
|
33
|
+
"name": "node",
|
|
34
|
+
"version": ">=26.4",
|
|
35
|
+
"onFail": "download"
|
|
36
|
+
},
|
|
37
|
+
"packageManager": {
|
|
38
|
+
"name": "pnpm",
|
|
39
|
+
"version": ">=11.9",
|
|
40
|
+
"onFail": "download"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@firefoxic/oxlint-config": "^0.4.0",
|
|
45
|
+
"@types/node": "^26.1.0",
|
|
46
|
+
"oxlint": "^1.72.0",
|
|
47
|
+
"tsdown": "^0.22.3",
|
|
48
|
+
"typescript": "^7.0.1-rc",
|
|
49
|
+
"node": "runtime:>=26.4"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"javascript",
|
|
53
|
+
"node.js",
|
|
54
|
+
"prepare",
|
|
55
|
+
"utils"
|
|
56
|
+
],
|
|
57
|
+
"scripts": {
|
|
58
|
+
"help": "make help"
|
|
59
|
+
}
|
|
60
|
+
}
|