|
1 | 1 | import { info, debug, warning, addPath } from "@actions/core"; |
2 | 2 | import { exec, getExecOutput } from "@actions/exec"; |
3 | 3 | import type { Inputs } from "./types.js"; |
4 | | -import { PACKAGE_NAME, GITHUB_REGISTRY } from "./types.js"; |
| 4 | +import { PACKAGE_NAME } from "./types.js"; |
5 | 5 |
|
6 | 6 | export async function installVitePlus(inputs: Inputs): Promise<void> { |
7 | | - const { version, registry, githubToken } = inputs; |
| 7 | + const { version } = inputs; |
8 | 8 |
|
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}...`); |
18 | 10 |
|
19 | 11 | // Build npm install command arguments |
20 | 12 | const packageSpec = version === "latest" ? PACKAGE_NAME : `${PACKAGE_NAME}@${version}`; |
21 | | - |
22 | 13 | const args = ["install", "-g", packageSpec]; |
23 | 14 |
|
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 | | - |
47 | 15 | debug(`Running: npm ${args.join(" ")}`); |
48 | 16 |
|
49 | | - const exitCode = await exec("npm", args, { env }); |
| 17 | + const exitCode = await exec("npm", args); |
50 | 18 |
|
51 | 19 | if (exitCode !== 0) { |
52 | 20 | throw new Error(`Failed to install ${PACKAGE_NAME}. Exit code: ${exitCode}`); |
|
0 commit comments