create-vxrn 1.1.319 → 1.1.321
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/dist/cjs/create.js +117 -0
- package/dist/cjs/helpers/cloneStarter.js +73 -0
- package/dist/cjs/helpers/detectPackageManager.js +73 -0
- package/dist/cjs/helpers/exec.js +38 -0
- package/dist/cjs/helpers/getProjectName.js +49 -0
- package/dist/cjs/helpers/getTemplateInfo.js +38 -0
- package/dist/cjs/helpers/installDependencies.js +44 -0
- package/dist/cjs/helpers/validateNpmPackage.js +36 -0
- package/dist/cjs/index.js +73 -0
- package/dist/cjs/steps/bare.js +91 -0
- package/dist/cjs/steps/fullstack.js +38 -0
- package/dist/cjs/steps/one.js +45 -0
- package/dist/cjs/steps/types.js +14 -0
- package/dist/cjs/templates.js +96 -0
- package/package.json +2 -2
- /package/dist/cjs/{create.cjs.map → create.js.map} +0 -0
- /package/dist/cjs/helpers/{cloneStarter.cjs.map → cloneStarter.js.map} +0 -0
- /package/dist/cjs/helpers/{detectPackageManager.cjs.map → detectPackageManager.js.map} +0 -0
- /package/dist/cjs/helpers/{exec.cjs.map → exec.js.map} +0 -0
- /package/dist/cjs/helpers/{getProjectName.cjs.map → getProjectName.js.map} +0 -0
- /package/dist/cjs/helpers/{getTemplateInfo.cjs.map → getTemplateInfo.js.map} +0 -0
- /package/dist/cjs/helpers/{installDependencies.cjs.map → installDependencies.js.map} +0 -0
- /package/dist/cjs/helpers/{validateNpmPackage.cjs.map → validateNpmPackage.js.map} +0 -0
- /package/dist/cjs/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/steps/{bare.cjs.map → bare.js.map} +0 -0
- /package/dist/cjs/steps/{fullstack.cjs.map → fullstack.js.map} +0 -0
- /package/dist/cjs/steps/{one.cjs.map → one.js.map} +0 -0
- /package/dist/cjs/steps/{types.cjs.map → types.js.map} +0 -0
- /package/dist/cjs/{templates.cjs.map → templates.js.map} +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
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 create_exports = {};
|
|
24
|
+
__export(create_exports, {
|
|
25
|
+
create: () => create
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(create_exports);
|
|
28
|
+
var import_ansis = __toESM(require("ansis")), import_fs_extra = __toESM(require("fs-extra")), import_node_child_process = require("node:child_process"), import_node_fs = __toESM(require("node:fs")), import_node_path = __toESM(require("node:path")), import_cloneStarter = require("./helpers/cloneStarter"), import_getProjectName = require("./helpers/getProjectName"), import_getTemplateInfo = require("./helpers/getTemplateInfo"), import_installDependencies = require("./helpers/installDependencies"), import_validateNpmPackage = require("./helpers/validateNpmPackage"), import_prompts = __toESM(require("prompts")), import_detectPackageManager = require("./helpers/detectPackageManager");
|
|
29
|
+
const { existsSync, readFileSync, writeFileSync } = import_fs_extra.default;
|
|
30
|
+
async function create(args) {
|
|
31
|
+
Number.parseFloat(
|
|
32
|
+
(0, import_node_child_process.execSync)("git --version").toString().replace("git version ", "").trim()
|
|
33
|
+
) < 2.27 && (console.error(`
|
|
34
|
+
|
|
35
|
+
\u26A0\uFE0F vxrn can't install: Git version must be >= 2.27
|
|
36
|
+
|
|
37
|
+
`), process.exit(1));
|
|
38
|
+
let projectName = args.name || "", resolvedProjectPath = import_node_path.default.resolve(process.cwd(), projectName);
|
|
39
|
+
async function promptForName() {
|
|
40
|
+
projectName = await (0, import_getProjectName.getProjectName)(), resolvedProjectPath = import_node_path.default.resolve(process.cwd(), projectName);
|
|
41
|
+
}
|
|
42
|
+
if (projectName)
|
|
43
|
+
import_node_fs.default.existsSync(resolvedProjectPath) && (console.error(`Error: folder already exists: ${resolvedProjectPath}`), process.exit(1));
|
|
44
|
+
else
|
|
45
|
+
for (await promptForName(); import_node_fs.default.existsSync(resolvedProjectPath); )
|
|
46
|
+
console.info(), console.info(
|
|
47
|
+
import_ansis.default.yellow("\u26A0\uFE0F"),
|
|
48
|
+
`The folder ${import_ansis.default.underline(
|
|
49
|
+
import_ansis.default.blueBright(projectName)
|
|
50
|
+
)} already exists, lets try another name`
|
|
51
|
+
), console.info(), console.info(), await promptForName();
|
|
52
|
+
console.info();
|
|
53
|
+
let template = await (0, import_getTemplateInfo.getTemplateInfo)(args.template);
|
|
54
|
+
const { valid, problems } = (0, import_validateNpmPackage.validateNpmName)(projectName);
|
|
55
|
+
valid || (console.error(
|
|
56
|
+
`Could not create a project called ${import_ansis.default.red(
|
|
57
|
+
`"${projectName}"`
|
|
58
|
+
)} because of npm naming restrictions:`
|
|
59
|
+
), problems.forEach((p) => console.error(` ${import_ansis.default.red.bold("*")} ${p}`)), process.exit(1)), console.info();
|
|
60
|
+
const spinner = (await import("yocto-spinner").then((x) => x.default))({
|
|
61
|
+
text: "Creating...",
|
|
62
|
+
spinner: {
|
|
63
|
+
frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"],
|
|
64
|
+
interval: 100
|
|
65
|
+
}
|
|
66
|
+
}).start();
|
|
67
|
+
await import_fs_extra.default.mkdir(resolvedProjectPath);
|
|
68
|
+
try {
|
|
69
|
+
await (0, import_cloneStarter.cloneStarter)(template, resolvedProjectPath), process.chdir(resolvedProjectPath);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
console.error(`[vxrn] Failed to copy example into ${resolvedProjectPath}
|
|
72
|
+
|
|
73
|
+
`, e), process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
spinner.stop(), console.info(), console.info(), console.info(import_ansis.default.green(`${projectName} created!`)), console.info(), console.info(), updatePackageJsonName(projectName, resolvedProjectPath);
|
|
76
|
+
const packageManager = await (async () => {
|
|
77
|
+
if ("packageManager" in template)
|
|
78
|
+
return template.packageManager;
|
|
79
|
+
const found = await (0, import_detectPackageManager.detectPackageManager)(), allFound = Object.keys(found);
|
|
80
|
+
return allFound.length === 1 ? allFound[0] : (await (0, import_prompts.default)({
|
|
81
|
+
name: "packageManager",
|
|
82
|
+
type: "select",
|
|
83
|
+
message: "Package Manager:",
|
|
84
|
+
choices: allFound.filter((x) => found[x]).map((name) => ({
|
|
85
|
+
title: name,
|
|
86
|
+
value: name
|
|
87
|
+
}))
|
|
88
|
+
})).packageManager;
|
|
89
|
+
})();
|
|
90
|
+
console.info(), "preInstall" in template && await template.preInstall({
|
|
91
|
+
packageManager,
|
|
92
|
+
isFullClone: !0,
|
|
93
|
+
projectName,
|
|
94
|
+
projectPath: resolvedProjectPath
|
|
95
|
+
});
|
|
96
|
+
try {
|
|
97
|
+
console.info(), console.info(import_ansis.default.green(`Installing with ${packageManager}...`)), console.info(), await (0, import_installDependencies.installDependencies)(resolvedProjectPath, packageManager);
|
|
98
|
+
} catch (e) {
|
|
99
|
+
console.error("[vxrn] error installing with " + packageManager + `
|
|
100
|
+
${e}`), process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
const envDefault = import_node_path.default.join(resolvedProjectPath, ".env.default"), env = import_node_path.default.join(resolvedProjectPath, ".env");
|
|
103
|
+
existsSync(envDefault) && !existsSync(env) && await import_fs_extra.default.move(envDefault, env), "extraSteps" in template && await template.extraSteps({
|
|
104
|
+
packageManager,
|
|
105
|
+
isFullClone: !0,
|
|
106
|
+
projectName,
|
|
107
|
+
projectPath: resolvedProjectPath
|
|
108
|
+
}), console.info();
|
|
109
|
+
}
|
|
110
|
+
function updatePackageJsonName(projectName, dir) {
|
|
111
|
+
const packageJsonPath = import_node_path.default.join(dir, "package.json");
|
|
112
|
+
if (existsSync(packageJsonPath)) {
|
|
113
|
+
const contentWithUpdatedName = readFileSync(packageJsonPath).toString().replace(/("name": ")(.*)(",)/, `$1${projectName}$3`);
|
|
114
|
+
writeFileSync(packageJsonPath, contentWithUpdatedName);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var cloneStarter_exports = {};
|
|
16
|
+
__export(cloneStarter_exports, {
|
|
17
|
+
cloneStarter: () => cloneStarter
|
|
18
|
+
});
|
|
19
|
+
module.exports = __toCommonJS(cloneStarter_exports);
|
|
20
|
+
var import_fs_extra = require("fs-extra"), import_node_os = require("node:os"), import_node_path = require("node:path"), import_rimraf = require("rimraf"), import_exec = require("./exec");
|
|
21
|
+
const home = (0, import_node_os.homedir)(), vxrnDir = (0, import_node_path.join)(home, ".vxrn"), cloneStarter = async (template, resolvedProjectPath) => {
|
|
22
|
+
const dir = await setupVxrnDotDir(
|
|
23
|
+
template,
|
|
24
|
+
(0, import_node_path.join)(vxrnDir, "vxrn", template.repo.url.split("/").at(-1))
|
|
25
|
+
);
|
|
26
|
+
await (0, import_fs_extra.pathExists)(dir) || (console.error(`Missing template for ${template.value} in ${dir}`), process.exit(1)), await (0, import_fs_extra.copy)(dir, resolvedProjectPath), await (0, import_rimraf.rimraf)((0, import_node_path.join)(resolvedProjectPath, ".git")), await (0, import_exec.execPromiseQuiet)("git init", {
|
|
27
|
+
cwd: resolvedProjectPath
|
|
28
|
+
});
|
|
29
|
+
const yarnLockDefault = (0, import_node_path.join)(resolvedProjectPath, "yarn.lock.default");
|
|
30
|
+
await (0, import_fs_extra.pathExists)(yarnLockDefault) && await (0, import_fs_extra.move)(yarnLockDefault, (0, import_node_path.join)(resolvedProjectPath, "yarn.lock"));
|
|
31
|
+
};
|
|
32
|
+
async function setupVxrnDotDir(template, targetGitDir, isRetry = !1) {
|
|
33
|
+
const branch = template.repo.branch;
|
|
34
|
+
await (0, import_fs_extra.ensureDir)(vxrnDir);
|
|
35
|
+
const isInSubDir = template.repo.dir.length > 0;
|
|
36
|
+
if (await (0, import_fs_extra.pathExists)(targetGitDir))
|
|
37
|
+
await (0, import_fs_extra.pathExists)((0, import_node_path.join)(targetGitDir, ".git")) || (console.error(`Corrupt vxrn directory, please delete ${targetGitDir} folder and re-run`), process.exit(1));
|
|
38
|
+
else {
|
|
39
|
+
const sourceGitRepo = template.repo.url, sourceGitRepoSshFallback = template.repo.sshFallback, cmd = `git clone --branch ${branch} ${isInSubDir ? "--depth 1 --sparse --filter=blob:none " : ""}${sourceGitRepo} "${targetGitDir}"`;
|
|
40
|
+
try {
|
|
41
|
+
await (0, import_exec.execPromiseQuiet)(cmd);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
if (cmd.includes("https://")) {
|
|
44
|
+
console.info("https failed - trying with ssh now...");
|
|
45
|
+
const sshCmd = cmd.replace(sourceGitRepo, sourceGitRepoSshFallback);
|
|
46
|
+
await (0, import_exec.execPromiseQuiet)(sshCmd);
|
|
47
|
+
} else
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (isInSubDir) {
|
|
52
|
+
const cmd = `git sparse-checkout set ${template.repo.dir.join(import_node_path.sep) ?? "."}`;
|
|
53
|
+
await (0, import_exec.execPromiseQuiet)(cmd, { cwd: targetGitDir });
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const cmd2 = `git pull --rebase --allow-unrelated-histories --depth 1 origin ${branch}`;
|
|
57
|
+
await (0, import_exec.execPromiseQuiet)(cmd2, {
|
|
58
|
+
cwd: targetGitDir
|
|
59
|
+
}), console.info();
|
|
60
|
+
const dir = (0, import_node_path.join)(targetGitDir, ...template.repo.dir);
|
|
61
|
+
if (!await (0, import_fs_extra.pathExists)(dir))
|
|
62
|
+
throw new Error("Re-clone...");
|
|
63
|
+
return dir;
|
|
64
|
+
} catch (err) {
|
|
65
|
+
return isRetry && (console.info(
|
|
66
|
+
`Error updating: ${err.message} ${isRetry ? `failing.
|
|
67
|
+
${err.stack}` : "trying from fresh."}`
|
|
68
|
+
), console.info(
|
|
69
|
+
"Please file an issue: https://github.com/onejs/one/issues/new?assignees=&labels=&template=bug_report.md&title="
|
|
70
|
+
), process.exit(1)), await (0, import_rimraf.rimraf)(targetGitDir), await setupVxrnDotDir(template, targetGitDir, !0);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=cloneStarter.js.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var detectPackageManager_exports = {};
|
|
16
|
+
__export(detectPackageManager_exports, {
|
|
17
|
+
detectPackageManager: () => detectPackageManager
|
|
18
|
+
});
|
|
19
|
+
module.exports = __toCommonJS(detectPackageManager_exports);
|
|
20
|
+
var import_node_fs = require("node:fs"), import_node_path = require("node:path"), import_exec = require("./exec");
|
|
21
|
+
async function pathExists(p) {
|
|
22
|
+
try {
|
|
23
|
+
return await import_node_fs.promises.access(p), !0;
|
|
24
|
+
} catch {
|
|
25
|
+
return !1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function hasGlobal(pm) {
|
|
29
|
+
try {
|
|
30
|
+
return !!(0, import_exec.exec)(`which ${pm}`).length;
|
|
31
|
+
} catch {
|
|
32
|
+
return !1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async function getFromLockfile(cwd = ".") {
|
|
36
|
+
const [yarn, npm, pnpm, bun] = await Promise.all([
|
|
37
|
+
pathExists((0, import_node_path.resolve)(cwd, "yarn.lock")),
|
|
38
|
+
pathExists((0, import_node_path.resolve)(cwd, "package-lock.json")),
|
|
39
|
+
pathExists((0, import_node_path.resolve)(cwd, "pnpm-lock.yaml")),
|
|
40
|
+
pathExists((0, import_node_path.resolve)(cwd, "bun.lockb"))
|
|
41
|
+
]);
|
|
42
|
+
return { bun, yarn, pnpm, npm };
|
|
43
|
+
}
|
|
44
|
+
async function getFromPackage(cwd = ".") {
|
|
45
|
+
if (await pathExists((0, import_node_path.resolve)(cwd, "package.json"))) {
|
|
46
|
+
const json = JSON.parse(await import_node_fs.promises.readFile((0, import_node_path.resolve)(cwd, "package.json"), "utf-8"));
|
|
47
|
+
if (json.packageManager) {
|
|
48
|
+
const yarn = !!json.packageManager.starsWith("yarn"), pnpm = !!json.packageManager.starsWith("pnpm"), bun = !!json.packageManager.starsWith("bun"), npm = !!json.packageManager.starsWith("npm");
|
|
49
|
+
return { bun, yarn, pnpm, npm };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const foundSome = (obj) => Object.keys(obj).some((k) => !!obj[k]), detectPackageManager = async ({ cwd } = {}) => {
|
|
54
|
+
const fromLockfile = await getFromLockfile(cwd);
|
|
55
|
+
if (foundSome(fromLockfile))
|
|
56
|
+
return fromLockfile;
|
|
57
|
+
const fromPackageJson = await getFromPackage(cwd);
|
|
58
|
+
if (fromPackageJson && foundSome(fromPackageJson))
|
|
59
|
+
return fromPackageJson;
|
|
60
|
+
const [npm, yarn, pnpm, bun] = await Promise.all([
|
|
61
|
+
hasGlobal("npm"),
|
|
62
|
+
hasGlobal("yarn"),
|
|
63
|
+
hasGlobal("pnpm"),
|
|
64
|
+
hasGlobal("bun")
|
|
65
|
+
]);
|
|
66
|
+
return {
|
|
67
|
+
bun,
|
|
68
|
+
yarn,
|
|
69
|
+
pnpm,
|
|
70
|
+
npm
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=detectPackageManager.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var exec_exports = {};
|
|
16
|
+
__export(exec_exports, {
|
|
17
|
+
exec: () => exec,
|
|
18
|
+
execPromise: () => execPromise,
|
|
19
|
+
execPromiseQuiet: () => execPromiseQuiet
|
|
20
|
+
});
|
|
21
|
+
module.exports = __toCommonJS(exec_exports);
|
|
22
|
+
var import_node_child_process = require("node:child_process");
|
|
23
|
+
const exec = (cmd, options) => (0, import_node_child_process.execSync)(cmd, options)?.toString() || "", execPromise = (cmd, options) => new Promise((resolve, reject) => {
|
|
24
|
+
const [command, ...args] = cmd.split(" "), child = (0, import_node_child_process.spawn)(command, args, {
|
|
25
|
+
stdio: options?.quiet ? "pipe" : "inherit",
|
|
26
|
+
shell: !0,
|
|
27
|
+
...options
|
|
28
|
+
});
|
|
29
|
+
(!options?.quiet || process.env.DEBUG) && (child.stdout?.pipe(process.stdout), child.stderr?.pipe(process.stderr)), child.on("close", (code) => {
|
|
30
|
+
code !== 0 ? reject(new Error(`Command failed with exit code ${code}: ${cmd}`)) : resolve();
|
|
31
|
+
}), child.on("error", (error) => {
|
|
32
|
+
reject(error);
|
|
33
|
+
});
|
|
34
|
+
}), execPromiseQuiet = (cmd, options) => execPromise(cmd, {
|
|
35
|
+
...options,
|
|
36
|
+
quiet: !0
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=exec.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
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 getProjectName_exports = {};
|
|
24
|
+
__export(getProjectName_exports, {
|
|
25
|
+
getProjectName: () => getProjectName
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(getProjectName_exports);
|
|
28
|
+
var import_node_path = __toESM(require("node:path")), import_ansis = __toESM(require("ansis")), import_prompts = __toESM(require("prompts")), import_validateNpmPackage = require("./validateNpmPackage");
|
|
29
|
+
const getProjectName = async (projectPath) => {
|
|
30
|
+
if (typeof projectPath == "string" && (projectPath = projectPath.trim()), console.info(), console.info(import_ansis.default.yellow(` Hello. Let's create a new ${import_ansis.default.yellowBright("\u2460")} app...`)), console.info(), !projectPath) {
|
|
31
|
+
const defaultName = "hello-world", res = await (0, import_prompts.default)({
|
|
32
|
+
type: "text",
|
|
33
|
+
name: "path",
|
|
34
|
+
message: "Name",
|
|
35
|
+
initial: defaultName,
|
|
36
|
+
validate: (name) => {
|
|
37
|
+
const validation = (0, import_validateNpmPackage.validateNpmName)(import_node_path.default.basename(import_node_path.default.resolve(name)));
|
|
38
|
+
return validation.valid ? !0 : "Invalid name: " + validation.problems[0];
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
typeof res.path == "string" && (projectPath = res.path.trim() || defaultName);
|
|
42
|
+
}
|
|
43
|
+
if (!projectPath) {
|
|
44
|
+
const name = "create-vxrn";
|
|
45
|
+
console.info(), console.info("Please specify the project directory:"), console.info(` ${import_ansis.default.cyan(name)} ${import_ansis.default.green("<project-directory>")}`), console.info(), console.info("For example:"), console.info(` ${import_ansis.default.cyan(name)} ${import_ansis.default.green("my-app")}`), console.info(), console.info(`Run ${import_ansis.default.cyan(`${name} --help`)} to see all options.`), process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
return projectPath;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=getProjectName.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
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 getTemplateInfo_exports = {};
|
|
24
|
+
__export(getTemplateInfo_exports, {
|
|
25
|
+
getTemplateInfo: () => getTemplateInfo
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(getTemplateInfo_exports);
|
|
28
|
+
var import_prompts = __toESM(require("prompts")), import_templates = require("../templates");
|
|
29
|
+
const validTemplates = import_templates.templates.map(({ value }) => value).join(", "), getTemplateInfo = async (template) => {
|
|
30
|
+
let res = getValidTemplate(template);
|
|
31
|
+
return template && !res && (console.warn(`template ${template} is not valid. valid options: ${validTemplates}`), process.exit(1)), res || (console.info(), template = (await (0, import_prompts.default)({
|
|
32
|
+
name: "template",
|
|
33
|
+
type: "select",
|
|
34
|
+
message: "Template",
|
|
35
|
+
choices: import_templates.templates.filter((t) => !t.hidden)
|
|
36
|
+
})).template), res = getValidTemplate(`${template}`), res || (console.warn(`template ${template} is not valid. valid options: ${validTemplates}`), process.exit(1)), res;
|
|
37
|
+
}, getValidTemplate = (template) => typeof template == "string" && import_templates.templates.find(({ value }) => value === template);
|
|
38
|
+
//# sourceMappingURL=getTemplateInfo.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var installDependencies_exports = {};
|
|
16
|
+
__export(installDependencies_exports, {
|
|
17
|
+
installDependencies: () => installDependencies
|
|
18
|
+
});
|
|
19
|
+
module.exports = __toCommonJS(installDependencies_exports);
|
|
20
|
+
var import_exec = require("./exec");
|
|
21
|
+
async function installDependencies(projectRoot, packageManager) {
|
|
22
|
+
const options = { cwd: projectRoot };
|
|
23
|
+
let command;
|
|
24
|
+
switch (packageManager) {
|
|
25
|
+
case "bun":
|
|
26
|
+
command = "bun install";
|
|
27
|
+
break;
|
|
28
|
+
case "yarn":
|
|
29
|
+
command = "yarn install";
|
|
30
|
+
break;
|
|
31
|
+
case "pnpm":
|
|
32
|
+
command = "pnpm install";
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
command = "npm install --force";
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
await (0, import_exec.execPromise)(command, options), console.info(`${packageManager} install completed successfully.`);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
throw console.error(`Failed to install dependencies using ${packageManager}:`, error), error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=installDependencies.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
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 validateNpmPackage_exports = {};
|
|
24
|
+
__export(validateNpmPackage_exports, {
|
|
25
|
+
validateNpmName: () => validateNpmName
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(validateNpmPackage_exports);
|
|
28
|
+
var import_validate_npm_package_name = __toESM(require("validate-npm-package-name"));
|
|
29
|
+
function validateNpmName(name) {
|
|
30
|
+
const nameValidation = (0, import_validate_npm_package_name.default)(name);
|
|
31
|
+
return nameValidation.validForNewPackages ? { valid: !0 } : {
|
|
32
|
+
valid: !1,
|
|
33
|
+
problems: [...nameValidation.errors || [], ...nameValidation.warnings || []]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=validateNpmPackage.js.map
|
|
@@ -0,0 +1,73 @@
|
|
|
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: 'One of "bare", "tamagui", "router".'
|
|
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(
|
|
61
|
+
import_ansis.default.bold(' Note: You may need to run "npm create vxrn@latest" to get the latest version!')
|
|
62
|
+
), console.info(), console.info(), console.info(import_ansis.default.bold("Creating vxrn app...")), await (0, import_create.create)({ template: args.template });
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
(0, import_citty.runMain)(main);
|
|
66
|
+
function getPackageVersion() {
|
|
67
|
+
let dirname;
|
|
68
|
+
typeof __dirname < "u" ? dirname = __dirname : dirname = import_node_path.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
69
|
+
const packagePath = import_node_path.default.join(dirname, "..", "..", "package.json");
|
|
70
|
+
return JSON.parse((0, import_node_fs.readFileSync)(packagePath, "utf-8")).version;
|
|
71
|
+
}
|
|
72
|
+
process.argv.includes("--version") && (console.info(getPackageVersion()), process.exit(0));
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
await replaceNameInUTF8File(
|
|
58
|
+
"android/app/build.gradle",
|
|
59
|
+
"../../node_modules/",
|
|
60
|
+
"../../../../node_modules/"
|
|
61
|
+
), await replaceNameInUTF8File(
|
|
62
|
+
"android/settings.gradle",
|
|
63
|
+
"../node_modules/",
|
|
64
|
+
"../../../node_modules/"
|
|
65
|
+
), await replaceNameInUTF8File(
|
|
66
|
+
`ios/${projectName}.xcodeproj/project.pbxproj`,
|
|
67
|
+
"../node_modules/react-native/scripts/",
|
|
68
|
+
"../../../node_modules/react-native/scripts/"
|
|
69
|
+
), isFullClone && console.info(`
|
|
70
|
+
${import_ansis.default.green.bold("Done!")} Created a new project under ./${import_ansis.default.greenBright(projectName)} visit your project:
|
|
71
|
+
\u2022 ${import_ansis.default.green("cd")} ${projectName}
|
|
72
|
+
|
|
73
|
+
${import_ansis.default.green(`Run instructions for ${import_ansis.default.bold("Android")}:`)}
|
|
74
|
+
\u2022 Have an Android emulator running (quickest way to get started), or a device connected.
|
|
75
|
+
\u2022 npx react-native run-android
|
|
76
|
+
|
|
77
|
+
${import_ansis.default.blue(`Run instructions for ${import_ansis.default.bold("iOS")}:`)}
|
|
78
|
+
\u2022 Install Cocoapods
|
|
79
|
+
\u2022 bundle install # you need to run this only once in your project.
|
|
80
|
+
\u2022 bundle exec pod install
|
|
81
|
+
\u2022 cd ..
|
|
82
|
+
|
|
83
|
+
\u2022 npx react-native run-ios
|
|
84
|
+
${import_ansis.default.gray("- or -")}
|
|
85
|
+
\u2022 Open ${projectName}/ios/${projectName}.xcworkspace in Xcode or run "xed -b ios"
|
|
86
|
+
\u2022 Hit the Run button
|
|
87
|
+
|
|
88
|
+
`);
|
|
89
|
+
};
|
|
90
|
+
var bare_default = main;
|
|
91
|
+
//# sourceMappingURL=bare.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
|
@@ -0,0 +1,45 @@
|
|
|
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_node_path = require("node:path"), import_fs_extra = __toESM(require("fs-extra"));
|
|
30
|
+
const extraSteps = async ({ isFullClone, projectName, packageManager }) => {
|
|
31
|
+
const useBun = packageManager === "bun", runCommand = (scriptName) => `${packageManager} ${useBun ? "" : "run "}${scriptName}`;
|
|
32
|
+
isFullClone && console.info(
|
|
33
|
+
`
|
|
34
|
+
${import_ansis.default.green.bold("Done!")} Created a new project under ./${import_ansis.default.greenBright(projectName)}`
|
|
35
|
+
), console.info(`
|
|
36
|
+
To run:
|
|
37
|
+
|
|
38
|
+
${import_ansis.default.green("cd")} ${projectName}
|
|
39
|
+
${import_ansis.default.green(runCommand("dev"))}
|
|
40
|
+
`);
|
|
41
|
+
}, preInstall = async ({ projectName, packageManager, projectPath }) => {
|
|
42
|
+
packageManager === "pnpm" && await import_fs_extra.default.writeFile((0, import_node_path.join)(projectPath, ".npmrc"), `node-linker=hoisted
|
|
43
|
+
`), packageManager === "yarn" && (await import_fs_extra.default.writeFile((0, import_node_path.join)(projectPath, "yarn.lock"), ""), console.info("Created empty yarn.lock file"));
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=one.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
|
@@ -0,0 +1,96 @@
|
|
|
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: "Minimal Tamagui",
|
|
32
|
+
value: "Tamagui",
|
|
33
|
+
type: "included-in-monorepo",
|
|
34
|
+
hidden: !1,
|
|
35
|
+
repo: {
|
|
36
|
+
url: "https://github.com/onejs/one.git",
|
|
37
|
+
sshFallback: "git@github.com:onejs/one.git",
|
|
38
|
+
dir: ["examples", "one-tamagui"],
|
|
39
|
+
branch: "main"
|
|
40
|
+
},
|
|
41
|
+
...BasicTemplateSteps
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
title: "Fullstack - Drizzle, Postgres, Tamagui, Biome",
|
|
45
|
+
value: "Recommended",
|
|
46
|
+
type: "included-in-monorepo",
|
|
47
|
+
hidden: !1,
|
|
48
|
+
repo: {
|
|
49
|
+
url: "https://github.com/onejs/one.git",
|
|
50
|
+
sshFallback: "git@github.com:onejs/one.git",
|
|
51
|
+
dir: ["examples", "one-recommended"],
|
|
52
|
+
branch: "main"
|
|
53
|
+
},
|
|
54
|
+
...BasicTemplateSteps
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: "Minimal",
|
|
58
|
+
value: "Minimal",
|
|
59
|
+
type: "included-in-monorepo",
|
|
60
|
+
hidden: !1,
|
|
61
|
+
repo: {
|
|
62
|
+
url: "https://github.com/onejs/one.git",
|
|
63
|
+
sshFallback: "git@github.com:onejs/one.git",
|
|
64
|
+
dir: ["examples", "one-basic"],
|
|
65
|
+
branch: "main"
|
|
66
|
+
},
|
|
67
|
+
...BasicTemplateSteps
|
|
68
|
+
}
|
|
69
|
+
// {
|
|
70
|
+
// title: `Fullstack - Recommended + Supabase Auth flows`,
|
|
71
|
+
// value: 'Fullstack',
|
|
72
|
+
// type: 'included-in-monorepo',
|
|
73
|
+
// hidden: false,
|
|
74
|
+
// repo: {
|
|
75
|
+
// url: `https://github.com/onejs/one.git`,
|
|
76
|
+
// sshFallback: `git@github.com:onejs/one.git`,
|
|
77
|
+
// dir: [`examples`, `one-basic`],
|
|
78
|
+
// branch: 'main',
|
|
79
|
+
// },
|
|
80
|
+
// ...FullstackSteps,
|
|
81
|
+
// },
|
|
82
|
+
// {
|
|
83
|
+
// title: `Bare`,
|
|
84
|
+
// value: 'bare',
|
|
85
|
+
// type: 'included-in-monorepo',
|
|
86
|
+
// hidden: false,
|
|
87
|
+
// repo: {
|
|
88
|
+
// url: `https://github.com/onejs/one.git`,
|
|
89
|
+
// sshFallback: `git@github.com:onejs/one.git`,
|
|
90
|
+
// dir: [`examples`, `bare`],
|
|
91
|
+
// branch: 'main',
|
|
92
|
+
// },
|
|
93
|
+
// extraSteps: stepsBare,
|
|
94
|
+
// },
|
|
95
|
+
];
|
|
96
|
+
//# sourceMappingURL=templates.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-vxrn",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.321",
|
|
4
4
|
"bin": "run.js",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/build": "^1.
|
|
30
|
+
"@tamagui/build": "^1.116.4",
|
|
31
31
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
32
32
|
"ansis": "^3.1.0",
|
|
33
33
|
"async-retry": "1.3.1",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|