create-routify 1.0.0 → 1.3.1
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 -1
- package/package.json +14 -7
- package/src/bin.js +0 -1
- package/src/index.js +37 -9
- package/src/versions/two.js +17 -2
package/README.md
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Create Routify
|
|
2
|
+
|
|
3
|
+
Welcome to the new Routiy CLI! This CLI currently supports both version 2 & 3 (beta) of Routify.
|
|
4
|
+
|
|
5
|
+
# Get Started
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm init routify@latest
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
# CLI Options
|
|
12
|
+
|
|
13
|
+
We have designed the cli to be able to be run in headless mode, as such the following options are available:
|
|
14
|
+
|
|
15
|
+
> Don't worry, most users won't need these as everyting is fully graphical first!
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
npm init routify [directory-name]
|
|
19
|
+
|
|
20
|
+
-h, --help get the help menu
|
|
21
|
+
-v, --version use this to set the version of routify, e.g. 3
|
|
22
|
+
-f, --force this option bypasses directory checks, be careful as might overwrite files!
|
|
23
|
+
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-routify",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "A powerful cli for
|
|
3
|
+
"version": "1.3.1",
|
|
4
|
+
"description": "A powerful cli for super-powering your routify development experience",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -18,22 +18,29 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://routify.dev",
|
|
20
20
|
"keywords": [
|
|
21
|
-
"routify"
|
|
21
|
+
"routify",
|
|
22
|
+
"create routify",
|
|
23
|
+
"npm init",
|
|
24
|
+
"@roxi/routify",
|
|
25
|
+
"npm init routify",
|
|
26
|
+
"routify 3",
|
|
27
|
+
"routify 2"
|
|
22
28
|
],
|
|
23
29
|
"author": "ghostdevbusiness@gmail.com",
|
|
24
|
-
"license": "
|
|
30
|
+
"license": "MIT",
|
|
25
31
|
"bugs": {
|
|
26
32
|
"url": "https://github.com/roxiness/create-routify/issues"
|
|
27
33
|
},
|
|
28
34
|
"dependencies": {
|
|
29
35
|
"kleur": "^4.1.4",
|
|
30
36
|
"log-symbols": "^5.1.0",
|
|
31
|
-
"minimist": "^1.2.
|
|
37
|
+
"minimist": "^1.2.6",
|
|
32
38
|
"prompts": "^2.4.2",
|
|
33
|
-
"
|
|
39
|
+
"simple-git": "^3.7.1",
|
|
40
|
+
"update-notifier": "^5.1.0"
|
|
34
41
|
},
|
|
35
42
|
"devDependencies": {
|
|
36
43
|
"@types/prompts": "^2.0.14",
|
|
37
44
|
"@types/update-notifier": "^5.1.0"
|
|
38
45
|
}
|
|
39
|
-
}
|
|
46
|
+
}
|
package/src/bin.js
CHANGED
package/src/index.js
CHANGED
|
@@ -12,13 +12,17 @@ const versions = {
|
|
|
12
12
|
3: () => import('./versions/three/index.js'),
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const helpText = ` npm init routify [directory-name]
|
|
16
|
+
|
|
17
|
+
-h, --help get the help menu
|
|
18
|
+
-v, --version use this to set the version of routify, e.g. 3
|
|
19
|
+
-f, --force this option bypasses directory checks, be careful as might overwrite files!`;
|
|
20
|
+
|
|
21
|
+
async function getVersion(args) {
|
|
22
|
+
const argsVersion = args.v || args.version;
|
|
23
|
+
if (argsVersion) return argsVersion;
|
|
19
24
|
|
|
20
25
|
const { version } = await prompts(
|
|
21
|
-
// TODO disable this if version cli opt
|
|
22
26
|
{
|
|
23
27
|
type: 'select',
|
|
24
28
|
name: 'version',
|
|
@@ -31,13 +35,35 @@ export const run = async ({ args }) => {
|
|
|
31
35
|
},
|
|
32
36
|
],
|
|
33
37
|
},
|
|
34
|
-
|
|
35
38
|
{ onCancel },
|
|
36
39
|
);
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
return version;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const run = async ({ args }) => {
|
|
45
|
+
console.log(` ${k.dim(`v${'1.0.0'}`)}`);
|
|
46
|
+
console.log(` ${k.bold().magenta('Routify')} ${k.magenta().dim('CLI')}`);
|
|
47
|
+
console.log();
|
|
48
|
+
|
|
49
|
+
if (args.h || args.help) {
|
|
50
|
+
return console.log(helpText);
|
|
51
|
+
}
|
|
39
52
|
|
|
40
|
-
|
|
53
|
+
const version = await getVersion(args);
|
|
54
|
+
const force = args.f || args.force;
|
|
55
|
+
|
|
56
|
+
if (!Object.keys(versions).includes(version.toString()))
|
|
57
|
+
return console.log(` ${k.red(`Version ${version} not found`)}`);
|
|
58
|
+
|
|
59
|
+
const projectName = args._[0] || '.';
|
|
60
|
+
const projectDir = resolve(projectName.toString());
|
|
61
|
+
|
|
62
|
+
if (
|
|
63
|
+
existsSync(projectDir) &&
|
|
64
|
+
readdirSync(projectDir).length > 0 &&
|
|
65
|
+
!force
|
|
66
|
+
) {
|
|
41
67
|
const { proceed } = await prompts(
|
|
42
68
|
{
|
|
43
69
|
type: 'confirm',
|
|
@@ -61,7 +87,9 @@ export const run = async ({ args }) => {
|
|
|
61
87
|
|
|
62
88
|
let i = 1;
|
|
63
89
|
|
|
64
|
-
|
|
90
|
+
if (relative(process.cwd(), projectDir) != '')
|
|
91
|
+
console.log(` ${i++}) cd ${relative(process.cwd(), projectDir)}`);
|
|
92
|
+
|
|
65
93
|
console.log(` ${i++}) npm install`);
|
|
66
94
|
console.log(` ${i++}) npm run dev`);
|
|
67
95
|
|
package/src/versions/two.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import logSymbols from 'log-symbols';
|
|
2
|
+
import simpleGit from 'simple-git';
|
|
3
|
+
import { rmSync } from 'fs';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import k from 'kleur';
|
|
6
|
+
|
|
7
|
+
export const run = async ({ projectDir, args }) => {
|
|
8
|
+
const git = simpleGit(projectDir);
|
|
9
|
+
|
|
10
|
+
console.log(k.blue(`\n${logSymbols.info} Cloning template...`));
|
|
11
|
+
|
|
12
|
+
await git.clone('https://github.com/roxiness/routify-starter', projectDir);
|
|
13
|
+
|
|
14
|
+
rmSync(join(projectDir, '.git'), {
|
|
15
|
+
recursive: true,
|
|
16
|
+
force: true,
|
|
17
|
+
});
|
|
3
18
|
};
|