Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@docs.page/cli

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@docs.page/cli - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

89

dist/cli.js

@@ -85,2 +85,3 @@ #!/usr/bin/env node

import chalk2 from "chalk";
import { confirm } from "@inquirer/prompts";
function registerInitCommand(program2) {

@@ -90,14 +91,28 @@ program2.command("init").description("Initializes new docs.page files").argument("[path]", "Path to the relative directory to initilize in.").action((input, o) => __async(this, null, function* () {

const absolutePath = path2.resolve(relativePath);
if (!fs2.existsSync(absolutePath)) {
console.log(
chalk2.red(
`Directory "${chalk2.yellow(absolutePath)}" does not exist.`
)
);
const confirmSetup = yield confirm({
message: `Are you sure you want to setup and install docs.page in ${chalk2.yellow(
absolutePath
)}?`,
default: true
});
if (!confirmSetup) {
console.log(chalk2.red("Initialization cancelled."));
process.exit(1);
}
console.log(chalk2.green("Initializing docs.page files..."));
let confirmOverwrite = false;
if (fs2.existsSync(absolutePath)) {
confirmOverwrite = yield confirm({
message: `Directory "${chalk2.yellow(
absolutePath
)}" already exists. Do you want to overwrite any existing files?`,
default: true
});
}
if (!fs2.existsSync) {
fs2.mkdirSync(absolutePath, { recursive: true });
}
const configurationFilePath = path2.join(absolutePath, "docs.json");
const documentationPath = path2.join(absolutePath, "docs");
if (fs2.existsSync(configurationFilePath)) {
const docsDirectoryExists = fs2.existsSync(documentationPath);
if (fs2.existsSync(configurationFilePath) && !confirmOverwrite) {
console.log(

@@ -108,2 +123,11 @@ chalk2.red("Configuration file 'docs.json' already exists.")

}
if (docsDirectoryExists && !confirmOverwrite) {
console.log(
chalk2.red("Documentation directory 'docs/' already exists.")
);
process.exit(1);
}
if (!docsDirectoryExists) {
fs2.mkdirSync(documentationPath, { recursive: true });
}
const createdFiles = [

@@ -114,35 +138,23 @@ ` - ${chalk2.green(

];
const docsDirectoryExists = fs2.existsSync(documentationPath);
if (docsDirectoryExists) {
console.log(
chalk2.yellow(
"A 'docs/' directory already exists, this command will not overwrite existing files."
)
);
} else {
fs2.mkdirSync(documentationPath, { recursive: true });
}
fs2.writeFileSync(
configurationFilePath,
jsonConfiguration({
sidebar: !docsDirectoryExists
sidebar: true
})
);
if (!docsDirectoryExists) {
fs2.writeFileSync(path2.join(documentationPath, "index.mdx"), indexPage);
createdFiles.push(
` - ${chalk2.green(
"docs/index.mdx"
)}: The home page of your documentation site`
);
fs2.writeFileSync(
path2.join(documentationPath, "next-steps.mdx"),
nextStepsPage
);
createdFiles.push(
` - ${chalk2.green(
"docs/next-steps.mdx"
)}: A page to help you get started with docs.page`
);
}
fs2.writeFileSync(path2.join(documentationPath, "index.mdx"), indexPage);
fs2.writeFileSync(
path2.join(documentationPath, "next-steps.mdx"),
nextStepsPage
);
createdFiles.push(
` - ${chalk2.green(
"docs/index.mdx"
)}: The home page of your documentation site`
);
createdFiles.push(
` - ${chalk2.green(
"docs/next-steps.mdx"
)}: A page to help you get started with docs.page`
);
console.log(chalk2.green("Files created:"));

@@ -152,5 +164,4 @@ console.log(createdFiles.join("\n"));

console.log(
chalk2.green(
"Initialization complete. To preview your documentation site, vist https://docs.page/preview in your browser."
)
chalk2.green("Initialization complete."),
"To preview your documentation site, vist https://docs.page/preview in your browser."
);

@@ -157,0 +168,0 @@ }));

{
"name": "@docs.page/cli",
"version": "1.0.3",
"version": "1.0.4",
"author": "Invertase <oss@invertase.io> (http://invertase.io)",

@@ -32,2 +32,3 @@ "license": "Apache-2.0",

"dependencies": {
"@inquirer/prompts": "^5.3.8",
"chalk": "^5.3.0",

@@ -34,0 +35,0 @@ "commander": "^12.1.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc