mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 23:57:22 +02:00
Add docusaurus-init package and update copy-examples.js (#70)
* Add docusaurus-init package and update copy-examples.js * Use yarn by default
This commit is contained in:
parent
f803dcbc8e
commit
b88d4ac014
4 changed files with 94 additions and 0 deletions
|
@ -176,6 +176,7 @@ if (feature === "translations") {
|
|||
}
|
||||
const containingFolder = path.basename(path.dirname(file));
|
||||
if (
|
||||
path.basename(file) === "gitignore" ||
|
||||
containingFolder === "blog-examples-from-docusaurus" ||
|
||||
containingFolder === "docs-examples-from-docusaurus"
|
||||
) {
|
||||
|
@ -205,3 +206,28 @@ if (feature === "translations") {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
// add scripts to package.json file
|
||||
if (fs.existsSync(CWD + "/package.json")) {
|
||||
const packageContent = JSON.parse(
|
||||
fs.readFileSync(CWD + "/package.json", "utf8")
|
||||
);
|
||||
if (!packageContent.scripts) {
|
||||
packageContent.scripts = {};
|
||||
}
|
||||
packageContent.scripts["start"] = "docusaurus-start";
|
||||
packageContent.scripts["build"] = "docusaurus-build";
|
||||
packageContent.scripts["publish-gh-pages"] = "docusaurus-publish";
|
||||
packageContent.scripts["examples"] = "docusaurus-examples";
|
||||
packageContent.scripts["write-translations"] =
|
||||
"docusaurus-write-translations";
|
||||
packageContent.scripts["version"] = "docusaurus-version";
|
||||
packageContent.scripts["rename-version"] = "docusaurus-rename-version";
|
||||
fs.writeFileSync(
|
||||
CWD + "/package.json",
|
||||
JSON.stringify(packageContent, null, 2)
|
||||
);
|
||||
console.log(
|
||||
`${chalk.green("Wrote docusaurus scripts to package.json file.")}\n`
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue