create-takeout 0.0.46
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/index.js +138 -0
- package/dist/index.js.map +6 -0
- package/dist/index.mjs +168 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +40 -0
- package/run.js +12 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
};
|
|
12
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
13
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
14
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
15
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
16
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
17
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
18
|
+
mod
|
|
19
|
+
));
|
|
20
|
+
var import_node_child_process = require("node:child_process"), import_node_fs = __toESM(require("node:fs")), import_node_path = __toESM(require("node:path")), import_citty = require("citty"), import_prompts = __toESM(require("prompts")), import_yocto_spinner = __toESM(require("yocto-spinner"));
|
|
21
|
+
const REPO_URL = "https://github.com/tamagui/takeout-free.git", REPO_SSH = "git@github.com:tamagui/takeout-free.git", bold = (s) => `\x1B[1m${s}\x1B[22m`, dim = (s) => `\x1B[2m${s}\x1B[22m`, green = (s) => `\x1B[32m${s}\x1B[39m`, cyan = (s) => `\x1B[36m${s}\x1B[39m`, yellow = (s) => `\x1B[33m${s}\x1B[39m`, red = (s) => `\x1B[31m${s}\x1B[39m`, orange = (s) => `\x1B[38;2;247;104;8m${s}\x1B[39m`, goldBold = (s) => `\x1B[1m\x1B[38;2;245;217;10m${s}\x1B[39m\x1B[22m`, blueUnderline = (s) => `\x1B[4m\x1B[38;2;0;145;255m${s}\x1B[39m\x1B[24m`, takeoutArt = `
|
|
22
|
+
\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
|
|
23
|
+
\u2502 \u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E \u2502
|
|
24
|
+
\u2502 \u2502 \u{1F961} ${bold(yellow("TAKEOUT"))} \u{1F961} \u2502 \u2502
|
|
25
|
+
\u2502 \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F \u2502
|
|
26
|
+
\u2502 \u2572 \u2571 \u2502
|
|
27
|
+
\u2502 \u2572 \u2571 \u2502
|
|
28
|
+
\u2502 \u2572 \u2571 \u2502
|
|
29
|
+
\u2502 \u2572 \u2571 \u2502
|
|
30
|
+
\u2502 \u2572 \u2571 \u2502
|
|
31
|
+
\u2502 \u2572 \u2571 \u2502
|
|
32
|
+
\u2502 \u2572 \u2571 \u2502
|
|
33
|
+
\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
|
|
34
|
+
`, banner = `
|
|
35
|
+
${orange(takeoutArt)}
|
|
36
|
+
${bold("Universal React + React Native Starter")}
|
|
37
|
+
${dim("Powered by Tamagui, One, Expo & More")}
|
|
38
|
+
`, proMessage = `
|
|
39
|
+
${goldBold("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501")}
|
|
40
|
+
|
|
41
|
+
${bold("\u{1F680} Want the full experience?")}
|
|
42
|
+
|
|
43
|
+
Takeout Pro includes:
|
|
44
|
+
${green("\u2713")} SST / AWS deploy
|
|
45
|
+
${green("\u2713")} Website with home, docs policy/terms
|
|
46
|
+
${green("\u2713")} Errors and analytics
|
|
47
|
+
${green("\u2713")} Emailing
|
|
48
|
+
${green("\u2713")} A lot more UI
|
|
49
|
+
${green("\u2713")} A bunch of screens, settings, profile...
|
|
50
|
+
${green("\u2713")} Faster updates, chat support
|
|
51
|
+
${green("\u2713")} And much more...
|
|
52
|
+
|
|
53
|
+
${blueUnderline("https://tamagui.dev/takeout")}
|
|
54
|
+
|
|
55
|
+
${goldBold("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501")}
|
|
56
|
+
`;
|
|
57
|
+
async function getProjectName(initialName) {
|
|
58
|
+
if (initialName)
|
|
59
|
+
return initialName;
|
|
60
|
+
const response = await (0, import_prompts.default)({
|
|
61
|
+
type: "text",
|
|
62
|
+
name: "name",
|
|
63
|
+
message: "Project name:",
|
|
64
|
+
initial: "my-app"
|
|
65
|
+
});
|
|
66
|
+
return response.name || (console.info(dim(`
|
|
67
|
+
Cancelled.`)), process.exit(0)), response.name;
|
|
68
|
+
}
|
|
69
|
+
async function cloneRepo(projectPath) {
|
|
70
|
+
const spinner = (0, import_yocto_spinner.default)({ text: "Cloning takeout-free..." }).start();
|
|
71
|
+
try {
|
|
72
|
+
(0, import_node_child_process.execSync)(`git clone --depth 1 ${REPO_URL} "${projectPath}"`, {
|
|
73
|
+
stdio: "pipe"
|
|
74
|
+
});
|
|
75
|
+
} catch {
|
|
76
|
+
try {
|
|
77
|
+
(0, import_node_child_process.execSync)(`git clone --depth 1 ${REPO_SSH} "${projectPath}"`, {
|
|
78
|
+
stdio: "pipe"
|
|
79
|
+
});
|
|
80
|
+
} catch (err) {
|
|
81
|
+
throw spinner.error("Failed to clone repository"), err;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
import_node_fs.default.rmSync(import_node_path.default.join(projectPath, ".git"), { recursive: !0, force: !0 }), spinner.success("Cloned takeout-free");
|
|
85
|
+
}
|
|
86
|
+
function updatePackageJson(projectPath, projectName) {
|
|
87
|
+
const pkgPath = import_node_path.default.join(projectPath, "package.json");
|
|
88
|
+
if (import_node_fs.default.existsSync(pkgPath)) {
|
|
89
|
+
const pkg = JSON.parse(import_node_fs.default.readFileSync(pkgPath, "utf-8"));
|
|
90
|
+
pkg.name = projectName, import_node_fs.default.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async function installDependencies(projectPath) {
|
|
94
|
+
const spinner = (0, import_yocto_spinner.default)({ text: "Installing dependencies with bun..." }).start();
|
|
95
|
+
try {
|
|
96
|
+
(0, import_node_child_process.execSync)("bun install", {
|
|
97
|
+
cwd: projectPath,
|
|
98
|
+
stdio: "pipe"
|
|
99
|
+
}), spinner.success("Dependencies installed");
|
|
100
|
+
} catch (err) {
|
|
101
|
+
throw spinner.error("Failed to install dependencies"), err;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const main = (0, import_citty.defineCommand)({
|
|
105
|
+
meta: {
|
|
106
|
+
name: "create-takeout",
|
|
107
|
+
version: "0.0.45",
|
|
108
|
+
description: "Create a new Takeout app"
|
|
109
|
+
},
|
|
110
|
+
args: {
|
|
111
|
+
directory: {
|
|
112
|
+
type: "positional",
|
|
113
|
+
description: "Project directory name",
|
|
114
|
+
required: !1
|
|
115
|
+
},
|
|
116
|
+
info: {
|
|
117
|
+
type: "boolean",
|
|
118
|
+
description: "Show Pro information without creating a project"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
async run({ args }) {
|
|
122
|
+
if (console.info(banner), args.info) {
|
|
123
|
+
console.info(proMessage);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const projectName = await getProjectName(args.directory), projectPath = import_node_path.default.resolve(projectName);
|
|
127
|
+
import_node_fs.default.existsSync(projectPath) && import_node_fs.default.readdirSync(projectPath).length > 0 && (console.error(red(`
|
|
128
|
+
Directory "${projectName}" is not empty.`)), process.exit(1)), console.info(""), await cloneRepo(projectPath), updatePackageJson(projectPath, projectName), await installDependencies(projectPath), console.info(`
|
|
129
|
+
${green(bold("\u2713 Success!"))} Created ${cyan(projectName)}
|
|
130
|
+
|
|
131
|
+
${bold("Next steps:")}
|
|
132
|
+
${cyan("cd")} ${projectName}
|
|
133
|
+
${cyan("bun dev")}
|
|
134
|
+
`), console.info(proMessage);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
(0, import_citty.runMain)(main);
|
|
138
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;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.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
9
|
+
get: () => from[key],
|
|
10
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
+
});
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
15
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
16
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
17
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
18
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
19
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: !0
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
var import_node_child_process = require("node:child_process"),
|
|
24
|
+
import_node_fs = __toESM(require("node:fs")),
|
|
25
|
+
import_node_path = __toESM(require("node:path")),
|
|
26
|
+
import_citty = require("citty"),
|
|
27
|
+
import_prompts = __toESM(require("prompts")),
|
|
28
|
+
import_yocto_spinner = __toESM(require("yocto-spinner"));
|
|
29
|
+
const REPO_URL = "https://github.com/tamagui/takeout-free.git",
|
|
30
|
+
REPO_SSH = "git@github.com:tamagui/takeout-free.git",
|
|
31
|
+
bold = s => `\x1B[1m${s}\x1B[22m`,
|
|
32
|
+
dim = s => `\x1B[2m${s}\x1B[22m`,
|
|
33
|
+
green = s => `\x1B[32m${s}\x1B[39m`,
|
|
34
|
+
cyan = s => `\x1B[36m${s}\x1B[39m`,
|
|
35
|
+
yellow = s => `\x1B[33m${s}\x1B[39m`,
|
|
36
|
+
red = s => `\x1B[31m${s}\x1B[39m`,
|
|
37
|
+
orange = s => `\x1B[38;2;247;104;8m${s}\x1B[39m`,
|
|
38
|
+
goldBold = s => `\x1B[1m\x1B[38;2;245;217;10m${s}\x1B[39m\x1B[22m`,
|
|
39
|
+
blueUnderline = s => `\x1B[4m\x1B[38;2;0;145;255m${s}\x1B[39m\x1B[24m`,
|
|
40
|
+
takeoutArt = `
|
|
41
|
+
\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
|
|
42
|
+
\u2502 \u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E \u2502
|
|
43
|
+
\u2502 \u2502 \u{1F961} ${bold(yellow("TAKEOUT"))} \u{1F961} \u2502 \u2502
|
|
44
|
+
\u2502 \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F \u2502
|
|
45
|
+
\u2502 \u2572 \u2571 \u2502
|
|
46
|
+
\u2502 \u2572 \u2571 \u2502
|
|
47
|
+
\u2502 \u2572 \u2571 \u2502
|
|
48
|
+
\u2502 \u2572 \u2571 \u2502
|
|
49
|
+
\u2502 \u2572 \u2571 \u2502
|
|
50
|
+
\u2502 \u2572 \u2571 \u2502
|
|
51
|
+
\u2502 \u2572 \u2571 \u2502
|
|
52
|
+
\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
|
|
53
|
+
`,
|
|
54
|
+
banner = `
|
|
55
|
+
${orange(takeoutArt)}
|
|
56
|
+
${bold("Universal React + React Native Starter")}
|
|
57
|
+
${dim("Powered by Tamagui, One, Expo & More")}
|
|
58
|
+
`,
|
|
59
|
+
proMessage = `
|
|
60
|
+
${goldBold("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501")}
|
|
61
|
+
|
|
62
|
+
${bold("\u{1F680} Want the full experience?")}
|
|
63
|
+
|
|
64
|
+
Takeout Pro includes:
|
|
65
|
+
${green("\u2713")} SST / AWS deploy
|
|
66
|
+
${green("\u2713")} Website with home, docs policy/terms
|
|
67
|
+
${green("\u2713")} Errors and analytics
|
|
68
|
+
${green("\u2713")} Emailing
|
|
69
|
+
${green("\u2713")} A lot more UI
|
|
70
|
+
${green("\u2713")} A bunch of screens, settings, profile...
|
|
71
|
+
${green("\u2713")} Faster updates, chat support
|
|
72
|
+
${green("\u2713")} And much more...
|
|
73
|
+
|
|
74
|
+
${blueUnderline("https://tamagui.dev/takeout")}
|
|
75
|
+
|
|
76
|
+
${goldBold("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501")}
|
|
77
|
+
`;
|
|
78
|
+
async function getProjectName(initialName) {
|
|
79
|
+
if (initialName) return initialName;
|
|
80
|
+
const response = await (0, import_prompts.default)({
|
|
81
|
+
type: "text",
|
|
82
|
+
name: "name",
|
|
83
|
+
message: "Project name:",
|
|
84
|
+
initial: "my-app"
|
|
85
|
+
});
|
|
86
|
+
return response.name || (console.info(dim(`
|
|
87
|
+
Cancelled.`)), process.exit(0)), response.name;
|
|
88
|
+
}
|
|
89
|
+
async function cloneRepo(projectPath) {
|
|
90
|
+
const spinner = (0, import_yocto_spinner.default)({
|
|
91
|
+
text: "Cloning takeout-free..."
|
|
92
|
+
}).start();
|
|
93
|
+
try {
|
|
94
|
+
(0, import_node_child_process.execSync)(`git clone --depth 1 ${REPO_URL} "${projectPath}"`, {
|
|
95
|
+
stdio: "pipe"
|
|
96
|
+
});
|
|
97
|
+
} catch {
|
|
98
|
+
try {
|
|
99
|
+
(0, import_node_child_process.execSync)(`git clone --depth 1 ${REPO_SSH} "${projectPath}"`, {
|
|
100
|
+
stdio: "pipe"
|
|
101
|
+
});
|
|
102
|
+
} catch (err) {
|
|
103
|
+
throw spinner.error("Failed to clone repository"), err;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
import_node_fs.default.rmSync(import_node_path.default.join(projectPath, ".git"), {
|
|
107
|
+
recursive: !0,
|
|
108
|
+
force: !0
|
|
109
|
+
}), spinner.success("Cloned takeout-free");
|
|
110
|
+
}
|
|
111
|
+
function updatePackageJson(projectPath, projectName) {
|
|
112
|
+
const pkgPath = import_node_path.default.join(projectPath, "package.json");
|
|
113
|
+
if (import_node_fs.default.existsSync(pkgPath)) {
|
|
114
|
+
const pkg = JSON.parse(import_node_fs.default.readFileSync(pkgPath, "utf-8"));
|
|
115
|
+
pkg.name = projectName, import_node_fs.default.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async function installDependencies(projectPath) {
|
|
119
|
+
const spinner = (0, import_yocto_spinner.default)({
|
|
120
|
+
text: "Installing dependencies with bun..."
|
|
121
|
+
}).start();
|
|
122
|
+
try {
|
|
123
|
+
(0, import_node_child_process.execSync)("bun install", {
|
|
124
|
+
cwd: projectPath,
|
|
125
|
+
stdio: "pipe"
|
|
126
|
+
}), spinner.success("Dependencies installed");
|
|
127
|
+
} catch (err) {
|
|
128
|
+
throw spinner.error("Failed to install dependencies"), err;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const main = (0, import_citty.defineCommand)({
|
|
132
|
+
meta: {
|
|
133
|
+
name: "create-takeout",
|
|
134
|
+
version: "0.0.45",
|
|
135
|
+
description: "Create a new Takeout app"
|
|
136
|
+
},
|
|
137
|
+
args: {
|
|
138
|
+
directory: {
|
|
139
|
+
type: "positional",
|
|
140
|
+
description: "Project directory name",
|
|
141
|
+
required: !1
|
|
142
|
+
},
|
|
143
|
+
info: {
|
|
144
|
+
type: "boolean",
|
|
145
|
+
description: "Show Pro information without creating a project"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
async run({
|
|
149
|
+
args
|
|
150
|
+
}) {
|
|
151
|
+
if (console.info(banner), args.info) {
|
|
152
|
+
console.info(proMessage);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const projectName = await getProjectName(args.directory),
|
|
156
|
+
projectPath = import_node_path.default.resolve(projectName);
|
|
157
|
+
import_node_fs.default.existsSync(projectPath) && import_node_fs.default.readdirSync(projectPath).length > 0 && (console.error(red(`
|
|
158
|
+
Directory "${projectName}" is not empty.`)), process.exit(1)), console.info(""), await cloneRepo(projectPath), updatePackageJson(projectPath, projectName), await installDependencies(projectPath), console.info(`
|
|
159
|
+
${green(bold("\u2713 Success!"))} Created ${cyan(projectName)}
|
|
160
|
+
|
|
161
|
+
${bold("Next steps:")}
|
|
162
|
+
${cyan("cd")} ${projectName}
|
|
163
|
+
${cyan("bun dev")}
|
|
164
|
+
`), console.info(proMessage);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
(0, import_citty.runMain)(main);
|
|
168
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["import_node_child_process","require","import_node_fs","__toESM","import_node_path","import_citty","import_prompts","import_yocto_spinner","REPO_URL","REPO_SSH","bold","s","dim","green","cyan","yellow","red","orange","goldBold","blueUnderline","takeoutArt","banner","proMessage","getProjectName","initialName","response","default","type","name","message","initial","console","info","process","exit","cloneRepo","projectPath","spinner","text","start","execSync","stdio","err","error","rmSync","join","recursive","force","success","updatePackageJson","projectName","pkgPath","existsSync","pkg","JSON","parse","readFileSync","writeFileSync","stringify","installDependencies","cwd","main","defineCommand","meta","version","description","args","directory","required","run","resolve","readdirSync","length","runMain"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,yBAAA,GAAyBC,OAAA;EACzBC,cAAA,GAAeC,OAAA,CAAAF,OAAA;EACfG,gBAAA,GAAiBD,OAAA,CAAAF,OAAA;EAEjBI,YAAA,GAAuCJ,OAAA;EACvCK,cAAA,GAAoBH,OAAA,CAAAF,OAAA;EACpBM,oBAAA,GAA0BJ,OAAA,CAAAF,OAAA;AAE1B,MAAMO,QAAA,GAAW;EACXC,QAAA,GAAW;EAGXC,IAAA,GAAQC,CAAA,IAAc,UAAUA,CAAC;EACjCC,GAAA,GAAOD,CAAA,IAAc,UAAUA,CAAC;EAChCE,KAAA,GAASF,CAAA,IAAc,WAAWA,CAAC;EACnCG,IAAA,GAAQH,CAAA,IAAc,WAAWA,CAAC;EAClCI,MAAA,GAAUJ,CAAA,IAAc,WAAWA,CAAC;EACpCK,GAAA,GAAOL,CAAA,IAAc,WAAWA,CAAC;EACjCM,MAAA,GAAUN,CAAA,IAAc,uBAAuBA,CAAC;EAChDO,QAAA,GAAYP,CAAA,IAAc,+BAA+BA,CAAC;EAC1DQ,aAAA,GAAiBR,CAAA,IAAc,8BAA8BA,CAAC;EAE9DS,UAAA,GAAa;AAAA;AAAA;AAAA,gCAGJV,IAAA,CAAKK,MAAA,CAAO,SAAS,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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CL,OAAA,CAAQC,IAAA,CAAK;AAAA,EACfnB,KAAA,CAAMH,IAAA,CAAK,iBAAY,CAAC,CAAC,YAAYI,IAAA,CAAKoC,WAAW,CAAC;AAAA;AAAA,EAEtDxC,IAAA,CAAK,aAAa,CAAC;AAAA,IACjBI,IAAA,CAAK,IAAI,CAAC,IAAIoC,WAAW;AAAA,IACzBpC,IAAA,CAAK,SAAS,CAAC;AAAA,CAClB,GAEGiB,OAAA,CAAQC,IAAA,CAAKV,UAAU;EACzB;AACF,CAAC;AAAA,IAEDjB,YAAA,CAAAoE,OAAA,EAAQZ,IAAI","ignoreList":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-takeout",
|
|
3
|
+
"version": "0.0.46",
|
|
4
|
+
"description": "Create a new Takeout app",
|
|
5
|
+
"bin": "./run.js",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"run.js",
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tamagui-build --skip-native",
|
|
13
|
+
"watch": "tamagui-build --skip-native --watch"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"citty": "^0.1.6",
|
|
17
|
+
"prompts": "^2.4.2",
|
|
18
|
+
"yocto-spinner": "^0.1.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@tamagui/build": "^2.0.0-1768983999155",
|
|
22
|
+
"@types/prompts": "^2.4.9",
|
|
23
|
+
"typescript": "^5.0.0"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/tamagui/takeout"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"takeout",
|
|
34
|
+
"tamagui",
|
|
35
|
+
"react-native",
|
|
36
|
+
"expo",
|
|
37
|
+
"create"
|
|
38
|
+
],
|
|
39
|
+
"license": "MIT"
|
|
40
|
+
}
|
package/run.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const command = require.resolve('create-takeout')
|
|
4
|
+
const args = process.argv.slice(2)
|
|
5
|
+
|
|
6
|
+
try {
|
|
7
|
+
require('node:child_process').execSync(`node ${command} ${args.join(' ')}`, {
|
|
8
|
+
stdio: 'inherit',
|
|
9
|
+
})
|
|
10
|
+
} catch (err) {
|
|
11
|
+
process.exit(1)
|
|
12
|
+
}
|