create-vxrn 1.27.1 → 2.0.0-beta.45.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/.turbo/turbo-build.log +1 -1
- package/dist/cjs/create.cjs +193 -194
- package/dist/cjs/create.native.cjs +262 -0
- package/dist/cjs/create.native.js +218 -227
- package/dist/cjs/create.native.js.map +1 -1
- package/dist/cjs/helpers/cloneStarter.cjs +83 -95
- package/dist/cjs/helpers/cloneStarter.native.cjs +114 -0
- package/dist/cjs/helpers/cloneStarter.native.js +86 -97
- package/dist/cjs/helpers/cloneStarter.native.js.map +1 -1
- package/dist/cjs/helpers/getProjectName.cjs +56 -65
- package/dist/cjs/helpers/getProjectName.native.cjs +75 -0
- package/dist/cjs/helpers/getProjectName.native.js +56 -64
- package/dist/cjs/helpers/getProjectName.native.js.map +1 -1
- package/dist/cjs/helpers/getTemplateInfo.cjs +39 -52
- package/dist/cjs/helpers/getTemplateInfo.native.cjs +67 -0
- package/dist/cjs/helpers/getTemplateInfo.native.js +48 -60
- package/dist/cjs/helpers/getTemplateInfo.native.js.map +1 -1
- package/dist/cjs/helpers/installDependencies.cjs +37 -43
- package/dist/cjs/helpers/installDependencies.native.cjs +51 -0
- package/dist/cjs/helpers/installDependencies.native.js +37 -42
- package/dist/cjs/helpers/installDependencies.native.js.map +1 -1
- package/dist/cjs/helpers/validateNpmPackage.cjs +25 -36
- package/dist/cjs/helpers/validateNpmPackage.native.cjs +42 -0
- package/dist/cjs/helpers/validateNpmPackage.native.js +25 -35
- package/dist/cjs/helpers/validateNpmPackage.native.js.map +1 -1
- package/dist/cjs/index.cjs +60 -69
- package/dist/cjs/index.native.cjs +92 -0
- package/dist/cjs/index.native.js +61 -69
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/steps/bare.cjs +51 -61
- package/dist/cjs/steps/bare.native.cjs +121 -0
- package/dist/cjs/steps/bare.native.js +71 -82
- package/dist/cjs/steps/bare.native.js.map +1 -1
- package/dist/cjs/steps/fullstack.cjs +23 -35
- package/dist/cjs/steps/fullstack.native.cjs +50 -0
- package/dist/cjs/steps/fullstack.native.js +25 -36
- package/dist/cjs/steps/fullstack.native.js.map +1 -1
- package/dist/cjs/steps/one.cjs +42 -57
- package/dist/cjs/steps/one.native.cjs +97 -0
- package/dist/cjs/steps/one.native.js +46 -60
- package/dist/cjs/steps/one.native.js.map +1 -1
- package/dist/cjs/steps/types.cjs +9 -11
- package/dist/cjs/steps/types.native.cjs +18 -0
- package/dist/cjs/steps/types.native.js +9 -10
- package/dist/cjs/steps/types.native.js.map +1 -1
- package/dist/cjs/templates.cjs +54 -59
- package/dist/cjs/templates.native.cjs +70 -0
- package/dist/cjs/templates.native.js +55 -59
- package/dist/cjs/templates.native.js.map +1 -1
- package/dist/esm/create.mjs +179 -169
- package/dist/esm/create.mjs.map +1 -1
- package/dist/esm/create.native.js +204 -203
- package/dist/esm/create.native.js.map +1 -1
- package/dist/esm/helpers/cloneStarter.mjs +71 -77
- package/dist/esm/helpers/cloneStarter.mjs.map +1 -1
- package/dist/esm/helpers/cloneStarter.native.js +74 -80
- package/dist/esm/helpers/cloneStarter.native.js.map +1 -1
- package/dist/esm/helpers/getProjectName.mjs +41 -39
- package/dist/esm/helpers/getProjectName.mjs.map +1 -1
- package/dist/esm/helpers/getProjectName.native.js +41 -39
- package/dist/esm/helpers/getProjectName.native.js.map +1 -1
- package/dist/esm/helpers/getTemplateInfo.mjs +25 -27
- package/dist/esm/helpers/getTemplateInfo.mjs.map +1 -1
- package/dist/esm/helpers/getTemplateInfo.native.js +33 -35
- package/dist/esm/helpers/getTemplateInfo.native.js.map +1 -1
- package/dist/esm/helpers/installDependencies.mjs +25 -25
- package/dist/esm/helpers/installDependencies.mjs.map +1 -1
- package/dist/esm/helpers/installDependencies.native.js +25 -25
- package/dist/esm/helpers/installDependencies.native.js.map +1 -1
- package/dist/esm/helpers/validateNpmPackage.mjs +10 -10
- package/dist/esm/helpers/validateNpmPackage.mjs.map +1 -1
- package/dist/esm/helpers/validateNpmPackage.native.js +10 -10
- package/dist/esm/helpers/validateNpmPackage.native.js.map +1 -1
- package/dist/esm/index.js +51 -53
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +51 -53
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +52 -54
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/steps/bare.mjs +35 -36
- package/dist/esm/steps/bare.mjs.map +1 -1
- package/dist/esm/steps/bare.native.js +55 -58
- package/dist/esm/steps/bare.native.js.map +1 -1
- package/dist/esm/steps/fullstack.mjs +8 -9
- package/dist/esm/steps/fullstack.mjs.map +1 -1
- package/dist/esm/steps/fullstack.native.js +10 -11
- package/dist/esm/steps/fullstack.native.js.map +1 -1
- package/dist/esm/steps/one.mjs +26 -32
- package/dist/esm/steps/one.mjs.map +1 -1
- package/dist/esm/steps/one.native.js +30 -36
- package/dist/esm/steps/one.native.js.map +1 -1
- package/dist/esm/steps/types.mjs +0 -2
- package/dist/esm/steps/types.native.js +0 -2
- package/dist/esm/templates.mjs +40 -34
- package/dist/esm/templates.mjs.map +1 -1
- package/dist/esm/templates.native.js +40 -34
- package/dist/esm/templates.native.js.map +1 -1
- package/package.json +4 -4
- package/dist/esm/steps/types.mjs.map +0 -1
- package/dist/esm/steps/types.native.js.map +0 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
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, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
27
|
+
}) : target, mod));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var templates_exports = {};
|
|
30
|
+
__export(templates_exports, { templates: () => templates });
|
|
31
|
+
module.exports = __toCommonJS(templates_exports);
|
|
32
|
+
var BasicTemplateSteps = __toESM(require("./steps/one.native.js"));
|
|
33
|
+
var templates = [
|
|
34
|
+
{
|
|
35
|
+
title: `Basic`,
|
|
36
|
+
value: "Basic",
|
|
37
|
+
description: "The simplest starting point, vanilla Rreact Native",
|
|
38
|
+
type: "included-in-monorepo",
|
|
39
|
+
hidden: false,
|
|
40
|
+
repo: {
|
|
41
|
+
url: `https://github.com/onejs/one.git`,
|
|
42
|
+
sshFallback: `git@github.com:onejs/one.git`,
|
|
43
|
+
dir: [`examples`, `one-basic`],
|
|
44
|
+
branch: "main"
|
|
45
|
+
},
|
|
46
|
+
...BasicTemplateSteps
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: `Takeout Free`,
|
|
50
|
+
value: "Takeout",
|
|
51
|
+
description: "One, Tamagui, Zero, Better Auth",
|
|
52
|
+
type: "external-repo",
|
|
53
|
+
hidden: false,
|
|
54
|
+
repo: {
|
|
55
|
+
url: `https://github.com/tamagui/takeout-free.git`,
|
|
56
|
+
sshFallback: `git@github.com:tamagui/takeout-free.git`,
|
|
57
|
+
dir: [],
|
|
58
|
+
branch: "main"
|
|
59
|
+
},
|
|
60
|
+
...BasicTemplateSteps
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: `Takeout Production`,
|
|
64
|
+
value: "TakeoutPro",
|
|
65
|
+
description: "Takeout + a startup in a repo. Refined stack that's production ready. Home/Terms/Docs, CI/CD, IaC, Integration Tests, Onboarding, Notifications, OTA Updates, Screens, >50 Components, >25 Agent Docs, >30 Scripts. See https://takeout.tamagui.dev",
|
|
66
|
+
type: "external-link",
|
|
67
|
+
hidden: false,
|
|
68
|
+
externalUrl: "https://takeout.tamagui.dev"
|
|
69
|
+
}
|
|
70
|
+
];
|
|
@@ -7,70 +7,66 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
14
|
};
|
|
15
15
|
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
23
|
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
32
27
|
}) : target, mod));
|
|
33
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
-
value: true
|
|
35
|
-
}), mod);
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
29
|
var templates_exports = {};
|
|
37
|
-
__export(templates_exports, {
|
|
38
|
-
templates: () => templates
|
|
39
|
-
});
|
|
30
|
+
__export(templates_exports, { templates: () => templates });
|
|
40
31
|
module.exports = __toCommonJS(templates_exports);
|
|
41
32
|
var BasicTemplateSteps = __toESM(require("./steps/one.native.js"));
|
|
42
|
-
var templates = [
|
|
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
|
-
|
|
33
|
+
var templates = [
|
|
34
|
+
{
|
|
35
|
+
title: `Basic`,
|
|
36
|
+
value: "Basic",
|
|
37
|
+
description: "The simplest starting point, vanilla Rreact Native",
|
|
38
|
+
type: "included-in-monorepo",
|
|
39
|
+
hidden: false,
|
|
40
|
+
repo: {
|
|
41
|
+
url: `https://github.com/onejs/one.git`,
|
|
42
|
+
sshFallback: `git@github.com:onejs/one.git`,
|
|
43
|
+
dir: [`examples`, `one-basic`],
|
|
44
|
+
branch: "main"
|
|
45
|
+
},
|
|
46
|
+
...BasicTemplateSteps
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: `Takeout Free`,
|
|
50
|
+
value: "Takeout",
|
|
51
|
+
description: "One, Tamagui, Zero, Better Auth",
|
|
52
|
+
type: "external-repo",
|
|
53
|
+
hidden: false,
|
|
54
|
+
repo: {
|
|
55
|
+
url: `https://github.com/tamagui/takeout-free.git`,
|
|
56
|
+
sshFallback: `git@github.com:tamagui/takeout-free.git`,
|
|
57
|
+
dir: [],
|
|
58
|
+
branch: "main"
|
|
59
|
+
},
|
|
60
|
+
...BasicTemplateSteps
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: `Takeout Production`,
|
|
64
|
+
value: "TakeoutPro",
|
|
65
|
+
description: "Takeout + a startup in a repo. Refined stack that's production ready. Home/Terms/Docs, CI/CD, IaC, Integration Tests, Onboarding, Notifications, OTA Updates, Screens, >50 Components, >25 Agent Docs, >30 Scripts. See https://takeout.tamagui.dev",
|
|
66
|
+
type: "external-link",
|
|
67
|
+
hidden: false,
|
|
68
|
+
externalUrl: "https://takeout.tamagui.dev"
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
|
|
76
72
|
//# sourceMappingURL=templates.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"templates.native.js","names":[],"sources":["cjs/templates.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar templates_exports = {};\n__export(templates_exports, {\n templates: () => templates\n});\nmodule.exports = __toCommonJS(templates_exports);\nvar BasicTemplateSteps = __toESM(require(\"./steps/one\"));\nvar templates = [\n {\n title: `Basic`,\n value: \"Basic\",\n description: \"The simplest starting point, vanilla Rreact Native\",\n type: \"included-in-monorepo\",\n hidden: false,\n repo: {\n url: `https://github.com/onejs/one.git`,\n sshFallback: `git@github.com:onejs/one.git`,\n dir: [\n `examples`,\n `one-basic`\n ],\n branch: \"main\"\n },\n ...BasicTemplateSteps\n },\n {\n title: `Takeout Free`,\n value: \"Takeout\",\n description: \"One, Tamagui, Zero, Better Auth\",\n type: \"external-repo\",\n hidden: false,\n repo: {\n url: `https://github.com/tamagui/takeout-free.git`,\n sshFallback: `git@github.com:tamagui/takeout-free.git`,\n dir: [],\n branch: \"main\"\n },\n ...BasicTemplateSteps\n },\n {\n title: `Takeout Production`,\n value: \"TakeoutPro\",\n description: \"Takeout + a startup in a repo. Refined stack that's production ready. Home/Terms/Docs, CI/CD, IaC, Integration Tests, Onboarding, Notifications, OTA Updates, Screens, >50 Components, >25 Agent Docs, >30 Scripts. See https://takeout.tamagui.dev\",\n type: \"external-link\",\n hidden: false,\n externalUrl: \"https://takeout.tamagui.dev\"\n }\n];\n//# sourceMappingURL=templates.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,oBAAoB,CAAC;AACzB,SAAS,mBAAmB,EAC1B,iBAAiB,UACnB,CAAC;AACD,OAAO,UAAU,aAAa,iBAAiB;AAC/C,IAAI,qBAAqB,QAAQ,QAAQ,uBAAa,CAAC;AACvD,IAAI,YAAY;CACd;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,QAAQ;EACR,MAAM;GACJ,KAAK;GACL,aAAa;GACb,KAAK,CACH,YACA,WACF;GACA,QAAQ;EACV;EACA,GAAG;CACL;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,QAAQ;EACR,MAAM;GACJ,KAAK;GACL,aAAa;GACb,KAAK,CAAC;GACN,QAAQ;EACV;EACA,GAAG;CACL;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,MAAM;EACN,QAAQ;EACR,aAAa;CACf;AACF"}
|
package/dist/esm/create.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ansis from "ansis";
|
|
2
2
|
import FSExtra from "fs-extra";
|
|
3
|
-
import {
|
|
3
|
+
import { exec, execSync } from "node:child_process";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { promisify } from "node:util";
|
|
@@ -12,188 +12,198 @@ import { installDependencies } from "./helpers/installDependencies.mjs";
|
|
|
12
12
|
import { validateNpmName } from "./helpers/validateNpmPackage.mjs";
|
|
13
13
|
import prompts from "prompts";
|
|
14
14
|
import { detectPackageManager } from "@vxrn/utils";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
readFileSync,
|
|
18
|
-
writeFileSync
|
|
19
|
-
} = FSExtra;
|
|
15
|
+
|
|
16
|
+
const { existsSync, readFileSync, writeFileSync } = FSExtra;
|
|
20
17
|
async function create(args) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const gitVersionString = Number.parseFloat(execSync(`git --version`).toString().replace(`git version `, "").trim());
|
|
19
|
+
if (gitVersionString < 2.27) {
|
|
20
|
+
console.error(`
|
|
24
21
|
|
|
25
22
|
! vxrn can't install: Git version must be >= 2.27
|
|
26
23
|
|
|
27
24
|
`);
|
|
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
|
-
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
let projectName = args.name || "";
|
|
28
|
+
let resolvedProjectPath = path.resolve(process.cwd(), projectName);
|
|
29
|
+
async function promptForName() {
|
|
30
|
+
projectName = await getProjectName();
|
|
31
|
+
resolvedProjectPath = path.resolve(process.cwd(), projectName);
|
|
32
|
+
}
|
|
33
|
+
if (projectName) {
|
|
34
|
+
if (fs.existsSync(resolvedProjectPath)) {
|
|
35
|
+
console.error(`Error: folder already exists: ${resolvedProjectPath}`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
await promptForName();
|
|
40
|
+
while (fs.existsSync(resolvedProjectPath)) {
|
|
41
|
+
console.info();
|
|
42
|
+
console.info(ansis.yellow("!"), `The folder ${ansis.underline(ansis.blueBright(projectName))} already exists, lets try another name`);
|
|
43
|
+
console.info();
|
|
44
|
+
console.info();
|
|
45
|
+
await promptForName();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
console.info();
|
|
49
|
+
let template = await getTemplateInfo(args.template);
|
|
50
|
+
if (template.type === "external-link") {
|
|
51
|
+
const url = template.externalUrl;
|
|
52
|
+
console.info();
|
|
53
|
+
console.info(ansis.green(`Opening ${url}...`));
|
|
54
|
+
console.info();
|
|
55
|
+
const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
56
|
+
exec(`${openCmd} ${url}`);
|
|
57
|
+
process.exit(0);
|
|
58
|
+
}
|
|
59
|
+
const { valid, problems } = validateNpmName(projectName);
|
|
60
|
+
if (!valid) {
|
|
61
|
+
console.error(`Could not create a project called ${ansis.red(`"${projectName}"`)} because of npm naming restrictions:`);
|
|
62
|
+
problems.forEach((p) => console.error(` ${ansis.red.bold("*")} ${p}`));
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
console.info();
|
|
66
|
+
const Spinner = await import("yocto-spinner").then((x) => x.default);
|
|
67
|
+
const spinner = Spinner({
|
|
68
|
+
text: `Creating...`,
|
|
69
|
+
spinner: {
|
|
70
|
+
frames: [
|
|
71
|
+
"⠋",
|
|
72
|
+
"⠙",
|
|
73
|
+
"⠹",
|
|
74
|
+
"⠸",
|
|
75
|
+
"⠼",
|
|
76
|
+
"⠴",
|
|
77
|
+
"⠦",
|
|
78
|
+
"⠧",
|
|
79
|
+
"⠇",
|
|
80
|
+
"⠏"
|
|
81
|
+
],
|
|
82
|
+
interval: 100
|
|
83
|
+
}
|
|
84
|
+
}).start();
|
|
85
|
+
await FSExtra.mkdir(resolvedProjectPath);
|
|
86
|
+
try {
|
|
87
|
+
await cloneStarter(template, resolvedProjectPath);
|
|
88
|
+
process.chdir(resolvedProjectPath);
|
|
89
|
+
} catch (e) {
|
|
90
|
+
console.error(`[vxrn] Failed to copy example into ${resolvedProjectPath}
|
|
86
91
|
|
|
87
92
|
`, e);
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
spinner.stop();
|
|
96
|
+
console.info();
|
|
97
|
+
console.info();
|
|
98
|
+
console.info(ansis.green(`${projectName} created!`));
|
|
99
|
+
console.info();
|
|
100
|
+
console.info();
|
|
101
|
+
const packageJson = await (async () => {
|
|
102
|
+
const errorMessages = [];
|
|
103
|
+
try {
|
|
104
|
+
const dirname = typeof __dirname !== "undefined" ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
|
105
|
+
const possiblePaths = [
|
|
106
|
+
path.join(dirname, "..", "package.json"),
|
|
107
|
+
path.join(dirname, "..", "..", "package.json"),
|
|
108
|
+
path.join(dirname, "..", "..", "..", "package.json")
|
|
109
|
+
];
|
|
110
|
+
const readFile = promisify(fs.readFile);
|
|
111
|
+
for (const p of possiblePaths) {
|
|
112
|
+
try {
|
|
113
|
+
const data = JSON.parse(await readFile(p));
|
|
114
|
+
return data;
|
|
115
|
+
} catch (e) {
|
|
116
|
+
if (e instanceof Error) errorMessages.push(e.message);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
throw new Error("package.json not found in any of the expected locations.");
|
|
120
|
+
} catch (e) {
|
|
121
|
+
console.error("Failed to load package.json:", errorMessages.join("\n"));
|
|
122
|
+
throw e;
|
|
123
|
+
}
|
|
124
|
+
})();
|
|
125
|
+
updatePackageJsonName(projectName, resolvedProjectPath);
|
|
126
|
+
updatePackageJsonVersions(packageJson.version, resolvedProjectPath);
|
|
127
|
+
updateAppJsonName(projectName, resolvedProjectPath);
|
|
128
|
+
const packageManager = await (async () => {
|
|
129
|
+
if ("packageManager" in template) {
|
|
130
|
+
return template.packageManager;
|
|
131
|
+
}
|
|
132
|
+
const found = await detectPackageManager();
|
|
133
|
+
const allFound = Object.keys(found);
|
|
134
|
+
if (allFound.length === 1) {
|
|
135
|
+
return allFound[0];
|
|
136
|
+
}
|
|
137
|
+
const response = await prompts({
|
|
138
|
+
name: "packageManager",
|
|
139
|
+
type: "select",
|
|
140
|
+
message: `Package Manager:`,
|
|
141
|
+
choices: allFound.filter((x) => found[x]).map((name) => ({
|
|
142
|
+
title: name,
|
|
143
|
+
value: name
|
|
144
|
+
}))
|
|
145
|
+
});
|
|
146
|
+
return response.packageManager;
|
|
147
|
+
})();
|
|
148
|
+
console.info();
|
|
149
|
+
if ("preInstall" in template) {
|
|
150
|
+
await template.preInstall({
|
|
151
|
+
packageManager,
|
|
152
|
+
isFullClone: true,
|
|
153
|
+
projectName,
|
|
154
|
+
projectPath: resolvedProjectPath
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
console.info();
|
|
159
|
+
console.info(ansis.green(`Installing with ${packageManager}...`));
|
|
160
|
+
console.info();
|
|
161
|
+
await installDependencies(resolvedProjectPath, packageManager);
|
|
162
|
+
} catch (e) {
|
|
163
|
+
console.error("[vxrn] error installing with " + packageManager + `
|
|
155
164
|
${e}`);
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
165
|
+
process.exit(1);
|
|
166
|
+
}
|
|
167
|
+
const envDefault = path.join(resolvedProjectPath, ".env.default");
|
|
168
|
+
const env = path.join(resolvedProjectPath, ".env");
|
|
169
|
+
if (existsSync(envDefault) && !existsSync(env)) {
|
|
170
|
+
await FSExtra.move(envDefault, env);
|
|
171
|
+
}
|
|
172
|
+
if ("extraSteps" in template) {
|
|
173
|
+
await template.extraSteps({
|
|
174
|
+
packageManager,
|
|
175
|
+
isFullClone: true,
|
|
176
|
+
projectName,
|
|
177
|
+
projectPath: resolvedProjectPath
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
console.info();
|
|
172
181
|
}
|
|
173
182
|
function updatePackageJsonName(projectName, dir) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
183
|
+
const packageJsonPath = path.join(dir, "package.json");
|
|
184
|
+
if (existsSync(packageJsonPath)) {
|
|
185
|
+
const content = readFileSync(packageJsonPath).toString();
|
|
186
|
+
const contentWithUpdatedName = content.replace(/("name": ")(.*)(",)/, `$1${projectName}$3`);
|
|
187
|
+
writeFileSync(packageJsonPath, contentWithUpdatedName);
|
|
188
|
+
}
|
|
180
189
|
}
|
|
181
190
|
function updatePackageJsonVersions(version, dir) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
191
|
+
const packageJsonPath = path.join(dir, "package.json");
|
|
192
|
+
if (existsSync(packageJsonPath)) {
|
|
193
|
+
const content = readFileSync(packageJsonPath).toString();
|
|
194
|
+
const contentWithUpdatedVersions = content.replace(/"workspace:\^"/gm, `"^${version}"`).replace(/"workspace:~"/gm, `"~${version}"`).replace(/"workspace:\*"/gm, `"^${version}"`);
|
|
195
|
+
writeFileSync(packageJsonPath, contentWithUpdatedVersions);
|
|
196
|
+
}
|
|
188
197
|
}
|
|
189
198
|
function updateAppJsonName(projectName, dir) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
199
|
+
const appJsonPath = path.join(dir, "app.json");
|
|
200
|
+
if (existsSync(appJsonPath)) {
|
|
201
|
+
const content = readFileSync(appJsonPath).toString();
|
|
202
|
+
const projectSlug = projectName.toLowerCase().replace(/\s/g, "-");
|
|
203
|
+
const contentWithUpdatedName = content.replace(/("name": ")(.*)(",)/, `$1${projectName}$3`).replace(/("slug": ")(.*)(",)/, `$1${projectSlug}$3`);
|
|
204
|
+
writeFileSync(appJsonPath, contentWithUpdatedName);
|
|
205
|
+
}
|
|
197
206
|
}
|
|
207
|
+
|
|
198
208
|
export { create };
|
|
199
209
|
//# sourceMappingURL=create.mjs.map
|