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.
Files changed (100) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/cjs/create.cjs +193 -194
  3. package/dist/cjs/create.native.cjs +262 -0
  4. package/dist/cjs/create.native.js +218 -227
  5. package/dist/cjs/create.native.js.map +1 -1
  6. package/dist/cjs/helpers/cloneStarter.cjs +83 -95
  7. package/dist/cjs/helpers/cloneStarter.native.cjs +114 -0
  8. package/dist/cjs/helpers/cloneStarter.native.js +86 -97
  9. package/dist/cjs/helpers/cloneStarter.native.js.map +1 -1
  10. package/dist/cjs/helpers/getProjectName.cjs +56 -65
  11. package/dist/cjs/helpers/getProjectName.native.cjs +75 -0
  12. package/dist/cjs/helpers/getProjectName.native.js +56 -64
  13. package/dist/cjs/helpers/getProjectName.native.js.map +1 -1
  14. package/dist/cjs/helpers/getTemplateInfo.cjs +39 -52
  15. package/dist/cjs/helpers/getTemplateInfo.native.cjs +67 -0
  16. package/dist/cjs/helpers/getTemplateInfo.native.js +48 -60
  17. package/dist/cjs/helpers/getTemplateInfo.native.js.map +1 -1
  18. package/dist/cjs/helpers/installDependencies.cjs +37 -43
  19. package/dist/cjs/helpers/installDependencies.native.cjs +51 -0
  20. package/dist/cjs/helpers/installDependencies.native.js +37 -42
  21. package/dist/cjs/helpers/installDependencies.native.js.map +1 -1
  22. package/dist/cjs/helpers/validateNpmPackage.cjs +25 -36
  23. package/dist/cjs/helpers/validateNpmPackage.native.cjs +42 -0
  24. package/dist/cjs/helpers/validateNpmPackage.native.js +25 -35
  25. package/dist/cjs/helpers/validateNpmPackage.native.js.map +1 -1
  26. package/dist/cjs/index.cjs +60 -69
  27. package/dist/cjs/index.native.cjs +92 -0
  28. package/dist/cjs/index.native.js +61 -69
  29. package/dist/cjs/index.native.js.map +1 -1
  30. package/dist/cjs/steps/bare.cjs +51 -61
  31. package/dist/cjs/steps/bare.native.cjs +121 -0
  32. package/dist/cjs/steps/bare.native.js +71 -82
  33. package/dist/cjs/steps/bare.native.js.map +1 -1
  34. package/dist/cjs/steps/fullstack.cjs +23 -35
  35. package/dist/cjs/steps/fullstack.native.cjs +50 -0
  36. package/dist/cjs/steps/fullstack.native.js +25 -36
  37. package/dist/cjs/steps/fullstack.native.js.map +1 -1
  38. package/dist/cjs/steps/one.cjs +42 -57
  39. package/dist/cjs/steps/one.native.cjs +97 -0
  40. package/dist/cjs/steps/one.native.js +46 -60
  41. package/dist/cjs/steps/one.native.js.map +1 -1
  42. package/dist/cjs/steps/types.cjs +9 -11
  43. package/dist/cjs/steps/types.native.cjs +18 -0
  44. package/dist/cjs/steps/types.native.js +9 -10
  45. package/dist/cjs/steps/types.native.js.map +1 -1
  46. package/dist/cjs/templates.cjs +54 -59
  47. package/dist/cjs/templates.native.cjs +70 -0
  48. package/dist/cjs/templates.native.js +55 -59
  49. package/dist/cjs/templates.native.js.map +1 -1
  50. package/dist/esm/create.mjs +179 -169
  51. package/dist/esm/create.mjs.map +1 -1
  52. package/dist/esm/create.native.js +204 -203
  53. package/dist/esm/create.native.js.map +1 -1
  54. package/dist/esm/helpers/cloneStarter.mjs +71 -77
  55. package/dist/esm/helpers/cloneStarter.mjs.map +1 -1
  56. package/dist/esm/helpers/cloneStarter.native.js +74 -80
  57. package/dist/esm/helpers/cloneStarter.native.js.map +1 -1
  58. package/dist/esm/helpers/getProjectName.mjs +41 -39
  59. package/dist/esm/helpers/getProjectName.mjs.map +1 -1
  60. package/dist/esm/helpers/getProjectName.native.js +41 -39
  61. package/dist/esm/helpers/getProjectName.native.js.map +1 -1
  62. package/dist/esm/helpers/getTemplateInfo.mjs +25 -27
  63. package/dist/esm/helpers/getTemplateInfo.mjs.map +1 -1
  64. package/dist/esm/helpers/getTemplateInfo.native.js +33 -35
  65. package/dist/esm/helpers/getTemplateInfo.native.js.map +1 -1
  66. package/dist/esm/helpers/installDependencies.mjs +25 -25
  67. package/dist/esm/helpers/installDependencies.mjs.map +1 -1
  68. package/dist/esm/helpers/installDependencies.native.js +25 -25
  69. package/dist/esm/helpers/installDependencies.native.js.map +1 -1
  70. package/dist/esm/helpers/validateNpmPackage.mjs +10 -10
  71. package/dist/esm/helpers/validateNpmPackage.mjs.map +1 -1
  72. package/dist/esm/helpers/validateNpmPackage.native.js +10 -10
  73. package/dist/esm/helpers/validateNpmPackage.native.js.map +1 -1
  74. package/dist/esm/index.js +51 -53
  75. package/dist/esm/index.js.map +1 -1
  76. package/dist/esm/index.mjs +51 -53
  77. package/dist/esm/index.mjs.map +1 -1
  78. package/dist/esm/index.native.js +52 -54
  79. package/dist/esm/index.native.js.map +1 -1
  80. package/dist/esm/steps/bare.mjs +35 -36
  81. package/dist/esm/steps/bare.mjs.map +1 -1
  82. package/dist/esm/steps/bare.native.js +55 -58
  83. package/dist/esm/steps/bare.native.js.map +1 -1
  84. package/dist/esm/steps/fullstack.mjs +8 -9
  85. package/dist/esm/steps/fullstack.mjs.map +1 -1
  86. package/dist/esm/steps/fullstack.native.js +10 -11
  87. package/dist/esm/steps/fullstack.native.js.map +1 -1
  88. package/dist/esm/steps/one.mjs +26 -32
  89. package/dist/esm/steps/one.mjs.map +1 -1
  90. package/dist/esm/steps/one.native.js +30 -36
  91. package/dist/esm/steps/one.native.js.map +1 -1
  92. package/dist/esm/steps/types.mjs +0 -2
  93. package/dist/esm/steps/types.native.js +0 -2
  94. package/dist/esm/templates.mjs +40 -34
  95. package/dist/esm/templates.mjs.map +1 -1
  96. package/dist/esm/templates.native.js +40 -34
  97. package/dist/esm/templates.native.js.map +1 -1
  98. package/package.json +4 -4
  99. package/dist/esm/steps/types.mjs.map +0 -1
  100. 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
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
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
- 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;
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
- // 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
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
- title: `Basic`,
44
- value: "Basic",
45
- description: "The simplest starting point, vanilla Rreact Native",
46
- type: "included-in-monorepo",
47
- hidden: false,
48
- repo: {
49
- url: `https://github.com/onejs/one.git`,
50
- sshFallback: `git@github.com:onejs/one.git`,
51
- dir: [`examples`, `one-basic`],
52
- branch: "main"
53
- },
54
- ...BasicTemplateSteps
55
- }, {
56
- title: `Takeout Free`,
57
- value: "Takeout",
58
- description: "One, Tamagui, Zero, Better Auth",
59
- type: "external-repo",
60
- hidden: false,
61
- repo: {
62
- url: `https://github.com/tamagui/takeout-free.git`,
63
- sshFallback: `git@github.com:tamagui/takeout-free.git`,
64
- dir: [],
65
- branch: "main"
66
- },
67
- ...BasicTemplateSteps
68
- }, {
69
- title: `Takeout Production`,
70
- value: "TakeoutPro",
71
- 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",
72
- type: "external-link",
73
- hidden: false,
74
- externalUrl: "https://takeout.tamagui.dev"
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,"names":["__toCommonJS","mod","__copyProps","__defProp","value","templates_exports","__export","templates","module","exports","BasicTemplateSteps","__toESM","require","title","description","type","hidden","repo","url","sshFallback","dir","branch"],"sources":["../../src/templates.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,iBAAA;AAAAC,QAAA,CAAAD,iBAAA;EAAAE,SAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAoC,CAAAK,iBAAA;AAE7B,IAAAK,kBAAkB,GAAAC,OAAA,CAAAC,OAAA;AAAA,IACvBL,SAAA;EAEEM,KAAA,EAAO;EACPT,KAAA,SAAa;EACbU,WAAM;EACNC,IAAA,wBAAQ;EACRC,MAAM;EAAAC,IACJ;IACAC,GAAA,oCAAa;IACbC,WAAM,gCAAuB;IAC7BC,GAAA,GACF,YACG,YACL;IAEAC,MAAA;EACE;EACA,GAAAX;AAAO,GACM;EAEbG,KAAA,gBAAQ;EACRT,KAAA,EAAM;EAAAU,WACC;EAAAC,IACL,iBAAa;EAAAC,MACb,EAAM;EAAAC,IACN;IACFC,GAAA;IACAC,WAAG;IACLC,GAAA;IAEAC,MAAA;EACE;EACA,GAAAX;AAAO,GAEL;EAEFG,KAAA,sBAAQ;EACRT,KAAA,cAAa;EACfU,WAAA;EACFC,IAAA","ignoreList":[]}
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"}
@@ -1,6 +1,6 @@
1
1
  import ansis from "ansis";
2
2
  import FSExtra from "fs-extra";
3
- import { execSync, exec } from "node:child_process";
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
- const {
16
- existsSync,
17
- readFileSync,
18
- writeFileSync
19
- } = FSExtra;
15
+
16
+ const { existsSync, readFileSync, writeFileSync } = FSExtra;
20
17
  async function create(args) {
21
- const gitVersionString = Number.parseFloat(execSync(`git --version`).toString().replace(`git version `, "").trim());
22
- if (gitVersionString < 2.27) {
23
- console.error(`
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
- process.exit(1);
29
- }
30
- let projectName = args.name || "";
31
- let resolvedProjectPath = path.resolve(process.cwd(), projectName);
32
- async function promptForName() {
33
- projectName = await getProjectName();
34
- resolvedProjectPath = path.resolve(process.cwd(), projectName);
35
- }
36
- if (projectName) {
37
- if (fs.existsSync(resolvedProjectPath)) {
38
- console.error(`Error: folder already exists: ${resolvedProjectPath}`);
39
- process.exit(1);
40
- }
41
- } else {
42
- await promptForName();
43
- while (fs.existsSync(resolvedProjectPath)) {
44
- console.info();
45
- console.info(ansis.yellow("!"), `The folder ${ansis.underline(ansis.blueBright(projectName))} already exists, lets try another name`);
46
- console.info();
47
- console.info();
48
- await promptForName();
49
- }
50
- }
51
- console.info();
52
- let template = await getTemplateInfo(args.template);
53
- if (template.type === "external-link") {
54
- const url = template.externalUrl;
55
- console.info();
56
- console.info(ansis.green(`Opening ${url}...`));
57
- console.info();
58
- const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
59
- exec(`${openCmd} ${url}`);
60
- process.exit(0);
61
- }
62
- const {
63
- valid,
64
- problems
65
- } = validateNpmName(projectName);
66
- if (!valid) {
67
- console.error(`Could not create a project called ${ansis.red(`"${projectName}"`)} because of npm naming restrictions:`);
68
- problems.forEach(p => console.error(` ${ansis.red.bold("*")} ${p}`));
69
- process.exit(1);
70
- }
71
- console.info();
72
- const Spinner = await import("yocto-spinner").then(x => x.default);
73
- const spinner = Spinner({
74
- text: `Creating...`,
75
- spinner: {
76
- frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"],
77
- interval: 100
78
- }
79
- }).start();
80
- await FSExtra.mkdir(resolvedProjectPath);
81
- try {
82
- await cloneStarter(template, resolvedProjectPath);
83
- process.chdir(resolvedProjectPath);
84
- } catch (e) {
85
- console.error(`[vxrn] Failed to copy example into ${resolvedProjectPath}
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
- process.exit(1);
89
- }
90
- spinner.stop();
91
- console.info();
92
- console.info();
93
- console.info(ansis.green(`${projectName} created!`));
94
- console.info();
95
- console.info();
96
- const packageJson = await (async () => {
97
- const errorMessages = [];
98
- try {
99
- const dirname = typeof __dirname !== "undefined" ? __dirname : path.dirname(fileURLToPath(import.meta.url));
100
- const possiblePaths = [path.join(dirname, "..", "package.json"), path.join(dirname, "..", "..", "package.json"), path.join(dirname, "..", "..", "..", "package.json")];
101
- const readFile = promisify(fs.readFile);
102
- for (const p of possiblePaths) {
103
- try {
104
- const data = JSON.parse(await readFile(p));
105
- return data;
106
- } catch (e) {
107
- if (e instanceof Error) errorMessages.push(e.message);
108
- }
109
- }
110
- throw new Error("package.json not found in any of the expected locations.");
111
- } catch (e) {
112
- console.error("Failed to load package.json:", errorMessages.join("\n"));
113
- throw e;
114
- }
115
- })();
116
- updatePackageJsonName(projectName, resolvedProjectPath);
117
- updatePackageJsonVersions(packageJson.version, resolvedProjectPath);
118
- updateAppJsonName(projectName, resolvedProjectPath);
119
- const packageManager = await (async () => {
120
- if ("packageManager" in template) {
121
- return template.packageManager;
122
- }
123
- const found = await detectPackageManager();
124
- const allFound = Object.keys(found);
125
- if (allFound.length === 1) {
126
- return allFound[0];
127
- }
128
- const response = await prompts({
129
- name: "packageManager",
130
- type: "select",
131
- message: `Package Manager:`,
132
- choices: allFound.filter(x => found[x]).map(name => ({
133
- title: name,
134
- value: name
135
- }))
136
- });
137
- return response.packageManager;
138
- })();
139
- console.info();
140
- if ("preInstall" in template) {
141
- await template.preInstall({
142
- packageManager,
143
- isFullClone: true,
144
- projectName,
145
- projectPath: resolvedProjectPath
146
- });
147
- }
148
- try {
149
- console.info();
150
- console.info(ansis.green(`Installing with ${packageManager}...`));
151
- console.info();
152
- await installDependencies(resolvedProjectPath, packageManager);
153
- } catch (e) {
154
- console.error("[vxrn] error installing with " + packageManager + `
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
- process.exit(1);
157
- }
158
- const envDefault = path.join(resolvedProjectPath, ".env.default");
159
- const env = path.join(resolvedProjectPath, ".env");
160
- if (existsSync(envDefault) && !existsSync(env)) {
161
- await FSExtra.move(envDefault, env);
162
- }
163
- if ("extraSteps" in template) {
164
- await template.extraSteps({
165
- packageManager,
166
- isFullClone: true,
167
- projectName,
168
- projectPath: resolvedProjectPath
169
- });
170
- }
171
- console.info();
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
- const packageJsonPath = path.join(dir, "package.json");
175
- if (existsSync(packageJsonPath)) {
176
- const content = readFileSync(packageJsonPath).toString();
177
- const contentWithUpdatedName = content.replace(/("name": ")(.*)(",)/, `$1${projectName}$3`);
178
- writeFileSync(packageJsonPath, contentWithUpdatedName);
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
- const packageJsonPath = path.join(dir, "package.json");
183
- if (existsSync(packageJsonPath)) {
184
- const content = readFileSync(packageJsonPath).toString();
185
- const contentWithUpdatedVersions = content.replace(/"workspace:\^"/gm, `"^${version}"`).replace(/"workspace:~"/gm, `"~${version}"`).replace(/"workspace:\*"/gm, `"^${version}"`);
186
- writeFileSync(packageJsonPath, contentWithUpdatedVersions);
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
- const appJsonPath = path.join(dir, "app.json");
191
- if (existsSync(appJsonPath)) {
192
- const content = readFileSync(appJsonPath).toString();
193
- const projectSlug = projectName.toLowerCase().replace(/\s/g, "-");
194
- const contentWithUpdatedName = content.replace(/("name": ")(.*)(",)/, `$1${projectName}$3`).replace(/("slug": ")(.*)(",)/, `$1${projectSlug}$3`);
195
- writeFileSync(appJsonPath, contentWithUpdatedName);
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