Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

Commit bbe53c6

Browse files
committed
✨ simplified the setup
added more instructions updated dependencies
1 parent 83ab914 commit bbe53c6

File tree

7 files changed

+47
-26
lines changed

7 files changed

+47
-26
lines changed

bin/create-chartbrew-app

100644100755
File mode changed.

create-chartbrew-app.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const commander = require('commander');
22
const fs = require("fs");
33
const chalk = require("chalk");
44
const prompts = require("prompts");
5+
const { nanoid } = require("nanoid");
56

67
const packageJson = require('./package.json');
78
const createDirectory = require("./utils/createProjectFolder");
@@ -80,7 +81,8 @@ function setTheVars() {
8081
console.log(" ");
8182
showPrompts()
8283
.then((answers) => {
83-
installation(answers);
84+
// also insert a unique string for the internal data encryption
85+
installation({ ...answers, cbsecret: nanoid() });
8486
})
8587
.catch((err) => {
8688
console.error(err);
@@ -96,6 +98,9 @@ function installation(answers) {
9698
process.exit(1);
9799
}
98100

101+
console.log(" ");
102+
console.log("Fetching the project files...")
103+
console.log(" ");
99104
createDirectory(projectName);
100105
fetchProject(projectName)
101106
.then(() => {

package-lock.json

Lines changed: 32 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"chalk": "^2.4.2",
2626
"child-process-promise": "^2.2.1",
2727
"commander": "^4.1.1",
28+
"nanoid": "^3.3.2",
2829
"ncp": "^2.0.0",
2930
"node-7z": "^2.1.2",
3031
"prompts": "^2.4.0",

utils/endInfo.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ module.exports = (program, projectName) => {
88
console.log(chalk.bold(`If there are any database errors, make sure you have a database named '${program.dbname}'`));
99
console.log(chalk.bold(`Also, make sure the env variables in ${chalk.blue.bold(projectName + "/.env")} are set, then run: `));
1010
console.log(" ");
11-
console.log(chalk.blue.bold(`cd ${projectName}/server && npm run db:migrate`));
11+
console.log("https://docs.chartbrew.com/#environmental-variables")
1212
}
1313
console.log(" ");
1414

15-
console.log(chalk.green.bold("Next steps:"));
15+
console.log(chalk.green.bold("Start Chartbrew:"));
1616
console.log(" ");
17-
console.log("To run in development: ");
18-
console.log(`Run the client app: ${chalk.blue.bold("cd client && npm run start")}`);
19-
console.log(`Run the server app: ${chalk.blue.bold("cd server && npm run start-dev")}`);
17+
console.log(chalk.bold("To run in development, open two terminals and run: "));
18+
console.log(`Terminal 1: ${chalk.blue.bold("cd client && npm run start")}`);
19+
console.log(`Terminal 2: ${chalk.blue.bold("cd server && npm run start-dev")}`);
2020
console.log(" ");
2121

22-
console.log("To deploy your app in production:");
23-
console.log(`${chalk.blue("Visit the documentation for instructions: ")} https://docs.chartbrew.com/deployment/`);
22+
console.log(chalk.bold("Learn how to deploy your app in production:"));
23+
console.log("https://docs.chartbrew.com/deployment/");
2424
console.log(" ");
2525

2626
console.log(chalk.green.bold("Thank you for using Chartbrew!"));

utils/setupProject.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ const { spawnSync } = require("child_process");
33
module.exports = (projectName) => {
44
console.log("Setting up the project...");
55
const npm = spawnSync(`cd ${projectName} && npm run`, ["setup"], { shell: true, stdio: 'inherit' });
6+
const git = spawnSync(`cd ${projectName} && git init`, ["."], { shell: true, stdio: 'inherit' });
67
};

utils/showPrompts.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ module.exports = () => {
3131
type: "text",
3232
name: "dbport",
3333
message: "On which port is your database running? (default: '3306')",
34-
}, {
35-
type: "text",
36-
name: "cbsecret",
37-
message: "Add a secret string to secure your user sessions and encrypt the data:",
3834
}];
3935

4036
return prompts(questions);

0 commit comments

Comments
 (0)