radiant-docs 0.1.51 → 0.1.53
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/dist/index.js +14 -4
- package/package.json +1 -1
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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);
|