@tamagui/cli 1.116.0 → 1.116.2

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/add.js ADDED
@@ -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 add_exports = {};
24
+ __export(add_exports, {
25
+ generatedPackageTypes: () => generatedPackageTypes,
26
+ installGeneratedPackage: () => installGeneratedPackage
27
+ });
28
+ module.exports = __toCommonJS(add_exports);
29
+ var import_node_child_process = require("node:child_process"), import_node_fs = require("node:fs"), import_promises = require("node:fs/promises"), import_node_os = require("node:os"), import_node_path = __toESM(require("node:path")), import_chalk = __toESM(require("chalk")), import_change_case = require("change-case"), import_fs_extra = require("fs-extra"), import_marked = require("marked"), import_marked_terminal = __toESM(require("marked-terminal")), import_opener = __toESM(require("opener")), import_prompts = __toESM(require("prompts"));
30
+ import_marked.marked.setOptions({
31
+ renderer: new import_marked_terminal.default()
32
+ });
33
+ const home = (0, import_node_os.homedir)(), tamaguiDir = import_node_path.default.join(home, ".tamagui"), generatedPackageTypes = ["font", "icon"], installGeneratedPackage = async (type, packagesPath) => {
34
+ if (packagesPath = packagesPath || import_node_path.default.join(process.cwd(), "packages"), !generatedPackageTypes.includes(type))
35
+ throw new Error(
36
+ `${type ? `Type "${type}" is Not supported.` : "No type provided."} Supported types: ${generatedPackageTypes.join(", ")}`
37
+ );
38
+ const repoName = type === "font" ? "tamagui-google-fonts" : "tamagui-iconify";
39
+ console.info(`Setting up ${import_chalk.default.blueBright(tamaguiDir)}...`), await (0, import_fs_extra.ensureDir)(tamaguiDir);
40
+ const tempDir = import_node_path.default.join(tamaguiDir, repoName);
41
+ (0, import_node_fs.existsSync)(tempDir) && (0, import_node_fs.rmSync)(tempDir, { recursive: !0 });
42
+ try {
43
+ process.chdir(tamaguiDir);
44
+ try {
45
+ console.info("Attempting to clone with SSH"), (0, import_node_child_process.execSync)(
46
+ `git clone -n --depth=1 --branch generated --filter=tree:0 git@github.com:tamagui/${repoName}.git`
47
+ );
48
+ } catch {
49
+ console.info("SSH failed - Attempting to c lone with HTTPS"), (0, import_node_child_process.execSync)(
50
+ `git clone -n --depth=1 --branch generated --filter=tree:0 https://github.com/tamagui/${repoName}`
51
+ );
52
+ }
53
+ process.chdir(tempDir), (0, import_node_child_process.execSync)(["git sparse-checkout set --no-cone meta", "git checkout"].join(" && "));
54
+ } catch (error) {
55
+ if (error instanceof Error)
56
+ throw error?.stderr.includes("Repository not found") && (console.info(
57
+ import_chalk.default.yellow(
58
+ `You don't have access to Tamagui ${type === "font" ? "fonts" : "icons"}. Check \u{1F961} Tamagui Takeout (https://tamagui.dev/takeout) for more info.`
59
+ )
60
+ ), (0, import_opener.default)("https://tamagui.dev/takeout"), process.exit(0)), error;
61
+ }
62
+ const meta = JSON.parse(
63
+ await (0, import_promises.readFile)(import_node_path.default.join(tamaguiDir, repoName, "meta", "data.json")).then(
64
+ (r) => r.toString()
65
+ )
66
+ );
67
+ console.info(
68
+ import_chalk.default.gray(
69
+ "Use \u21E7/\u21E9 to navigate. Use tab to cycle the result. Use Page Up/Page Down (on Mac: fn + \u21E7 / \u21E9) to change page. Hit enter to select the highlighted item below the prompt."
70
+ )
71
+ );
72
+ const result = await (0, import_prompts.default)({
73
+ name: "packageName",
74
+ type: "autocomplete",
75
+ message: type === "icon" ? "Pick an icon pack:" : type === "font" ? "Pick a font:" : "Pick one:",
76
+ choices: Object.entries(meta).map(([slug, data]) => ({
77
+ title: type === "font" ? `${slug}: ${data.weights.length} weights, ${data.styles.length} styles, ${data.subsets.length} subsets (https://fonts.google.com/specimen/${(0, import_change_case.pascalCase)(slug)})` : `${data.name}: ${data.total} icons, ${data.license.title} license (${data.author.url})`,
78
+ value: slug
79
+ }))
80
+ }), packageName = `${type}-${result.packageName}`, packageDir = import_node_path.default.join(tempDir, "packages", packageName);
81
+ process.chdir(tempDir), (0, import_node_child_process.execSync)(
82
+ [`git sparse-checkout set --no-cone packages/${packageName}`, "git checkout"].join(
83
+ " && "
84
+ )
85
+ );
86
+ const finalDir = import_node_path.default.join(packagesPath, packageName);
87
+ await (0, import_fs_extra.ensureDir)(packagesPath), await (0, import_fs_extra.copy)(packageDir, finalDir), console.info(), console.info(import_chalk.default.green(`Created the package under ${finalDir}`)), console.info();
88
+ const readmePath = import_node_path.default.join(finalDir, "README.md");
89
+ (0, import_node_fs.existsSync)(readmePath) && console.info(import_marked.marked.parse((0, import_fs_extra.readFileSync)(readmePath).toString()));
90
+ };
91
+ //# sourceMappingURL=add.js.map
package/dist/build.js ADDED
@@ -0,0 +1,75 @@
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 build_exports = {};
24
+ __export(build_exports, {
25
+ build: () => build
26
+ });
27
+ module.exports = __toCommonJS(build_exports);
28
+ var import_node_path = require("node:path"), import_static = require("@tamagui/static"), import_chokidar = __toESM(require("chokidar")), import_fs_extra = require("fs-extra"), import_micromatch = __toESM(require("micromatch"));
29
+ const build = async (options) => {
30
+ const sourceDir = options.dir ?? ".", promises = [], buildOptions = (0, import_static.loadTamaguiBuildConfigSync)(options.tamaguiOptions), platform = options.target ?? "web";
31
+ process.env.TAMAGUI_TARGET = platform;
32
+ const tamaguiOptions = {
33
+ ...buildOptions,
34
+ platform
35
+ };
36
+ await (0, import_static.loadTamagui)(tamaguiOptions), await new Promise((res) => {
37
+ import_chokidar.default.watch(`${sourceDir}/**/*.tsx`, {
38
+ // persistent: true,
39
+ }).on("add", (relativePath) => {
40
+ if (options.exclude && import_micromatch.default.contains(relativePath, options.exclude) || options.include && !import_micromatch.default.contains(relativePath, options.include))
41
+ return;
42
+ const sourcePath = (0, import_node_path.resolve)(process.cwd(), relativePath);
43
+ console.info(` [tamagui] optimizing ${sourcePath}`), promises.push(
44
+ (async () => {
45
+ options.debug && (process.env.NODE_ENV ||= "development");
46
+ const source = await (0, import_fs_extra.readFile)(sourcePath, "utf-8");
47
+ if (platform === "web") {
48
+ const extractor = (0, import_static.createExtractor)({
49
+ platform
50
+ }), out2 = await (0, import_static.extractToClassNames)({
51
+ extractor,
52
+ source,
53
+ sourcePath,
54
+ options: buildOptions,
55
+ shouldPrintDebug: options.debug || !1
56
+ });
57
+ if (!out2)
58
+ return;
59
+ const cssName = "_" + (0, import_node_path.basename)(sourcePath, (0, import_node_path.extname)(sourcePath)), stylePath = (0, import_node_path.join)((0, import_node_path.dirname)(sourcePath), cssName + ".css"), code = `import "./${cssName}.css"
60
+ ${out2.js}`;
61
+ await Promise.all([
62
+ (0, import_fs_extra.writeFile)(sourcePath, code, "utf-8"),
63
+ (0, import_fs_extra.writeFile)(stylePath, out2.styles, "utf-8")
64
+ ]);
65
+ }
66
+ const out = (0, import_static.extractToNative)(sourcePath, source, tamaguiOptions);
67
+ await (0, import_fs_extra.writeFile)(sourcePath, out.code, "utf-8");
68
+ })()
69
+ );
70
+ }).on("ready", () => {
71
+ res();
72
+ });
73
+ }), await Promise.all(promises);
74
+ };
75
+ //# sourceMappingURL=build.js.map
package/dist/cli.js ADDED
@@ -0,0 +1,199 @@
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_arg = __toESM(require("arg")), import_chalk = __toESM(require("chalk")), import_add = require("./add"), import_utils = require("./utils"), import_static = require("@tamagui/static");
21
+ ["exit", "SIGINT"].forEach((_) => {
22
+ process.on(_, () => {
23
+ (0, import_utils.disposeAll)(), process.exit();
24
+ });
25
+ });
26
+ const COMMAND_MAP = {
27
+ check: {
28
+ description: "Checks your dependencies for inconsistent versions.",
29
+ shorthands: [],
30
+ flags: {
31
+ "--help": Boolean,
32
+ "--debug": Boolean,
33
+ "--verbose": Boolean
34
+ },
35
+ async run() {
36
+ const { _, ...flags2 } = (0, import_arg.default)(this.flags), options = await (0, import_utils.getOptions)({
37
+ debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : !0 : !1,
38
+ loadTamaguiOptions: !0
39
+ });
40
+ await (0, import_static.checkDeps)(options.paths.root);
41
+ }
42
+ },
43
+ generate: {
44
+ description: "Builds your entire tamagui configuration and outputs any CSS.",
45
+ shorthands: [],
46
+ flags: {
47
+ "--help": Boolean,
48
+ "--debug": Boolean,
49
+ "--verbose": Boolean
50
+ },
51
+ async run() {
52
+ const { _, ...flags2 } = (0, import_arg.default)(this.flags), options = await (0, import_utils.getOptions)({
53
+ debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : !0 : !1,
54
+ loadTamaguiOptions: !0
55
+ });
56
+ process.env.TAMAGUI_KEEP_THEMES = "1", await (0, import_static.loadTamagui)({
57
+ ...options.tamaguiOptions,
58
+ platform: "web"
59
+ });
60
+ }
61
+ },
62
+ "generate-themes": {
63
+ shorthands: ["gt"],
64
+ description: "Use to pre-build your themes",
65
+ flags: {
66
+ "--help": Boolean,
67
+ "--debug": Boolean,
68
+ "--verbose": Boolean
69
+ },
70
+ async run() {
71
+ const { _, ...flags2 } = (0, import_arg.default)(this.flags), options = await (0, import_utils.getOptions)({
72
+ debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : !0 : !1
73
+ }), [_cmd, inPath, outPath] = _;
74
+ if (!inPath || !outPath)
75
+ throw new Error(
76
+ `Must supply both input and output paths, missing one (inPath: ${inPath}, outPath: ${outPath})`
77
+ );
78
+ const { generateThemes, writeGeneratedThemes } = require("@tamagui/generate-themes");
79
+ try {
80
+ const generated = await generateThemes(inPath);
81
+ await writeGeneratedThemes(options.paths.dotDir, outPath, generated);
82
+ } catch (err) {
83
+ console.error(`Error generating themes: ${err}`);
84
+ return;
85
+ }
86
+ console.info(`Successfully generated themes to ${outPath}`);
87
+ }
88
+ },
89
+ add: {
90
+ shorthands: ["a"],
91
+ description: `Use to add fonts and icons to your monorepo. Supported types: ${import_add.generatedPackageTypes.join(
92
+ ", "
93
+ )}`,
94
+ flags: {
95
+ "--help": Boolean,
96
+ "--debug": Boolean,
97
+ "--verbose": Boolean
98
+ },
99
+ async run() {
100
+ const { _, ...flags2 } = (0, import_arg.default)(this.flags), { installGeneratedPackage } = require("./add"), [cmd, type, path] = _;
101
+ await installGeneratedPackage(type, path);
102
+ }
103
+ },
104
+ build: {
105
+ shorthands: ["b"],
106
+ description: "Use to pre-build a Tamagui component directory",
107
+ flags: {
108
+ "--help": Boolean,
109
+ "--debug": Boolean,
110
+ "--verbose": Boolean,
111
+ "--target": String,
112
+ "--include": String,
113
+ "--exclude": String
114
+ },
115
+ async run() {
116
+ const { _, ...flags2 } = (0, import_arg.default)(this.flags), [_command, dir] = _, imported = await import("./build"), options = await (0, import_utils.getOptions)({
117
+ debug: flags2["--debug"] ? flags2["--verbose"] ? "verbose" : !0 : !1
118
+ });
119
+ await imported.default.build({
120
+ ...options,
121
+ dir,
122
+ include: flags2["--include"],
123
+ target: flags2["--target"] || "web",
124
+ exclude: flags2["--exclude"]
125
+ });
126
+ }
127
+ },
128
+ // update: {
129
+ // shorthands: [],
130
+ // description: `Update all tamagui packages within a monorepo`,
131
+ // flags: {},
132
+ // async run() {
133
+ // const { update } = await import('./update')
134
+ // await update()
135
+ // },
136
+ // },
137
+ "update-template": {
138
+ shorthands: ["ut"],
139
+ description: "Used to update your git repo with the source template. (e.g. Takeout)",
140
+ flags: {
141
+ "--help": Boolean,
142
+ "--template-repo": String,
143
+ "--ignored-patterns": String
144
+ },
145
+ async run() {
146
+ const { _, ...flags2 } = (0, import_arg.default)(this.flags), { updateTemplate } = require("./update-template");
147
+ if (!flags2["--template-repo"])
148
+ throw new Error("--template-repo is required");
149
+ await updateTemplate(
150
+ flags2["--template-repo"],
151
+ flags2["--ignored-patterns"]?.split(" ")
152
+ );
153
+ }
154
+ }
155
+ }, commandEntries = Object.keys(COMMAND_MAP).flatMap((command2) => {
156
+ const definition2 = COMMAND_MAP[command2];
157
+ return [command2, ...definition2.shorthands].map((cmd) => [cmd, definition2]);
158
+ }), commands = Object.fromEntries(commandEntries), {
159
+ _: [command],
160
+ ...flags
161
+ } = (0, import_arg.default)(
162
+ {
163
+ "--help": Boolean,
164
+ "--version": Boolean
165
+ },
166
+ {
167
+ permissive: !0
168
+ }
169
+ );
170
+ flags["--version"] && (console.info(require("../package.json").version), process.exit(0));
171
+ !command && flags["--help"] && (console.info(`$ tamagui
172
+
173
+ commands:
174
+
175
+ ${Object.keys(COMMAND_MAP).map((key) => ` ${key}`).join(`
176
+ `)}`), process.exit(0));
177
+ command in commands || (console.error(), console.warn(import_chalk.default.yellow(`Not a valid command: ${command}`)), process.exit(1));
178
+ const definition = commands[command];
179
+ main();
180
+ async function main() {
181
+ flags["--help"] && (console.info(`
182
+ $ tamagui ${command}: ${definition.description}
183
+ `), console.info(
184
+ `Flags: ${Object.entries(definition.flags).map(([k, v]) => `${k} (${v.name})`)}`
185
+ ), process.exit(0));
186
+ const { _, ...cmdFlags } = (0, import_arg.default)(definition.flags);
187
+ cmdFlags["--help"] && (console.info(`$ tamagui ${_}
188
+
189
+ Flags: ${JSON.stringify(cmdFlags, null, 2)}
190
+
191
+ `), process.exit(0));
192
+ try {
193
+ await definition.run();
194
+ } catch (err) {
195
+ console.error(`Error running command: ${err.message}`);
196
+ }
197
+ process.exit(0);
198
+ }
199
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1,62 @@
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 __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: !0 });
10
+ }, __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from == "object" || typeof from == "function")
12
+ for (let key of __getOwnPropNames(from))
13
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
+ mod
23
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
24
+ var generate_exports = {};
25
+ __export(generate_exports, {
26
+ generateTypes: () => generateTypes,
27
+ getTypes: () => getTypes
28
+ });
29
+ module.exports = __toCommonJS(generate_exports);
30
+ var import_fs_extra = __toESM(require("fs-extra")), import_ts_morph = require("ts-morph"), import_utils = require("./utils");
31
+ async function generateTypes(options) {
32
+ const types = await getTypes(options);
33
+ await import_fs_extra.default.writeJSON(options.paths.types, types, {
34
+ spaces: 2
35
+ });
36
+ }
37
+ async function getTypes(options) {
38
+ const tamagui = await (0, import_utils.loadTamagui)(options.tamaguiOptions);
39
+ if (!tamagui)
40
+ throw new Error("No tamagui config");
41
+ const nameToPaths = tamagui.nameToPaths || [], uniqueViewExportingPaths = new Set(
42
+ Object.keys(nameToPaths).map((name) => `${[...nameToPaths[name]][0]}.ts*`)
43
+ ), files = new import_ts_morph.Project({
44
+ compilerOptions: {
45
+ noEmit: !1,
46
+ declaration: !0,
47
+ emitDeclarationOnly: !0
48
+ },
49
+ skipAddingFilesFromTsConfig: !0,
50
+ tsConfigFilePath: options.tsconfigPath
51
+ }).addSourceFilesAtPaths([...uniqueViewExportingPaths]);
52
+ return Object.fromEntries(
53
+ files.flatMap((x) => [...x.getExportedDeclarations()].map(([k, v]) => [
54
+ k,
55
+ v[0].getType().getApparentType().getProperties().map((prop) => [
56
+ prop.getEscapedName(),
57
+ prop.getValueDeclaration()?.getType().getText()
58
+ ])
59
+ ]))
60
+ );
61
+ }
62
+ //# sourceMappingURL=generate.js.map
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ require("./cli");
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,57 @@
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 update_template_exports = {};
24
+ __export(update_template_exports, {
25
+ updateTemplate: () => updateTemplate
26
+ });
27
+ module.exports = __toCommonJS(update_template_exports);
28
+ var import_chalk = __toESM(require("chalk")), import_child_process = require("child_process");
29
+ function updateTemplate(templateUrl, ignoredPatterns = []) {
30
+ const remoteName = `${templateUrl.split("/").pop()?.split(".")[0] || "template"}-template`, addRemoteCommand = `git remote add ${remoteName} ${templateUrl}`, rmRemoteCommand = `git remote remove ${remoteName}`;
31
+ try {
32
+ (0, import_child_process.execSync)(addRemoteCommand);
33
+ } catch (error) {
34
+ if (error instanceof Error && error.toString().includes("already exists"))
35
+ (0, import_child_process.execSync)(rmRemoteCommand), (0, import_child_process.execSync)(addRemoteCommand);
36
+ else
37
+ throw error;
38
+ }
39
+ (0, import_child_process.execSync)("git fetch --all");
40
+ try {
41
+ (0, import_child_process.execSync)("git merge takeout-template/main --allow-unrelated-histories");
42
+ } catch (error) {
43
+ if (error instanceof Error && error.message.includes("unresolved conflict"))
44
+ console.info(
45
+ tamaguiLog(
46
+ "We've merged the latest changes. Please resolve the conflicts and commit the merge."
47
+ )
48
+ );
49
+ else
50
+ throw error;
51
+ }
52
+ (0, import_child_process.execSync)(`git reset HEAD ${ignoredPatterns.join(" ")}`);
53
+ }
54
+ function tamaguiLog(message) {
55
+ return `${import_chalk.default.green("[Tamagui]")} ${message}`;
56
+ }
57
+ //# sourceMappingURL=update-template.js.map
package/dist/update.js ADDED
@@ -0,0 +1,22 @@
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 update_exports = {};
16
+ __export(update_exports, {
17
+ update: () => update
18
+ });
19
+ module.exports = __toCommonJS(update_exports);
20
+ const update = async () => {
21
+ };
22
+ //# sourceMappingURL=update.js.map
package/dist/utils.js ADDED
@@ -0,0 +1,94 @@
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 utils_exports = {};
24
+ __export(utils_exports, {
25
+ disposeAll: () => disposeAll,
26
+ ensure: () => ensure,
27
+ getOptions: () => getOptions,
28
+ loadTamagui: () => loadTamagui,
29
+ registerDispose: () => registerDispose
30
+ });
31
+ module.exports = __toCommonJS(utils_exports);
32
+ var import_static = require("@tamagui/static"), import_chalk = __toESM(require("chalk")), import_fs_extra = __toESM(require("fs-extra")), import_node_path = require("node:path");
33
+ async function getOptions({
34
+ root = process.cwd(),
35
+ tsconfigPath = "tsconfig.json",
36
+ tamaguiOptions,
37
+ host,
38
+ debug,
39
+ loadTamaguiOptions
40
+ } = {}) {
41
+ const tsConfigFilePath = (0, import_node_path.join)(root, tsconfigPath);
42
+ ensure(await import_fs_extra.default.pathExists(tsConfigFilePath), `No tsconfig found: ${tsConfigFilePath}`);
43
+ const dotDir = (0, import_node_path.join)(root, ".tamagui");
44
+ let pkgJson = {}, config = "";
45
+ try {
46
+ config = await getDefaultTamaguiConfigPath(), pkgJson = await (0, import_fs_extra.readJSON)((0, import_node_path.join)(root, "package.json"));
47
+ } catch {
48
+ }
49
+ const filledOptions = {
50
+ platform: "native",
51
+ components: ["tamagui"],
52
+ config,
53
+ ...tamaguiOptions
54
+ }, finalOptions = loadTamaguiOptions ? (0, import_static.loadTamaguiBuildConfigSync)(filledOptions) : filledOptions;
55
+ return {
56
+ mode: process.env.NODE_ENV === "production" ? "production" : "development",
57
+ root,
58
+ host: host || "127.0.0.1",
59
+ pkgJson,
60
+ debug,
61
+ tsconfigPath,
62
+ tamaguiOptions: finalOptions,
63
+ paths: {
64
+ root,
65
+ dotDir,
66
+ conf: (0, import_node_path.join)(dotDir, "tamagui.config.json"),
67
+ types: (0, import_node_path.join)(dotDir, "types.json")
68
+ }
69
+ };
70
+ }
71
+ function ensure(condition, message) {
72
+ condition || (console.error(import_chalk.default.red.bold("Error:"), import_chalk.default.yellow(`${message}`)), process.exit(1));
73
+ }
74
+ const defaultPaths = ["tamagui.config.ts", (0, import_node_path.join)("src", "tamagui.config.ts")];
75
+ let cachedPath = "";
76
+ async function getDefaultTamaguiConfigPath() {
77
+ if (cachedPath) return cachedPath;
78
+ const existing = (await Promise.all(defaultPaths.map((path) => (0, import_fs_extra.pathExists)(path)))).findIndex((x) => !!x), found = defaultPaths[existing];
79
+ if (!found)
80
+ throw new Error("No found tamagui.config.ts");
81
+ return cachedPath = found, found;
82
+ }
83
+ const loadTamagui = async (opts) => await (0, import_static.loadTamagui)({
84
+ components: ["tamagui"],
85
+ ...opts,
86
+ config: opts.config ?? await getDefaultTamaguiConfigPath()
87
+ }), disposers = /* @__PURE__ */ new Set();
88
+ function registerDispose(cb) {
89
+ disposers.add(cb);
90
+ }
91
+ function disposeAll() {
92
+ disposers.forEach((cb) => cb());
93
+ }
94
+ //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/cli",
3
- "version": "1.116.0",
3
+ "version": "1.116.2",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/index.cjs",
@@ -23,11 +23,11 @@
23
23
  "clean:build": "tamagui-build clean:build"
24
24
  },
25
25
  "dependencies": {
26
- "@tamagui/create-theme": "1.116.0",
27
- "@tamagui/generate-themes": "1.116.0",
28
- "@tamagui/static": "1.116.0",
29
- "@tamagui/types": "1.116.0",
30
- "@tamagui/vite-plugin": "1.116.0",
26
+ "@tamagui/create-theme": "1.116.2",
27
+ "@tamagui/generate-themes": "1.116.2",
28
+ "@tamagui/static": "1.116.2",
29
+ "@tamagui/types": "1.116.2",
30
+ "@tamagui/vite-plugin": "1.116.2",
31
31
  "arg": "^5.0.2",
32
32
  "chalk": "^4.1.2",
33
33
  "change-case": "^4.1.2",
@@ -54,7 +54,7 @@
54
54
  "vite-plugin-entry-shaking": "^0.4.3"
55
55
  },
56
56
  "devDependencies": {
57
- "@tamagui/build": "1.116.0",
57
+ "@tamagui/build": "1.116.2",
58
58
  "@types/chokidar": "^2.1.3",
59
59
  "@types/marked": "^5.0.0"
60
60
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes