create-solidbase-app
Advanced tools
+158
-93
@@ -10,109 +10,174 @@ #!/usr/bin/env node | ||
| const stackName = "SolidBase"; | ||
| let firebaseSetup = false; | ||
| figlet(stackName, (err, data) => { | ||
| console.log(gradient.pastel.multiline(data)); | ||
| initPrompt(); | ||
| console.log(gradient.pastel.multiline(data)); | ||
| initPrompt(); | ||
| }); | ||
| function initPrompt() { | ||
| inquirer.prompt({ | ||
| name: "name", | ||
| type: "input", | ||
| message: " Project Name:" | ||
| inquirer | ||
| .prompt({ | ||
| name: "name", | ||
| type: "input", | ||
| message: " Project Name:", | ||
| }) | ||
| .then(answers => { | ||
| let projectName = answers["name"]; | ||
| promptYesNo(" Would you like to initialize Solid Router?") | ||
| .then((confirmation) => { | ||
| if (confirmation) { | ||
| const templates = ["https://github.com/jehaad1/SolidBase-Template1", "https://github.com/jehaad1/SolidBase-Template2"]; | ||
| console.log(chalk.green("\n Alright! We will initialize Solid Router for you.\n")); | ||
| initFirebase(templates, projectName); | ||
| } else { | ||
| const templates = ["https://github.com/jehaad1/SolidBase-Template3", "https://github.com/jehaad1/SolidBase-Template4"]; | ||
| console.log(chalk.green("\n Got it! We won't initialize Solid Router at this time.\n")); | ||
| initFirebase(templates, projectName); | ||
| }; | ||
| }).catch((err) => { | ||
| console.log(chalk.red(` ${err}`)); | ||
| }); | ||
| .then((answers) => { | ||
| let projectName = answers["name"]; | ||
| promptYesNo(" Would you like to initialize Solid Router?") | ||
| .then((confirmation) => { | ||
| if (confirmation) { | ||
| const templates = [ | ||
| "https://github.com/jehaad1/SolidBase-Template1", | ||
| "https://github.com/jehaad1/SolidBase-Template2", | ||
| ]; | ||
| console.log( | ||
| chalk.green( | ||
| "\n Alright! We will initialize Solid Router for you.\n" | ||
| ) | ||
| ); | ||
| initFirebase(templates, projectName); | ||
| } else { | ||
| const templates = [ | ||
| "https://github.com/jehaad1/SolidBase-Template3", | ||
| "https://github.com/jehaad1/SolidBase-Template4", | ||
| ]; | ||
| console.log( | ||
| chalk.green( | ||
| "\n Got it! We won't initialize Solid Router at this time.\n" | ||
| ) | ||
| ); | ||
| initFirebase(templates, projectName); | ||
| } | ||
| }) | ||
| .catch((err) => { | ||
| console.log( | ||
| chalk.red("\n ", err.split("\n").join("\n ")) | ||
| ); | ||
| }); | ||
| }; | ||
| }); | ||
| } | ||
| function createTemplateFiles(templateLink, projectName) { | ||
| exec(`git clone ${templateLink} ${projectName}`, (error, stdout) => { | ||
| if (error) { | ||
| console.log(chalk.red("\n ✖ Failed to clone the template.")); | ||
| console.log(chalk.red(` ${error.message}`)); | ||
| } else { | ||
| if (projectName === ".") console.log(chalk.green("\n ✔ Template cloned successfully!\n")) | ||
| else console.log(chalk.green("\n ✔ Template cloned successfully! Go to it by running ") + chalk.bgGray.bold(` cd ${projectName} `) + "\n"); | ||
| console.log(stdout); | ||
| exec(`git clone ${templateLink} ${projectName}`, (error) => { | ||
| if (error) { | ||
| console.log(chalk.red("\n ✖ Failed to clone the template.")); | ||
| console.log( | ||
| chalk.red(` ${error.message.split("\n").join("\n ")}`) | ||
| ); | ||
| } else { | ||
| console.log(chalk.green("\n ✔ Template cloned successfully!\n")); | ||
| promptYesNo(" Do you want us to install the dependencies for you?") | ||
| .then((confirmation) => { | ||
| if (confirmation) { | ||
| console.log( | ||
| chalk.green( | ||
| "\n Awesome! give us some time to install the dependencies." | ||
| ) | ||
| ); | ||
| console.log( | ||
| "\n " + chalk.bgGreen.bold(" Installing dependencies... ") | ||
| ); | ||
| exec( | ||
| projectName !== "." ? `cd ${projectName} && npm i` : "npm i", | ||
| (error, stdout) => { | ||
| if (error) { | ||
| console.log( | ||
| chalk.red("\n ✖ Failed to install the dependencies.") | ||
| ); | ||
| console.log(chalk.red(` ${error.message}`)); | ||
| } else { | ||
| console.log( | ||
| chalk.green( | ||
| "\n ✔ Dependencies installed successfully!" | ||
| ) | ||
| ); | ||
| console.log(stdout.split("\n").join("\n ")); | ||
| if (projectName === ".") | ||
| console.log( | ||
| chalk.green( | ||
| "\n " + chalk.bgGray.bold(` npm start `) + "\n" | ||
| ) | ||
| ); | ||
| else | ||
| console.log( | ||
| chalk.green("\n Run your project: ") + | ||
| "\n " + | ||
| chalk.bgGray.bold(` cd ${projectName} `) + | ||
| "\n " + | ||
| chalk.bgGray.bold(` npm start `) + | ||
| "\n" | ||
| ); | ||
| end(); | ||
| } | ||
| } | ||
| ); | ||
| } else { | ||
| if (projectName === ".") { | ||
| console.log( | ||
| chalk.green("\n Never mind! You can still run: ") + | ||
| chalk.bgGray.bold(" npm i ") + | ||
| chalk.green(" later to install them.\n") | ||
| ); | ||
| } else { | ||
| console.log( | ||
| chalk.green("\n Never mind! You can still run: ") + | ||
| "\n " + | ||
| chalk.bgGray.bold(` cd ${projectName} `) + | ||
| "\n " + | ||
| chalk.bgGray.bold(` npm i `) + | ||
| chalk.green("\n to install them.\n") | ||
| ); | ||
| } | ||
| end(); | ||
| } | ||
| }) | ||
| .catch((err) => { | ||
| console.log( | ||
| chalk.red("\n ", err.split("\n").join("\n ")) | ||
| ); | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| promptYesNo(" Do you want us to install the dependencies for you?") | ||
| .then((confirmation) => { | ||
| if (confirmation) { | ||
| console.log(chalk.green("\n Awesome! give us some time to install the dependencies.")); | ||
| console.log("\n " + chalk.bgGreen.bold(" Installing dependencies... ")); | ||
| exec(projectName !== "." ? `cd ${projectName} && npm i` : "npm i", (error, stdout) => { | ||
| if (error) { | ||
| console.log(chalk.red("\n ✖ Failed to install the dependencies.")); | ||
| console.log(chalk.red(` ${error.message}`)); | ||
| } else { | ||
| console.log(chalk.green("\n ✔ Dependencies installed successfully!")); | ||
| console.log(stdout); | ||
| end(); | ||
| }; | ||
| }); | ||
| } else { | ||
| if (projectName === ".") { | ||
| console.log(chalk.green("\n Never mind! You can still run ") + chalk.bgGray.bold(" npm i ") + chalk.green(" later to install them.\n")); | ||
| } else { | ||
| console.log(chalk.green("\n Never mind! You can still run:") + "\n " + chalk.bgGray.bold(` cd ${projectName} `) + "\n " + chalk.bgGray.bold(` npm i${" ".repeat(projectName.length)}`) + chalk.green("\n to install them.\n")); | ||
| } end(); | ||
| }; | ||
| }).catch((err) => { | ||
| console.log(chalk.red("\n ", err)); | ||
| }); | ||
| }; | ||
| }); | ||
| }; | ||
| async function promptYesNo(message) { | ||
| const question = { | ||
| name: "confirmation", | ||
| type: "confirm", | ||
| message, | ||
| default: true | ||
| }; | ||
| const question = { | ||
| name: "confirmation", | ||
| type: "confirm", | ||
| message, | ||
| default: true, | ||
| }; | ||
| const answer = await inquirer.prompt(question); | ||
| return answer.confirmation; | ||
| }; | ||
| const answer = await inquirer.prompt(question); | ||
| return answer.confirmation; | ||
| } | ||
| async function initFirebase(templates, projectName) { | ||
| promptYesNo(" Would you like to set up Firebase Cloud Firestore and Auth?") | ||
| .then((confirmation) => { | ||
| if (confirmation) { | ||
| console.log(chalk.green("\n Alright! We will set up firebase for you.\n")); | ||
| firebaseSetup = true; | ||
| createTemplateFiles(templates[0], projectName); | ||
| } else { | ||
| console.log(chalk.green("\n No problem! We will configure Firebase without setting it up.\n")); | ||
| createTemplateFiles(templates[1], projectName); | ||
| }; | ||
| }).catch((err) => { | ||
| console.log(chalk.red("\n ", err)); | ||
| }); | ||
| }; | ||
| promptYesNo( | ||
| " Would you like to set up Firebase Cloud Firestore and Auth?" | ||
| ) | ||
| .then((confirmation) => { | ||
| if (confirmation) { | ||
| console.log( | ||
| chalk.green("\n Alright! We will set up firebase for you.\n") | ||
| ); | ||
| createTemplateFiles(templates[0], projectName); | ||
| } else { | ||
| console.log( | ||
| chalk.green( | ||
| "\n No problem! We will configure Firebase without setting it up.\n" | ||
| ) | ||
| ); | ||
| createTemplateFiles(templates[1], projectName); | ||
| } | ||
| }) | ||
| .catch((err) => { | ||
| console.log(chalk.red("\n ", err)); | ||
| }); | ||
| } | ||
| function end() { | ||
| if (firebaseSetup) { | ||
| console.log("\n " + chalk.yellow.bold("Firebase Tip:")); | ||
| console.log(" " + chalk.yellow("We have set up Firebase Cloud Firestore and Auth in the template, but you need to set up the Firebase project in the Firebase Console.")); | ||
| console.log(" " + chalk.yellow("Follow these steps to set up the Firebase project: https://github.com/jehaad1/SolidBase/blob/main/FirebaseSetup.md\n")); | ||
| }; | ||
| console.log("\n " + chalk.blue.bold("Made with ❤️ by Jehaad.")); | ||
| console.log(chalk.blue(" SolidBase: https://github.com/jehaad1/SolidBase")); | ||
| }; | ||
| console.log("\n " + chalk.blue.bold("Made with ❤️ by Jehaad.")); | ||
| console.log( | ||
| chalk.blue(" SolidBase: https://github.com/jehaad1/SolidBase") | ||
| ); | ||
| } |
+1
-1
| { | ||
| "name": "create-solidbase-app", | ||
| "version": "2.0.2", | ||
| "version": "2.1.0", | ||
| "description": "Building a scalable frontend app made easy.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
7044
4%174
64.15%3
50%