create-routify 1.0.0 → 1.1.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.
Files changed (3) hide show
  1. package/README.md +21 -1
  2. package/package.json +10 -4
  3. package/src/index.js +21 -8
package/README.md CHANGED
@@ -1 +1,21 @@
1
- # Dev branch for upcoming routify-cli, readme coming soon
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
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
+ -v, --version use this to set the version of routify, e.g. 3
21
+ ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-routify",
3
- "version": "1.0.0",
4
- "description": "A powerful cli for simplifying your routify development experience",
3
+ "version": "1.1.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,10 +18,16 @@
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": "ISC",
30
+ "license": "MIT",
25
31
  "bugs": {
26
32
  "url": "https://github.com/roxiness/create-routify/issues"
27
33
  },
package/src/index.js CHANGED
@@ -12,13 +12,11 @@ const versions = {
12
12
  3: () => import('./versions/three/index.js'),
13
13
  };
14
14
 
15
- export const run = async ({ args }) => {
16
- console.log(` ${k.dim(`v${'1.0.0'}`)}`);
17
- console.log(` ${k.bold().magenta('Routify')} ${k.magenta().dim('CLI')}`);
18
- console.log();
15
+ async function getVersion(args) {
16
+ const argsVersion = args.v || args.version;
17
+ if (argsVersion) return argsVersion;
19
18
 
20
19
  const { version } = await prompts(
21
- // TODO disable this if version cli opt
22
20
  {
23
21
  type: 'select',
24
22
  name: 'version',
@@ -31,11 +29,24 @@ export const run = async ({ args }) => {
31
29
  },
32
30
  ],
33
31
  },
34
-
35
32
  { onCancel },
36
33
  );
37
34
 
38
- const projectDir = resolve(args._[0] || '.');
35
+ return version;
36
+ }
37
+
38
+ export const run = async ({ args }) => {
39
+ console.log(` ${k.dim(`v${'1.0.0'}`)}`);
40
+ console.log(` ${k.bold().magenta('Routify')} ${k.magenta().dim('CLI')}`);
41
+ console.log();
42
+
43
+ const version = await getVersion(args);
44
+
45
+ if (!Object.keys(versions).includes(version.toString()))
46
+ return console.log(` ${k.red(`Version ${version} not found`)}`);
47
+
48
+ const projectName = args._[0] || '.';
49
+ const projectDir = resolve(projectName.toString());
39
50
 
40
51
  if (existsSync(projectDir) && readdirSync(projectDir).length > 0) {
41
52
  const { proceed } = await prompts(
@@ -61,7 +72,9 @@ export const run = async ({ args }) => {
61
72
 
62
73
  let i = 1;
63
74
 
64
- console.log(` ${i++}) cd ${relative(process.cwd(), projectDir)}`);
75
+ if (relative(process.cwd(), projectDir) != '')
76
+ console.log(` ${i++}) cd ${relative(process.cwd(), projectDir)}`);
77
+
65
78
  console.log(` ${i++}) npm install`);
66
79
  console.log(` ${i++}) npm run dev`);
67
80