Skip to content

Commit 5198b80

Browse files
fengmk2claude
andcommitted
refactor: remove GitHub Package Registry support, add feedback section
- Remove registry and github-token inputs - Simplify to npm-only installation - Add feedback section linking to vite-plus-discussions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent df5201f commit 5198b80

10 files changed

Lines changed: 11706 additions & 351 deletions

File tree

.github/workflows/test.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ jobs:
2424
uses: ./
2525
with:
2626
version: latest
27-
registry: github
28-
github-token: ${{ secrets.VP_TOKEN }}
2927
run-install: false
3028
cache: false
3129

@@ -52,8 +50,6 @@ jobs:
5250
uses: ./
5351
id: setup
5452
with:
55-
registry: github
56-
github-token: ${{ secrets.VP_TOKEN }}
5753
run-install: false
5854
cache: true
5955
cache-dependency-path: test-project/pnpm-lock.yaml
@@ -84,8 +80,6 @@ jobs:
8480
uses: ./
8581
id: setup
8682
with:
87-
registry: github
88-
github-token: ${{ secrets.VP_TOKEN }}
8983
run-install: false
9084
cache: true
9185
cache-dependency-path: test-project/package-lock.json
@@ -116,8 +110,6 @@ jobs:
116110
uses: ./
117111
id: setup
118112
with:
119-
registry: github
120-
github-token: ${{ secrets.VP_TOKEN }}
121113
run-install: false
122114
cache: true
123115
cache-dependency-path: test-project/yarn.lock
@@ -141,8 +133,6 @@ jobs:
141133
uses: ./
142134
id: setup
143135
with:
144-
registry: github
145-
github-token: ${{ secrets.VP_TOKEN }}
146136
cache: true
147137

148138
- name: Type check

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ This is a GitHub Action with main and post execution phases (defined in `action.
5151
### Key Modules
5252

5353
- `src/inputs.ts` - Parse and validate action inputs using Zod schemas
54-
- `src/install-viteplus.ts` - Install vite-plus globally, handles GitHub Package Registry auth
54+
- `src/install-viteplus.ts` - Install vite-plus globally via npm
5555
- `src/cache-restore.ts` / `src/cache-save.ts` - Dependency caching via `@actions/cache`
5656
- `src/run-install.ts` - Execute `vite install` with optional cwd/args
5757
- `src/types.ts` - Shared types, enums, and Zod schemas

README.md

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ GitHub Action to set up [Vite+](https://github.com/voidzero-dev/vite-plus) (`vit
55
## Features
66

77
- Install Vite+ globally with version specification
8-
- Support both npm Registry and GitHub Package Registry
98
- Cache project dependencies with auto-detection of lock files
109
- Optionally run `vite install` after setup
1110
- Support for all major package managers (npm, pnpm, yarn)
@@ -55,20 +54,6 @@ steps:
5554
cache: true
5655
```
5756
58-
### GitHub Package Registry
59-
60-
```yaml
61-
steps:
62-
- uses: actions/checkout@v6
63-
- uses: actions/setup-node@v6
64-
with:
65-
node-version: '22'
66-
- uses: voidzero-dev/setup-vite-plus-action@v1
67-
with:
68-
registry: github
69-
github-token: ${{ secrets.GH_PKG_TOKEN }}
70-
```
71-
7257
### Advanced Run Install
7358
7459
```yaml
@@ -91,8 +76,6 @@ steps:
9176
| Input | Description | Required | Default |
9277
|-------|-------------|----------|---------|
9378
| `version` | Version of vite-plus-cli to install | No | `latest` |
94-
| `registry` | Registry to install from: `npm` or `github` | No | `npm` |
95-
| `github-token` | GitHub PAT for GitHub Package Registry | No | - |
9679
| `run-install` | Run `vite install` after setup. Accepts boolean or YAML object with `cwd`/`args` | No | `true` |
9780
| `cache` | Enable caching of project dependencies | No | `false` |
9881
| `cache-dependency-path` | Path to lock file for cache key generation | No | Auto-detected |
@@ -146,6 +129,10 @@ jobs:
146129
- run: vite run test
147130
```
148131

132+
## Feedback
133+
134+
If you have any feedback or issues, please [submit an issue or start a discussion](https://github.com/voidzero-dev/vite-plus-discussions).
135+
149136
## License
150137

151138
MIT

action.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ inputs:
1010
description: 'Version of vite-plus-cli to install'
1111
required: false
1212
default: 'latest'
13-
registry:
14-
description: 'Registry to install from: "npm" (default) or "github"'
15-
required: false
16-
default: 'npm'
17-
github-token:
18-
description: 'GitHub PAT for GitHub Package Registry. Required when registry is "github".'
19-
required: false
2013
run-install:
2114
description: 'Run `vite install` after setup. Accepts boolean or YAML object with cwd/args.'
2215
required: false

dist/index.mjs

Lines changed: 11695 additions & 197 deletions
Large diffs are not rendered by default.

src/inputs.test.ts

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ describe("getInputs", () => {
2525

2626
expect(inputs).toEqual({
2727
version: "latest",
28-
registry: "npm",
29-
githubToken: undefined,
3028
runInstall: [],
3129
cache: false,
3230
cacheDependencyPath: undefined,
@@ -45,52 +43,6 @@ describe("getInputs", () => {
4543
expect(inputs.version).toBe("1.2.3");
4644
});
4745

48-
it("should parse registry input as npm", () => {
49-
vi.mocked(getInput).mockImplementation((name) => {
50-
if (name === "registry") return "npm";
51-
return "";
52-
});
53-
vi.mocked(getBooleanInput).mockReturnValue(false);
54-
55-
const inputs = getInputs();
56-
57-
expect(inputs.registry).toBe("npm");
58-
});
59-
60-
it("should parse registry input as github", () => {
61-
vi.mocked(getInput).mockImplementation((name) => {
62-
if (name === "registry") return "github";
63-
return "";
64-
});
65-
vi.mocked(getBooleanInput).mockReturnValue(false);
66-
67-
const inputs = getInputs();
68-
69-
expect(inputs.registry).toBe("github");
70-
});
71-
72-
it("should throw error for invalid registry", () => {
73-
vi.mocked(getInput).mockImplementation((name) => {
74-
if (name === "registry") return "invalid";
75-
return "";
76-
});
77-
vi.mocked(getBooleanInput).mockReturnValue(false);
78-
79-
expect(() => getInputs()).toThrow('Invalid registry "invalid"');
80-
});
81-
82-
it("should parse github-token input", () => {
83-
vi.mocked(getInput).mockImplementation((name) => {
84-
if (name === "github-token") return "ghp_xxxx";
85-
return "";
86-
});
87-
vi.mocked(getBooleanInput).mockReturnValue(false);
88-
89-
const inputs = getInputs();
90-
91-
expect(inputs.githubToken).toBe("ghp_xxxx");
92-
});
93-
9446
it("should parse run-install as true", () => {
9547
vi.mocked(getInput).mockImplementation((name) => {
9648
if (name === "run-install") return "true";

src/inputs.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,18 @@
11
import { getInput, getBooleanInput } from "@actions/core";
22
import { parse as parseYaml } from "yaml";
33
import { z } from "zod";
4-
import type { Inputs, Registry, RunInstall } from "./types.js";
4+
import type { Inputs, RunInstall } from "./types.js";
55
import { RunInstallInputSchema } from "./types.js";
66

77
export function getInputs(): Inputs {
88
return {
99
version: getInput("version") || "latest",
10-
registry: parseRegistry(getInput("registry")),
11-
githubToken: getInput("github-token") || undefined,
1210
runInstall: parseRunInstall(getInput("run-install")),
1311
cache: getBooleanInput("cache"),
1412
cacheDependencyPath: getInput("cache-dependency-path") || undefined,
1513
};
1614
}
1715

18-
function parseRegistry(input: string): Registry {
19-
const normalized = input.toLowerCase().trim() || "npm";
20-
if (normalized !== "npm" && normalized !== "github") {
21-
throw new Error(`Invalid registry "${input}". Must be "npm" or "github".`);
22-
}
23-
return normalized;
24-
}
25-
2616
function parseRunInstall(input: string): RunInstall[] {
2717
if (!input || input === "false" || input === "null") {
2818
return [];

src/install-viteplus.ts

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,20 @@
11
import { info, debug, warning, addPath } from "@actions/core";
22
import { exec, getExecOutput } from "@actions/exec";
33
import type { Inputs } from "./types.js";
4-
import { PACKAGE_NAME, GITHUB_REGISTRY } from "./types.js";
4+
import { PACKAGE_NAME } from "./types.js";
55

66
export async function installVitePlus(inputs: Inputs): Promise<void> {
7-
const { version, registry, githubToken } = inputs;
7+
const { version } = inputs;
88

9-
info(`Installing ${PACKAGE_NAME}@${version} from ${registry} registry...`);
10-
11-
// Validate GitHub token if using GitHub registry
12-
if (registry === "github" && !githubToken) {
13-
throw new Error(
14-
"GitHub token is required when using GitHub Package Registry. " +
15-
"Please set the github-token input.",
16-
);
17-
}
9+
info(`Installing ${PACKAGE_NAME}@${version}...`);
1810

1911
// Build npm install command arguments
2012
const packageSpec = version === "latest" ? PACKAGE_NAME : `${PACKAGE_NAME}@${version}`;
21-
2213
const args = ["install", "-g", packageSpec];
2314

24-
// Set up environment for installation
25-
const env: Record<string, string> = {};
26-
for (const [key, value] of Object.entries(process.env)) {
27-
if (value !== undefined) {
28-
env[key] = value;
29-
}
30-
}
31-
32-
// Configure scoped registry for GitHub Package Registry
33-
if (registry === "github" && githubToken) {
34-
debug("Configuring @voidzero-dev scoped registry for GitHub Package Registry");
35-
36-
// Set scoped registry using npm config
37-
await exec("npm", ["config", "set", "@voidzero-dev:registry", GITHUB_REGISTRY]);
38-
39-
// Set auth token placeholder using npm config
40-
// The actual token is passed via VP_TOKEN environment variable
41-
await exec("npm", ["config", "set", "//npm.pkg.github.com/:_authToken", "${VP_TOKEN}"]);
42-
43-
// Pass the actual token via VP_TOKEN environment variable
44-
env.VP_TOKEN = githubToken;
45-
}
46-
4715
debug(`Running: npm ${args.join(" ")}`);
4816

49-
const exitCode = await exec("npm", args, { env });
17+
const exitCode = await exec("npm", args);
5018

5119
if (exitCode !== 0) {
5220
throw new Error(`Failed to install ${PACKAGE_NAME}. Exit code: ${exitCode}`);

src/run-install.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
1-
import { startGroup, endGroup, setFailed, info, debug } from "@actions/core";
1+
import { startGroup, endGroup, setFailed, info } from "@actions/core";
22
import { exec } from "@actions/exec";
33
import type { Inputs } from "./types.js";
44

55
export async function runViteInstall(inputs: Inputs): Promise<void> {
6-
const { registry, githubToken } = inputs;
7-
8-
// Set up environment for vite install
9-
const env: Record<string, string> = {};
10-
for (const [key, value] of Object.entries(process.env)) {
11-
if (value !== undefined) {
12-
env[key] = value;
13-
}
14-
}
15-
16-
// Pass GitHub token via VP_TOKEN for GitHub Package Registry
17-
if (registry === "github" && githubToken) {
18-
debug("Setting VP_TOKEN environment variable for vite install");
19-
env.VP_TOKEN = githubToken;
20-
}
21-
226
for (const options of inputs.runInstall) {
237
const args = ["install"];
248
if (options.args) {
@@ -33,7 +17,6 @@ export async function runViteInstall(inputs: Inputs): Promise<void> {
3317
try {
3418
const exitCode = await exec("vite", args, {
3519
cwd,
36-
env,
3720
ignoreReturnCode: true,
3821
});
3922

src/types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { z } from "zod";
22

3-
// Registry type
4-
export type Registry = "npm" | "github";
5-
63
// Run install configuration schema
74
export const RunInstallSchema = z.object({
85
cwd: z.string().optional(),
@@ -22,8 +19,6 @@ export type RunInstall = z.infer<typeof RunInstallSchema>;
2219
// Main inputs interface
2320
export interface Inputs {
2421
readonly version: string;
25-
readonly registry: Registry;
26-
readonly githubToken?: string;
2722
readonly runInstall: RunInstall[];
2823
readonly cache: boolean;
2924
readonly cacheDependencyPath?: string;
@@ -59,4 +54,3 @@ export enum Outputs {
5954

6055
// Package constants
6156
export const PACKAGE_NAME = "vite-plus-cli";
62-
export const GITHUB_REGISTRY = "https://npm.pkg.github.com";

0 commit comments

Comments
 (0)