create-fs-app 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -8
- package/assets/logo.png +0 -0
- package/assets/s1.png +0 -0
- package/assets/s2.png +0 -0
- package/create-fs-app.js +138 -138
- package/package-lock.json +1408 -0
- package/package.json +33 -33
package/README.md
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+

|
|
2
|
+
<img src="./assets/logo.png">
|
|
3
|
+
Create Full Stack apps with no build configuration.
|
|
4
|
+
|
|
5
|
+
- [Creating an App](#creating-an-app) – How to create a new app.
|
|
6
|
+
Create fs App works on macOS, Windows, and Linux.<br>
|
|
7
|
+
If something doesn’t work, please [file an issue](https://github.com/Om-jannu/create-fs-app/issues/new).<br>
|
|
8
|
+
|
|
9
|
+
## Quick Overview
|
|
10
|
+
```sh
|
|
11
|
+
npx create-fs-app my-app
|
|
12
|
+
cd my-app
|
|
13
|
+
```
|
|
14
|
+
If you've previously installed `create-fs-app` globally via `npm install -g create-fs-app`, we recommend you uninstall the package using `npm uninstall -g create-fs-app` or `yarn global remove create-fs-app` to ensure that npx always uses the latest version.
|
|
15
|
+
|
|
16
|
+
_([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) is a package runner tool that comes with npm 5.2+ and higher, see [instructions for older npm versions](https://gist.github.com/gaearon/4064d3c23a77c74a3614c498a8bb1c5f))_
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<img src="./assets/s1.png">
|
|
20
|
+
</p>
|
|
21
|
+
<p align="center">
|
|
22
|
+
<img src="./assets/s2.png">
|
|
23
|
+
</p>
|
package/assets/logo.png
ADDED
|
Binary file
|
package/assets/s1.png
ADDED
|
Binary file
|
package/assets/s2.png
ADDED
|
Binary file
|
package/create-fs-app.js
CHANGED
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import child_process from "child_process";
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
6
|
-
import chalk from 'chalk';
|
|
7
|
-
import chalkAnimation from 'chalk-animation';
|
|
8
|
-
import inquirer from 'inquirer';
|
|
9
|
-
import { createSpinner } from 'nanospinner';
|
|
10
|
-
import figlet from 'figlet';
|
|
11
|
-
import gradient from 'gradient-string';
|
|
12
|
-
|
|
13
|
-
let appName = process.argv[2];
|
|
14
|
-
const currentDirectory = process.cwd();
|
|
15
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
-
// git repository
|
|
17
|
-
const mernGitRepo = "https://github.com/Om-jannu/mern-template.git";
|
|
18
|
-
|
|
19
|
-
//sleep function
|
|
20
|
-
const sleep = (ms = 1000) => new Promise((r) => setTimeout(r, ms));
|
|
21
|
-
const installMyPackage = async() =>{
|
|
22
|
-
child_process.execSync('npm i create-fs-app -g');
|
|
23
|
-
}
|
|
24
|
-
// welcome function
|
|
25
|
-
const welcome = async () => {
|
|
26
|
-
const msg = "create-fs-app";
|
|
27
|
-
const welcomeMsg = figlet(msg, (err, data) => {
|
|
28
|
-
console.log(gradient.pastel.multiline(data));
|
|
29
|
-
})
|
|
30
|
-
welcomeMsg;
|
|
31
|
-
await sleep();
|
|
32
|
-
console.log(`
|
|
33
|
-
I am your personal FullStack template generator
|
|
34
|
-
I can create Full Stack Templates for you ${chalk.green('in seconds')}😉
|
|
35
|
-
Let's get started...
|
|
36
|
-
`);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// qns function
|
|
40
|
-
const askFsName = async () => {
|
|
41
|
-
const answers = await inquirer.prompt({
|
|
42
|
-
name: "fs_app",
|
|
43
|
-
type: 'list',
|
|
44
|
-
message: 'Which FullStack App do you want to build?',
|
|
45
|
-
choices: [
|
|
46
|
-
'MERN app',
|
|
47
|
-
'MEAN app',
|
|
48
|
-
'MEVN app',
|
|
49
|
-
],
|
|
50
|
-
});
|
|
51
|
-
return handleAnswer(answers.fs_app);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
//completion screen
|
|
55
|
-
const completion = async () => {
|
|
56
|
-
const completion_msg = chalkAnimation.rainbow(
|
|
57
|
-
'\nSuccesfully created your Full Stack Template'
|
|
58
|
-
);
|
|
59
|
-
await sleep();
|
|
60
|
-
completion_msg.stop();
|
|
61
|
-
console.log(chalk.bold.yellow('To access your folder :'));
|
|
62
|
-
console.log(chalk.bold.blue(`cd ${(appName=='.')?currentDirectory:appName}`));
|
|
63
|
-
console.log(chalk.bold.blue('code .'));
|
|
64
|
-
console.log(chalk.bold.yellow(`\nNOTE : ${chalk.bold.blue('code .')} is for opening folder in ${chalk.bold.blue('vs-code')} for different IDE use different Keyword`));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// answer handler
|
|
68
|
-
const handleAnswer = async (fs_app) => {
|
|
69
|
-
const spinner = createSpinner(chalk.bold.green('Creating your Project Structure...')).start();
|
|
70
|
-
await sleep();
|
|
71
|
-
spinner.stop();
|
|
72
|
-
if (fs_app == 'MERN app') {
|
|
73
|
-
console.log(chalk.bold.bgGreen("\nBuilding MERN structure"));
|
|
74
|
-
BuildStructure(fs_app,mernGitRepo);
|
|
75
|
-
await sleep();
|
|
76
|
-
completion();
|
|
77
|
-
}
|
|
78
|
-
if (fs_app == 'MEAN app') {
|
|
79
|
-
console.log("\nNot yet started");
|
|
80
|
-
// completion();
|
|
81
|
-
}
|
|
82
|
-
if (fs_app == 'MEVN app') {
|
|
83
|
-
console.log("\nNot yet started");
|
|
84
|
-
// completion();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// function to clone mern repository
|
|
89
|
-
const BuildStructure = async(selected_app,repoUrl) => {
|
|
90
|
-
|
|
91
|
-
// function to create a folder
|
|
92
|
-
async function createFolder(folderName,selected_app) {
|
|
93
|
-
try {
|
|
94
|
-
if (!fs.existsSync(folderName)) {
|
|
95
|
-
fs.mkdirSync(folderName);
|
|
96
|
-
console.log(chalk.bold.green(`Creating a ${selected_app} in ~/${folderName}`));
|
|
97
|
-
} else {
|
|
98
|
-
console.log(chalk.italic.red(`Folder ${folderName} already exists.`));
|
|
99
|
-
console.log(chalk.bold.yellow(`Try : cd ${folderName} && npx create-fs-app .`));
|
|
100
|
-
process.exit(1);
|
|
101
|
-
}
|
|
102
|
-
} catch (err) {
|
|
103
|
-
console.error(chalk.italic.red(`error creting folder ${err}`));
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// function to clone a repositoy
|
|
108
|
-
const cloneRepository = async(dirName, custdir, repo) => {
|
|
109
|
-
try {
|
|
110
|
-
child_process.execSync(`git clone ${repo} ${dirName}`, { stdio: 'inherit' });
|
|
111
|
-
console.log(chalk.bold.green('\nRepository cloned successfully to ' + custdir));
|
|
112
|
-
} catch (err) {
|
|
113
|
-
console.error(chalk.italic.red('Error cloning repository:', err));
|
|
114
|
-
process.exit(1);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (!appName) {
|
|
119
|
-
console.error(chalk.italic.red('Error: Please provide a directory name'));
|
|
120
|
-
process.exit(1);
|
|
121
|
-
}
|
|
122
|
-
else if (appName == ".") {
|
|
123
|
-
cloneRepository('.', currentDirectory, repoUrl);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
await createFolder(appName,selected_app);
|
|
127
|
-
await cloneRepository(appName,currentDirectory,repoUrl);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (process.argv.length > 3) {
|
|
132
|
-
console.log(chalk.italic.red("Error: Please provide a valid directory name"));
|
|
133
|
-
console.log(chalk.italic.red("Note: directory name should not contain spaces"));
|
|
134
|
-
console.log(chalk.bold.yellow("Try : npx build-mern-app app_name"));
|
|
135
|
-
process.exit(1);
|
|
136
|
-
}
|
|
137
|
-
await installMyPackage();
|
|
138
|
-
await welcome();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import child_process from "child_process";
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import chalkAnimation from 'chalk-animation';
|
|
8
|
+
import inquirer from 'inquirer';
|
|
9
|
+
import { createSpinner } from 'nanospinner';
|
|
10
|
+
import figlet from 'figlet';
|
|
11
|
+
import gradient from 'gradient-string';
|
|
12
|
+
|
|
13
|
+
let appName = process.argv[2];
|
|
14
|
+
const currentDirectory = process.cwd();
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
// git repository
|
|
17
|
+
const mernGitRepo = "https://github.com/Om-jannu/mern-template.git";
|
|
18
|
+
|
|
19
|
+
//sleep function
|
|
20
|
+
const sleep = (ms = 1000) => new Promise((r) => setTimeout(r, ms));
|
|
21
|
+
const installMyPackage = async() =>{
|
|
22
|
+
child_process.execSync('npm i create-fs-app -g');
|
|
23
|
+
}
|
|
24
|
+
// welcome function
|
|
25
|
+
const welcome = async () => {
|
|
26
|
+
const msg = "create-fs-app";
|
|
27
|
+
const welcomeMsg = figlet(msg, (err, data) => {
|
|
28
|
+
console.log(gradient.pastel.multiline(data));
|
|
29
|
+
})
|
|
30
|
+
welcomeMsg;
|
|
31
|
+
await sleep();
|
|
32
|
+
console.log(`
|
|
33
|
+
I am your personal FullStack template generator
|
|
34
|
+
I can create Full Stack Templates for you ${chalk.green('in seconds')}😉
|
|
35
|
+
Let's get started...
|
|
36
|
+
`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// qns function
|
|
40
|
+
const askFsName = async () => {
|
|
41
|
+
const answers = await inquirer.prompt({
|
|
42
|
+
name: "fs_app",
|
|
43
|
+
type: 'list',
|
|
44
|
+
message: 'Which FullStack App do you want to build?',
|
|
45
|
+
choices: [
|
|
46
|
+
'MERN app',
|
|
47
|
+
'MEAN app',
|
|
48
|
+
'MEVN app',
|
|
49
|
+
],
|
|
50
|
+
});
|
|
51
|
+
return handleAnswer(answers.fs_app);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//completion screen
|
|
55
|
+
const completion = async () => {
|
|
56
|
+
const completion_msg = chalkAnimation.rainbow(
|
|
57
|
+
'\nSuccesfully created your Full Stack Template'
|
|
58
|
+
);
|
|
59
|
+
await sleep();
|
|
60
|
+
completion_msg.stop();
|
|
61
|
+
console.log(chalk.bold.yellow('To access your folder :'));
|
|
62
|
+
console.log(chalk.bold.blue(`cd ${(appName=='.')?currentDirectory:appName}`));
|
|
63
|
+
console.log(chalk.bold.blue('code .'));
|
|
64
|
+
console.log(chalk.bold.yellow(`\nNOTE : ${chalk.bold.blue('code .')} is for opening folder in ${chalk.bold.blue('vs-code')} for different IDE use different Keyword`));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// answer handler
|
|
68
|
+
const handleAnswer = async (fs_app) => {
|
|
69
|
+
const spinner = createSpinner(chalk.bold.green('Creating your Project Structure...')).start();
|
|
70
|
+
await sleep();
|
|
71
|
+
spinner.stop();
|
|
72
|
+
if (fs_app == 'MERN app') {
|
|
73
|
+
console.log(chalk.bold.bgGreen("\nBuilding MERN structure"));
|
|
74
|
+
BuildStructure(fs_app,mernGitRepo);
|
|
75
|
+
await sleep();
|
|
76
|
+
completion();
|
|
77
|
+
}
|
|
78
|
+
if (fs_app == 'MEAN app') {
|
|
79
|
+
console.log("\nNot yet started");
|
|
80
|
+
// completion();
|
|
81
|
+
}
|
|
82
|
+
if (fs_app == 'MEVN app') {
|
|
83
|
+
console.log("\nNot yet started");
|
|
84
|
+
// completion();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// function to clone mern repository
|
|
89
|
+
const BuildStructure = async(selected_app,repoUrl) => {
|
|
90
|
+
|
|
91
|
+
// function to create a folder
|
|
92
|
+
async function createFolder(folderName,selected_app) {
|
|
93
|
+
try {
|
|
94
|
+
if (!fs.existsSync(folderName)) {
|
|
95
|
+
fs.mkdirSync(folderName);
|
|
96
|
+
console.log(chalk.bold.green(`Creating a ${selected_app} in ~/${folderName}`));
|
|
97
|
+
} else {
|
|
98
|
+
console.log(chalk.italic.red(`Folder ${folderName} already exists.`));
|
|
99
|
+
console.log(chalk.bold.yellow(`Try : cd ${folderName} && npx create-fs-app .`));
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
} catch (err) {
|
|
103
|
+
console.error(chalk.italic.red(`error creting folder ${err}`));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// function to clone a repositoy
|
|
108
|
+
const cloneRepository = async(dirName, custdir, repo) => {
|
|
109
|
+
try {
|
|
110
|
+
child_process.execSync(`git clone ${repo} ${dirName}`, { stdio: 'inherit' });
|
|
111
|
+
console.log(chalk.bold.green('\nRepository cloned successfully to ' + custdir));
|
|
112
|
+
} catch (err) {
|
|
113
|
+
console.error(chalk.italic.red('Error cloning repository:', err));
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (!appName) {
|
|
119
|
+
console.error(chalk.italic.red('Error: Please provide a directory name'));
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
else if (appName == ".") {
|
|
123
|
+
cloneRepository('.', currentDirectory, repoUrl);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
await createFolder(appName,selected_app);
|
|
127
|
+
await cloneRepository(appName,currentDirectory,repoUrl);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (process.argv.length > 3) {
|
|
132
|
+
console.log(chalk.italic.red("Error: Please provide a valid directory name"));
|
|
133
|
+
console.log(chalk.italic.red("Note: directory name should not contain spaces"));
|
|
134
|
+
console.log(chalk.bold.yellow("Try : npx build-mern-app app_name"));
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
await installMyPackage();
|
|
138
|
+
await welcome();
|
|
139
139
|
await askFsName();
|