@yukiakai/actions-git 1.0.2 → 1.0.6

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Yuki Akai
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Yuki Akai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,7 +1,5 @@
1
1
  import { ExecOptions } from '@actions/exec';
2
2
 
3
- type GitExecOptions = Omit<ExecOptions, 'cwd'>;
4
- type GitInspectableOptions = Omit<GitExecOptions, 'ignoreReturnCode'>;
5
3
  interface GitExecResult {
6
4
  exitCode: number;
7
5
  }
@@ -31,4 +29,4 @@ declare class GitClient {
31
29
  private branchExists;
32
30
  }
33
31
 
34
- export { GitClient, type GitExecOptions, type GitExecResult, type GitInspectableOptions, type GitOptions };
32
+ export { GitClient, type GitOptions };
package/package.json CHANGED
@@ -1,72 +1,75 @@
1
- {
2
- "name": "@yukiakai/actions-git",
3
- "version": "1.0.2",
4
- "description": "Lightweight Git client for GitHub Actions and CI workflows.",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./dist/index.js",
11
- "require": "./dist/index.cjs"
12
- },
13
- "scripts": {
14
- "test": "npm run build && npx vitest run --reporter verbose --coverage",
15
- "format": "prettier --write **/*.{js,ts}",
16
- "format:check": "prettier --check **/*.{js,ts}",
17
- "lint": "eslint src/**/*.ts",
18
- "build": "npx tsup",
19
- "docs": "npx typedoc",
20
- "prepare": "is-ci || husky"
21
- },
22
- "files": [
23
- "dist/*",
24
- "CHANGELOG.md"
25
- ],
26
- "keywords": [
27
- "actions",
28
- "git",
29
- "CI",
30
- "typescript"
31
- ],
32
- "author": "Yuki_akai",
33
- "homepage": "https://github.com/yukiakai212/actions-git.js",
34
- "funding": "https://github.com/sponsors/yukiakai212",
35
- "engines": {
36
- "node": ">= 16"
37
- },
38
- "maintainers": [
39
- {
40
- "name": "Yuki_akai",
41
- "homepage": "https://github.com/yukiakai212"
42
- }
43
- ],
44
- "repository": {
45
- "type": "git",
46
- "url": "git+https://github.com/yukiakai212/actions-git.js.git"
47
- },
48
- "bugs": {
49
- "url": "https://github.com/yukiakai212/actions-git.js/issues"
50
- },
51
- "license": "MIT",
52
- "devDependencies": {
53
- "@changesets/cli": "^2.29.8",
54
- "@eslint/js": "^9.30.1",
55
- "@types/node": "^24.0.10",
56
- "@vitest/coverage-v8": "^4.0.15",
57
- "dotenv": "^17.0.1",
58
- "eslint": "^9.30.0",
59
- "husky": "^9.1.7",
60
- "is-ci": "^4.1.0",
61
- "prettier": "^3.6.2",
62
- "tsup": "^8.5.1",
63
- "tsx": "^4.20.3",
64
- "typedoc": "^0.28.9",
65
- "typescript": "^5.8.3",
66
- "typescript-eslint": "^8.35.1",
67
- "vitest": "^4.0.15"
68
- },
69
- "dependencies": {
70
- "@actions/exec": "^3.0.0"
71
- }
72
- }
1
+ {
2
+ "name": "@yukiakai/actions-git",
3
+ "version": "1.0.6",
4
+ "description": "Lightweight Git client for GitHub Actions and CI workflows.",
5
+ "type": "module",
6
+ "main": "./dist/public.js",
7
+ "types": "./dist/public.d.ts",
8
+ "exports": {
9
+ "types": "./dist/public.d.ts",
10
+ "import": "./dist/public.js"
11
+ },
12
+ "scripts": {
13
+ "test": "npx vitest run --reporter verbose --coverage",
14
+ "format": "prettier --write **/*.{js,ts,json}",
15
+ "format:check": "prettier --check **/*.{js,ts,json}",
16
+ "lint": "eslint src/**/*.ts",
17
+ "typecheck:workspace": "tsc -p tsconfig.workspace.json",
18
+ "build": "npx tsup",
19
+ "build:public": "npx tsup --config tsup.public.config.ts",
20
+ "docs": "npx typedoc",
21
+ "prepare:artifact": "tsx workspace/release/prepareArtifact.ts",
22
+ "prepare": "is-ci || husky"
23
+ },
24
+ "files": [
25
+ "dist/*",
26
+ "CHANGELOG.md"
27
+ ],
28
+ "keywords": [
29
+ "actions",
30
+ "git",
31
+ "CI",
32
+ "typescript"
33
+ ],
34
+ "author": "Yuki_akai",
35
+ "homepage": "https://github.com/yukiakai212/actions-git.js",
36
+ "funding": "https://github.com/sponsors/yukiakai212",
37
+ "engines": {
38
+ "node": ">= 16"
39
+ },
40
+ "maintainers": [
41
+ {
42
+ "name": "Yuki_akai",
43
+ "homepage": "https://github.com/yukiakai212"
44
+ }
45
+ ],
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/yukiakai212/actions-git.js.git"
49
+ },
50
+ "bugs": {
51
+ "url": "https://github.com/yukiakai212/actions-git.js/issues"
52
+ },
53
+ "license": "MIT",
54
+ "devDependencies": {
55
+ "@changesets/cli": "^2.29.8",
56
+ "@eslint/js": "^9.30.1",
57
+ "@types/node": "^24.0.10",
58
+ "@vitest/coverage-v8": "^4.0.15",
59
+ "@yukiakai/artifact": "^1.0.1",
60
+ "dotenv": "^17.0.1",
61
+ "eslint": "^9.30.0",
62
+ "husky": "^9.1.7",
63
+ "is-ci": "^4.1.0",
64
+ "prettier": "^3.6.2",
65
+ "tsup": "^8.5.1",
66
+ "tsx": "^4.20.3",
67
+ "typedoc": "^0.28.9",
68
+ "typescript": "^5.8.3",
69
+ "typescript-eslint": "^8.35.1",
70
+ "vitest": "^4.0.15"
71
+ },
72
+ "dependencies": {
73
+ "@actions/exec": "^3.0.0"
74
+ }
75
+ }
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";var n=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var u=(i,t)=>{for(var e in t)n(i,e,{get:t[e],enumerable:!0})},l=(i,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of h(t))!x.call(i,s)&&s!==e&&n(i,s,{get:()=>t[s],enumerable:!(o=p(t,s))||o.enumerable});return i};var w=i=>l(n({},"__esModule",{value:!0}),i);var d={};u(d,{GitClient:()=>r});module.exports=w(d);var a=require("@actions/exec"),r=class{constructor(t){this.options=t}get repoUrl(){let{repo:t,token:e}=this.options;return`https://x-access-token:${e}@github.com/${t}.git`}async execGitRaw(t,e){return{exitCode:await(0,a.exec)("git",t,e)}}async execGit(t,e){return await this.execGitRaw(t,{cwd:this.options.cwd,...e})}async execGitInspectable(t,e){return await this.execGit(t,{...e,ignoreReturnCode:!0})}async clone(){let{branch:t,cwd:e}=this.options;(await this.execGitRaw(["clone","--depth=1","--branch",t,this.repoUrl,e],{ignoreReturnCode:!0})).exitCode!==0&&await this.execGitRaw(["clone",this.repoUrl,e])}async wipe(t){await this.execGit(["rm","-r","-f","--ignore-unmatch",...t]),await this.execGit(["clean","-fdx","--",...t])}async setup(){await this.execGit(["config","user.name","github-actions[bot]"]),await this.execGit(["config","user.email","github-actions[bot]@users.noreply.github.com"])}async checkout(){let{branch:t}=this.options;await this.branchExists(t)?await this.execGit(["checkout",t]):(await this.execGit(["checkout","--orphan",t]),await this.wipe(["."]))}async pullRebase(){let{branch:t}=this.options;await this.execGit(["pull","--rebase","origin",t])}async commit(t){await this.execGit(["commit","-m",t])}async add(t){await this.execGit(["add",...t])}async push(){let{branch:t}=this.options;await this.execGit(["push","origin",t])}async hasChanges(){let t=await this.execGitInspectable(["diff","--cached","--quiet"]);if(t.exitCode===0)return!1;if(t.exitCode===1)return!0;throw new Error(`git diff failed with exit code ${t.exitCode}`)}async branchExists(t){let e=await this.execGitInspectable(["ls-remote","--exit-code","--heads","origin",t]);if(e.exitCode===0)return!0;if(e.exitCode===2)return!1;throw new Error(`Failed to check remote branch "${t}" (exit code ${e.exitCode})`)}};0&&(module.exports={GitClient});
package/dist/index.d.ts DELETED
@@ -1,34 +0,0 @@
1
- import { ExecOptions } from '@actions/exec';
2
-
3
- type GitExecOptions = Omit<ExecOptions, 'cwd'>;
4
- type GitInspectableOptions = Omit<GitExecOptions, 'ignoreReturnCode'>;
5
- interface GitExecResult {
6
- exitCode: number;
7
- }
8
- interface GitOptions {
9
- cwd: string;
10
- repo: string;
11
- branch: string;
12
- token: string;
13
- }
14
-
15
- declare class GitClient {
16
- private options;
17
- constructor(options: GitOptions);
18
- private get repoUrl();
19
- protected execGitRaw(args: string[], options?: ExecOptions): Promise<GitExecResult>;
20
- private execGit;
21
- private execGitInspectable;
22
- clone(): Promise<void>;
23
- wipe(pattern: string[]): Promise<void>;
24
- setup(): Promise<void>;
25
- checkout(): Promise<void>;
26
- pullRebase(): Promise<void>;
27
- commit(message: string): Promise<void>;
28
- add(pattern: string[]): Promise<void>;
29
- push(): Promise<void>;
30
- hasChanges(): Promise<boolean>;
31
- private branchExists;
32
- }
33
-
34
- export { GitClient, type GitExecOptions, type GitExecResult, type GitInspectableOptions, type GitOptions };
File without changes