@tamagui/cli 2.0.0-rc.4 → 2.0.0-rc.40
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 +96 -71
- package/dist/build.cjs +226 -133
- package/dist/cli.cjs +318 -268
- package/dist/generate-prompt.cjs +310 -261
- package/dist/generate.cjs +51 -38
- package/dist/update-template.cjs +43 -31
- package/dist/update.cjs +12 -10
- package/dist/upgrade.cjs +274 -162
- package/dist/utils.cjs +69 -44
- package/package.json +9 -8
- package/src/build.ts +190 -56
- package/src/cli.ts +20 -73
- package/src/generate-prompt.ts +1 -1
- package/src/utils.ts +13 -8
- package/types/build.d.ts +3 -0
- package/types/build.d.ts.map +1 -1
- package/types/generate-prompt.d.ts.map +1 -1
- package/types/utils.d.ts.map +1 -1
- package/dist/add.js +0 -91
- package/dist/add.js.map +0 -6
- package/dist/build.js +0 -188
- package/dist/build.js.map +0 -6
- package/dist/cli.js +0 -266
- package/dist/cli.js.map +0 -6
- package/dist/generate-prompt.js +0 -392
- package/dist/generate-prompt.js.map +0 -6
- package/dist/generate.js +0 -62
- package/dist/generate.js.map +0 -6
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -6
- package/dist/update-template.js +0 -57
- package/dist/update-template.js.map +0 -6
- package/dist/update.js +0 -22
- package/dist/update.js.map +0 -6
- package/dist/upgrade.js +0 -319
- package/dist/upgrade.js.map +0 -6
- package/dist/utils.js +0 -92
- package/dist/utils.js.map +0 -6
package/dist/generate.cjs
CHANGED
|
@@ -3,42 +3,44 @@ var __create = Object.create;
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
7
|
-
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __export = (target, all) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
17
|
get: () => from[key],
|
|
17
18
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
19
|
});
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
21
23
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
29
|
+
value: mod,
|
|
30
|
+
enumerable: true
|
|
31
|
+
}) : target, mod));
|
|
32
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
33
|
+
value: true
|
|
34
|
+
}), mod);
|
|
33
35
|
var generate_exports = {};
|
|
34
36
|
__export(generate_exports, {
|
|
35
37
|
generateTypes: () => generateTypes,
|
|
36
38
|
getTypes: () => getTypes
|
|
37
39
|
});
|
|
38
40
|
module.exports = __toCommonJS(generate_exports);
|
|
39
|
-
var import_fs_extra = __toESM(require("fs-extra"))
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
42
|
+
var import_ts_morph = require("ts-morph");
|
|
43
|
+
var import_utils = require("./utils.cjs");
|
|
42
44
|
async function generateTypes(options) {
|
|
43
45
|
const types = await getTypes(options);
|
|
44
46
|
await import_fs_extra.default.writeJSON(options.paths.types, types, {
|
|
@@ -47,17 +49,28 @@ async function generateTypes(options) {
|
|
|
47
49
|
}
|
|
48
50
|
async function getTypes(options) {
|
|
49
51
|
const tamagui = await (0, import_utils.loadTamagui)(options.tamaguiOptions);
|
|
50
|
-
if (!tamagui)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
if (!tamagui) {
|
|
53
|
+
throw new Error(`No tamagui config`);
|
|
54
|
+
}
|
|
55
|
+
const nameToPaths = tamagui.nameToPaths || [];
|
|
56
|
+
const uniqueViewExportingPaths = new Set(Object.keys(nameToPaths).map(name => {
|
|
57
|
+
return `${[...nameToPaths[name]][0]}.ts*`;
|
|
58
|
+
}));
|
|
59
|
+
const project = new import_ts_morph.Project({
|
|
60
|
+
compilerOptions: {
|
|
61
|
+
noEmit: false,
|
|
62
|
+
declaration: true,
|
|
63
|
+
emitDeclarationOnly: true
|
|
64
|
+
},
|
|
65
|
+
skipAddingFilesFromTsConfig: true,
|
|
66
|
+
tsConfigFilePath: options.tsconfigPath
|
|
67
|
+
});
|
|
68
|
+
const files = project.addSourceFilesAtPaths([...uniqueViewExportingPaths]);
|
|
69
|
+
return Object.fromEntries(files.flatMap(x => {
|
|
70
|
+
return [...x.getExportedDeclarations()].map(([k, v]) => {
|
|
71
|
+
return [k, v[0].getType().getApparentType().getProperties().map(prop => {
|
|
72
|
+
return [prop.getEscapedName(), prop.getValueDeclaration()?.getType().getText()];
|
|
73
|
+
})];
|
|
74
|
+
});
|
|
75
|
+
}));
|
|
63
76
|
}
|
package/dist/update-template.cjs
CHANGED
|
@@ -2,54 +2,66 @@ 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
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var update_template_exports = {};
|
|
33
35
|
__export(update_template_exports, {
|
|
34
36
|
updateTemplate: () => updateTemplate
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(update_template_exports);
|
|
37
|
-
var import_chalk = __toESM(require("chalk"))
|
|
38
|
-
|
|
39
|
+
var import_chalk = __toESM(require("chalk"));
|
|
40
|
+
var import_node_child_process = require("node:child_process");
|
|
39
41
|
function updateTemplate(templateUrl, ignoredPatterns = []) {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
const templateName = templateUrl.split("/").pop()?.split(".")[0] || "template";
|
|
43
|
+
const remoteName = `${templateName}-template`;
|
|
44
|
+
const addRemoteCommand = `git remote add ${remoteName} ${templateUrl}`;
|
|
45
|
+
const rmRemoteCommand = `git remote remove ${remoteName}`;
|
|
43
46
|
try {
|
|
44
47
|
(0, import_node_child_process.execSync)(addRemoteCommand);
|
|
45
48
|
} catch (error) {
|
|
46
|
-
if (error instanceof Error && error.toString().includes("already exists"))
|
|
49
|
+
if (error instanceof Error && error.toString().includes("already exists")) {
|
|
50
|
+
(0, import_node_child_process.execSync)(rmRemoteCommand);
|
|
51
|
+
(0, import_node_child_process.execSync)(addRemoteCommand);
|
|
52
|
+
} else {
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
47
55
|
}
|
|
48
|
-
(0, import_node_child_process.execSync)(
|
|
56
|
+
(0, import_node_child_process.execSync)(`git fetch --all`);
|
|
49
57
|
try {
|
|
50
|
-
(0, import_node_child_process.execSync)(
|
|
58
|
+
(0, import_node_child_process.execSync)(`git merge takeout-template/main --allow-unrelated-histories`);
|
|
51
59
|
} catch (error) {
|
|
52
|
-
if (error instanceof Error && error.message.includes("unresolved conflict"))
|
|
60
|
+
if (error instanceof Error && error.message.includes("unresolved conflict")) {
|
|
61
|
+
console.info(tamaguiLog("We've merged the latest changes. Please resolve the conflicts and commit the merge."));
|
|
62
|
+
} else {
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
53
65
|
}
|
|
54
66
|
(0, import_node_child_process.execSync)(`git reset HEAD ${ignoredPatterns.join(" ")}`);
|
|
55
67
|
}
|
package/dist/update.cjs
CHANGED
|
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var update_exports = {};
|
|
22
24
|
__export(update_exports, {
|