radiant-docs 0.1.51 → 0.1.54

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -4
  2. package/package.json +4 -2
package/dist/index.js CHANGED
@@ -36,12 +36,14 @@ var log = {
36
36
  ),
37
37
  blank: () => console.log("")
38
38
  };
39
- var SUPPORTED_COMMANDS = /* @__PURE__ */ new Set(["dev", "check"]);
39
+ var SUPPORTED_COMMANDS = /* @__PURE__ */ new Set(["dev", "check", "prepare"]);
40
40
  function getUserDocsDir() {
41
41
  return process.cwd();
42
42
  }
43
43
  function getProjectHash(docsDir) {
44
- return crypto.createHash("md5").update(docsDir).digest("hex").slice(0, 8);
44
+ const cacheKey = process.env.RADIANT_CACHE_KEY?.trim();
45
+ const hashInput = cacheKey ? `cache-key:${cacheKey}` : docsDir;
46
+ return crypto.createHash("md5").update(hashInput).digest("hex").slice(0, 8);
45
47
  }
46
48
  function getCacheDir(docsDir) {
47
49
  const projectHash = getProjectHash(docsDir);
@@ -146,7 +148,8 @@ async function installDependencies(cacheDir) {
146
148
  }
147
149
  log.info(`Cache location: ${cacheDir}`);
148
150
  try {
149
- execSync("npm install --silent --no-fund --no-audit", {
151
+ const installCommand = fs.existsSync(path.join(cacheDir, "package-lock.json")) ? "npm ci --silent --no-fund --no-audit" : "npm install --silent --no-fund --no-audit";
152
+ execSync(installCommand, {
150
153
  cwd: cacheDir,
151
154
  stdio: "pipe",
152
155
  env: process.env
@@ -350,6 +353,7 @@ ${colors.bright}Usage:${colors.reset}
350
353
  radiant Start the dev server
351
354
  radiant dev Start the dev server
352
355
  radiant check Validate and build the docs once
356
+ radiant prepare Prepare cached framework dependencies
353
357
  radiant --help Show this help message
354
358
  radiant --version Show version
355
359
 
@@ -382,11 +386,17 @@ async function run() {
382
386
  const docsDir = getUserDocsDir();
383
387
  const cacheDir = getCacheDir(docsDir);
384
388
  const contentDir = getContentDir(cacheDir);
385
- await validateUserDocs(docsDir);
389
+ if (command !== "prepare") {
390
+ await validateUserDocs(docsDir);
391
+ }
386
392
  const needsInstall = await setupCache(cacheDir);
387
393
  if (needsInstall) {
388
394
  await installDependencies(cacheDir);
389
395
  }
396
+ if (command === "prepare") {
397
+ log.success("Radiant framework cache is ready.");
398
+ return;
399
+ }
390
400
  log.info("Syncing your documentation...");
391
401
  await syncContent(docsDir, contentDir);
392
402
  await runAstroSync(cacheDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "radiant-docs",
3
- "version": "0.1.51",
3
+ "version": "0.1.54",
4
4
  "description": "CLI tool for previewing Radiant documentation locally",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,7 +11,9 @@
11
11
  "build": "tsup src/index.ts --format esm --clean && npm run bundle-template",
12
12
  "dev": "tsup src/index.ts --format esm --watch",
13
13
  "prepublishOnly": "npm run build",
14
- "release": "npm version patch && npm publish"
14
+ "release": "npm version patch && npm publish",
15
+ "sync-docs-agent-version": "node scripts/sync-docs-agent-version.js",
16
+ "version": "npm run sync-docs-agent-version && git add ../workers/docs-agent/container/Dockerfile"
15
17
  },
16
18
  "dependencies": {
17
19
  "chokidar": "^4.0.3",