create-nhdemo-app
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -5,2 +5,3 @@ #! /usr/bin/env node | ||
const inquirer = require("inquirer"); | ||
const fs = require("fs"); | ||
@@ -21,4 +22,23 @@ const cmdRunner = (command) => { | ||
const cleanunRepo = (projectName) => | ||
`cd ${projectName} && rm README.md && rm -rf diff && cp -r with-create-react-app/* . && rm -rf with-create-react-app`; | ||
`cd ${projectName} && rm README.md && rm -rf diff && cp -rf with-create-react-app/. . && rm -rf with-create-react-app`; | ||
const replaceAppIdInFile = (projectName, appId) => { | ||
const file = `${projectName}/.env`; | ||
fs.readFileSync(file, "utf8", function (err, data) { | ||
if (err) { | ||
return console.log(err); | ||
} | ||
var updated = data.replace( | ||
/REACT_APP_ASTEROIDKIT_APPID=123/g, | ||
`REACT_APP_ASTEROIDKIT_APPID=${appId}` | ||
); | ||
fs.writeFile(file, updated, "utf8", function (err) { | ||
if (err) return console.log(err); | ||
}); | ||
}); | ||
}; | ||
const run = async () => { | ||
@@ -34,2 +54,8 @@ console.log(cyan("Welcome to AsteroidKit!")); | ||
}, | ||
{ | ||
type: "input", | ||
name: "appId", | ||
message: "What is the app id? (leave blank for none)", | ||
default: "", | ||
}, | ||
]); | ||
@@ -43,9 +69,21 @@ | ||
const clean = cmdRunner(cleanunRepo(answers.projectName)); | ||
const install = cmdRunner(npmInstallCmd(answers.projectName)); | ||
if (!clean || !install) process.exit(1); | ||
// const install = cmdRunner(npmInstallCmd(answers.projectName)); | ||
// if (!clean || !install) process.exit(1); | ||
console.log(green("Your project is ready!")); | ||
if (answers.appId != "") { | ||
console.log(magenta("Finishing app configuration")); | ||
const config = cmdRunner( | ||
`cd ${answers.projectName} && perl -pi -e 's/REACT_APP_ASTEROIDKIT_APPID=123/REACT_APP_ASTEROIDKIT_APPID=${answers.appId}/g' $PWD/.env` | ||
); | ||
if (!config) process.exit(1); | ||
} | ||
console.log(green("Your Asteroidkit project is ready!")); | ||
console.log( | ||
green("To run your project cd into the directory and run with npm start.") | ||
green("To run the project cd into the directory and run with npm start:") | ||
); | ||
console.log(green("")); | ||
console.log(green("cd " + answers.projectName + " && npm start")); | ||
console.log(green("")); | ||
console.log( | ||
@@ -52,0 +90,0 @@ green("If necessary, go to our docs at: https://docs.asteroidkit.com") |
{ | ||
"name": "create-nhdemo-app", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
3070
77
1
2