|
1 | | -import { restoreCache, saveCache } from "@actions/cache"; |
2 | | -import { info, debug, saveState, getState, warning } from "@actions/core"; |
3 | | -import { arch, platform } from "node:os"; |
4 | | -import { State } from "./types.js"; |
5 | | -import { getVitePlusHome } from "./utils.js"; |
| 1 | +import { info, warning } from "@actions/core"; |
6 | 2 |
|
7 | 3 | const SEMVER_RE = /^\d+\.\d+\.\d+/; |
8 | 4 |
|
@@ -31,60 +27,15 @@ export async function resolveVersion(versionInput: string): Promise<string | und |
31 | 27 | } |
32 | 28 | } |
33 | 29 |
|
34 | | -export async function restoreVpCache(version: string, nodeVersion: string): Promise<boolean> { |
35 | | - const vpHome = getVitePlusHome(); |
36 | | - const runnerOS = process.env.RUNNER_OS || platform(); |
37 | | - const runnerArch = arch(); |
38 | | - const primaryKey = `setup-vp-${runnerOS}-${runnerArch}-${version}-node${nodeVersion}`; |
39 | | - |
40 | | - debug(`Vp cache key: ${primaryKey}`); |
41 | | - debug(`Vp cache path: ${vpHome}`); |
42 | | - saveState(State.VpCachePrimaryKey, primaryKey); |
43 | | - |
44 | | - try { |
45 | | - const matchedKey = await restoreCache([vpHome], primaryKey); |
46 | | - if (matchedKey) { |
47 | | - info(`Vite+ restored from cache (key: ${matchedKey})`); |
48 | | - saveState(State.VpCacheMatchedKey, matchedKey); |
49 | | - return true; |
50 | | - } |
51 | | - } catch (error) { |
52 | | - warning(`Failed to restore vp cache: ${error}`); |
53 | | - } |
54 | | - |
| 30 | +// FIXME: Re-enable vp CLI caching after the new version of vite-plus is released |
| 31 | +// that fixes the Windows `Cannot find module 'which'` issue (#10). |
| 32 | +export async function restoreVpCache(_version: string, _nodeVersion: string): Promise<boolean> { |
| 33 | + info("Vp CLI caching is temporarily disabled"); |
55 | 34 | return false; |
56 | 35 | } |
57 | 36 |
|
| 37 | +// FIXME: Re-enable vp CLI caching after the new version of vite-plus is released |
| 38 | +// that fixes the Windows `Cannot find module 'which'` issue (#10). |
58 | 39 | export async function saveVpCache(): Promise<void> { |
59 | | - const forceInstall = |
60 | | - process.env.SETUP_VP_FORCE_INSTALL === "true" || process.env.SETUP_VP_FORCE_INSTALL === "1"; |
61 | | - if (forceInstall) { |
62 | | - info("SETUP_VP_FORCE_INSTALL is set, skipping vp cache save"); |
63 | | - return; |
64 | | - } |
65 | | - |
66 | | - const primaryKey = getState(State.VpCachePrimaryKey); |
67 | | - const matchedKey = getState(State.VpCacheMatchedKey); |
68 | | - |
69 | | - if (!primaryKey) { |
70 | | - debug("No vp cache key found. Skipping save."); |
71 | | - return; |
72 | | - } |
73 | | - |
74 | | - if (primaryKey === matchedKey) { |
75 | | - info(`Vp cache hit on primary key "${primaryKey}". Skipping save.`); |
76 | | - return; |
77 | | - } |
78 | | - |
79 | | - try { |
80 | | - const vpHome = getVitePlusHome(); |
81 | | - const cacheId = await saveCache([vpHome], primaryKey); |
82 | | - if (cacheId === -1) { |
83 | | - warning("Vp cache save failed or was skipped."); |
84 | | - return; |
85 | | - } |
86 | | - info(`Vp cache saved with key: ${primaryKey}`); |
87 | | - } catch (error) { |
88 | | - warning(`Failed to save vp cache: ${String(error)}`); |
89 | | - } |
| 40 | + info("Vp CLI caching is temporarily disabled, skipping save"); |
90 | 41 | } |
0 commit comments