@tishlang/create-tish-app 1.3.2 → 1.3.4
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/index.js +15 -16
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -4,17 +4,6 @@
|
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
7
|
-
const projectName = process.argv[2] || getProjectNameFromCwd();
|
|
8
|
-
|
|
9
|
-
function getProjectNameFromCwd() {
|
|
10
|
-
const cwd = process.cwd();
|
|
11
|
-
const base = path.basename(cwd);
|
|
12
|
-
if (base && base !== '.' && !fs.existsSync(path.join(cwd, 'src'))) {
|
|
13
|
-
return base;
|
|
14
|
-
}
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
7
|
function prompt(question) {
|
|
19
8
|
const readline = require('readline');
|
|
20
9
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -27,13 +16,23 @@ function prompt(question) {
|
|
|
27
16
|
}
|
|
28
17
|
|
|
29
18
|
async function main() {
|
|
30
|
-
let name =
|
|
19
|
+
let name = (process.argv[2] && String(process.argv[2]).trim()) || '';
|
|
31
20
|
if (!name) {
|
|
32
21
|
name = await prompt('Project name: ');
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
name = name.trim();
|
|
23
|
+
}
|
|
24
|
+
if (!name) {
|
|
25
|
+
console.error('Please provide a project name (argument or when prompted). Example: npx @tishlang/create-tish-app my-app');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (name.includes(path.sep) || name.includes('/') || name.includes('\\')) {
|
|
30
|
+
console.error('Project name must be a single folder name, not a path.');
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
if (name === '.' || name === '..') {
|
|
34
|
+
console.error('Invalid project name.');
|
|
35
|
+
process.exit(1);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
const dir = path.resolve(process.cwd(), name);
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tishlang/create-tish-app",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "Scaffold a new Tish project",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "PIF",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/tishlang/tish.git"
|