moonwave-gitlab 1.3.4 → 1.3.7
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/argv.js +41 -0
- package/dist/argv.js.map +1 -0
- package/dist/binary.js +91 -0
- package/dist/binary.js.map +1 -0
- package/dist/commands/build.js +64 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/dev.js +63 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/getDocusaurusConfig.js +131 -0
- package/dist/getDocusaurusConfig.js.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/prepareProject.js +297 -0
- package/dist/prepareProject.js.map +1 -0
- package/package.json +1 -1
- package/src/binary.ts +143 -143
- package/template/root/package-lock.json +4 -4
- package/template/root/package.json +1 -1
package/dist/argv.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createRequire } from "module";
|
|
2
|
+
import yargs from "yargs";
|
|
3
|
+
import buildCommand from "./commands/build.js";
|
|
4
|
+
import devCommand from "./commands/dev.js";
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const version = require("../package.json").version;
|
|
7
|
+
const argv = yargs(process.argv.slice(2))
|
|
8
|
+
.scriptName("moonwave")
|
|
9
|
+
.usage("Usage: moonwave [options]")
|
|
10
|
+
.alias("v", "version")
|
|
11
|
+
.version(version)
|
|
12
|
+
.describe("version", "show version information")
|
|
13
|
+
.alias("h", "help")
|
|
14
|
+
.help("help")
|
|
15
|
+
.describe("help", "show help")
|
|
16
|
+
.showHelpOnFail(true)
|
|
17
|
+
.command("build", "build the docs website", (yargs) => {
|
|
18
|
+
yargs
|
|
19
|
+
.boolean("publish")
|
|
20
|
+
.describe("publish", "publish the built website to your gh-pages branch after building");
|
|
21
|
+
yargs
|
|
22
|
+
.string("out-dir")
|
|
23
|
+
.describe("out-dir", "set the build directory to a different path (relative to the current directory)");
|
|
24
|
+
}, buildCommand)
|
|
25
|
+
.command("dev", "run in development live-reload mode", (yargs) => {
|
|
26
|
+
yargs
|
|
27
|
+
.boolean("fresh")
|
|
28
|
+
.describe("fresh", "deletes build cache before building")
|
|
29
|
+
.alias("f", "fresh");
|
|
30
|
+
}, devCommand)
|
|
31
|
+
.array("code")
|
|
32
|
+
.describe("code", "the path to your Lua code. e.g. 'src'")
|
|
33
|
+
.default("code", ["lib", "src"])
|
|
34
|
+
.boolean("install")
|
|
35
|
+
.describe("install", "re-install npm dependencies")
|
|
36
|
+
.alias("i", "install")
|
|
37
|
+
.strictCommands()
|
|
38
|
+
.demandCommand()
|
|
39
|
+
.parse();
|
|
40
|
+
export default argv;
|
|
41
|
+
//# sourceMappingURL=argv.js.map
|
package/dist/argv.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argv.js","sourceRoot":"","sources":["../src/argv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,YAAY,MAAM,qBAAqB,CAAA;AAC9C,OAAO,UAAU,MAAM,mBAAmB,CAAA;AAE1C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C,MAAM,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAiB,CAAA;AAU5D,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACtC,UAAU,CAAC,UAAU,CAAC;KACtB,KAAK,CAAC,2BAA2B,CAAC;KAElC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC;KACrB,OAAO,CAAC,OAAO,CAAC;KAChB,QAAQ,CAAC,SAAS,EAAE,0BAA0B,CAAC;KAE/C,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC;KAClB,IAAI,CAAC,MAAM,CAAC;KACZ,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;KAC7B,cAAc,CAAC,IAAI,CAAC;KAEpB,OAAO,CACN,OAAO,EACP,wBAAwB,EACxB,CAAC,KAAK,EAAE,EAAE;IACR,KAAK;SACF,OAAO,CAAC,SAAS,CAAC;SAClB,QAAQ,CACP,SAAS,EACT,kEAAkE,CACnE,CAAA;IACH,KAAK;SACF,MAAM,CAAC,SAAS,CAAC;SACjB,QAAQ,CACP,SAAS,EACT,iFAAiF,CAClF,CAAA;AACL,CAAC,EACD,YAAY,CACb;KACA,OAAO,CACN,KAAK,EACL,qCAAqC,EACrC,CAAC,KAAK,EAAE,EAAE;IACR,KAAK;SACF,OAAO,CAAC,OAAO,CAAC;SAChB,QAAQ,CAAC,OAAO,EAAE,qCAAqC,CAAC;SACxD,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;AACxB,CAAC,EACD,UAAU,CACX;KAEA,KAAK,CAAC,MAAM,CAAC;KACb,QAAQ,CAAC,MAAM,EAAE,uCAAuC,CAAC;KACzD,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;KAE/B,OAAO,CAAC,SAAS,CAAC;KAClB,QAAQ,CAAC,SAAS,EAAE,6BAA6B,CAAC;KAClD,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC;KAErB,cAAc,EAAE;KAChB,aAAa,EAAE;KACf,KAAK,EAAE,CAAA;AAEV,eAAe,IAAI,CAAA"}
|
package/dist/binary.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import fetch from "node-fetch";
|
|
3
|
+
import os from "os";
|
|
4
|
+
import path, { dirname } from "path";
|
|
5
|
+
import unzipper from "unzipper";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const packageConfig = fs.readJSONSync(path.join(__dirname, "../package.json"));
|
|
9
|
+
const version = packageConfig.version;
|
|
10
|
+
const URL = `https://latest-github-release.eryn.io/evaera/moonwave/v${version}`;
|
|
11
|
+
export function promisifyStream(stream) {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
stream.on("close", resolve);
|
|
14
|
+
stream.on("finish", resolve);
|
|
15
|
+
stream.on("end", resolve);
|
|
16
|
+
stream.on("error", reject);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function getBinaryExtension() {
|
|
20
|
+
if (os.platform() === "win32") {
|
|
21
|
+
return ".exe";
|
|
22
|
+
}
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
function getBinaryName() {
|
|
26
|
+
return `moonwave-extractor${getBinaryExtension()}`;
|
|
27
|
+
}
|
|
28
|
+
function getBinaryZipPattern() {
|
|
29
|
+
switch (os.platform()) {
|
|
30
|
+
case "win32":
|
|
31
|
+
return /^moonwave-extractor(?:-|-.*-)win64.zip$/;
|
|
32
|
+
case "darwin":
|
|
33
|
+
return /^moonwave-extractor(?:-|-.*-)macos.zip$/;
|
|
34
|
+
case "linux":
|
|
35
|
+
return /^moonwave-extractor(?:-|-.*-)linux.zip$/;
|
|
36
|
+
default:
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async function downloadBinary(binaryPath) {
|
|
41
|
+
const result = await fetch(URL);
|
|
42
|
+
if (!result.ok) {
|
|
43
|
+
console.error("Raw response from API:", await result.text());
|
|
44
|
+
throw new Error(`${result.status} ${result.statusText} - Could not fetch Moonwave binary`);
|
|
45
|
+
}
|
|
46
|
+
const release = (await result.json());
|
|
47
|
+
console.log(`Downloading moonwave-extractor from release ${release.name} released at ${release.created_at}`);
|
|
48
|
+
const assets = release.assets;
|
|
49
|
+
const zipPattern = getBinaryZipPattern();
|
|
50
|
+
if (!zipPattern) {
|
|
51
|
+
throw new Error(`Your platform is unsupported: ${os.platform}`);
|
|
52
|
+
}
|
|
53
|
+
const targetAsset = assets.find((asset) => asset.name.match(zipPattern));
|
|
54
|
+
if (!targetAsset) {
|
|
55
|
+
throw new Error("Release does not contain a binary for this platform");
|
|
56
|
+
}
|
|
57
|
+
const download = await fetch(targetAsset.browser_download_url);
|
|
58
|
+
if (!download.body) {
|
|
59
|
+
throw new Error("Asset download body is null");
|
|
60
|
+
}
|
|
61
|
+
const writeStream = fs.createWriteStream(binaryPath);
|
|
62
|
+
const unzip = download.body.pipe(unzipper.ParseOne(new RegExp(getBinaryName()), {}));
|
|
63
|
+
const file = unzip.pipe(writeStream);
|
|
64
|
+
await promisifyStream(file);
|
|
65
|
+
if (file.bytesWritten === 0) {
|
|
66
|
+
file.close();
|
|
67
|
+
fs.removeSync(binaryPath);
|
|
68
|
+
throw new Error("Write stream closed but zero bytes were written");
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
if (os.platform() !== "win32") {
|
|
72
|
+
fs.chmod(binaryPath, 0o755);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export async function getBinaryPath() {
|
|
77
|
+
if (process.env.MOONWAVE_DEV) {
|
|
78
|
+
const extractorPath = process.env.MOONWAVE_EXTRACTOR_PATH || "moonwave-extractor";
|
|
79
|
+
console.log(`Moonwave: Using development extractor path: ${extractorPath}`);
|
|
80
|
+
return extractorPath;
|
|
81
|
+
}
|
|
82
|
+
const binFolder = path.join(__dirname, "bin");
|
|
83
|
+
const binaryPath = path.join(binFolder, `moonwave-extractor-${version}${getBinaryExtension()}`);
|
|
84
|
+
if (fs.existsSync(binaryPath)) {
|
|
85
|
+
return binaryPath;
|
|
86
|
+
}
|
|
87
|
+
fs.ensureDirSync(binFolder);
|
|
88
|
+
await downloadBinary(binaryPath);
|
|
89
|
+
return binaryPath;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=binary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary.js","sourceRoot":"","sources":["../src/binary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAA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AAkB,EAAE,EAAE,CACvD,CAAA;IAED,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,OAAO,UAAU,CAAA;IACnB,CAAC;IAED,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,CAAA;IAE3B,MAAM,cAAc,CAAC,UAAU,CAAC,CAAA;IAEhC,OAAO,UAAU,CAAA;AACnB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
import githubPages from "gh-pages";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { getBinaryPath } from "../binary.js";
|
|
5
|
+
import { prepareProject } from "../prepareProject.js";
|
|
6
|
+
function publish(buildDir) {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
githubPages.publish(buildDir, { dotfiles: true, message: "Built and published by Moonwave" }, (err) => (err ? reject(err) : resolve()));
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export default async function buildCommand(args) {
|
|
12
|
+
try {
|
|
13
|
+
const { tempDir, projectDir } = prepareProject(process.cwd(), {
|
|
14
|
+
codePaths: args.code,
|
|
15
|
+
fresh: true,
|
|
16
|
+
install: args.install,
|
|
17
|
+
binaryPath: await getBinaryPath(),
|
|
18
|
+
});
|
|
19
|
+
const buildDirName = args["out-dir"] || "build";
|
|
20
|
+
const buildDir = path.join(projectDir, buildDirName);
|
|
21
|
+
const command = "npm" + (process.platform === "win32" ? ".cmd" : "");
|
|
22
|
+
const spawnOptions = {
|
|
23
|
+
cwd: tempDir,
|
|
24
|
+
shell: true,
|
|
25
|
+
stdio: "inherit",
|
|
26
|
+
};
|
|
27
|
+
const swizzleExitCode = await new Promise((resolve) => {
|
|
28
|
+
spawn(command, [
|
|
29
|
+
"run",
|
|
30
|
+
"swizzle",
|
|
31
|
+
"docusaurus-lunr-search",
|
|
32
|
+
"SearchBar",
|
|
33
|
+
"--",
|
|
34
|
+
"--eject",
|
|
35
|
+
"--danger",
|
|
36
|
+
], spawnOptions)
|
|
37
|
+
.on("exit", resolve)
|
|
38
|
+
.on("error", console.error);
|
|
39
|
+
});
|
|
40
|
+
if (swizzleExitCode !== 0) {
|
|
41
|
+
throw new Error("Swizzle had an non-zero exit code");
|
|
42
|
+
}
|
|
43
|
+
const exitCode = await new Promise((resolve) => {
|
|
44
|
+
spawn(command, ["run", "build", "--", "--out-dir", `"${buildDir}"`], spawnOptions)
|
|
45
|
+
.on("exit", resolve)
|
|
46
|
+
.on("error", console.error);
|
|
47
|
+
});
|
|
48
|
+
if (exitCode !== 0) {
|
|
49
|
+
throw new Error("Build had an non-zero exit code");
|
|
50
|
+
}
|
|
51
|
+
console.log(`Moonwave: Website built into the \`${buildDirName}\` directory. Do not commit this folder: you should add it to your .gitignore file.`);
|
|
52
|
+
if (args.publish) {
|
|
53
|
+
console.log("Moonwave: Publishing build to gh-pages branch...");
|
|
54
|
+
await publish(buildDir);
|
|
55
|
+
console.log("Moonwave: Published! Your website should now be live.");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
console.error(typeof e === "object" && e !== null ? e.toString() : e);
|
|
60
|
+
console.error("Moonwave: It looks like something went wrong. Check the error output above.");
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,WAAW,MAAM,UAAU,CAAA;AAClC,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,SAAS,OAAO,CAAC,QAAgB;IAC/B,OAAO,IAAI,OAAO,CAAC,CAAC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"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
import chokidar from "chokidar";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { getBinaryPath } from "../binary.js";
|
|
6
|
+
import { prepareProject } from "../prepareProject.js";
|
|
7
|
+
export default async function devCommand(args) {
|
|
8
|
+
try {
|
|
9
|
+
const binaryPath = await getBinaryPath();
|
|
10
|
+
const { tempDir, watchPaths, projectDir } = prepareProject(process.cwd(), {
|
|
11
|
+
codePaths: args.code,
|
|
12
|
+
fresh: args.fresh,
|
|
13
|
+
install: args.install,
|
|
14
|
+
binaryPath,
|
|
15
|
+
});
|
|
16
|
+
console.error(`Moonwave: Temporary build directory is located at ${tempDir}`);
|
|
17
|
+
chokidar
|
|
18
|
+
.watch(projectDir, {
|
|
19
|
+
ignoreInitial: true,
|
|
20
|
+
})
|
|
21
|
+
.on("all", (event, changedPath) => {
|
|
22
|
+
if (watchPaths.some((watchPath) => {
|
|
23
|
+
if (path.normalize(watchPath) === path.normalize(changedPath)) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
const relative = path.relative(watchPath, changedPath);
|
|
27
|
+
return (relative &&
|
|
28
|
+
!relative.startsWith("..") &&
|
|
29
|
+
!path.isAbsolute(relative));
|
|
30
|
+
})) {
|
|
31
|
+
if (event === "unlink" || event == "unlinkDir") {
|
|
32
|
+
const relativePath = path.relative(projectDir, changedPath);
|
|
33
|
+
const targetPath = path.join(tempDir, relativePath);
|
|
34
|
+
fs.removeSync(targetPath);
|
|
35
|
+
}
|
|
36
|
+
prepareProject(process.cwd(), {
|
|
37
|
+
codePaths: args.code,
|
|
38
|
+
fresh: false,
|
|
39
|
+
skipRootCopy: true,
|
|
40
|
+
binaryPath,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const exitCode = await new Promise((resolve) => {
|
|
45
|
+
spawn("npm" + (process.platform === "win32" ? ".cmd" : ""), ["run", "start"], {
|
|
46
|
+
cwd: tempDir,
|
|
47
|
+
shell: true,
|
|
48
|
+
stdio: "inherit",
|
|
49
|
+
})
|
|
50
|
+
.on("exit", resolve)
|
|
51
|
+
.on("error", console.error);
|
|
52
|
+
});
|
|
53
|
+
if (exitCode !== 0) {
|
|
54
|
+
throw new Error("Non-zero exit code");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
console.error(typeof e === "object" && e !== null ? e.toString() : e);
|
|
59
|
+
console.error("Moonwave: It looks like something went wrong. Check the error output above.");
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,UAAU,CAAC,IAAU;IACjD,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,aAAa,EAAE,CAAA;QAExC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE;YACxE,SAAS,EAAE,IAAI,CAAC,IAAI;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU;SACX,CAAC,CAAA;QAEF,OAAO,CAAC,KAAK,CACX,qDAAqD,OAAO,EAAE,C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KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EACpD,CAAC,KAAK,EAAE,OAAO,CAAC,EAChB;gBACE,GAAG,EAAE,OAAO;gBACZ,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,SAAS;aACjB,CACF;iBACE,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;iBACnB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;QAEF,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAA;QACvC,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACrE,OAAO,CAAC,KAAK,CACX,6EAA6E,CAC9E,CAAA;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import path from "path";
|
|
3
|
+
export default function getDocusaurusConfig({ codePaths, enablePlugins, config, customCssExists, customSidebarExists, changelogExists, projectDir, binaryPath, classOrder, apiCategories, autoSectionPath, }) {
|
|
4
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
5
|
+
const gitRepoUrl = config.gitRepoUrl;
|
|
6
|
+
const validCodePaths = codePaths
|
|
7
|
+
.map((codePath) => path.join(process.cwd(), codePath))
|
|
8
|
+
.filter((codePath) => fs.existsSync(codePath));
|
|
9
|
+
return {
|
|
10
|
+
onBrokenLinks: "throw",
|
|
11
|
+
onBrokenMarkdownLinks: "warn",
|
|
12
|
+
url: `https://${(_a = config.docusaurus) === null || _a === void 0 ? void 0 : _a.organizationName}.github.io`,
|
|
13
|
+
...config.docusaurus,
|
|
14
|
+
customFields: {
|
|
15
|
+
bannerImage: (_b = config.home) === null || _b === void 0 ? void 0 : _b.bannerImage,
|
|
16
|
+
},
|
|
17
|
+
themeConfig: {
|
|
18
|
+
prism: {
|
|
19
|
+
additionalLanguages: [
|
|
20
|
+
"lua",
|
|
21
|
+
"bash",
|
|
22
|
+
"css",
|
|
23
|
+
"javascript",
|
|
24
|
+
"diff",
|
|
25
|
+
"git",
|
|
26
|
+
"json",
|
|
27
|
+
"typescript",
|
|
28
|
+
"toml",
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
navbar: {
|
|
32
|
+
...config.navbar,
|
|
33
|
+
items: [
|
|
34
|
+
...(enablePlugins.docs
|
|
35
|
+
? [
|
|
36
|
+
{
|
|
37
|
+
type: "doc",
|
|
38
|
+
docId: "intro",
|
|
39
|
+
position: "left",
|
|
40
|
+
label: "Docs",
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
: []),
|
|
44
|
+
...(enablePlugins.blog
|
|
45
|
+
? [{ to: "/blog", label: "Blog", position: "left" }]
|
|
46
|
+
: []),
|
|
47
|
+
...(validCodePaths.length > 0
|
|
48
|
+
? [{ to: "/api/", label: "API", position: "left" }]
|
|
49
|
+
: []),
|
|
50
|
+
...(changelogExists
|
|
51
|
+
? [{ to: "/changelog", label: "Changelog", position: "left" }]
|
|
52
|
+
: []),
|
|
53
|
+
...(((_c = config === null || config === void 0 ? void 0 : config.navbar) === null || _c === void 0 ? void 0 : _c.items) || []),
|
|
54
|
+
...(gitRepoUrl
|
|
55
|
+
? [
|
|
56
|
+
{
|
|
57
|
+
href: gitRepoUrl,
|
|
58
|
+
label: "GitLab",
|
|
59
|
+
position: "right",
|
|
60
|
+
},
|
|
61
|
+
]
|
|
62
|
+
: []),
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
footer: {
|
|
66
|
+
style: "dark",
|
|
67
|
+
copyright: `Copyright © ${new Date().getFullYear()} ${(_e = (_d = config.docusaurus) === null || _d === void 0 ? void 0 : _d.organizationName) !== null && _e !== void 0 ? _e : ""}. Built with Moonwave and Docusaurus.`,
|
|
68
|
+
...config.footer,
|
|
69
|
+
},
|
|
70
|
+
colorMode: {
|
|
71
|
+
respectPrefersColorScheme: true,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
plugins: [
|
|
75
|
+
[
|
|
76
|
+
"docusaurus-plugin-moonwave",
|
|
77
|
+
{
|
|
78
|
+
id: "moonwave",
|
|
79
|
+
code: validCodePaths,
|
|
80
|
+
sourceUrl: gitRepoUrl + `-/blob/${(_f = config.gitSourceBranch) !== null && _f !== void 0 ? _f : "main"}`,
|
|
81
|
+
projectDir,
|
|
82
|
+
classOrder,
|
|
83
|
+
apiCategories,
|
|
84
|
+
binaryPath,
|
|
85
|
+
autoSectionPath,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
"docusaurus-lunr-search",
|
|
89
|
+
],
|
|
90
|
+
presets: [
|
|
91
|
+
[
|
|
92
|
+
"@docusaurus/preset-classic",
|
|
93
|
+
{
|
|
94
|
+
docs: enablePlugins.docs
|
|
95
|
+
? {
|
|
96
|
+
// Please change this to your repo.
|
|
97
|
+
editUrl: gitRepoUrl
|
|
98
|
+
? `${gitRepoUrl}/-/edit/${(_g = config.gitSourceBranch) !== null && _g !== void 0 ? _g : "main"}/`
|
|
99
|
+
: undefined, // Omitting this variable entirely will disable edit links
|
|
100
|
+
sidebarCollapsible: true,
|
|
101
|
+
sidebarPath: customSidebarExists
|
|
102
|
+
? "./src/sidebars.js"
|
|
103
|
+
: undefined,
|
|
104
|
+
}
|
|
105
|
+
: false,
|
|
106
|
+
blog: enablePlugins.blog
|
|
107
|
+
? {
|
|
108
|
+
showReadingTime: true,
|
|
109
|
+
// Please change this to your repo.
|
|
110
|
+
editUrl: gitRepoUrl
|
|
111
|
+
? `${gitRepoUrl}/-/edit/${(_h = config.gitSourceBranch) !== null && _h !== void 0 ? _h : "main"}/`
|
|
112
|
+
: undefined, // Omitting this variable entirely will disable edit links
|
|
113
|
+
}
|
|
114
|
+
: false,
|
|
115
|
+
pages: {
|
|
116
|
+
path: "pages",
|
|
117
|
+
//exclude any file starting with an underscore
|
|
118
|
+
exclude: ["_*.*"],
|
|
119
|
+
},
|
|
120
|
+
theme: {
|
|
121
|
+
customCss: [
|
|
122
|
+
"src/css/moonwave.css",
|
|
123
|
+
...(customCssExists ? ["src/css/custom.css"] : []),
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
],
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=getDocusaurusConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDocusaurusConfig.js","sourceRoot":"","sources":["../src/getDocusaurusConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,IAAI,MAAM,MAAM,CAAA;AAiBvB,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,SAAS,EACT,aAAa,EACb,MAAM,EACN,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,UAAU,EACV,UAAU,EACV,aAAa,EACb,eAAe,GACM;;IACrB,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAA;IAEpC,MAAM,cAAc,GAAG,SAAS;SAC7B,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;SACrD,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEhD,OAAO;QACL,aAAa,EAAE,OAAO;QACtB,qBAAqB,EAAE,MAAM;QAC7B,GAAG,EAAE,WAAW,M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,EAAE,UAAU;gCACjB,CAAC,CAAC,GAAG,UAAU,WAAW,MAAA,MAAM,CAAC,eAAe,mCAAI,MAAM,GAAG;gCAC7D,CAAC,CAAC,SAAS,EAAE,0DAA0D;yBAC1E;wBACH,CAAC,CAAC,KAAK;oBACT,KAAK,EAAE;wBACL,IAAI,EAAE,OAAO;wBAEb,8CAA8C;wBAC9C,OAAO,EAAE,CAAC,MAAM,CAAC;qBAClB;oBACD,KAAK,EAAE;wBACL,SAAS,EAAE;4BACT,sBAAsB;4BACtB,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;yBACnD;qBACF;iBACF;aACF;SACF;KACF,CAAA;AACH,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,WAAW,CAAA"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import cachedir from "cachedir";
|
|
2
|
+
import { execSync } from "child_process";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import parseGitConfig from "parse-git-config";
|
|
5
|
+
import path, { dirname } from "path";
|
|
6
|
+
import toml from "toml";
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
8
|
+
import getDocusaurusConfig from "./getDocusaurusConfig.js";
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const TEMPLATE_PATH = path.join(__dirname, "../template");
|
|
11
|
+
const ROOT_PATH = path.join(TEMPLATE_PATH, "root");
|
|
12
|
+
const SNIP_BEFORE = "<!--moonwave-hide-before-this-line-->";
|
|
13
|
+
const SNIP_AFTER = "<!--moonwave-hide-after-this-line-->";
|
|
14
|
+
const INDEX_EXTS = ["html", "js", "mdx", "md"];
|
|
15
|
+
const COPY_FOLDERS = ["blog", "docs", "pages"];
|
|
16
|
+
const NO_README_TEXT = (title) => `# ${title}
|
|
17
|
+
This project doesn't have a README.
|
|
18
|
+
If it had a README.md in its root directory, you would be reading that right now.`;
|
|
19
|
+
const NO_GIT_REPO_TEXT = `# This project has no configured title
|
|
20
|
+
The site title is usually pulled from your Git repo, but no git repo could be detected.
|
|
21
|
+
Either set this project up as a Git repo, or configure the website title in moonwave.toml`;
|
|
22
|
+
function getGitRepoUrl() {
|
|
23
|
+
var _a, _b, _c, _d, _e, _f;
|
|
24
|
+
const gitConfig = parseGitConfig.sync();
|
|
25
|
+
if (gitConfig) {
|
|
26
|
+
if ((_b = (_a = gitConfig['remote "origin"']) === null || _a === void 0 ? void 0 : _a.url) === null || _b === void 0 ? void 0 : _b.includes("git@")) {
|
|
27
|
+
const [, repoHostSite, repoAuthor, repoName] = (_c = gitConfig['remote "origin"']) === null || _c === void 0 ? void 0 : _c.url.replace(/\.git$/, "").match(/^git@+(.+):(.+)\/(.+)$/);
|
|
28
|
+
return `https://${repoHostSite}/${repoAuthor}/${repoName}`;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
return (_f = (_e = (_d = gitConfig['remote "origin"']) === null || _d === void 0 ? void 0 : _d.url) === null || _e === void 0 ? void 0 : _e.replace(/\.git$/, "")) === null || _f === void 0 ? void 0 : _f.replace(/\/\/.*@/, "//"); // Strip out http basic auth if present
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function readConfig(projectDir) {
|
|
36
|
+
const configPath = path.join(projectDir, "moonwave");
|
|
37
|
+
if (fs.existsSync(configPath + ".toml")) {
|
|
38
|
+
return toml.parse(fs.readFileSync(configPath + ".toml", { encoding: "utf-8" }));
|
|
39
|
+
}
|
|
40
|
+
else if (fs.existsSync(configPath + ".json")) {
|
|
41
|
+
return fs.readJSONSync(configPath + ".json");
|
|
42
|
+
}
|
|
43
|
+
return {};
|
|
44
|
+
}
|
|
45
|
+
function getConfig(projectDir) {
|
|
46
|
+
var _a, _b, _c, _d, _e, _f;
|
|
47
|
+
const gitRepoUrl = getGitRepoUrl();
|
|
48
|
+
const [, repoAuthor, repoName] = (gitRepoUrl === null || gitRepoUrl === void 0 ? void 0 : gitRepoUrl.match(/^https?:\/\/.+\/(.+)\/(.+)$/)) || [];
|
|
49
|
+
const config = readConfig(projectDir);
|
|
50
|
+
// Note: Only copying values from other places in the config should go here.
|
|
51
|
+
// Default values for docusaurus.config.js belong in getDocusaurusConfig
|
|
52
|
+
return {
|
|
53
|
+
title: repoName,
|
|
54
|
+
gitRepoUrl: gitRepoUrl,
|
|
55
|
+
changelog: true,
|
|
56
|
+
...config,
|
|
57
|
+
docusaurus: {
|
|
58
|
+
projectName: repoName !== null && repoName !== void 0 ? repoName : undefined,
|
|
59
|
+
organizationName: repoAuthor !== null && repoAuthor !== void 0 ? repoAuthor : undefined,
|
|
60
|
+
title: (_b = (_a = config.title) !== null && _a !== void 0 ? _a : repoName) !== null && _b !== void 0 ? _b : "You need to configure your title",
|
|
61
|
+
baseUrl: repoName ? `/${repoName}/` : "/",
|
|
62
|
+
...config.docusaurus,
|
|
63
|
+
},
|
|
64
|
+
navbar: {
|
|
65
|
+
title: (_f = (_e = (_c = config.title) !== null && _c !== void 0 ? _c : (_d = config.docusaurus) === null || _d === void 0 ? void 0 : _d.title) !== null && _e !== void 0 ? _e : repoName) !== null && _f !== void 0 ? _f : "No Title",
|
|
66
|
+
...config.navbar,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function prepareReadme(readmeContent) {
|
|
71
|
+
while (true) {
|
|
72
|
+
const index_before = readmeContent.indexOf(SNIP_BEFORE);
|
|
73
|
+
const index_after = readmeContent.indexOf(SNIP_AFTER);
|
|
74
|
+
if (index_before > -1) {
|
|
75
|
+
if (index_after > -1 && index_after < index_before) {
|
|
76
|
+
// snip text between comments
|
|
77
|
+
readmeContent =
|
|
78
|
+
readmeContent.slice(0, index_after) +
|
|
79
|
+
readmeContent.slice(index_before + SNIP_BEFORE.length);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
// regular hide before
|
|
83
|
+
readmeContent = readmeContent.slice(index_before + SNIP_BEFORE.length);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else if (index_after > -1) {
|
|
87
|
+
// can only handle a lone hide-after if no hide-before
|
|
88
|
+
readmeContent = readmeContent.slice(0, index_after);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
return readmeContent;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function makeHomePage(projectDir, tempDir, config) {
|
|
96
|
+
var _a, _b, _c, _d, _e;
|
|
97
|
+
if (INDEX_EXTS.filter((ext) => fs.existsSync(path.join(projectDir, "pages", "index." + ext))).length === 0) {
|
|
98
|
+
fs.ensureDirSync(path.join(tempDir, "pages"));
|
|
99
|
+
INDEX_EXTS.forEach((ext) => fs.removeSync(path.join(tempDir, "pages", "index." + ext)));
|
|
100
|
+
if ((_a = config.home) === null || _a === void 0 ? void 0 : _a.enabled) {
|
|
101
|
+
const features = (_c = (_b = config.home) === null || _b === void 0 ? void 0 : _b.features) === null || _c === void 0 ? void 0 : _c.map((feature) => {
|
|
102
|
+
var _a;
|
|
103
|
+
if (feature.image && feature.image.startsWith("/")) {
|
|
104
|
+
feature.image = ((_a = config.docusaurus) === null || _a === void 0 ? void 0 : _a.baseUrl) + feature.image;
|
|
105
|
+
}
|
|
106
|
+
return feature;
|
|
107
|
+
});
|
|
108
|
+
let indexSource = fs
|
|
109
|
+
.readFileSync(path.join(TEMPLATE_PATH, "home", "index.js"), {
|
|
110
|
+
encoding: "utf-8",
|
|
111
|
+
})
|
|
112
|
+
.replace("/***features***/", JSON.stringify(features !== null && features !== void 0 ? features : null));
|
|
113
|
+
const readmePath = path.join(projectDir, typeof ((_d = config.home) === null || _d === void 0 ? void 0 : _d.includeReadme) === "string"
|
|
114
|
+
? config.home.includeReadme
|
|
115
|
+
: "README.md");
|
|
116
|
+
if (((_e = config.home) === null || _e === void 0 ? void 0 : _e.includeReadme) && fs.existsSync(readmePath)) {
|
|
117
|
+
fs.copyFileSync(readmePath, path.join(tempDir, "README.md"));
|
|
118
|
+
let readmeContent = fs.readFileSync(readmePath, { encoding: "utf-8" });
|
|
119
|
+
readmeContent = prepareReadme(readmeContent);
|
|
120
|
+
fs.writeFileSync(path.join(tempDir, "README.md"), readmeContent);
|
|
121
|
+
indexSource = 'import README from "../README.md"\n' + indexSource;
|
|
122
|
+
indexSource = indexSource.replace("{/***readme***/}", "<README />");
|
|
123
|
+
}
|
|
124
|
+
fs.writeFileSync(path.join(tempDir, "pages", "index.js"), indexSource);
|
|
125
|
+
fs.copyFileSync(path.join(TEMPLATE_PATH, "home", "index.module.css"), path.join(tempDir, "pages", "index.module.css"));
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
const indexPath = path.join(tempDir, "pages", "index.md");
|
|
129
|
+
const readmePath = path.join(projectDir, "README.md");
|
|
130
|
+
if (fs.existsSync(readmePath)) {
|
|
131
|
+
let readmeContent = fs.readFileSync(readmePath, { encoding: "utf-8" });
|
|
132
|
+
readmeContent = prepareReadme(readmeContent);
|
|
133
|
+
fs.writeFileSync(indexPath, readmeContent);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
const placeholderHomeText = config.title
|
|
137
|
+
? NO_README_TEXT(config.title)
|
|
138
|
+
: NO_GIT_REPO_TEXT;
|
|
139
|
+
fs.writeFileSync(indexPath, placeholderHomeText);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function copyChangelog(projectDir, tempDir, config) {
|
|
145
|
+
const changelogPath = path.join(projectDir, "CHANGELOG.md");
|
|
146
|
+
const targetPath = path.join(tempDir, "pages", "changelog.md");
|
|
147
|
+
if (config.changelog && fs.existsSync(changelogPath)) {
|
|
148
|
+
fs.ensureDirSync(path.join(tempDir, "pages"));
|
|
149
|
+
fs.copyFileSync(changelogPath, targetPath);
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
else if (fs.existsSync(targetPath)) {
|
|
153
|
+
fs.removeSync(targetPath);
|
|
154
|
+
}
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
function copyMoonwaveFolder(projectDir, tempDir) {
|
|
158
|
+
const staticDir = path.join(projectDir, ".moonwave", "static");
|
|
159
|
+
if (fs.existsSync(staticDir)) {
|
|
160
|
+
fs.copySync(staticDir, path.join(tempDir, "static"));
|
|
161
|
+
}
|
|
162
|
+
const status = { customCssExists: false, customSidebarExists: false };
|
|
163
|
+
const customCssPath = path.join(projectDir, ".moonwave", "custom.css");
|
|
164
|
+
if (fs.existsSync(customCssPath)) {
|
|
165
|
+
fs.copySync(customCssPath, path.join(tempDir, "src", "css", "custom.css"));
|
|
166
|
+
status.customCssExists = true;
|
|
167
|
+
}
|
|
168
|
+
const customSidebarsPath = path.join(projectDir, ".moonwave", "sidebars.js");
|
|
169
|
+
if (fs.existsSync(customSidebarsPath)) {
|
|
170
|
+
fs.copySync(customSidebarsPath, path.join(tempDir, "src", "sidebars.js"));
|
|
171
|
+
status.customSidebarExists = true;
|
|
172
|
+
}
|
|
173
|
+
return status;
|
|
174
|
+
}
|
|
175
|
+
function writeDocusaurusConfig(tempDir, params) {
|
|
176
|
+
const docusaurusConfigPath = path.join(tempDir, "./docusaurus.config.js");
|
|
177
|
+
const newDocusaurusConfig = "module.exports = " + JSON.stringify(getDocusaurusConfig(params), null, 2);
|
|
178
|
+
if (fs.existsSync(docusaurusConfigPath) &&
|
|
179
|
+
fs.readFileSync(docusaurusConfigPath, { encoding: "utf-8" }) ===
|
|
180
|
+
newDocusaurusConfig) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
fs.writeFileSync(docusaurusConfigPath, newDocusaurusConfig);
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function copyContentFolders(projectDir, tempDir) {
|
|
189
|
+
return Object.fromEntries(COPY_FOLDERS.map((folder) => {
|
|
190
|
+
const folderPath = path.join(projectDir, folder);
|
|
191
|
+
const targetPath = path.join(tempDir, folder);
|
|
192
|
+
if (fs.existsSync(folderPath)) {
|
|
193
|
+
fs.copySync(folderPath, targetPath);
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
}).map((wasFound, index) => [COPY_FOLDERS[index], wasFound]));
|
|
200
|
+
}
|
|
201
|
+
function needsCompleteRebuild(tempDir) {
|
|
202
|
+
if (process.env.MOONWAVE_DEV) {
|
|
203
|
+
// We do fancy things to package.json in dev mode, which causes this code to always think a rebuild is needed
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
if (!fs.existsSync(tempDir) ||
|
|
207
|
+
!fs.existsSync(path.join(tempDir, "package.json")) ||
|
|
208
|
+
!fs.existsSync(path.join(tempDir, "package-lock.json"))) {
|
|
209
|
+
console.log("Moonwave: package.json or package-lock.json does not exist, rebuilding...");
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
if (!fs
|
|
213
|
+
.readFileSync(path.join(ROOT_PATH, "package.json"))
|
|
214
|
+
.equals(fs.readFileSync(path.join(tempDir, "package.json")))) {
|
|
215
|
+
console.log("Moonwave: package.json differs from cached files, rebuilding...");
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
export function prepareProject(projectDir, options) {
|
|
221
|
+
var _a, _b, _c, _d;
|
|
222
|
+
const config = getConfig(projectDir);
|
|
223
|
+
const folderName = (_a = projectDir.split(path.sep).slice(-1)[0]) !== null && _a !== void 0 ? _a : "unknown";
|
|
224
|
+
const tempDir = path.join(cachedir("moonwave"), folderName);
|
|
225
|
+
if ((options.install && fs.existsSync(tempDir)) ||
|
|
226
|
+
needsCompleteRebuild(tempDir)) {
|
|
227
|
+
console.log(`Deleting ${tempDir} for complete re-install`);
|
|
228
|
+
fs.removeSync(tempDir);
|
|
229
|
+
}
|
|
230
|
+
else if (options.fresh && fs.existsSync(tempDir)) {
|
|
231
|
+
for (const file of fs
|
|
232
|
+
.readdirSync(tempDir)
|
|
233
|
+
.filter((name) => name !== "node_modules")) {
|
|
234
|
+
fs.removeSync(path.join(tempDir, file));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (!options.skipRootCopy) {
|
|
238
|
+
fs.copySync(ROOT_PATH, tempDir);
|
|
239
|
+
const moonwavePluginPath = process.env.MOONWAVE_PLUGIN_PATH;
|
|
240
|
+
if (process.env.MOONWAVE_DEV || moonwavePluginPath) {
|
|
241
|
+
console.log(`Moonwave: Using development Docusaurus plugin: ${process.env.MOONWAVE_PLUGIN_PATH || "../../docusaurus-plugin-moonwave"}`);
|
|
242
|
+
const packageJsonPath = path.join(tempDir, "package.json");
|
|
243
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
244
|
+
packageJson.dependencies["docusaurus-plugin-moonwave"] =
|
|
245
|
+
moonwavePluginPath
|
|
246
|
+
? path.resolve(process.cwd(), moonwavePluginPath)
|
|
247
|
+
: path.resolve(__dirname, "../../docusaurus-plugin-moonwave");
|
|
248
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// Create home page or copy readme
|
|
252
|
+
makeHomePage(projectDir, tempDir, config);
|
|
253
|
+
// Copy CHANGELOG.md if it exists
|
|
254
|
+
const changelogExists = copyChangelog(projectDir, tempDir, config);
|
|
255
|
+
const foundFolders = copyContentFolders(projectDir, tempDir);
|
|
256
|
+
const { customCssExists, customSidebarExists } = copyMoonwaveFolder(projectDir, tempDir);
|
|
257
|
+
const docusaurusConfigModified = writeDocusaurusConfig(tempDir, {
|
|
258
|
+
config,
|
|
259
|
+
enablePlugins: foundFolders,
|
|
260
|
+
customCssExists,
|
|
261
|
+
customSidebarExists,
|
|
262
|
+
codePaths: options.codePaths,
|
|
263
|
+
binaryPath: options.binaryPath,
|
|
264
|
+
changelogExists,
|
|
265
|
+
projectDir,
|
|
266
|
+
classOrder: (_b = config.classOrder) !== null && _b !== void 0 ? _b : [],
|
|
267
|
+
apiCategories: (_c = config.apiCategories) !== null && _c !== void 0 ? _c : [],
|
|
268
|
+
autoSectionPath: config.autoSectionPath,
|
|
269
|
+
});
|
|
270
|
+
if (!fs.existsSync(path.join(tempDir, "./node_modules")) ||
|
|
271
|
+
!fs.existsSync(path.join(tempDir, "./node_modules/.bin/docusaurus"))) {
|
|
272
|
+
console.log("Installing dependencies (this might take awhile)...");
|
|
273
|
+
execSync("npm i", {
|
|
274
|
+
cwd: tempDir,
|
|
275
|
+
stdio: "inherit",
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
docusaurusConfigModified,
|
|
280
|
+
tempDir,
|
|
281
|
+
projectDir,
|
|
282
|
+
watchPaths: [
|
|
283
|
+
path.join(projectDir, typeof ((_d = config.home) === null || _d === void 0 ? void 0 : _d.includeReadme) === "string"
|
|
284
|
+
? config.home.includeReadme
|
|
285
|
+
: "README.md"),
|
|
286
|
+
path.join(projectDir, "moonwave.toml"),
|
|
287
|
+
path.join(projectDir, "moonwave.json"),
|
|
288
|
+
path.join(projectDir, "CHANGELOG.md"),
|
|
289
|
+
path.join(projectDir, ".moonwave/"),
|
|
290
|
+
...Object.entries(foundFolders)
|
|
291
|
+
// .filter(([_folder, wasFound]) => wasFound)
|
|
292
|
+
.map(([folder]) => folder)
|
|
293
|
+
.map((folder) => path.join(projectDir, folder)),
|
|
294
|
+
],
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=prepareProject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareProject.js","sourceRoot":"","sources":["../src/prepareProject.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE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AC,qDAAqD,CAAC,CAAA;QAElE,QAAQ,CAAC,OAAO,EAAE;YAChB,GAAG,EAAE,OAAO;YACZ,KAAK,EAAE,SAAS;SACjB,CAAC,CAAA;IACJ,CAAC;IAED,OAAO;QACL,wBAAwB;QACxB,OAAO;QACP,UAAU;QACV,UAAU,EAAE;YACV,IAAI,CAAC,IAAI,CACP,UAAU,EACV,OAAO,CAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,aAAa,CAAA,KAAK,QAAQ;gBAC5C,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa;gBAC3B,CAAC,CAAC,WAAW,CAChB;YACD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC;YACtC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC;YACtC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC;YACrC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC;YACnC,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;gBAC7B,6CAA6C;iBAC5C,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC;iBACzB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;SAClD;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
package/src/binary.ts
CHANGED
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
import fs from "fs-extra"
|
|
2
|
-
import fetch from "node-fetch"
|
|
3
|
-
import os from "os"
|
|
4
|
-
import path, { dirname } from "path"
|
|
5
|
-
import unzipper from "unzipper"
|
|
6
|
-
import { fileURLToPath } from "url"
|
|
7
|
-
|
|
8
|
-
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
9
|
-
|
|
10
|
-
const packageConfig = fs.readJSONSync(path.join(__dirname, "../package.json"))
|
|
11
|
-
const version = packageConfig.version
|
|
12
|
-
|
|
13
|
-
const URL = `https://latest-github-release.eryn.io/evaera/moonwave
|
|
14
|
-
|
|
15
|
-
interface Asset {
|
|
16
|
-
name: string
|
|
17
|
-
content_type: string
|
|
18
|
-
browser_download_url: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface Release {
|
|
22
|
-
name: string
|
|
23
|
-
created_at: string
|
|
24
|
-
assets: Asset[]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function promisifyStream(
|
|
28
|
-
stream: fs.ReadStream | fs.WriteStream
|
|
29
|
-
): Promise<unknown> {
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
stream.on("close", resolve)
|
|
32
|
-
stream.on("finish", resolve)
|
|
33
|
-
stream.on("end", resolve)
|
|
34
|
-
stream.on("error", reject)
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function getBinaryExtension(): string {
|
|
39
|
-
if (os.platform() === "win32") {
|
|
40
|
-
return ".exe"
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return ""
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function getBinaryName(): string {
|
|
47
|
-
return `moonwave-extractor${getBinaryExtension()}`
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function getBinaryZipPattern(): RegExp | undefined {
|
|
51
|
-
switch (os.platform()) {
|
|
52
|
-
case "win32":
|
|
53
|
-
return /^moonwave-extractor(?:-|-.*-)win64.zip$/
|
|
54
|
-
case "darwin":
|
|
55
|
-
return /^moonwave-extractor(?:-|-.*-)macos.zip$/
|
|
56
|
-
case "linux":
|
|
57
|
-
return /^moonwave-extractor(?:-|-.*-)linux.zip$/
|
|
58
|
-
default:
|
|
59
|
-
return undefined
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async function downloadBinary(binaryPath: string) {
|
|
64
|
-
const result = await fetch(URL)
|
|
65
|
-
|
|
66
|
-
if (!result.ok) {
|
|
67
|
-
console.error("Raw response from API:", await result.text())
|
|
68
|
-
throw new Error(
|
|
69
|
-
`${result.status} ${result.statusText} - Could not fetch Moonwave binary`
|
|
70
|
-
)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const release = (await result.json()) as Release
|
|
74
|
-
|
|
75
|
-
console.log(
|
|
76
|
-
`Downloading moonwave-extractor from release ${release.name} released at ${release.created_at}`
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
const assets = release.assets
|
|
80
|
-
const zipPattern = getBinaryZipPattern()
|
|
81
|
-
|
|
82
|
-
if (!zipPattern) {
|
|
83
|
-
throw new Error(`Your platform is unsupported: ${os.platform}`)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const targetAsset = assets.find((asset) => asset.name.match(zipPattern))
|
|
87
|
-
|
|
88
|
-
if (!targetAsset) {
|
|
89
|
-
throw new Error("Release does not contain a binary for this platform")
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const download = await fetch(targetAsset.browser_download_url)
|
|
93
|
-
|
|
94
|
-
if (!download.body) {
|
|
95
|
-
throw new Error("Asset download body is null")
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const writeStream = fs.createWriteStream(binaryPath)
|
|
99
|
-
|
|
100
|
-
const unzip = download.body.pipe(
|
|
101
|
-
unzipper.ParseOne(new RegExp(getBinaryName()), {})
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
const file = unzip.pipe(writeStream)
|
|
105
|
-
|
|
106
|
-
await promisifyStream(file)
|
|
107
|
-
|
|
108
|
-
if (file.bytesWritten === 0) {
|
|
109
|
-
file.close()
|
|
110
|
-
fs.removeSync(binaryPath)
|
|
111
|
-
|
|
112
|
-
throw new Error("Write stream closed but zero bytes were written")
|
|
113
|
-
} else {
|
|
114
|
-
if (os.platform() !== "win32") {
|
|
115
|
-
fs.chmod(binaryPath, 0o755)
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export async function getBinaryPath() {
|
|
121
|
-
if (process.env.MOONWAVE_DEV) {
|
|
122
|
-
const extractorPath =
|
|
123
|
-
process.env.MOONWAVE_EXTRACTOR_PATH || "moonwave-extractor"
|
|
124
|
-
console.log(`Moonwave: Using development extractor path: ${extractorPath}`)
|
|
125
|
-
return extractorPath
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const binFolder = path.join(__dirname, "bin")
|
|
129
|
-
const binaryPath = path.join(
|
|
130
|
-
binFolder,
|
|
131
|
-
`moonwave-extractor-${version}${getBinaryExtension()}`
|
|
132
|
-
)
|
|
133
|
-
|
|
134
|
-
if (fs.existsSync(binaryPath)) {
|
|
135
|
-
return binaryPath
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
fs.ensureDirSync(binFolder)
|
|
139
|
-
|
|
140
|
-
await downloadBinary(binaryPath)
|
|
141
|
-
|
|
142
|
-
return binaryPath
|
|
143
|
-
}
|
|
1
|
+
import fs from "fs-extra"
|
|
2
|
+
import fetch from "node-fetch"
|
|
3
|
+
import os from "os"
|
|
4
|
+
import path, { dirname } from "path"
|
|
5
|
+
import unzipper from "unzipper"
|
|
6
|
+
import { fileURLToPath } from "url"
|
|
7
|
+
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
9
|
+
|
|
10
|
+
const packageConfig = fs.readJSONSync(path.join(__dirname, "../package.json"))
|
|
11
|
+
const version = packageConfig.version
|
|
12
|
+
|
|
13
|
+
const URL = `https://latest-github-release.eryn.io/evaera/moonwave/`
|
|
14
|
+
|
|
15
|
+
interface Asset {
|
|
16
|
+
name: string
|
|
17
|
+
content_type: string
|
|
18
|
+
browser_download_url: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface Release {
|
|
22
|
+
name: string
|
|
23
|
+
created_at: string
|
|
24
|
+
assets: Asset[]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function promisifyStream(
|
|
28
|
+
stream: fs.ReadStream | fs.WriteStream
|
|
29
|
+
): Promise<unknown> {
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
stream.on("close", resolve)
|
|
32
|
+
stream.on("finish", resolve)
|
|
33
|
+
stream.on("end", resolve)
|
|
34
|
+
stream.on("error", reject)
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getBinaryExtension(): string {
|
|
39
|
+
if (os.platform() === "win32") {
|
|
40
|
+
return ".exe"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return ""
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function getBinaryName(): string {
|
|
47
|
+
return `moonwave-extractor${getBinaryExtension()}`
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function getBinaryZipPattern(): RegExp | undefined {
|
|
51
|
+
switch (os.platform()) {
|
|
52
|
+
case "win32":
|
|
53
|
+
return /^moonwave-extractor(?:-|-.*-)win64.zip$/
|
|
54
|
+
case "darwin":
|
|
55
|
+
return /^moonwave-extractor(?:-|-.*-)macos.zip$/
|
|
56
|
+
case "linux":
|
|
57
|
+
return /^moonwave-extractor(?:-|-.*-)linux.zip$/
|
|
58
|
+
default:
|
|
59
|
+
return undefined
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function downloadBinary(binaryPath: string) {
|
|
64
|
+
const result = await fetch(URL)
|
|
65
|
+
|
|
66
|
+
if (!result.ok) {
|
|
67
|
+
console.error("Raw response from API:", await result.text())
|
|
68
|
+
throw new Error(
|
|
69
|
+
`${result.status} ${result.statusText} - Could not fetch Moonwave binary`
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const release = (await result.json()) as Release
|
|
74
|
+
|
|
75
|
+
console.log(
|
|
76
|
+
`Downloading moonwave-extractor from release ${release.name} released at ${release.created_at}`
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
const assets = release.assets
|
|
80
|
+
const zipPattern = getBinaryZipPattern()
|
|
81
|
+
|
|
82
|
+
if (!zipPattern) {
|
|
83
|
+
throw new Error(`Your platform is unsupported: ${os.platform}`)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const targetAsset = assets.find((asset) => asset.name.match(zipPattern))
|
|
87
|
+
|
|
88
|
+
if (!targetAsset) {
|
|
89
|
+
throw new Error("Release does not contain a binary for this platform")
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const download = await fetch(targetAsset.browser_download_url)
|
|
93
|
+
|
|
94
|
+
if (!download.body) {
|
|
95
|
+
throw new Error("Asset download body is null")
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const writeStream = fs.createWriteStream(binaryPath)
|
|
99
|
+
|
|
100
|
+
const unzip = download.body.pipe(
|
|
101
|
+
unzipper.ParseOne(new RegExp(getBinaryName()), {})
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
const file = unzip.pipe(writeStream)
|
|
105
|
+
|
|
106
|
+
await promisifyStream(file)
|
|
107
|
+
|
|
108
|
+
if (file.bytesWritten === 0) {
|
|
109
|
+
file.close()
|
|
110
|
+
fs.removeSync(binaryPath)
|
|
111
|
+
|
|
112
|
+
throw new Error("Write stream closed but zero bytes were written")
|
|
113
|
+
} else {
|
|
114
|
+
if (os.platform() !== "win32") {
|
|
115
|
+
fs.chmod(binaryPath, 0o755)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export async function getBinaryPath() {
|
|
121
|
+
if (process.env.MOONWAVE_DEV) {
|
|
122
|
+
const extractorPath =
|
|
123
|
+
process.env.MOONWAVE_EXTRACTOR_PATH || "moonwave-extractor"
|
|
124
|
+
console.log(`Moonwave: Using development extractor path: ${extractorPath}`)
|
|
125
|
+
return extractorPath
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const binFolder = path.join(__dirname, "bin")
|
|
129
|
+
const binaryPath = path.join(
|
|
130
|
+
binFolder,
|
|
131
|
+
`moonwave-extractor-${version}${getBinaryExtension()}`
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
if (fs.existsSync(binaryPath)) {
|
|
135
|
+
return binaryPath
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
fs.ensureDirSync(binFolder)
|
|
139
|
+
|
|
140
|
+
await downloadBinary(binaryPath)
|
|
141
|
+
|
|
142
|
+
return binaryPath
|
|
143
|
+
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@mdx-js/react": "^3.0.1",
|
|
14
14
|
"clsx": "^2.1.1",
|
|
15
15
|
"docusaurus-lunr-search": "^3.6.1",
|
|
16
|
-
"docusaurus-plugin-moonwave-gitlab": "^1.3.
|
|
16
|
+
"docusaurus-plugin-moonwave-gitlab": "^1.3.7",
|
|
17
17
|
"react": "^18.3.1",
|
|
18
18
|
"react-dom": "^18.3.1"
|
|
19
19
|
}
|
|
@@ -7324,9 +7324,9 @@
|
|
|
7324
7324
|
}
|
|
7325
7325
|
},
|
|
7326
7326
|
"node_modules/docusaurus-plugin-moonwave-gitlab": {
|
|
7327
|
-
"version": "1.3.
|
|
7328
|
-
"resolved": "https://registry.npmjs.org/docusaurus-plugin-moonwave-gitlab/-/docusaurus-plugin-moonwave-gitlab-1.3.
|
|
7329
|
-
"integrity": "sha512-
|
|
7327
|
+
"version": "1.3.7",
|
|
7328
|
+
"resolved": "https://registry.npmjs.org/docusaurus-plugin-moonwave-gitlab/-/docusaurus-plugin-moonwave-gitlab-1.3.7.tgz",
|
|
7329
|
+
"integrity": "sha512-fbVpeGELIgLCHcB8G59YlJy8nGj7uKDrLV7wBztyFo+ZXo/PYFoVUdZxusNJ9rbIEu1vnjI9Us3baKQnV15SBw==",
|
|
7330
7330
|
"license": "MIT",
|
|
7331
7331
|
"dependencies": {
|
|
7332
7332
|
"@mapbox/rehype-prism": "^0.9.0",
|