create-vxrn 1.14.4 → 1.15.0
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/.turbo/turbo-build.log +1 -1
- package/dist/cjs/create.cjs +156 -93
- package/dist/cjs/create.native.js +165 -102
- package/dist/cjs/create.native.js.map +1 -1
- package/dist/cjs/helpers/cloneStarter.cjs +77 -45
- package/dist/cjs/helpers/cloneStarter.native.js +79 -47
- package/dist/cjs/helpers/cloneStarter.native.js.map +1 -1
- package/dist/cjs/helpers/getProjectName.cjs +61 -40
- package/dist/cjs/helpers/getProjectName.native.js +67 -46
- package/dist/cjs/helpers/getProjectName.native.js.map +1 -1
- package/dist/cjs/helpers/getTemplateInfo.cjs +50 -35
- package/dist/cjs/helpers/getTemplateInfo.native.js +59 -44
- package/dist/cjs/helpers/getTemplateInfo.native.js.map +1 -1
- package/dist/cjs/helpers/installDependencies.cjs +16 -12
- package/dist/cjs/helpers/installDependencies.native.js +19 -15
- package/dist/cjs/helpers/installDependencies.native.js.map +1 -1
- package/dist/cjs/helpers/validateNpmPackage.cjs +31 -26
- package/dist/cjs/helpers/validateNpmPackage.native.js +31 -26
- package/dist/cjs/helpers/validateNpmPackage.native.js.map +1 -1
- package/dist/cjs/index.cjs +39 -25
- package/dist/cjs/index.native.js +39 -26
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/steps/bare.cjs +53 -32
- package/dist/cjs/steps/bare.native.js +75 -52
- package/dist/cjs/steps/bare.native.js.map +1 -1
- package/dist/cjs/steps/fullstack.cjs +37 -32
- package/dist/cjs/steps/fullstack.native.js +42 -37
- package/dist/cjs/steps/fullstack.native.js.map +1 -1
- package/dist/cjs/steps/one.cjs +65 -47
- package/dist/cjs/steps/one.native.js +70 -52
- package/dist/cjs/steps/one.native.js.map +1 -1
- package/dist/cjs/steps/types.cjs +7 -5
- package/dist/cjs/steps/types.native.js +7 -5
- package/dist/cjs/steps/types.native.js.map +1 -1
- package/dist/cjs/templates.cjs +35 -33
- package/dist/cjs/templates.native.js +59 -57
- package/dist/cjs/templates.native.js.map +1 -1
- package/dist/esm/create.mjs +112 -51
- package/dist/esm/create.mjs.map +1 -1
- package/dist/esm/create.native.js +127 -66
- package/dist/esm/create.native.js.map +1 -1
- package/dist/esm/helpers/cloneStarter.mjs +60 -30
- package/dist/esm/helpers/cloneStarter.mjs.map +1 -1
- package/dist/esm/helpers/cloneStarter.native.js +62 -32
- package/dist/esm/helpers/cloneStarter.native.js.map +1 -1
- package/dist/esm/helpers/getProjectName.mjs +33 -14
- package/dist/esm/helpers/getProjectName.mjs.map +1 -1
- package/dist/esm/helpers/getProjectName.native.js +33 -14
- package/dist/esm/helpers/getProjectName.native.js.map +1 -1
- package/dist/esm/helpers/getTemplateInfo.mjs +24 -11
- package/dist/esm/helpers/getTemplateInfo.mjs.map +1 -1
- package/dist/esm/helpers/getTemplateInfo.native.js +32 -19
- package/dist/esm/helpers/getTemplateInfo.native.js.map +1 -1
- package/dist/esm/helpers/installDependencies.mjs +4 -2
- package/dist/esm/helpers/installDependencies.mjs.map +1 -1
- package/dist/esm/helpers/installDependencies.native.js +7 -5
- package/dist/esm/helpers/installDependencies.native.js.map +1 -1
- package/dist/esm/helpers/validateNpmPackage.mjs +7 -4
- package/dist/esm/helpers/validateNpmPackage.mjs.map +1 -1
- package/dist/esm/helpers/validateNpmPackage.native.js +7 -4
- package/dist/esm/helpers/validateNpmPackage.native.js.map +1 -1
- package/dist/esm/index.js +22 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +22 -10
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +22 -11
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/steps/bare.mjs +26 -7
- package/dist/esm/steps/bare.mjs.map +1 -1
- package/dist/esm/steps/bare.native.js +48 -27
- package/dist/esm/steps/bare.native.js.map +1 -1
- package/dist/esm/steps/fullstack.mjs +13 -10
- package/dist/esm/steps/fullstack.mjs.map +1 -1
- package/dist/esm/steps/fullstack.native.js +17 -14
- package/dist/esm/steps/fullstack.native.js.map +1 -1
- package/dist/esm/steps/one.mjs +37 -21
- package/dist/esm/steps/one.mjs.map +1 -1
- package/dist/esm/steps/one.native.js +41 -25
- package/dist/esm/steps/one.native.js.map +1 -1
- package/dist/esm/templates.mjs +11 -11
- package/dist/esm/templates.native.js +11 -11
- package/package.json +3 -3
|
@@ -5,91 +5,123 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var cloneStarter_exports = {};
|
|
24
26
|
__export(cloneStarter_exports, {
|
|
25
27
|
cloneStarter: () => cloneStarter
|
|
26
28
|
});
|
|
27
29
|
module.exports = __toCommonJS(cloneStarter_exports);
|
|
28
|
-
var import_fs_extra = require("fs-extra")
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
var import_fs_extra = require("fs-extra");
|
|
31
|
+
var import_os = require("os");
|
|
32
|
+
var import_path = require("path");
|
|
33
|
+
var import_rimraf = require("rimraf");
|
|
34
|
+
var import_utils = require("@vxrn/utils");
|
|
35
|
+
var home = (0, import_os.homedir)();
|
|
36
|
+
var vxrnDir = (0, import_path.join)(home, ".vxrn");
|
|
37
|
+
var cloneStarter = async function (template, resolvedProjectPath) {
|
|
38
|
+
var dir = await setupVxrnDotDir(template, (0, import_path.join)(vxrnDir, "vxrn", template.repo.url.split("/").at(-1)));
|
|
39
|
+
if (!(await (0, import_fs_extra.pathExists)(dir))) {
|
|
40
|
+
console.error(`Missing template for ${template.value} in ${dir}`);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
await (0, import_fs_extra.copy)(dir, resolvedProjectPath);
|
|
44
|
+
await (0, import_rimraf.rimraf)((0, import_path.join)(resolvedProjectPath, ".git"));
|
|
45
|
+
if (!isInGitRepo()) {
|
|
46
|
+
await (0, import_utils.execPromiseQuiet)(`git init`, {
|
|
38
47
|
cwd: resolvedProjectPath
|
|
39
|
-
})
|
|
40
|
-
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
41
51
|
async function setupVxrnDotDir(template, targetGitDir) {
|
|
42
|
-
var isRetry = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
43
|
-
|
|
52
|
+
var isRetry = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
53
|
+
var branch = template.repo.branch;
|
|
44
54
|
await (0, import_fs_extra.ensureDir)(vxrnDir);
|
|
45
55
|
var isInSubDir = template.repo.dir.length > 0;
|
|
46
|
-
if (
|
|
47
|
-
var sourceGitRepo = template.repo.url
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
if (!(await (0, import_fs_extra.pathExists)(targetGitDir))) {
|
|
57
|
+
var sourceGitRepo = template.repo.url;
|
|
58
|
+
var sourceGitRepoSshFallback = template.repo.sshFallback;
|
|
59
|
+
var cmd = `git clone --branch ${branch} ${isInSubDir ? "--depth 1 --sparse --filter=blob:none " : ""}${sourceGitRepo} "${targetGitDir}"`;
|
|
50
60
|
try {
|
|
51
61
|
await (0, import_utils.execPromiseQuiet)(cmd);
|
|
52
62
|
} catch (error) {
|
|
53
63
|
if (cmd.includes("https://")) {
|
|
54
|
-
console.info(
|
|
64
|
+
console.info(`https failed - trying with ssh now...`);
|
|
55
65
|
var sshCmd = cmd.replace(sourceGitRepo, sourceGitRepoSshFallback);
|
|
56
66
|
await (0, import_utils.execPromiseQuiet)(sshCmd);
|
|
57
|
-
} else
|
|
67
|
+
} else {
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
if (!(await (0, import_fs_extra.pathExists)((0, import_path.join)(targetGitDir, ".git")))) {
|
|
73
|
+
console.error(`Corrupt vxrn directory, please delete ${targetGitDir} folder and re-run`);
|
|
74
|
+
process.exit(1);
|
|
58
75
|
}
|
|
59
76
|
}
|
|
60
|
-
if (isInSubDir)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
77
|
+
if (isInSubDir) {
|
|
78
|
+
try {
|
|
79
|
+
var _template_repo_dir_join;
|
|
80
|
+
var cmd1 = `git sparse-checkout set ${(_template_repo_dir_join = template.repo.dir.join(import_path.sep)) !== null && _template_repo_dir_join !== void 0 ? _template_repo_dir_join : "."}`;
|
|
81
|
+
await (0, import_utils.execPromiseQuiet)(cmd1, {
|
|
82
|
+
cwd: targetGitDir
|
|
83
|
+
});
|
|
84
|
+
} catch (err) {
|
|
85
|
+
if (`${err}`.includes(`code 128`)) {
|
|
86
|
+
console.warn(`\u26A0\uFE0F Note: you need to be sure you can git clone from Github, your SSH key isn't valid.
|
|
68
87
|
|
|
69
88
|
- See: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
|
|
70
89
|
|
|
71
|
-
`)
|
|
90
|
+
`);
|
|
91
|
+
}
|
|
92
|
+
throw err;
|
|
93
|
+
}
|
|
72
94
|
}
|
|
73
95
|
try {
|
|
74
96
|
var cmd2 = `git pull --rebase --allow-unrelated-histories --depth 1 origin ${branch}`;
|
|
75
97
|
await (0, import_utils.execPromiseQuiet)(cmd2, {
|
|
76
98
|
cwd: targetGitDir
|
|
77
|
-
})
|
|
99
|
+
});
|
|
100
|
+
console.info();
|
|
78
101
|
var dir = (0, import_path.join)(targetGitDir, ...template.repo.dir);
|
|
79
|
-
if (!(await (0, import_fs_extra.pathExists)(dir)))
|
|
102
|
+
if (!(await (0, import_fs_extra.pathExists)(dir))) {
|
|
103
|
+
throw new Error(`Re-clone...`);
|
|
104
|
+
}
|
|
80
105
|
return dir;
|
|
81
106
|
} catch (err) {
|
|
82
|
-
|
|
83
|
-
|
|
107
|
+
if (isRetry) {
|
|
108
|
+
console.info(`Error updating: ${err.message} ${isRetry ? `failing.
|
|
109
|
+
${err.stack}` : "trying from fresh."}`);
|
|
110
|
+
console.info(`Please file an issue: https://github.com/onejs/one/issues/new?assignees=&labels=&template=bug_report.md&title=`);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
await (0, import_rimraf.rimraf)(targetGitDir);
|
|
114
|
+
return await setupVxrnDotDir(template, targetGitDir, true);
|
|
84
115
|
}
|
|
85
116
|
}
|
|
86
117
|
function isInGitRepo() {
|
|
87
118
|
try {
|
|
88
|
-
|
|
119
|
+
(0, import_utils.exec)("git rev-parse --is-inside-work-tree", {
|
|
89
120
|
stdio: "ignore"
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
|
|
121
|
+
});
|
|
122
|
+
return true;
|
|
123
|
+
} catch (error) {
|
|
124
|
+
return false;
|
|
93
125
|
}
|
|
94
126
|
}
|
|
95
127
|
//# sourceMappingURL=cloneStarter.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","cloneStarter_exports","__export","cloneStarter","module","exports","import_fs_extra","require","import_os","import_path","import_rimraf","import_utils","home","homedir","vxrnDir","join","template","resolvedProjectPath","dir","setupVxrnDotDir","repo","url","split","at","pathExists","console","error","process","exit","copy","rimraf","isInGitRepo","execPromiseQuiet","cwd","targetGitDir","isRetry","arguments","length","branch","ensureDir","isInSubDir","sourceGitRepo","sourceGitRepoSshFallback","sshFallback","cmd","includes","info","sshCmd","replace","_template_repo_dir_join","cmd1","sep","err","warn","cmd2","Error","message","stack","exec","stdio"],"sources":["../../../src/helpers/cloneStarter.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","cloneStarter_exports","__export","cloneStarter","module","exports","import_fs_extra","require","import_os","import_path","import_rimraf","import_utils","home","homedir","vxrnDir","join","template","resolvedProjectPath","dir","setupVxrnDotDir","repo","url","split","at","pathExists","console","error","process","exit","copy","rimraf","isInGitRepo","execPromiseQuiet","cwd","targetGitDir","isRetry","arguments","length","branch","ensureDir","isInSubDir","sourceGitRepo","sourceGitRepoSshFallback","sshFallback","cmd","includes","info","sshCmd","replace","_template_repo_dir_join","cmd1","sep","err","warn","cmd2","Error","message","stack","exec","stdio"],"sources":["../../../src/helpers/cloneStarter.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,oBAAA;AAAAC,QAAA,CAAAD,oBAAA;EAAAE,YAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAkD,CAAAK,oBAAA;AAClD,IAAAK,eAAA,GAAwBC,OAAA;AACxB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AAA,EAAiBsB,IAAA,EAAM;MAC3BrB,GAAA,EAAKC;IACP,CAAC;IACDT,OAAA,CAAQqB,IAAA,CAAK;IAEb,IAAA5B,GAAM,OAAAT,WAAM,CAAAM,IAAA,EAAAmB,YAAK,KAAAlB,QAAiB,CAAAI,IAAA,CAAAF,GAAS;IAC3C,IAAI,EAAE,UAAMZ,eAAA,CAAAkB,UAAA,EAAWN,GAAG,IAAI;MAC5B,MAAM,IAAIqC,KAAA,CAAM,aAAa;IAC/B;IAEA,OAAOrC,GAAA;EACT,SAASkC,GAAA,EAAU;IACjB,IAAIjB,OAAA,EAAS;MACXV,OAAA,CAAQqB,IAAA,oBAAAM,GAAA,CAAAI,OAAA,IAAArB,OAAA;AAAA,EAAAiB,GAAA,CAAAK,KACN,yBAAuB,EAAO;MAA+BhC,OAAK,CAAAqB,IAAK,iHAAoB;MAC7FnB,OAAA,CAAAC,IAAA;IACA;IAAQ,MACN,IAAAlB,aAAA,CAAAoB,MAAA,EAAAI,YAAA;IAAA,OACF,MAAAf,eAAA,CAAAH,QAAA,EAAAkB,YAAA;EACA;AAAc;AAEhB,SAAAH,WAAMA,CAAA;EACN;IACF,IAAApB,YAAA,CAAA+C,IAAA;MACFC,KAAA;IAEA;IACE,OAAI;EACF,SAAAjC,KAAA;IACA,OAAO;EACT;AACE","ignoreList":[]}
|
|
@@ -2,60 +2,81 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var getProjectName_exports = {};
|
|
33
35
|
__export(getProjectName_exports, {
|
|
34
36
|
getProjectName: () => getProjectName
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(getProjectName_exports);
|
|
37
|
-
var import_node_path = __toESM(require("node:path"))
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
var import_node_path = __toESM(require("node:path"));
|
|
40
|
+
var import_ansis = __toESM(require("ansis"));
|
|
41
|
+
var import_prompts = __toESM(require("prompts"));
|
|
42
|
+
var import_validateNpmPackage = require("./validateNpmPackage.cjs");
|
|
41
43
|
const getProjectName = async projectPath => {
|
|
42
|
-
if (typeof projectPath
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
if (typeof projectPath === "string") {
|
|
45
|
+
projectPath = projectPath.trim();
|
|
46
|
+
}
|
|
47
|
+
console.info();
|
|
48
|
+
console.info(import_ansis.default.yellow(` Hello. Let's create a new ${import_ansis.default.yellowBright(`\u2460`)} app...`));
|
|
49
|
+
console.info();
|
|
50
|
+
if (!projectPath) {
|
|
51
|
+
const defaultName = "hello-world";
|
|
52
|
+
const res = await (0, import_prompts.default)({
|
|
53
|
+
type: "text",
|
|
54
|
+
name: "path",
|
|
55
|
+
message: "Name",
|
|
56
|
+
initial: defaultName,
|
|
57
|
+
validate: name => {
|
|
58
|
+
const validation = (0, import_validateNpmPackage.validateNpmName)(import_node_path.default.basename(import_node_path.default.resolve(name)));
|
|
59
|
+
if (validation.valid) {
|
|
60
|
+
return true;
|
|
52
61
|
}
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
return "Invalid name: " + validation.problems[0];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
if (typeof res.path === "string") {
|
|
66
|
+
projectPath = res.path.trim() || defaultName;
|
|
67
|
+
}
|
|
55
68
|
}
|
|
56
69
|
if (!projectPath) {
|
|
57
|
-
const name =
|
|
58
|
-
console.info()
|
|
70
|
+
const name = `create-vxrn`;
|
|
71
|
+
console.info();
|
|
72
|
+
console.info("Please specify the project directory:");
|
|
73
|
+
console.info(` ${import_ansis.default.cyan(name)} ${import_ansis.default.green("<project-directory>")}`);
|
|
74
|
+
console.info();
|
|
75
|
+
console.info("For example:");
|
|
76
|
+
console.info(` ${import_ansis.default.cyan(name)} ${import_ansis.default.green("my-app")}`);
|
|
77
|
+
console.info();
|
|
78
|
+
console.info(`Run ${import_ansis.default.cyan(`${name} --help`)} to see all options.`);
|
|
79
|
+
process.exit(1);
|
|
59
80
|
}
|
|
60
81
|
return projectPath;
|
|
61
82
|
};
|
|
@@ -4,61 +4,82 @@ var __create = Object.create;
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
8
|
-
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
18
|
get: () => from[key],
|
|
18
19
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
22
24
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
+
value: true
|
|
35
|
+
}), mod);
|
|
34
36
|
var getProjectName_exports = {};
|
|
35
37
|
__export(getProjectName_exports, {
|
|
36
38
|
getProjectName: () => getProjectName
|
|
37
39
|
});
|
|
38
40
|
module.exports = __toCommonJS(getProjectName_exports);
|
|
39
|
-
var import_path = __toESM(require("path"))
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
41
|
+
var import_path = __toESM(require("path"));
|
|
42
|
+
var import_ansis = __toESM(require("ansis"));
|
|
43
|
+
var import_prompts = __toESM(require("prompts"));
|
|
44
|
+
var import_validateNpmPackage = require("./validateNpmPackage.native.js");
|
|
45
|
+
var getProjectName = async function (projectPath) {
|
|
46
|
+
if (typeof projectPath === "string") {
|
|
47
|
+
projectPath = projectPath.trim();
|
|
48
|
+
}
|
|
49
|
+
console.info();
|
|
50
|
+
console.info(import_ansis.default.yellow(` Hello. Let's create a new ${import_ansis.default.yellowBright(`\u2460`)} app...`));
|
|
51
|
+
console.info();
|
|
52
|
+
if (!projectPath) {
|
|
53
|
+
var defaultName = "hello-world";
|
|
54
|
+
var res = await (0, import_prompts.default)({
|
|
55
|
+
type: "text",
|
|
56
|
+
name: "path",
|
|
57
|
+
message: "Name",
|
|
58
|
+
initial: defaultName,
|
|
59
|
+
validate: function (name2) {
|
|
60
|
+
var validation = (0, import_validateNpmPackage.validateNpmName)(import_path.default.basename(import_path.default.resolve(name2)));
|
|
61
|
+
if (validation.valid) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
return "Invalid name: " + validation.problems[0];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
if (typeof res.path === "string") {
|
|
68
|
+
projectPath = res.path.trim() || defaultName;
|
|
61
69
|
}
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
}
|
|
71
|
+
if (!projectPath) {
|
|
72
|
+
var name = `create-vxrn`;
|
|
73
|
+
console.info();
|
|
74
|
+
console.info("Please specify the project directory:");
|
|
75
|
+
console.info(` ${import_ansis.default.cyan(name)} ${import_ansis.default.green("<project-directory>")}`);
|
|
76
|
+
console.info();
|
|
77
|
+
console.info("For example:");
|
|
78
|
+
console.info(` ${import_ansis.default.cyan(name)} ${import_ansis.default.green("my-app")}`);
|
|
79
|
+
console.info();
|
|
80
|
+
console.info(`Run ${import_ansis.default.cyan(`${name} --help`)} to see all options.`);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
return projectPath;
|
|
84
|
+
};
|
|
64
85
|
//# sourceMappingURL=getProjectName.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","getProjectName_exports","__export","getProjectName","module","exports","import_path","__toESM","require","import_ansis","import_prompts","import_validateNpmPackage","projectPath","trim","console","info","default","yellow","yellowBright","defaultName","res","type","name","message","initial","validate","name2","validation","validateNpmName","basename","resolve","valid","problems","path","cyan","green","process","exit"],"sources":["../../../src/helpers/getProjectName.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","getProjectName_exports","__export","getProjectName","module","exports","import_path","__toESM","require","import_ansis","import_prompts","import_validateNpmPackage","projectPath","trim","console","info","default","yellow","yellowBright","defaultName","res","type","name","message","initial","validate","name2","validation","validateNpmName","basename","resolve","valid","problems","path","cyan","green","process","exit"],"sources":["../../../src/helpers/getProjectName.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,sBAAA;AAAAC,QAAA,CAAAD,sBAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAiB,CAAAK,sBAAA;AACjB,IAAAK,WAAA,GAAAC,OAAkB,CAAAC,OAAA;AAClB,IAAAC,YAAA,GAAAF,OAAoB,CAAAC,OAAA;AACpB,IAAAE,cAAA,GAAAH,OAAA,CAAAC,OAAgC;AAEzB,IAAAG,yBAAuB,GAAOH,OAAA,iCAAyB;AAC5D,IAAAL,cAAW,kBAAAA,CAAgBS,WAAU;EACnC,WAAAA,WAAc,aAAiB;IACjCA,WAAA,GAAAA,WAAA,CAAAC,IAAA;EAEA;EACAC,OAAA,CAAQC,IAAA;EAAAD,OACN,CAAAC,IAAA,CAAAN,YAAM,CAAAO,OAAO,CAAAC,MAAA,gCAA+BR,YAAM,CAAAO,OAAA,CAAAE,YAAiB,SAAU;EAC/EJ,OAAA,CAAAC,IAAA;EACA,KAAAH,WAAa;IAEb,IAAKO,WAAA,GAAa;IAChB,IAAAC,GAAM,aAAcV,cAAA,CAAAM,OAAA;MACpBK,IAAM,QAAM;MACVC,IAAA,EAAM;MACNC,OAAM;MACNC,OAAA,EAASL,WAAA;MACTM,QAAA,EAAS,SAAAA,CAAAC,KAAA;QACT,IAAAC,UAAW,IAAiB,GAAAhB,yBAAA,CAAAiB,eAAA,EAAAtB,WAAA,CAAAU,OAAA,CAAAa,QAAA,CAAAvB,WAAA,CAAAU,OAAA,CAAAc,OAAA,CAAAJ,KAAA;QAC1B,IAAAC,UAAM,CAAAI,KAAA;UACN,OAAI;QACF;QACF,0BAAAJ,UAAA,CAAAK,QAAA;MACA;IAAgD,EAClD;IACF,IAAC,OAAAZ,GAAA,CAAAa,IAAA;MAEDrB,WAAW,GAAIQ,GAAA,CAAAa,IAAS,CAAApB,IAAA,MAAUM,WAAA;IAChC;EAAiC;EAErC,KAAAP,WAAA;IAEA,IAAKU,IAAA,gBAAa;IAChBR,OAAM,CAAAC,IAAA,CAAO;IACbD,OAAA,CAAQC,IAAA,CAAK;IACbD,OAAA,CAAQC,IAAA,CAAK,KAAAN,YAAA,CAAAO,OAAA,CAAAkB,IAAA,CAAAZ,IAAA,KAAuCb,YAAA,CAAAO,OAAA,CAAAmB,KAAA;IACpDrB,OAAA,CAAQC,IAAA,CAAK;IACbD,OAAA,CAAQC,IAAA,CAAK;IACbD,OAAA,CAAQC,IAAA,CAAK,KAAAN,YAAc,CAAAO,OAAA,CAAAkB,IAAA,CAAAZ,IAAA,KAAAb,YAAA,CAAAO,OAAA,CAAAmB,KAAA;IAC3BrB,OAAA,CAAQC,IAAA,CAAK;IACbD,OAAA,CAAQC,IAAA,CAAK,OAAAN,YAAA,CAAAO,OAAA,CAAAkB,IAAA,IAAAZ,IAAA;IACbc,OAAA,CAAQC,IAAA,CAAK;EACb;EACF,OAAAzB,WAAA;AACA","ignoreList":[]}
|
|
@@ -2,52 +2,67 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var getTemplateInfo_exports = {};
|
|
33
35
|
__export(getTemplateInfo_exports, {
|
|
34
36
|
getTemplateInfo: () => getTemplateInfo
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(getTemplateInfo_exports);
|
|
37
|
-
var import_prompts = __toESM(require("prompts"))
|
|
38
|
-
|
|
39
|
+
var import_prompts = __toESM(require("prompts"));
|
|
40
|
+
var import_templates = require("../templates.cjs");
|
|
39
41
|
const validTemplates = import_templates.templates.map(({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
value
|
|
43
|
+
}) => value).join(", ");
|
|
44
|
+
const getTemplateInfo = async template => {
|
|
45
|
+
let res = getValidTemplate(template);
|
|
46
|
+
if (template && !res) {
|
|
47
|
+
console.warn(`template ${template} is not valid. valid options: ${validTemplates}`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
if (!res) {
|
|
51
|
+
console.info();
|
|
52
|
+
template = (await (0, import_prompts.default)({
|
|
45
53
|
name: "template",
|
|
46
54
|
type: "select",
|
|
47
|
-
message:
|
|
55
|
+
message: `Template`,
|
|
48
56
|
choices: import_templates.templates.filter(t => !t.hidden)
|
|
49
|
-
})).template
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
})).template;
|
|
58
|
+
}
|
|
59
|
+
res = getValidTemplate(`${template}`);
|
|
60
|
+
if (!res) {
|
|
61
|
+
console.warn(`template ${template} is not valid. valid options: ${validTemplates}`);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
return res;
|
|
65
|
+
};
|
|
66
|
+
const getValidTemplate = template => typeof template === "string" && import_templates.templates.find(({
|
|
67
|
+
value
|
|
68
|
+
}) => value === template);
|