@tamagui/cli 1.114.3 → 1.115.0
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.cjs +93 -0
- package/dist/add.cjs.map +6 -0
- package/dist/add.native.js +0 -2
- package/dist/add.native.js.map +2 -2
- package/dist/build.cjs +86 -0
- package/dist/cli.cjs +232 -0
- package/dist/{cli.js.map → cli.cjs.map} +1 -1
- package/dist/cli.native.js +3 -3
- package/dist/cli.native.js.map +1 -1
- package/dist/generate.cjs +63 -0
- package/dist/index.cjs +2 -0
- package/dist/{update-template.js → update-template.cjs} +29 -28
- package/dist/update.cjs +26 -0
- package/dist/{utils.js → utils.cjs} +45 -32
- package/package.json +10 -10
- package/src/add.ts +0 -2
- package/src/cli.ts +3 -3
- package/types/add.d.ts.map +1 -1
- package/dist/add.js +0 -93
- package/dist/add.js.map +0 -6
- package/dist/build.js +0 -75
- package/dist/cli.js +0 -199
- package/dist/generate.js +0 -62
- package/dist/index.js +0 -3
- package/dist/update.js +0 -22
- /package/dist/{build.js.map → build.cjs.map} +0 -0
- /package/dist/{generate.js.map → generate.cjs.map} +0 -0
- /package/dist/{index.js.map → index.cjs.map} +0 -0
- /package/dist/{update-template.js.map → update-template.cjs.map} +0 -0
- /package/dist/{update.js.map → update.cjs.map} +0 -0
- /package/dist/{utils.js.map → utils.cjs.map} +0 -0
package/dist/cli.js
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
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.js"), 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.js"), [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.js"), 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
|
package/dist/generate.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
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
DELETED
package/dist/update.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|