@o/create-takeout 0.16.19-canary.1790165522484

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 ADDED
@@ -0,0 +1,182 @@
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;
6
+ var __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
+ if (!__hasOwnProp.call(to, key) && key !== except)
11
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ }
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: true }) : target,
21
+ mod
22
+ ));
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 = `
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
+ const banner = `
55
+ ${orange(takeoutArt)}
56
+ ${bold("Universal React + React Native Starter")}
57
+ ${dim("Powered by Tamagui, One, Expo & More")}
58
+ `;
59
+ const 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) {
80
+ return initialName;
81
+ }
82
+ const response = await (0, import_prompts.default)({
83
+ type: "text",
84
+ name: "name",
85
+ message: "Project name:",
86
+ initial: "my-app"
87
+ });
88
+ if (!response.name) {
89
+ console.info(dim("\nCancelled."));
90
+ process.exit(0);
91
+ }
92
+ return response.name;
93
+ }
94
+ async function cloneRepo(projectPath) {
95
+ const spinner = (0, import_yocto_spinner.default)({ text: "Cloning takeout-free..." }).start();
96
+ try {
97
+ (0, import_node_child_process.execSync)(`git clone --depth 1 ${REPO_URL} "${projectPath}"`, {
98
+ stdio: "pipe"
99
+ });
100
+ } catch {
101
+ try {
102
+ (0, import_node_child_process.execSync)(`git clone --depth 1 ${REPO_SSH} "${projectPath}"`, {
103
+ stdio: "pipe"
104
+ });
105
+ } catch (err) {
106
+ spinner.error("Failed to clone repository");
107
+ throw err;
108
+ }
109
+ }
110
+ import_node_fs.default.rmSync(import_node_path.default.join(projectPath, ".git"), { recursive: true, force: true });
111
+ spinner.success("Cloned takeout-free");
112
+ }
113
+ function updatePackageJson(projectPath, projectName) {
114
+ const pkgPath = import_node_path.default.join(projectPath, "package.json");
115
+ if (import_node_fs.default.existsSync(pkgPath)) {
116
+ const pkg = JSON.parse(import_node_fs.default.readFileSync(pkgPath, "utf-8"));
117
+ pkg.name = projectName;
118
+ import_node_fs.default.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
119
+ }
120
+ }
121
+ async function installDependencies(projectPath) {
122
+ const spinner = (0, import_yocto_spinner.default)({ text: "Installing dependencies with bun..." }).start();
123
+ try {
124
+ (0, import_node_child_process.execSync)("bun install", {
125
+ cwd: projectPath,
126
+ stdio: "pipe"
127
+ });
128
+ spinner.success("Dependencies installed");
129
+ } catch (err) {
130
+ spinner.error("Failed to install dependencies");
131
+ throw err;
132
+ }
133
+ }
134
+ const main = (0, import_citty.defineCommand)({
135
+ meta: {
136
+ name: "create-takeout",
137
+ version: "0.0.45",
138
+ description: "Create a new Takeout app"
139
+ },
140
+ args: {
141
+ directory: {
142
+ type: "positional",
143
+ description: "Project directory name",
144
+ required: false
145
+ },
146
+ info: {
147
+ type: "boolean",
148
+ description: "Show Pro information without creating a project"
149
+ }
150
+ },
151
+ async run({ args }) {
152
+ console.info(banner);
153
+ if (args.info) {
154
+ console.info(proMessage);
155
+ return;
156
+ }
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(`
172
+ ${green(bold("\u2713 Success!"))} Created ${cyan(projectName)}
173
+
174
+ ${bold("Next steps:")}
175
+ ${cyan("cd")} ${projectName}
176
+ ${cyan("bun dev")}
177
+ `);
178
+ console.info(proMessage);
179
+ }
180
+ });
181
+ (0, import_citty.runMain)(main);
182
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
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,oTAAq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AgB,WAAW,iBAAiB,CAAC;AAC/D,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,IACF;AAEA,YAAQ,KAAK,EAAE;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
+ "names": ["prompts", "createSpinner", "fs", "path"]
6
+ }
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@o/create-takeout",
3
+ "version": "0.16.19-canary.1790165522484",
4
+ "description": "Create a new Takeout app",
5
+ "bin": {
6
+ "create-takeout": "./run.js"
7
+ },
8
+ "main": "dist/index.js",
9
+ "files": [
10
+ "run.js",
11
+ "dist",
12
+ "src"
13
+ ],
14
+ "scripts": {
15
+ "build": "tamagui-build --skip-native",
16
+ "watch": "tamagui-build --skip-native --watch"
17
+ },
18
+ "dependencies": {
19
+ "citty": "^0.1.6",
20
+ "prompts": "^2.4.2",
21
+ "yocto-spinner": "^0.1.0"
22
+ },
23
+ "devDependencies": {
24
+ "@tamagui/build": "2.3.1",
25
+ "@types/prompts": "^2.4.9",
26
+ "typescript": "^5.0.0"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/natew/orez.git",
34
+ "directory": "packages/create-takeout"
35
+ },
36
+ "keywords": [
37
+ "takeout",
38
+ "tamagui",
39
+ "react-native",
40
+ "expo",
41
+ "create"
42
+ ],
43
+ "license": "MIT"
44
+ }
package/run.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require('node:child_process')
4
+ const command = require.resolve('./dist/index.js')
5
+ const result = spawnSync(process.execPath, [command, ...process.argv.slice(2)], {
6
+ stdio: 'inherit',
7
+ })
8
+ process.exit(result.status ?? 1)
package/src/index.ts ADDED
@@ -0,0 +1,186 @@
1
+ import { execSync } from 'node:child_process'
2
+ import fs from 'node:fs'
3
+ import path from 'node:path'
4
+
5
+ import { defineCommand, runMain } from 'citty'
6
+ import prompts from 'prompts'
7
+ import createSpinner from 'yocto-spinner'
8
+
9
+ const REPO_URL = 'https://github.com/tamagui/takeout-free.git'
10
+ const REPO_SSH = 'git@github.com:tamagui/takeout-free.git'
11
+
12
+ // ansi codes
13
+ const bold = (s: string) => `\x1b[1m${s}\x1b[22m`
14
+ const dim = (s: string) => `\x1b[2m${s}\x1b[22m`
15
+ const green = (s: string) => `\x1b[32m${s}\x1b[39m`
16
+ const cyan = (s: string) => `\x1b[36m${s}\x1b[39m`
17
+ const yellow = (s: string) => `\x1b[33m${s}\x1b[39m`
18
+ const red = (s: string) => `\x1b[31m${s}\x1b[39m`
19
+ const orange = (s: string) => `\x1b[38;2;247;104;8m${s}\x1b[39m`
20
+ const goldBold = (s: string) => `\x1b[1m\x1b[38;2;245;217;10m${s}\x1b[39m\x1b[22m`
21
+ const blueUnderline = (s: string) => `\x1b[4m\x1b[38;2;0;145;255m${s}\x1b[39m\x1b[24m`
22
+
23
+ const takeoutArt = `
24
+ ┌─────────────────────────┐
25
+ │ ╭─────────────────╮ │
26
+ │ │ 🥡 ${bold(yellow('TAKEOUT'))} 🥡 │ │
27
+ │ ╰─────────────────╯ │
28
+ │ ╲ ╱ │
29
+ │ ╲ ╱ │
30
+ │ ╲ ╱ │
31
+ │ ╲ ╱ │
32
+ │ ╲ ╱ │
33
+ │ ╲ ╱ │
34
+ │ ╲ ╱ │
35
+ └───────────┴─────────────┘
36
+ `
37
+
38
+ const banner = `
39
+ ${orange(takeoutArt)}
40
+ ${bold('Universal React + React Native Starter')}
41
+ ${dim('Powered by Tamagui, One, Expo & More')}
42
+ `
43
+
44
+ const proMessage = `
45
+ ${goldBold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')}
46
+
47
+ ${bold('🚀 Want the full experience?')}
48
+
49
+ Takeout Pro includes:
50
+ ${green('✓')} SST / AWS deploy
51
+ ${green('✓')} Website with home, docs policy/terms
52
+ ${green('✓')} Errors and analytics
53
+ ${green('✓')} Emailing
54
+ ${green('✓')} A lot more UI
55
+ ${green('✓')} A bunch of screens, settings, profile...
56
+ ${green('✓')} Faster updates, chat support
57
+ ${green('✓')} And much more...
58
+
59
+ ${blueUnderline('https://tamagui.dev/takeout')}
60
+
61
+ ${goldBold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')}
62
+ `
63
+
64
+ async function getProjectName(initialName?: string): Promise<string> {
65
+ if (initialName) {
66
+ return initialName
67
+ }
68
+
69
+ const response = await prompts({
70
+ type: 'text',
71
+ name: 'name',
72
+ message: 'Project name:',
73
+ initial: 'my-app',
74
+ })
75
+
76
+ if (!response.name) {
77
+ console.info(dim('\nCancelled.'))
78
+ process.exit(0)
79
+ }
80
+
81
+ return response.name
82
+ }
83
+
84
+ async function cloneRepo(projectPath: string): Promise<void> {
85
+ const spinner = createSpinner({ text: 'Cloning takeout-free...' }).start()
86
+
87
+ try {
88
+ execSync(`git clone --depth 1 ${REPO_URL} "${projectPath}"`, {
89
+ stdio: 'pipe',
90
+ })
91
+ } catch {
92
+ try {
93
+ execSync(`git clone --depth 1 ${REPO_SSH} "${projectPath}"`, {
94
+ stdio: 'pipe',
95
+ })
96
+ } catch (err) {
97
+ spinner.error('Failed to clone repository')
98
+ throw err
99
+ }
100
+ }
101
+
102
+ // remove .git folder so user starts fresh
103
+ fs.rmSync(path.join(projectPath, '.git'), { recursive: true, force: true })
104
+
105
+ spinner.success('Cloned takeout-free')
106
+ }
107
+
108
+ function updatePackageJson(projectPath: string, projectName: string) {
109
+ const pkgPath = path.join(projectPath, 'package.json')
110
+ if (fs.existsSync(pkgPath)) {
111
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
112
+ pkg.name = projectName
113
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2))
114
+ }
115
+ }
116
+
117
+ async function installDependencies(projectPath: string) {
118
+ const spinner = createSpinner({ text: 'Installing dependencies with bun...' }).start()
119
+
120
+ try {
121
+ execSync('bun install', {
122
+ cwd: projectPath,
123
+ stdio: 'pipe',
124
+ })
125
+ spinner.success('Dependencies installed')
126
+ } catch (err) {
127
+ spinner.error('Failed to install dependencies')
128
+ throw err
129
+ }
130
+ }
131
+
132
+ const main = defineCommand({
133
+ meta: {
134
+ name: 'create-takeout',
135
+ version: '0.0.45',
136
+ description: 'Create a new Takeout app',
137
+ },
138
+ args: {
139
+ directory: {
140
+ type: 'positional',
141
+ description: 'Project directory name',
142
+ required: false,
143
+ },
144
+ info: {
145
+ type: 'boolean',
146
+ description: 'Show Pro information without creating a project',
147
+ },
148
+ },
149
+ async run({ args }) {
150
+ console.info(banner)
151
+
152
+ if (args.info) {
153
+ console.info(proMessage)
154
+ return
155
+ }
156
+
157
+ const projectName = await getProjectName(args.directory)
158
+ const projectPath = path.resolve(projectName)
159
+
160
+ if (fs.existsSync(projectPath)) {
161
+ const files = fs.readdirSync(projectPath)
162
+ if (files.length > 0) {
163
+ console.error(red(`\nDirectory "${projectName}" is not empty.`))
164
+ process.exit(1)
165
+ }
166
+ }
167
+
168
+ console.info('')
169
+
170
+ await cloneRepo(projectPath)
171
+ updatePackageJson(projectPath, projectName)
172
+ await installDependencies(projectPath)
173
+
174
+ console.info(`
175
+ ${green(bold('✓ Success!'))} Created ${cyan(projectName)}
176
+
177
+ ${bold('Next steps:')}
178
+ ${cyan('cd')} ${projectName}
179
+ ${cyan('bun dev')}
180
+ `)
181
+
182
+ console.info(proMessage)
183
+ },
184
+ })
185
+
186
+ runMain(main)