create-fs-app 1.1.8 → 1.1.10
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/.github/workflows/npm-publish-github-packages.yml +36 -0
- package/README.md +57 -8
- package/SECURITY.md +21 -0
- package/assets/logo.png +0 -0
- package/assets/s1.png +0 -0
- package/create-fs-app.js +181 -139
- package/package.json +35 -33
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Node.js Package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
|
+
- uses: actions/setup-node@v3
|
|
16
|
+
with:
|
|
17
|
+
node-version: 16
|
|
18
|
+
- run: npm ci
|
|
19
|
+
- run: npm test
|
|
20
|
+
|
|
21
|
+
publish-gpr:
|
|
22
|
+
needs: build
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
permissions:
|
|
25
|
+
contents: read
|
|
26
|
+
packages: write
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v3
|
|
29
|
+
- uses: actions/setup-node@v3
|
|
30
|
+
with:
|
|
31
|
+
node-version: 16
|
|
32
|
+
registry-url: https://npm.pkg.github.com/
|
|
33
|
+
- run: npm ci
|
|
34
|
+
- run: npm publish
|
|
35
|
+
env:
|
|
36
|
+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
package/README.md
CHANGED
|
@@ -1,8 +1,57 @@
|
|
|
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
|
+
<p align="center">
|
|
17
|
+
<img src="./assets/s1.png">
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
### Get Started Immediately
|
|
21
|
+
|
|
22
|
+
You **don’t** need to install or configure tools like webpack or Babel.<br>
|
|
23
|
+
They are preconfigured and hidden so that you can focus on the code.
|
|
24
|
+
|
|
25
|
+
Create a project, and you’re good to go.
|
|
26
|
+
|
|
27
|
+
# Creating an App
|
|
28
|
+
|
|
29
|
+
**You’ll need to have Node 14.0.0 or later version on your local development machine** (but it’s not required on the server). We recommend using the latest LTS version. You can use [nvm](https://github.com/creationix/nvm#installation) (macOS/Linux) or [nvm-windows](https://github.com/coreybutler/nvm-windows#node-version-manager-nvm-for-windows) to switch Node versions between different projects.
|
|
30
|
+
|
|
31
|
+
To create a new app, you may choose one of the following methods:
|
|
32
|
+
|
|
33
|
+
### npx
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
npx create-fs-app my-app
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
_([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))_
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Yarn
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
yarn create-fs-app my-app
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
_[`yarn create <starter-kit-package>`](https://yarnpkg.com/lang/en/docs/cli/create/) is available in Yarn 0.25+_
|
|
49
|
+
|
|
50
|
+
It will create a directory called `my-app` inside the current folder.<br>
|
|
51
|
+
|
|
52
|
+
No configuration or complicated folder structures, only the files you need to build your app.<br>
|
|
53
|
+
Once the installation is done, you can open your project folder:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
cd my-app
|
|
57
|
+
```
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
Use this section to tell people about which versions of your project are
|
|
6
|
+
currently being supported with security updates.
|
|
7
|
+
|
|
8
|
+
| Version | Supported |
|
|
9
|
+
| ------- | ------------------ |
|
|
10
|
+
| 5.1.x | :white_check_mark: |
|
|
11
|
+
| 5.0.x | :x: |
|
|
12
|
+
| 4.0.x | :white_check_mark: |
|
|
13
|
+
| < 4.0 | :x: |
|
|
14
|
+
|
|
15
|
+
## Reporting a Vulnerability
|
|
16
|
+
|
|
17
|
+
Use this section to tell people how to report a vulnerability.
|
|
18
|
+
|
|
19
|
+
Tell them where to go, how often they can expect to get an update on a
|
|
20
|
+
reported vulnerability, what to expect if the vulnerability is accepted or
|
|
21
|
+
declined, etc.
|
package/assets/logo.png
ADDED
|
Binary file
|
package/assets/s1.png
ADDED
|
Binary file
|
package/create-fs-app.js
CHANGED
|
@@ -1,139 +1,181 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import child_process from 'child_process';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import chalkAnimation from 'chalk-animation';
|
|
6
|
+
import inquirer from 'inquirer';
|
|
7
|
+
import { createSpinner } from 'nanospinner';
|
|
8
|
+
import figlet from 'figlet';
|
|
9
|
+
import gradient from 'gradient-string';
|
|
10
|
+
import ora from 'ora';
|
|
11
|
+
import prompts from 'prompts';
|
|
12
|
+
|
|
13
|
+
const currentDirectory = process.cwd();
|
|
14
|
+
|
|
15
|
+
// Git repositories
|
|
16
|
+
const mernGitRepo = 'https://github.com/Om-jannu/mern-template.git';
|
|
17
|
+
const meanGitRepo = 'https://github.com/your-username/mean-template.git';
|
|
18
|
+
const mevnGitRepo = 'https://github.com/your-username/mevn-template.git';
|
|
19
|
+
|
|
20
|
+
// Sleep function
|
|
21
|
+
const sleep = (ms = 1000) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const installMyPackage = async () => {
|
|
25
|
+
const response = await prompts({
|
|
26
|
+
type: 'confirm',
|
|
27
|
+
name: 'confirm',
|
|
28
|
+
message: 'This script needs to install the create-fs-app package globally. Do you want to proceed?',
|
|
29
|
+
initial: false,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (response.confirm) {
|
|
33
|
+
const spinner = ora('Installing create-fs-app package...').start();
|
|
34
|
+
try {
|
|
35
|
+
child_process.execSync('npm i create-fs-app -g');
|
|
36
|
+
spinner.succeed('create-fs-app package installed successfully');
|
|
37
|
+
} catch (error) {
|
|
38
|
+
spinner.fail('Error installing create-fs-app package');
|
|
39
|
+
console.error(chalk.red('Error installing create-fs-app package:', error.message));
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
console.log(chalk.yellow('Package installation canceled. Exiting...'));
|
|
44
|
+
process.exit(0);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Welcome function
|
|
49
|
+
const welcome = async () => {
|
|
50
|
+
const msg = 'create-fs-app';
|
|
51
|
+
const welcomeMsg = figlet(msg, (err, data) => {
|
|
52
|
+
console.log(gradient.pastel.multiline(data));
|
|
53
|
+
});
|
|
54
|
+
welcomeMsg;
|
|
55
|
+
await sleep();
|
|
56
|
+
console.log(`
|
|
57
|
+
I am your personal FullStack template generator
|
|
58
|
+
I can create Full Stack Templates for you ${chalk.green('in seconds')}😉
|
|
59
|
+
Let's get started...
|
|
60
|
+
`);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// Question function
|
|
64
|
+
const askFsName = async () => {
|
|
65
|
+
const answers = await inquirer.prompt({
|
|
66
|
+
name: 'fs_app',
|
|
67
|
+
type: 'list',
|
|
68
|
+
message: 'Which FullStack App do you want to build?',
|
|
69
|
+
choices: ['MERN app', 'MEAN app', 'MEVN app'],
|
|
70
|
+
});
|
|
71
|
+
return handleAnswer(answers.fs_app);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// Completion screen
|
|
75
|
+
const completion = async (appName) => {
|
|
76
|
+
const completion_msg = chalkAnimation.rainbow(
|
|
77
|
+
'\nSuccessfully created your Full Stack Template'
|
|
78
|
+
);
|
|
79
|
+
await sleep();
|
|
80
|
+
completion_msg.stop();
|
|
81
|
+
console.log(chalk.bold.yellow('To access your folder :'));
|
|
82
|
+
console.log(chalk.bold.blue(`cd ${appName === '.' ? currentDirectory : appName}`));
|
|
83
|
+
console.log(chalk.bold.blue('code .'));
|
|
84
|
+
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`));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// Answer handler
|
|
88
|
+
const handleAnswer = async (fs_app) => {
|
|
89
|
+
const spinner = createSpinner(chalk.bold.green('Creating your Project Structure...')).start();
|
|
90
|
+
await sleep();
|
|
91
|
+
spinner.stop();
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
let repoUrl;
|
|
95
|
+
switch (fs_app) {
|
|
96
|
+
case 'MERN app':
|
|
97
|
+
console.log(chalk.bold.bgGreen('\nBuilding MERN structure'));
|
|
98
|
+
repoUrl = mernGitRepo;
|
|
99
|
+
break;
|
|
100
|
+
case 'MEAN app':
|
|
101
|
+
console.log(chalk.bold.bgBlue('\nBuilding MEAN structure'));
|
|
102
|
+
repoUrl = meanGitRepo;
|
|
103
|
+
break;
|
|
104
|
+
case 'MEVN app':
|
|
105
|
+
console.log(chalk.bold.bgMagenta('\nBuilding MEVN structure'));
|
|
106
|
+
repoUrl = mevnGitRepo;
|
|
107
|
+
break;
|
|
108
|
+
default:
|
|
109
|
+
console.error(chalk.red('Invalid choice. Please try again.'));
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const appName = process.argv[2] || '.';
|
|
114
|
+
await buildStructure(fs_app, repoUrl, appName);
|
|
115
|
+
await completion(appName);
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.error(chalk.red('Error creating project structure:', error.message));
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// Function to build the project structure
|
|
123
|
+
const buildStructure = async (selectedApp, repoUrl, appName) => {
|
|
124
|
+
try {
|
|
125
|
+
// Function to create a folder
|
|
126
|
+
const createFolder = async (folderName) => {
|
|
127
|
+
try {
|
|
128
|
+
if (!fs.existsSync(folderName)) {
|
|
129
|
+
fs.mkdirSync(folderName);
|
|
130
|
+
console.log(chalk.bold.green(`Creating a ${selectedApp} in ~/${folderName}`));
|
|
131
|
+
} else {
|
|
132
|
+
console.log(chalk.italic.red(`Folder ${folderName} already exists.`));
|
|
133
|
+
console.log(chalk.bold.yellow(`Try : cd ${folderName} && npx create-fs-app .`));
|
|
134
|
+
}
|
|
135
|
+
} catch (err) {
|
|
136
|
+
throw new Error(`Error creating folder ${err}`);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// Function to clone a repository
|
|
141
|
+
const cloneRepository = async (dirName, custdir, repo) => {
|
|
142
|
+
try {
|
|
143
|
+
child_process.execSync(`git clone ${repo} ${dirName}`, { stdio: 'inherit' });
|
|
144
|
+
console.log(chalk.bold.green('\nRepository cloned successfully to ' + custdir));
|
|
145
|
+
} catch (err) {
|
|
146
|
+
throw new Error('Error cloning repository:', err);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
if (!appName) {
|
|
151
|
+
throw new Error('Error: Please provide a directory name');
|
|
152
|
+
} else if (appName === '.') {
|
|
153
|
+
cloneRepository('.', currentDirectory, repoUrl);
|
|
154
|
+
} else {
|
|
155
|
+
await createFolder(appName);
|
|
156
|
+
await cloneRepository(appName, path.join(currentDirectory, appName), repoUrl);
|
|
157
|
+
}
|
|
158
|
+
} catch (error) {
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const run = async () => {
|
|
164
|
+
try {
|
|
165
|
+
if (process.argv.length > 3) {
|
|
166
|
+
console.log(chalk.italic.red('Error: Please provide a valid directory name'));
|
|
167
|
+
console.log(chalk.italic.red('Note: directory name should not contain spaces'));
|
|
168
|
+
console.log(chalk.bold.yellow('Try : npx create-fs-app app_name'));
|
|
169
|
+
process.exit(1);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// await installMyPackage();
|
|
173
|
+
await welcome();
|
|
174
|
+
await askFsName();
|
|
175
|
+
} catch (error) {
|
|
176
|
+
console.error(chalk.red('An error occurred:', error.message));
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
run();
|
package/package.json
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "create-fs-app",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "A command line tool to create Full Stack templates",
|
|
5
|
-
"main": "./create-fs-app",
|
|
6
|
-
"bin": "./create-fs-app.js",
|
|
7
|
-
"keywords": [
|
|
8
|
-
"full Stack",
|
|
9
|
-
"full",
|
|
10
|
-
"Stack",
|
|
11
|
-
"mern",
|
|
12
|
-
"mean",
|
|
13
|
-
"react",
|
|
14
|
-
"express",
|
|
15
|
-
"mongodb",
|
|
16
|
-
"mongo"
|
|
17
|
-
],
|
|
18
|
-
"repository": {
|
|
19
|
-
"type": "git",
|
|
20
|
-
"url": "https://github.com/Om-jannu/create-fs-app.git"
|
|
21
|
-
},
|
|
22
|
-
"type": "module",
|
|
23
|
-
"author": "Om Jannu",
|
|
24
|
-
"license": "ISC",
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"chalk": "^5.2.0",
|
|
27
|
-
"chalk-animation": "^2.0.3",
|
|
28
|
-
"figlet": "^1.5.2",
|
|
29
|
-
"gradient-string": "^2.0.2",
|
|
30
|
-
"inquirer": "^9.1.4",
|
|
31
|
-
"nanospinner": "^1.1.0"
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "create-fs-app",
|
|
3
|
+
"version": "1.1.10",
|
|
4
|
+
"description": "A command line tool to create Full Stack templates",
|
|
5
|
+
"main": "./create-fs-app",
|
|
6
|
+
"bin": "./create-fs-app.js",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"full Stack",
|
|
9
|
+
"full",
|
|
10
|
+
"Stack",
|
|
11
|
+
"mern",
|
|
12
|
+
"mean",
|
|
13
|
+
"react",
|
|
14
|
+
"express",
|
|
15
|
+
"mongodb",
|
|
16
|
+
"mongo"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/Om-jannu/create-fs-app.git"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"author": "Om Jannu",
|
|
24
|
+
"license": "ISC",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"chalk": "^5.2.0",
|
|
27
|
+
"chalk-animation": "^2.0.3",
|
|
28
|
+
"figlet": "^1.5.2",
|
|
29
|
+
"gradient-string": "^2.0.2",
|
|
30
|
+
"inquirer": "^9.1.4",
|
|
31
|
+
"nanospinner": "^1.1.0",
|
|
32
|
+
"ora": "^8.0.1",
|
|
33
|
+
"prompts": "^2.4.2"
|
|
34
|
+
}
|
|
35
|
+
}
|