create-vxrn 1.12.2 → 1.12.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/.turbo/turbo-build.log +3 -2
- package/dist/cjs/index.cjs +0 -0
- package/dist/cjs/index.native.js +0 -0
- package/dist/esm/index.js +10 -6
- package/dist/esm/index.js.map +1 -6
- package/dist/esm/index.mjs +0 -0
- package/dist/esm/index.native.js +0 -0
- package/package.json +3 -3
- package/dist/cjs/create.js +0 -161
- package/dist/cjs/create.js.map +0 -6
- package/dist/cjs/helpers/cloneStarter.js +0 -87
- package/dist/cjs/helpers/cloneStarter.js.map +0 -6
- package/dist/cjs/helpers/getProjectName.js +0 -51
- package/dist/cjs/helpers/getProjectName.js.map +0 -6
- package/dist/cjs/helpers/getTemplateInfo.js +0 -38
- package/dist/cjs/helpers/getTemplateInfo.js.map +0 -6
- package/dist/cjs/helpers/installDependencies.js +0 -44
- package/dist/cjs/helpers/installDependencies.js.map +0 -6
- package/dist/cjs/helpers/validateNpmPackage.js +0 -36
- package/dist/cjs/helpers/validateNpmPackage.js.map +0 -6
- package/dist/cjs/index.js +0 -71
- package/dist/cjs/index.js.map +0 -6
- package/dist/cjs/steps/bare.js +0 -79
- package/dist/cjs/steps/bare.js.map +0 -6
- package/dist/cjs/steps/fullstack.js +0 -38
- package/dist/cjs/steps/fullstack.js.map +0 -6
- package/dist/cjs/steps/one.js +0 -79
- package/dist/cjs/steps/one.js.map +0 -6
- package/dist/cjs/steps/types.js +0 -14
- package/dist/cjs/steps/types.js.map +0 -6
- package/dist/cjs/templates.js +0 -67
- package/dist/cjs/templates.js.map +0 -6
- package/dist/esm/create.js +0 -150
- package/dist/esm/create.js.map +0 -6
- package/dist/esm/helpers/cloneStarter.js +0 -75
- package/dist/esm/helpers/cloneStarter.js.map +0 -6
- package/dist/esm/helpers/getProjectName.js +0 -30
- package/dist/esm/helpers/getProjectName.js.map +0 -6
- package/dist/esm/helpers/getTemplateInfo.js +0 -15
- package/dist/esm/helpers/getTemplateInfo.js.map +0 -6
- package/dist/esm/helpers/installDependencies.js +0 -28
- package/dist/esm/helpers/installDependencies.js.map +0 -6
- package/dist/esm/helpers/validateNpmPackage.js +0 -12
- package/dist/esm/helpers/validateNpmPackage.js.map +0 -6
- package/dist/esm/steps/bare.js +0 -57
- package/dist/esm/steps/bare.js.map +0 -6
- package/dist/esm/steps/fullstack.js +0 -14
- package/dist/esm/steps/fullstack.js.map +0 -6
- package/dist/esm/steps/one.js +0 -58
- package/dist/esm/steps/one.js.map +0 -6
- package/dist/esm/steps/types.js +0 -1
- package/dist/esm/steps/types.js.map +0 -6
- package/dist/esm/templates.js +0 -43
- package/dist/esm/templates.js.map +0 -6
package/dist/cjs/index.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
9
|
-
for (let key of __getOwnPropNames(from))
|
|
10
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
14
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
15
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
16
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
17
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
18
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
19
|
-
mod
|
|
20
|
-
));
|
|
21
|
-
var import_ansis = __toESM(require("ansis")), import_citty = require("citty"), import_node_path = __toESM(require("node:path")), import_node_process = require("node:process"), import_getTemplateInfo = require("./helpers/getTemplateInfo"), import_create = require("./create"), import_node_url = require("node:url"), import_node_fs = require("node:fs");
|
|
22
|
-
const import_meta = {};
|
|
23
|
-
function exit() {
|
|
24
|
-
process.exit(0);
|
|
25
|
-
}
|
|
26
|
-
process.on("SIGTERM", exit);
|
|
27
|
-
process.on("SIGINT", exit);
|
|
28
|
-
const main = (0, import_citty.defineCommand)({
|
|
29
|
-
meta: {
|
|
30
|
-
name: "main",
|
|
31
|
-
version: "0.0.0",
|
|
32
|
-
description: "Welcome to vxrn"
|
|
33
|
-
},
|
|
34
|
-
args: {
|
|
35
|
-
directory: {
|
|
36
|
-
type: "positional",
|
|
37
|
-
description: "Directory to copy into",
|
|
38
|
-
default: ""
|
|
39
|
-
},
|
|
40
|
-
template: {
|
|
41
|
-
type: "string",
|
|
42
|
-
required: !1,
|
|
43
|
-
description: "Choose a template in advance (avoid selection screen)."
|
|
44
|
-
},
|
|
45
|
-
info: {
|
|
46
|
-
type: "boolean",
|
|
47
|
-
description: "Output the post-install instructions for the template."
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
async run({ args }) {
|
|
51
|
-
if (args.info) {
|
|
52
|
-
let template = await (0, import_getTemplateInfo.getTemplateInfo)(args.template);
|
|
53
|
-
"extraSteps" in template && await template.extraSteps({
|
|
54
|
-
isFullClone: !1,
|
|
55
|
-
projectName: import_node_path.default.basename((0, import_node_process.cwd)()),
|
|
56
|
-
projectPath: (0, import_node_process.cwd)()
|
|
57
|
-
});
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
console.info(), console.info(import_ansis.default.bold("Creating vxrn app...")), await (0, import_create.create)({ template: args.template });
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
(0, import_citty.runMain)(main);
|
|
64
|
-
function getPackageVersion() {
|
|
65
|
-
let dirname;
|
|
66
|
-
typeof __dirname < "u" ? dirname = __dirname : dirname = import_node_path.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
67
|
-
const packagePath = import_node_path.default.join(dirname, "..", "..", "package.json");
|
|
68
|
-
return JSON.parse((0, import_node_fs.readFileSync)(packagePath, "utf-8")).version;
|
|
69
|
-
}
|
|
70
|
-
process.argv.includes("--version") && (console.info(getPackageVersion()), process.exit(0));
|
|
71
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAGA,mBAAkB,2BAClB,eAAuC,kBACvC,mBAAiB,+BACjB,sBAAoB,yBACpB,yBAAgC,sCAChC,gBAAuB,qBACvB,kBAA8B,qBAC9B,iBAA6B;AAV7B;AAcA,SAAS,OAAO;AACd,UAAQ,KAAK,CAAC;AAChB;AAEA,QAAQ,GAAG,WAAW,IAAI;AAC1B,QAAQ,GAAG,UAAU,IAAI;AAEzB,MAAM,WAAO,4BAAc;AAAA,EACzB,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EACA,MAAM;AAAA,IACJ,WAAW;AAAA,MACT,MAAM;AAAA,MACN,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,UAAU;AAAA,MACV,aAAa;AAAA,IACf;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,MAAM,IAAI,EAAE,KAAK,GAAG;AAClB,QAAI,KAAK,MAAM;AACb,UAAI,WAAW,UAAM,wCAAgB,KAAK,QAAQ;AAClD,MAAI,gBAAgB,YAClB,MAAM,SAAS,WAAW;AAAA,QACxB,aAAa;AAAA,QACb,aAAa,iBAAAA,QAAK,aAAS,yBAAI,CAAC;AAAA,QAChC,iBAAa,yBAAI;AAAA,MACnB,CAAC;AAEH;AAAA,IACF;AAEA,YAAQ,KAAK,GACb,QAAQ,KAAK,aAAAC,QAAM,KAAK,sBAAsB,CAAC,GAE/C,UAAM,sBAAO,EAAE,UAAU,KAAK,SAAS,CAAC;AAAA,EAC1C;AACF,CAAC;AAAA,IAED,sBAAQ,IAAI;AAEZ,SAAS,oBAAoB;AAC3B,MAAI;AACJ,EAAI,OAAO,YAAc,MAEvB,UAAU,YAGV,UAAU,iBAAAD,QAAK,YAAQ,+BAAc,YAAY,GAAG,CAAC;AAEvD,QAAM,cAAc,iBAAAA,QAAK,KAAK,SAAS,MAAM,MAAM,cAAc;AAEjE,SADoB,KAAK,UAAM,6BAAa,aAAa,OAAO,CAAC,EAC9C;AACrB;AAEI,QAAQ,KAAK,SAAS,WAAW,MACnC,QAAQ,KAAK,kBAAkB,CAAC,GAChC,QAAQ,KAAK,CAAC;",
|
|
5
|
-
"names": ["path", "ansis"]
|
|
6
|
-
}
|
package/dist/cjs/steps/bare.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
-
mod
|
|
22
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
-
var bare_exports = {};
|
|
24
|
-
__export(bare_exports, {
|
|
25
|
-
default: () => bare_default,
|
|
26
|
-
replaceNameInUTF8File: () => replaceNameInUTF8File
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(bare_exports);
|
|
29
|
-
var import_ansis = __toESM(require("ansis")), import_fs_extra = __toESM(require("fs-extra")), import_node_path = require("node:path");
|
|
30
|
-
function shouldIgnoreFile(filePath) {
|
|
31
|
-
return filePath.match(/node_modules|yarn.lock|package-lock.json/g);
|
|
32
|
-
}
|
|
33
|
-
function shouldRenameFile(filePath, nameToReplace) {
|
|
34
|
-
return (0, import_node_path.basename)(filePath).includes(nameToReplace);
|
|
35
|
-
}
|
|
36
|
-
async function renameFile(filePath, oldName, newName) {
|
|
37
|
-
const newFileName = (0, import_node_path.join)(
|
|
38
|
-
(0, import_node_path.dirname)(filePath),
|
|
39
|
-
(0, import_node_path.basename)(filePath).replace(new RegExp(oldName, "g"), newName)
|
|
40
|
-
);
|
|
41
|
-
await import_fs_extra.default.rename(filePath, newFileName);
|
|
42
|
-
}
|
|
43
|
-
function walk(current) {
|
|
44
|
-
if (!import_fs_extra.default.lstatSync(current).isDirectory())
|
|
45
|
-
return [current];
|
|
46
|
-
const files = import_fs_extra.default.readdirSync(current).map((child) => walk((0, import_node_path.join)(current, child)));
|
|
47
|
-
return [].concat.apply([current], files);
|
|
48
|
-
}
|
|
49
|
-
async function replaceNameInUTF8File(filePath, projectName, templateName) {
|
|
50
|
-
const fileContent = await import_fs_extra.default.readFile(filePath, "utf8"), replacedFileContent = fileContent.replace(new RegExp(templateName, "g"), projectName).replace(new RegExp(templateName.toLowerCase(), "g"), projectName.toLowerCase());
|
|
51
|
-
fileContent !== replacedFileContent && await import_fs_extra.default.writeFile(filePath, replacedFileContent, "utf8");
|
|
52
|
-
}
|
|
53
|
-
const main = async ({ isFullClone, projectName }) => {
|
|
54
|
-
const placeholderName = "bare";
|
|
55
|
-
for (const filePath of walk(process.cwd()).reverse())
|
|
56
|
-
shouldIgnoreFile(filePath) || ((await import_fs_extra.default.stat(filePath)).isDirectory() || await replaceNameInUTF8File(filePath, projectName, "bare"), shouldRenameFile(filePath, placeholderName) ? await renameFile(filePath, placeholderName, projectName) : shouldRenameFile(filePath, placeholderName.toLowerCase()) && await renameFile(filePath, placeholderName.toLowerCase(), projectName.toLowerCase()));
|
|
57
|
-
isFullClone && console.info(`
|
|
58
|
-
${import_ansis.default.green.bold("Done!")} Created a new project under ./${import_ansis.default.greenBright(projectName)} visit your project:
|
|
59
|
-
\u2022 ${import_ansis.default.green("cd")} ${projectName}
|
|
60
|
-
|
|
61
|
-
${import_ansis.default.green(`Run instructions for ${import_ansis.default.bold("Android")}:`)}
|
|
62
|
-
\u2022 Have an Android emulator running (quickest way to get started), or a device connected.
|
|
63
|
-
\u2022 npx react-native run-android
|
|
64
|
-
|
|
65
|
-
${import_ansis.default.blue(`Run instructions for ${import_ansis.default.bold("iOS")}:`)}
|
|
66
|
-
\u2022 Install Cocoapods
|
|
67
|
-
\u2022 bundle install # you need to run this only once in your project.
|
|
68
|
-
\u2022 bundle exec pod install
|
|
69
|
-
\u2022 cd ..
|
|
70
|
-
|
|
71
|
-
\u2022 npx react-native run-ios
|
|
72
|
-
${import_ansis.default.gray("- or -")}
|
|
73
|
-
\u2022 Open ${projectName}/ios/${projectName}.xcworkspace in Xcode or run "xed -b ios"
|
|
74
|
-
\u2022 Hit the Run button
|
|
75
|
-
|
|
76
|
-
`);
|
|
77
|
-
};
|
|
78
|
-
var bare_default = main;
|
|
79
|
-
//# sourceMappingURL=bare.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/steps/bare.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,2BAClB,kBAAe,8BACf,mBAAwC;AAGxC,SAAS,iBAAiB,UAAkB;AAC1C,SAAO,SAAS,MAAM,2CAA2C;AACnE;AAEA,SAAS,iBAAiB,UAAkB,eAAuB;AACjE,aAAO,2BAAS,QAAQ,EAAE,SAAS,aAAa;AAClD;AAEA,eAAe,WAAW,UAAkB,SAAiB,SAAiB;AAC5E,QAAM,kBAAc;AAAA,QAClB,0BAAQ,QAAQ;AAAA,QAChB,2BAAS,QAAQ,EAAE,QAAQ,IAAI,OAAO,SAAS,GAAG,GAAG,OAAO;AAAA,EAC9D;AAEA,QAAM,gBAAAA,QAAG,OAAO,UAAU,WAAW;AACvC;AAEA,SAAS,KAAK,SAA2B;AACvC,MAAI,CAAC,gBAAAA,QAAG,UAAU,OAAO,EAAE,YAAY;AACrC,WAAO,CAAC,OAAO;AAGjB,QAAM,QAAQ,gBAAAA,QAAG,YAAY,OAAO,EAAE,IAAI,CAAC,UAAU,SAAK,uBAAK,SAAS,KAAK,CAAC,CAAC;AAE/E,SADyB,CAAC,EACZ,OAAO,MAAM,CAAC,OAAO,GAAG,KAAK;AAC7C;AAEA,eAAsB,sBACpB,UACA,aACA,cACA;AACA,QAAM,cAAc,MAAM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]
|
|
6
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
-
mod
|
|
22
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
-
var fullstack_exports = {};
|
|
24
|
-
__export(fullstack_exports, {
|
|
25
|
-
default: () => fullstack_default
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(fullstack_exports);
|
|
28
|
-
var import_ansis = __toESM(require("ansis"));
|
|
29
|
-
const packageManager = "yarn", useYarn = packageManager === "yarn", runCommand = (scriptName) => `${packageManager} ${useYarn ? "" : "run "}${scriptName}`, main = async ({ isFullClone, projectName }) => {
|
|
30
|
-
isFullClone && console.info(`
|
|
31
|
-
${import_ansis.default.green.bold("Done!")} Created a new project under ./${import_ansis.default.greenBright(projectName)} visit your project:
|
|
32
|
-
\u2022 ${import_ansis.default.green("cd")} ${projectName}
|
|
33
|
-
`), console.info(`
|
|
34
|
-
To start the dev server, run: ${import_ansis.default.green(runCommand("dev"))}
|
|
35
|
-
`);
|
|
36
|
-
};
|
|
37
|
-
var fullstack_default = main;
|
|
38
|
-
//# sourceMappingURL=fullstack.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/steps/fullstack.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAIlB,MAAM,iBAAiB,QACjB,UAAU,mBAAmB,QAE7B,aAAa,CAAC,eAClB,GAAG,cAAc,IAAI,UAAU,KAAK,MAAM,GAAG,UAAU,IAEnD,OAAmB,OAAO,EAAE,aAAa,YAAY,MAAM;AAC/D,EAAI,eACF,QAAQ,KAAK;AAAA,EACf,aAAAA,QAAM,MAAM,KAAK,OAAO,CAAC,kCAAkC,aAAAA,QAAM,YAAY,WAAW,CAAC;AAAA,UACtF,aAAAA,QAAM,MAAM,IAAI,CAAC,IAAI,WAAW;AAAA,CACpC,GAEC,QAAQ,KAAK;AAAA,gCACiB,aAAAA,QAAM,MAAM,WAAW,KAAK,CAAC,CAAC;AAAA,CAC7D;AACD;AAEA,IAAO,oBAAQ;",
|
|
5
|
-
"names": ["ansis"]
|
|
6
|
-
}
|
package/dist/cjs/steps/one.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
-
mod
|
|
22
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
-
var one_exports = {};
|
|
24
|
-
__export(one_exports, {
|
|
25
|
-
extraSteps: () => extraSteps,
|
|
26
|
-
preInstall: () => preInstall
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(one_exports);
|
|
29
|
-
var import_ansis = __toESM(require("ansis")), import_fs_extra = __toESM(require("fs-extra")), import_node_path = require("node:path"), import_utils = require("@vxrn/utils");
|
|
30
|
-
const extraSteps = async ({
|
|
31
|
-
isFullClone,
|
|
32
|
-
projectName,
|
|
33
|
-
packageManager
|
|
34
|
-
}) => {
|
|
35
|
-
const useBun = packageManager === "bun", runCommand = (scriptName) => `${packageManager} ${useBun ? "" : "run "}${scriptName}`;
|
|
36
|
-
isFullClone && console.info(
|
|
37
|
-
`
|
|
38
|
-
${import_ansis.default.green.bold("Done!")} Created a new project under ./${import_ansis.default.greenBright(projectName)}`
|
|
39
|
-
), console.info(`
|
|
40
|
-
To run:
|
|
41
|
-
|
|
42
|
-
${import_ansis.default.green("cd")} ${projectName}
|
|
43
|
-
${import_ansis.default.green(runCommand("dev"))}
|
|
44
|
-
`);
|
|
45
|
-
}, preInstall = async ({
|
|
46
|
-
projectName,
|
|
47
|
-
packageManager,
|
|
48
|
-
projectPath
|
|
49
|
-
}) => {
|
|
50
|
-
const path = projectPath || projectName, envExample = (0, import_node_path.join)(path, ".env.example");
|
|
51
|
-
import_fs_extra.default.existsSync(envExample) && (await import_fs_extra.default.move(envExample, (0, import_node_path.join)(path, ".env")), console.info("Moved .env.example to .env")), packageManager === "pnpm" && (await import_fs_extra.default.writeFile((0, import_node_path.join)(path, ".npmrc"), `node-linker=hoisted
|
|
52
|
-
`), console.info(`Set up .npmrc to avoid symlinked node_modules
|
|
53
|
-
|
|
54
|
-
Note! \u{1F44B}
|
|
55
|
-
|
|
56
|
-
If you are working in a monorepo, you need to move the .npmrc with the node-linker
|
|
57
|
-
configuration to the root of the monorepo rather than here.
|
|
58
|
-
|
|
59
|
-
`)), packageManager === "yarn" && (await import_fs_extra.default.writeFile(
|
|
60
|
-
(0, import_node_path.join)(path, ".yarnrc.yml"),
|
|
61
|
-
`
|
|
62
|
-
compressionLevel: mixed
|
|
63
|
-
enableGlobalCache: false
|
|
64
|
-
enableTelemetry: false
|
|
65
|
-
nodeLinker: node-modules
|
|
66
|
-
|
|
67
|
-
logFilters:
|
|
68
|
-
- code: YN0002
|
|
69
|
-
level: discard
|
|
70
|
-
- code: YN0060
|
|
71
|
-
level: discard
|
|
72
|
-
- code: YN0006
|
|
73
|
-
level: discard
|
|
74
|
-
- code: YN0076
|
|
75
|
-
level: discard
|
|
76
|
-
`
|
|
77
|
-
), await (0, import_utils.execPromise)("yarn set version stable"), await import_fs_extra.default.writeFile((0, import_node_path.join)(path, "yarn.lock"), ""), console.info("Set up yarn for latest version"));
|
|
78
|
-
};
|
|
79
|
-
//# sourceMappingURL=one.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/steps/one.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,2BAClB,kBAAoB,8BACpB,mBAAqB,sBACrB,eAA4B;AAGrB,MAAM,aAAyB,OAAO;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAAS,mBAAmB,OAE5B,aAAa,CAAC,eAClB,GAAG,cAAc,IAAI,SAAS,KAAK,MAAM,GAAG,UAAU;AAExD,EAAI,eACF,QAAQ;AAAA,IACN;AAAA,EAAK,aAAAA,QAAM,MAAM,KAAK,OAAO,CAAC,kCAAkC,aAAAA,QAAM,YAAY,WAAW,CAAC;AAAA,EAChG,GAGF,QAAQ,KAAK;AAAA;AAAA;AAAA,IAEX,aAAAA,QAAM,MAAM,IAAI,CAAC,IAAI,WAAW;AAAA,IAChC,aAAAA,QAAM,MAAM,WAAW,KAAK,CAAC,CAAC;AAAA,CAAI;AACtC,GAEa,aAAyB,OAAO;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,OAAO,eAAe,aACtB,iBAAa,uBAAK,MAAM,cAAc;AAE5C,EAAI,gBAAAC,QAAQ,WAAW,UAAU,MAC/B,MAAM,gBAAAA,QAAQ,KAAK,gBAAY,uBAAK,MAAM,MAAM,CAAC,GACjD,QAAQ,KAAK,4BAA4B,IAGvC,mBAAmB,WACrB,MAAM,gBAAAA,QAAQ,cAAU,uBAAK,MAAM,QAAQ,GAAG;AAAA,CAAuB,GACrE,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAOhB,IAGK,mBAAmB,WACrB,MAAM,gBAAAA,QAAQ;AAAA,QACZ,uBAAK,MAAM,aAAa;AAAA,IACxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBF,GACA,UAAM,0BAAY,yBAAyB,GAC3C,MAAM,gBAAAA,QAAQ,cAAU,uBAAK,MAAM,WAAW,GAAG,EAAE,GACnD,QAAQ,KAAK,gCAAgC;AAEjD;",
|
|
5
|
-
"names": ["ansis", "FSExtra"]
|
|
6
|
-
}
|
package/dist/cjs/steps/types.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
|
-
return to;
|
|
10
|
-
};
|
|
11
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
12
|
-
var types_exports = {};
|
|
13
|
-
module.exports = __toCommonJS(types_exports);
|
|
14
|
-
//# sourceMappingURL=types.js.map
|
package/dist/cjs/templates.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
-
mod
|
|
22
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
-
var templates_exports = {};
|
|
24
|
-
__export(templates_exports, {
|
|
25
|
-
templates: () => templates
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(templates_exports);
|
|
28
|
-
var BasicTemplateSteps = __toESM(require("./steps/one"));
|
|
29
|
-
const templates = [
|
|
30
|
-
{
|
|
31
|
-
title: "Base",
|
|
32
|
-
value: "Base",
|
|
33
|
-
description: "The simplest starting point",
|
|
34
|
-
type: "included-in-monorepo",
|
|
35
|
-
hidden: !1,
|
|
36
|
-
repo: {
|
|
37
|
-
url: "https://github.com/onejs/one.git",
|
|
38
|
-
sshFallback: "git@github.com:onejs/one.git",
|
|
39
|
-
dir: ["examples", "one-basic"],
|
|
40
|
-
branch: "main"
|
|
41
|
-
},
|
|
42
|
-
...BasicTemplateSteps
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
title: "Takeout",
|
|
46
|
-
value: "Takeout",
|
|
47
|
-
description: "One, Tamagui, Zero, Better Auth",
|
|
48
|
-
type: "external-repo",
|
|
49
|
-
hidden: !1,
|
|
50
|
-
repo: {
|
|
51
|
-
url: "https://github.com/tamagui/takeout-free.git",
|
|
52
|
-
sshFallback: "git@github.com:tamagui/takeout-free.git",
|
|
53
|
-
dir: [],
|
|
54
|
-
branch: "main"
|
|
55
|
-
},
|
|
56
|
-
...BasicTemplateSteps
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
title: "Takeout Production",
|
|
60
|
-
value: "TakeoutPro",
|
|
61
|
-
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",
|
|
62
|
-
type: "external-link",
|
|
63
|
-
hidden: !1,
|
|
64
|
-
externalUrl: "https://takeout.tamagui.dev"
|
|
65
|
-
}
|
|
66
|
-
];
|
|
67
|
-
//# sourceMappingURL=templates.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/templates.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAoC;AAE7B,MAAM,YAAY;AAAA,EACvB;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,IACb,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,MACJ,KAAK;AAAA,MACL,aAAa;AAAA,MACb,KAAK,CAAC,YAAY,WAAW;AAAA,MAC7B,QAAQ;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EACL;AAAA,EAEA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,IACb,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,MACJ,KAAK;AAAA,MACL,aAAa;AAAA,MACb,KAAK,CAAC;AAAA,MACN,QAAQ;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EACL;AAAA,EAEA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aACE;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,EACf;AACF;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
package/dist/esm/create.js
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import ansis from "ansis";
|
|
2
|
-
import FSExtra from "fs-extra";
|
|
3
|
-
import { execSync, exec } from "node:child_process";
|
|
4
|
-
import fs from "node:fs";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
import { promisify } from "node:util";
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
8
|
-
import { cloneStarter } from "./helpers/cloneStarter";
|
|
9
|
-
import { getProjectName } from "./helpers/getProjectName";
|
|
10
|
-
import { getTemplateInfo } from "./helpers/getTemplateInfo";
|
|
11
|
-
import { installDependencies } from "./helpers/installDependencies";
|
|
12
|
-
import { validateNpmName } from "./helpers/validateNpmPackage";
|
|
13
|
-
import prompts from "prompts";
|
|
14
|
-
import { detectPackageManager } from "@vxrn/utils";
|
|
15
|
-
const { existsSync, readFileSync, writeFileSync } = FSExtra;
|
|
16
|
-
async function create(args) {
|
|
17
|
-
Number.parseFloat(
|
|
18
|
-
execSync("git --version").toString().replace("git version ", "").trim()
|
|
19
|
-
) < 2.27 && (console.error(`
|
|
20
|
-
|
|
21
|
-
! vxrn can't install: Git version must be >= 2.27
|
|
22
|
-
|
|
23
|
-
`), process.exit(1));
|
|
24
|
-
let projectName = args.name || "", resolvedProjectPath = path.resolve(process.cwd(), projectName);
|
|
25
|
-
async function promptForName() {
|
|
26
|
-
projectName = await getProjectName(), resolvedProjectPath = path.resolve(process.cwd(), projectName);
|
|
27
|
-
}
|
|
28
|
-
if (projectName)
|
|
29
|
-
fs.existsSync(resolvedProjectPath) && (console.error(`Error: folder already exists: ${resolvedProjectPath}`), process.exit(1));
|
|
30
|
-
else
|
|
31
|
-
for (await promptForName(); fs.existsSync(resolvedProjectPath); )
|
|
32
|
-
console.info(), console.info(
|
|
33
|
-
ansis.yellow("!"),
|
|
34
|
-
`The folder ${ansis.underline(
|
|
35
|
-
ansis.blueBright(projectName)
|
|
36
|
-
)} already exists, lets try another name`
|
|
37
|
-
), console.info(), console.info(), await promptForName();
|
|
38
|
-
console.info();
|
|
39
|
-
let template = await getTemplateInfo(args.template);
|
|
40
|
-
if (template.type === "external-link") {
|
|
41
|
-
const url = template.externalUrl;
|
|
42
|
-
console.info(), console.info(ansis.green(`Opening ${url}...`)), console.info();
|
|
43
|
-
const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
44
|
-
exec(`${openCmd} ${url}`), process.exit(0);
|
|
45
|
-
}
|
|
46
|
-
const { valid, problems } = validateNpmName(projectName);
|
|
47
|
-
valid || (console.error(
|
|
48
|
-
`Could not create a project called ${ansis.red(
|
|
49
|
-
`"${projectName}"`
|
|
50
|
-
)} because of npm naming restrictions:`
|
|
51
|
-
), problems.forEach((p) => console.error(` ${ansis.red.bold("*")} ${p}`)), process.exit(1)), console.info();
|
|
52
|
-
const spinner = (await import("yocto-spinner").then((x) => x.default))({
|
|
53
|
-
text: "Creating...",
|
|
54
|
-
spinner: {
|
|
55
|
-
frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"],
|
|
56
|
-
interval: 100
|
|
57
|
-
}
|
|
58
|
-
}).start();
|
|
59
|
-
await FSExtra.mkdir(resolvedProjectPath);
|
|
60
|
-
try {
|
|
61
|
-
await cloneStarter(template, resolvedProjectPath), process.chdir(resolvedProjectPath);
|
|
62
|
-
} catch (e) {
|
|
63
|
-
console.error(`[vxrn] Failed to copy example into ${resolvedProjectPath}
|
|
64
|
-
|
|
65
|
-
`, e), process.exit(1);
|
|
66
|
-
}
|
|
67
|
-
spinner.stop(), console.info(), console.info(), console.info(ansis.green(`${projectName} created!`)), console.info(), console.info();
|
|
68
|
-
const packageJson = await (async () => {
|
|
69
|
-
const errorMessages = [];
|
|
70
|
-
try {
|
|
71
|
-
const dirname = typeof __dirname < "u" ? __dirname : path.dirname(fileURLToPath(import.meta.url)), possiblePaths = [
|
|
72
|
-
path.join(dirname, "..", "package.json"),
|
|
73
|
-
path.join(dirname, "..", "..", "package.json"),
|
|
74
|
-
path.join(dirname, "..", "..", "..", "package.json")
|
|
75
|
-
], readFile = promisify(fs.readFile);
|
|
76
|
-
for (const p of possiblePaths)
|
|
77
|
-
try {
|
|
78
|
-
return JSON.parse(await readFile(p));
|
|
79
|
-
} catch (e) {
|
|
80
|
-
e instanceof Error && errorMessages.push(e.message);
|
|
81
|
-
}
|
|
82
|
-
throw new Error("package.json not found in any of the expected locations.");
|
|
83
|
-
} catch (e) {
|
|
84
|
-
throw console.error("Failed to load package.json:", errorMessages.join(`
|
|
85
|
-
`)), e;
|
|
86
|
-
}
|
|
87
|
-
})();
|
|
88
|
-
updatePackageJsonName(projectName, resolvedProjectPath), updatePackageJsonVersions(packageJson.version, resolvedProjectPath), updateAppJsonName(projectName, resolvedProjectPath);
|
|
89
|
-
const packageManager = await (async () => {
|
|
90
|
-
if ("packageManager" in template)
|
|
91
|
-
return template.packageManager;
|
|
92
|
-
const found = await detectPackageManager(), allFound = Object.keys(found);
|
|
93
|
-
return allFound.length === 1 ? allFound[0] : (await prompts({
|
|
94
|
-
name: "packageManager",
|
|
95
|
-
type: "select",
|
|
96
|
-
message: "Package Manager:",
|
|
97
|
-
choices: allFound.filter((x) => found[x]).map((name) => ({
|
|
98
|
-
title: name,
|
|
99
|
-
value: name
|
|
100
|
-
}))
|
|
101
|
-
})).packageManager;
|
|
102
|
-
})();
|
|
103
|
-
console.info(), "preInstall" in template && await template.preInstall({
|
|
104
|
-
packageManager,
|
|
105
|
-
isFullClone: !0,
|
|
106
|
-
projectName,
|
|
107
|
-
projectPath: resolvedProjectPath
|
|
108
|
-
});
|
|
109
|
-
try {
|
|
110
|
-
console.info(), console.info(ansis.green(`Installing with ${packageManager}...`)), console.info(), await installDependencies(resolvedProjectPath, packageManager);
|
|
111
|
-
} catch (e) {
|
|
112
|
-
console.error("[vxrn] error installing with " + packageManager + `
|
|
113
|
-
${e}`), process.exit(1);
|
|
114
|
-
}
|
|
115
|
-
const envDefault = path.join(resolvedProjectPath, ".env.default"), env = path.join(resolvedProjectPath, ".env");
|
|
116
|
-
existsSync(envDefault) && !existsSync(env) && await FSExtra.move(envDefault, env), "extraSteps" in template && await template.extraSteps({
|
|
117
|
-
packageManager,
|
|
118
|
-
isFullClone: !0,
|
|
119
|
-
projectName,
|
|
120
|
-
projectPath: resolvedProjectPath
|
|
121
|
-
}), console.info();
|
|
122
|
-
}
|
|
123
|
-
function updatePackageJsonName(projectName, dir) {
|
|
124
|
-
const packageJsonPath = path.join(dir, "package.json");
|
|
125
|
-
if (existsSync(packageJsonPath)) {
|
|
126
|
-
const contentWithUpdatedName = readFileSync(packageJsonPath).toString().replace(
|
|
127
|
-
/("name": ")(.*)(",)/,
|
|
128
|
-
`$1${projectName}$3`
|
|
129
|
-
);
|
|
130
|
-
writeFileSync(packageJsonPath, contentWithUpdatedName);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
function updatePackageJsonVersions(version, dir) {
|
|
134
|
-
const packageJsonPath = path.join(dir, "package.json");
|
|
135
|
-
if (existsSync(packageJsonPath)) {
|
|
136
|
-
const contentWithUpdatedVersions = readFileSync(packageJsonPath).toString().replace(/"workspace:\^"/gm, `"^${version}"`).replace(/"workspace:~"/gm, `"~${version}"`).replace(/"workspace:\*"/gm, `"${version}"`);
|
|
137
|
-
writeFileSync(packageJsonPath, contentWithUpdatedVersions);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
function updateAppJsonName(projectName, dir) {
|
|
141
|
-
const appJsonPath = path.join(dir, "app.json");
|
|
142
|
-
if (existsSync(appJsonPath)) {
|
|
143
|
-
const content = readFileSync(appJsonPath).toString(), projectSlug = projectName.toLowerCase().replace(/\s/g, "-"), contentWithUpdatedName = content.replace(/("name": ")(.*)(",)/, `$1${projectName}$3`).replace(/("slug": ")(.*)(",)/, `$1${projectSlug}$3`);
|
|
144
|
-
writeFileSync(appJsonPath, contentWithUpdatedName);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
export {
|
|
148
|
-
create
|
|
149
|
-
};
|
|
150
|
-
//# sourceMappingURL=create.js.map
|
package/dist/esm/create.js.map
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/create.ts"],
|
|
4
|
-
"mappings": "AAAA,OAAO,WAAW;AAClB,OAAO,aAAa;AACpB,SAAS,UAAU,YAAY;AAC/B,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAChC,OAAO,aAAa;AACpB,SAAS,4BAAqD;AAE9D,MAAM,EAAE,YAAY,cAAc,cAAc,IAAI;AAEpD,eAAsB,OAAO,MAA4C;AAIvE,EAHyB,OAAO;AAAA,IAC9B,SAAS,eAAe,EAAE,SAAS,EAAE,QAAQ,gBAAgB,EAAE,EAAE,KAAK;AAAA,EACxE,IACuB,SACrB,QAAQ,MAAM;AAAA;AAAA;AAAA;AAAA,CAA4D,GAC1E,QAAQ,KAAK,CAAC;AAGhB,MAAI,cAAc,KAAK,QAAQ,IAC3B,sBAAsB,KAAK,QAAQ,QAAQ,IAAI,GAAG,WAAW;AAEjE,iBAAe,gB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AkB,KAAK,KAAK,KAAK,cAAc;AACrD,MAAI,WAAW,eAAe,GAAG;AAE/B,UAAM,yBADU,aAAa,eAAe,EAAE,SAAS,EAChB;AAAA,MACrC;AAAA,MACA,KAAK,WAAW;AAAA,IAClB;AACA,kBAAc,iBAAiB,sBAAsB;AAAA,EACvD;AACF;AAEA,SAAS,0BAA0B,SAAiB,KAAa;AAC/D,QAAM,kBAAkB,KAAK,KAAK,KAAK,cAAc;AACrD,MAAI,WAAW,eAAe,GAAG;AAG/B,UAAM,6BAFU,aAAa,eAAe,EAAE,SAAS,EAGpD,QAAQ,oBAAoB,KAAK,OAAO,GAAG,EAC3C,QAAQ,mBAAmB,KAAK,OAAO,GAAG,EAC1C,QAAQ,oBAAoB,IAAI,OAAO,GAAG;AAC7C,kBAAc,iBAAiB,0BAA0B;AAAA,EAC3D;AACF;AAEA,SAAS,kBAAkB,aAAqB,KAAa;AAC3D,QAAM,cAAc,KAAK,KAAK,KAAK,UAAU;AAC7C,MAAI,WAAW,WAAW,GAAG;AAC3B,UAAM,UAAU,aAAa,WAAW,EAAE,SAAS,GAC7C,cAAc,YAAY,YAAY,EAAE,QAAQ,OAAO,GAAG,GAC1D,yBAAyB,QAC5B,QAAQ,uBAAuB,KAAK,WAAW,IAAI,EACnD,QAAQ,uBAAuB,KAAK,WAAW,IAAI;AACtD,kBAAc,aAAa,sBAAsB;AAAA,EACnD;AACF;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { copy, ensureDir, pathExists } from "fs-extra";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import { join, sep } from "node:path";
|
|
4
|
-
import { rimraf } from "rimraf";
|
|
5
|
-
import { exec, execPromiseQuiet } from "@vxrn/utils";
|
|
6
|
-
const home = homedir(), vxrnDir = join(home, ".vxrn"), cloneStarter = async (template, resolvedProjectPath) => {
|
|
7
|
-
const dir = await setupVxrnDotDir(
|
|
8
|
-
template,
|
|
9
|
-
join(vxrnDir, "vxrn", template.repo.url.split("/").at(-1))
|
|
10
|
-
);
|
|
11
|
-
await pathExists(dir) || (console.error(`Missing template for ${template.value} in ${dir}`), process.exit(1)), await copy(dir, resolvedProjectPath), await rimraf(join(resolvedProjectPath, ".git")), isInGitRepo() || await execPromiseQuiet("git init", {
|
|
12
|
-
cwd: resolvedProjectPath
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
async function setupVxrnDotDir(template, targetGitDir, isRetry = !1) {
|
|
16
|
-
const branch = template.repo.branch;
|
|
17
|
-
await ensureDir(vxrnDir);
|
|
18
|
-
const isInSubDir = template.repo.dir.length > 0;
|
|
19
|
-
if (await pathExists(targetGitDir))
|
|
20
|
-
await pathExists(join(targetGitDir, ".git")) || (console.error(
|
|
21
|
-
`Corrupt vxrn directory, please delete ${targetGitDir} folder and re-run`
|
|
22
|
-
), process.exit(1));
|
|
23
|
-
else {
|
|
24
|
-
const sourceGitRepo = template.repo.url, sourceGitRepoSshFallback = template.repo.sshFallback, cmd = `git clone --branch ${branch} ${isInSubDir ? "--depth 1 --sparse --filter=blob:none " : ""}${sourceGitRepo} "${targetGitDir}"`;
|
|
25
|
-
try {
|
|
26
|
-
await execPromiseQuiet(cmd);
|
|
27
|
-
} catch (error) {
|
|
28
|
-
if (cmd.includes("https://")) {
|
|
29
|
-
console.info("https failed - trying with ssh now...");
|
|
30
|
-
const sshCmd = cmd.replace(sourceGitRepo, sourceGitRepoSshFallback);
|
|
31
|
-
await execPromiseQuiet(sshCmd);
|
|
32
|
-
} else
|
|
33
|
-
throw error;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (isInSubDir)
|
|
37
|
-
try {
|
|
38
|
-
const cmd = `git sparse-checkout set ${template.repo.dir.join(sep) ?? "."}`;
|
|
39
|
-
await execPromiseQuiet(cmd, { cwd: targetGitDir });
|
|
40
|
-
} catch (err) {
|
|
41
|
-
throw `${err}`.includes("code 128") && console.warn(`\u26A0\uFE0F Note: you need to be sure you can git clone from Github, your SSH key isn't valid.
|
|
42
|
-
|
|
43
|
-
- See: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
|
|
44
|
-
|
|
45
|
-
`), err;
|
|
46
|
-
}
|
|
47
|
-
try {
|
|
48
|
-
const cmd2 = `git pull --rebase --allow-unrelated-histories --depth 1 origin ${branch}`;
|
|
49
|
-
await execPromiseQuiet(cmd2, {
|
|
50
|
-
cwd: targetGitDir
|
|
51
|
-
}), console.info();
|
|
52
|
-
const dir = join(targetGitDir, ...template.repo.dir);
|
|
53
|
-
if (!await pathExists(dir))
|
|
54
|
-
throw new Error("Re-clone...");
|
|
55
|
-
return dir;
|
|
56
|
-
} catch (err) {
|
|
57
|
-
return isRetry && (console.info(
|
|
58
|
-
`Error updating: ${err.message} ${isRetry ? `failing.
|
|
59
|
-
${err.stack}` : "trying from fresh."}`
|
|
60
|
-
), console.info(
|
|
61
|
-
"Please file an issue: https://github.com/onejs/one/issues/new?assignees=&labels=&template=bug_report.md&title="
|
|
62
|
-
), process.exit(1)), await rimraf(targetGitDir), await setupVxrnDotDir(template, targetGitDir, !0);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function isInGitRepo() {
|
|
66
|
-
try {
|
|
67
|
-
return exec("git rev-parse --is-inside-work-tree", { stdio: "ignore" }), !0;
|
|
68
|
-
} catch {
|
|
69
|
-
return !1;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
export {
|
|
73
|
-
cloneStarter
|
|
74
|
-
};
|
|
75
|
-
//# sourceMappingURL=cloneStarter.js.map
|