create-takeout 0.4.3 → 0.4.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/dist/index.js +66 -22
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,11 +2,14 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
7
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
9
|
for (let key of __getOwnPropNames(from))
|
|
9
|
-
!__hasOwnProp.call(to, key) && key !== except
|
|
10
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
}
|
|
10
13
|
return to;
|
|
11
14
|
};
|
|
12
15
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
@@ -14,11 +17,27 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
14
17
|
// file that has been converted to a CommonJS file using a Babel-
|
|
15
18
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
16
19
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
17
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable:
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
18
21
|
mod
|
|
19
22
|
));
|
|
20
|
-
var import_node_child_process = require("node:child_process")
|
|
21
|
-
|
|
23
|
+
var import_node_child_process = require("node:child_process");
|
|
24
|
+
var import_node_fs = __toESM(require("node:fs"));
|
|
25
|
+
var import_node_path = __toESM(require("node:path"));
|
|
26
|
+
var import_citty = require("citty");
|
|
27
|
+
var import_prompts = __toESM(require("prompts"));
|
|
28
|
+
var import_yocto_spinner = __toESM(require("yocto-spinner"));
|
|
29
|
+
const REPO_URL = "https://github.com/tamagui/takeout-free.git";
|
|
30
|
+
const REPO_SSH = "git@github.com:tamagui/takeout-free.git";
|
|
31
|
+
const bold = (s) => `\x1B[1m${s}\x1B[22m`;
|
|
32
|
+
const dim = (s) => `\x1B[2m${s}\x1B[22m`;
|
|
33
|
+
const green = (s) => `\x1B[32m${s}\x1B[39m`;
|
|
34
|
+
const cyan = (s) => `\x1B[36m${s}\x1B[39m`;
|
|
35
|
+
const yellow = (s) => `\x1B[33m${s}\x1B[39m`;
|
|
36
|
+
const red = (s) => `\x1B[31m${s}\x1B[39m`;
|
|
37
|
+
const orange = (s) => `\x1B[38;2;247;104;8m${s}\x1B[39m`;
|
|
38
|
+
const goldBold = (s) => `\x1B[1m\x1B[38;2;245;217;10m${s}\x1B[39m\x1B[22m`;
|
|
39
|
+
const blueUnderline = (s) => `\x1B[4m\x1B[38;2;0;145;255m${s}\x1B[39m\x1B[24m`;
|
|
40
|
+
const takeoutArt = `
|
|
22
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
|
|
23
42
|
\u2502 \u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E \u2502
|
|
24
43
|
\u2502 \u2502 \u{1F961} ${bold(yellow("TAKEOUT"))} \u{1F961} \u2502 \u2502
|
|
@@ -31,11 +50,13 @@ const REPO_URL = "https://github.com/tamagui/takeout-free.git", REPO_SSH = "git@
|
|
|
31
50
|
\u2502 \u2572 \u2571 \u2502
|
|
32
51
|
\u2502 \u2572 \u2571 \u2502
|
|
33
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
|
|
34
|
-
|
|
53
|
+
`;
|
|
54
|
+
const banner = `
|
|
35
55
|
${orange(takeoutArt)}
|
|
36
56
|
${bold("Universal React + React Native Starter")}
|
|
37
57
|
${dim("Powered by Tamagui, One, Expo & More")}
|
|
38
|
-
|
|
58
|
+
`;
|
|
59
|
+
const proMessage = `
|
|
39
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")}
|
|
40
61
|
|
|
41
62
|
${bold("\u{1F680} Want the full experience?")}
|
|
@@ -55,16 +76,20 @@ ${goldBold("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u
|
|
|
55
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")}
|
|
56
77
|
`;
|
|
57
78
|
async function getProjectName(initialName) {
|
|
58
|
-
if (initialName)
|
|
79
|
+
if (initialName) {
|
|
59
80
|
return initialName;
|
|
81
|
+
}
|
|
60
82
|
const response = await (0, import_prompts.default)({
|
|
61
83
|
type: "text",
|
|
62
84
|
name: "name",
|
|
63
85
|
message: "Project name:",
|
|
64
86
|
initial: "my-app"
|
|
65
87
|
});
|
|
66
|
-
|
|
67
|
-
|
|
88
|
+
if (!response.name) {
|
|
89
|
+
console.info(dim("\nCancelled."));
|
|
90
|
+
process.exit(0);
|
|
91
|
+
}
|
|
92
|
+
return response.name;
|
|
68
93
|
}
|
|
69
94
|
async function cloneRepo(projectPath) {
|
|
70
95
|
const spinner = (0, import_yocto_spinner.default)({ text: "Cloning takeout-free..." }).start();
|
|
@@ -78,16 +103,19 @@ async function cloneRepo(projectPath) {
|
|
|
78
103
|
stdio: "pipe"
|
|
79
104
|
});
|
|
80
105
|
} catch (err) {
|
|
81
|
-
|
|
106
|
+
spinner.error("Failed to clone repository");
|
|
107
|
+
throw err;
|
|
82
108
|
}
|
|
83
109
|
}
|
|
84
|
-
import_node_fs.default.rmSync(import_node_path.default.join(projectPath, ".git"), { recursive:
|
|
110
|
+
import_node_fs.default.rmSync(import_node_path.default.join(projectPath, ".git"), { recursive: true, force: true });
|
|
111
|
+
spinner.success("Cloned takeout-free");
|
|
85
112
|
}
|
|
86
113
|
function updatePackageJson(projectPath, projectName) {
|
|
87
114
|
const pkgPath = import_node_path.default.join(projectPath, "package.json");
|
|
88
115
|
if (import_node_fs.default.existsSync(pkgPath)) {
|
|
89
116
|
const pkg = JSON.parse(import_node_fs.default.readFileSync(pkgPath, "utf-8"));
|
|
90
|
-
pkg.name = projectName
|
|
117
|
+
pkg.name = projectName;
|
|
118
|
+
import_node_fs.default.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
|
91
119
|
}
|
|
92
120
|
}
|
|
93
121
|
async function installDependencies(projectPath) {
|
|
@@ -96,9 +124,11 @@ async function installDependencies(projectPath) {
|
|
|
96
124
|
(0, import_node_child_process.execSync)("bun install", {
|
|
97
125
|
cwd: projectPath,
|
|
98
126
|
stdio: "pipe"
|
|
99
|
-
})
|
|
127
|
+
});
|
|
128
|
+
spinner.success("Dependencies installed");
|
|
100
129
|
} catch (err) {
|
|
101
|
-
|
|
130
|
+
spinner.error("Failed to install dependencies");
|
|
131
|
+
throw err;
|
|
102
132
|
}
|
|
103
133
|
}
|
|
104
134
|
const main = (0, import_citty.defineCommand)({
|
|
@@ -111,7 +141,7 @@ const main = (0, import_citty.defineCommand)({
|
|
|
111
141
|
directory: {
|
|
112
142
|
type: "positional",
|
|
113
143
|
description: "Project directory name",
|
|
114
|
-
required:
|
|
144
|
+
required: false
|
|
115
145
|
},
|
|
116
146
|
info: {
|
|
117
147
|
type: "boolean",
|
|
@@ -119,19 +149,33 @@ const main = (0, import_citty.defineCommand)({
|
|
|
119
149
|
}
|
|
120
150
|
},
|
|
121
151
|
async run({ args }) {
|
|
122
|
-
|
|
152
|
+
console.info(banner);
|
|
153
|
+
if (args.info) {
|
|
123
154
|
console.info(proMessage);
|
|
124
155
|
return;
|
|
125
156
|
}
|
|
126
|
-
const projectName = await getProjectName(args.directory)
|
|
127
|
-
|
|
128
|
-
|
|
157
|
+
const projectName = await getProjectName(args.directory);
|
|
158
|
+
const projectPath = import_node_path.default.resolve(projectName);
|
|
159
|
+
if (import_node_fs.default.existsSync(projectPath)) {
|
|
160
|
+
const files = import_node_fs.default.readdirSync(projectPath);
|
|
161
|
+
if (files.length > 0) {
|
|
162
|
+
console.error(red(`
|
|
163
|
+
Directory "${projectName}" is not empty.`));
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
console.info("");
|
|
168
|
+
await cloneRepo(projectPath);
|
|
169
|
+
updatePackageJson(projectPath, projectName);
|
|
170
|
+
await installDependencies(projectPath);
|
|
171
|
+
console.info(`
|
|
129
172
|
${green(bold("\u2713 Success!"))} Created ${cyan(projectName)}
|
|
130
173
|
|
|
131
174
|
${bold("Next steps:")}
|
|
132
175
|
${cyan("cd")} ${projectName}
|
|
133
176
|
${cyan("bun dev")}
|
|
134
|
-
`)
|
|
177
|
+
`);
|
|
178
|
+
console.info(proMessage);
|
|
135
179
|
}
|
|
136
180
|
});
|
|
137
181
|
(0, import_citty.runMain)(main);
|
package/dist/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA,gCAAyB;AACzB,qBAAe;AACf,uBAAiB;AAEjB,mBAAuC;AACvC,qBAAoB;AACpB,2BAA0B;AAE1B,MAAM,WAAW;AACjB,MAAM,WAAW;AAGjB,MAAM,OAAO,CAAC,MAAc,UAAU,CAAC;AACvC,MAAM,MAAM,CAAC,MAAc,UAAU,CAAC;AACtC,MAAM,QAAQ,CAAC,MAAc,WAAW,CAAC;AACzC,MAAM,OAAO,CAAC,MAAc,WAAW,CAAC;AACxC,MAAM,SAAS,CAAC,MAAc,WAAW,CAAC;AAC1C,MAAM,MAAM,CAAC,MAAc,WAAW,CAAC;AACvC,MAAM,SAAS,CAAC,MAAc,uBAAuB,CAAC;AACtD,MAAM,WAAW,CAAC,MAAc,+BAA+B,CAAC;AAChE,MAAM,gBAAgB,CAAC,MAAc,8BAA8B,CAAC;AAEpE,MAAM,aAAa;AAAA;AAAA;AAAA,gCAGJ,KAAK,OAAO,SAAS,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYtC,MAAM,SAAS;AAAA,EACb,OAAO,UAAU,CAAC;AAAA,IAChB,KAAK,wCAAwC,CAAC;AAAA,IAC9C,IAAI,sCAAsC,CAAC;AAAA;AAG/C,MAAM,aAAa;AAAA,EACjB,SAAS,oTAAqD,CAAC;AAAA;AAAA,IAE7D,KAAK,qCAA8B,CAAC;AAAA;AAAA;AAAA,IAGpC,MAAM,QAAG,CAAC;AAAA,IAC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;AAEf,UAAM,UAAU,WAAW;AAC3B,sBAAkB,aAAa,WAAW;AAC1C,UAAM,oBAAoB,WAAW;AAErC,YAAQ,KAAK;AAAA,EACf,MAAM,KAAK,iBAAY,CAAC,CAAC,YAAY,KAAK,WAAW,CAAC;AAAA;AAAA,EAEtD,KAAK,aAAa,CAAC;AAAA,IACjB,KAAK,IAAI,CAAC,IAAI,WAAW;AAAA,IACzB,KAAK,SAAS,CAAC;AAAA,CAClB;AAEG,YAAQ,KAAK,UAAU;AAAA,EACzB;AACF,CAAC;AAAA,IAED,sBAAQ,IAAI;",
|
|
5
5
|
"names": ["prompts", "createSpinner", "fs", "path"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-takeout",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Create a new Takeout app",
|
|
5
5
|
"bin": "./run.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"yocto-spinner": "^0.1.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@tamagui/build": "2.0.0-rc.
|
|
21
|
+
"@tamagui/build": "2.0.0-rc.38-1775848301302",
|
|
22
22
|
"@types/prompts": "^2.4.9",
|
|
23
23
|
"typescript": "^5.0.0"
|
|
24
24
|
},
|