@coze-arch/cli 0.0.7 → 0.0.8-alpha.9a0dda

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.
Files changed (36) hide show
  1. package/lib/__templates__/expo/AGENTS.md +194 -17
  2. package/lib/__templates__/expo/README.md +194 -17
  3. package/lib/__templates__/expo/client/app/+not-found.tsx +4 -19
  4. package/lib/__templates__/expo/client/app/_layout.tsx +16 -22
  5. package/lib/__templates__/expo/client/components/ColorSchemeUpdater.tsx +43 -0
  6. package/lib/__templates__/expo/client/components/Provider.tsx +18 -0
  7. package/lib/__templates__/expo/client/components/Screen.tsx +1 -1
  8. package/lib/__templates__/expo/client/eslint.config.mjs +1 -0
  9. package/lib/__templates__/expo/client/global.css +267 -0
  10. package/lib/__templates__/expo/client/metro.config.js +8 -1
  11. package/lib/__templates__/expo/client/package.json +5 -2
  12. package/lib/__templates__/expo/client/screens/demo/index.tsx +7 -13
  13. package/lib/__templates__/expo/client/scripts/formatter.mjs +78 -0
  14. package/lib/__templates__/expo/client/scripts/reporter.mjs +1358 -0
  15. package/lib/__templates__/expo/client/scripts/stylish-formatter.mjs +153 -0
  16. package/lib/__templates__/expo/client/scripts/text-table.mjs +68 -0
  17. package/lib/__templates__/expo/client/uniwind-types.d.ts +10 -0
  18. package/lib/__templates__/expo/package.json +4 -1
  19. package/lib/__templates__/expo/pnpm-lock.yaml +510 -51
  20. package/lib/__templates__/expo/server/package.json +2 -1
  21. package/lib/__templates__/nextjs/scripts/build.sh +2 -2
  22. package/lib/__templates__/nextjs/scripts/dev.sh +1 -1
  23. package/lib/__templates__/nuxt-vue/nuxt.config.ts +13 -0
  24. package/lib/__templates__/nuxt-vue/scripts/build.sh +1 -1
  25. package/lib/__templates__/nuxt-vue/scripts/dev.sh +1 -1
  26. package/lib/__templates__/taro/eslint.config.mjs +132 -123
  27. package/lib/__templates__/vite/scripts/build.sh +2 -2
  28. package/lib/__templates__/vite/scripts/dev.sh +1 -1
  29. package/lib/cli.js +4236 -488
  30. package/package.json +3 -1
  31. package/lib/__templates__/expo/client/components/ThemedText.tsx +0 -33
  32. package/lib/__templates__/expo/client/components/ThemedView.tsx +0 -37
  33. package/lib/__templates__/expo/client/constants/theme.ts +0 -177
  34. package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +0 -48
  35. package/lib/__templates__/expo/client/hooks/useTheme.ts +0 -33
  36. package/lib/__templates__/expo/client/screens/demo/styles.ts +0 -28
@@ -0,0 +1,153 @@
1
+ /**
2
+ * @fileoverview Stylish reporter
3
+ * @author Sindre Sorhus
4
+ */
5
+ "use strict";
6
+
7
+ import util from "node:util"
8
+ import table from "./text-table.mjs"
9
+
10
+ //------------------------------------------------------------------------------
11
+ // Helpers
12
+ //------------------------------------------------------------------------------
13
+
14
+ /**
15
+ * Returns a styling function based on the color option.
16
+ * @param {boolean|undefined} color Indicates whether to use colors.
17
+ * @returns {Function} A function that styles text.
18
+ */
19
+ function getStyleText(color) {
20
+ if (typeof color === "undefined") {
21
+ return (format, text) =>
22
+ util.styleText(format, text, { validateStream: true });
23
+ }
24
+ if (color) {
25
+ return (format, text) =>
26
+ util.styleText(format, text, { validateStream: false });
27
+ }
28
+ return (_, text) => text;
29
+ }
30
+
31
+ /**
32
+ * Given a word and a count, append an s if count is not one.
33
+ * @param {string} word A word in its singular form.
34
+ * @param {number} count A number controlling whether word should be pluralized.
35
+ * @returns {string} The original word with an s on the end if count is not one.
36
+ */
37
+ function pluralize(word, count) {
38
+ return count === 1 ? word : `${word}s`;
39
+ }
40
+
41
+ //------------------------------------------------------------------------------
42
+ // Public Interface
43
+ //------------------------------------------------------------------------------
44
+
45
+ export default function (results, data) {
46
+ const styleText = getStyleText(data?.color);
47
+
48
+ let output = "\n",
49
+ errorCount = 0,
50
+ warningCount = 0,
51
+ fixableErrorCount = 0,
52
+ fixableWarningCount = 0,
53
+ summaryColor = "yellow";
54
+
55
+ results.forEach(result => {
56
+ const messages = result.messages;
57
+
58
+ if (messages.length === 0) {
59
+ return;
60
+ }
61
+
62
+ errorCount += result.errorCount;
63
+ warningCount += result.warningCount;
64
+ fixableErrorCount += result.fixableErrorCount;
65
+ fixableWarningCount += result.fixableWarningCount;
66
+
67
+ output += `${styleText("underline", result.filePath)}\n`;
68
+
69
+ output += `${table(
70
+ messages.map(message => {
71
+ let messageType;
72
+
73
+ if (message.fatal || message.severity === 2) {
74
+ messageType = styleText("red", "error");
75
+ summaryColor = "red";
76
+ } else {
77
+ messageType = styleText("yellow", "warning");
78
+ }
79
+
80
+ return [
81
+ "",
82
+ String(message.line || 0),
83
+ String(message.column || 0),
84
+ messageType,
85
+ message.message.replace(/([^ ])\.$/u, "$1"),
86
+ message.ruleId ? styleText("dim", message.ruleId) : "",
87
+ ];
88
+ }),
89
+ {
90
+ align: ["", "r", "l"],
91
+ stringLength(str) {
92
+ return util.stripVTControlCharacters(str).length;
93
+ },
94
+ },
95
+ )
96
+ .split("\n")
97
+ .map(el =>
98
+ el.replace(/(\d+)\s+(\d+)/u, (m, p1, p2) =>
99
+ styleText("dim", `${p1}:${p2}`),
100
+ ),
101
+ )
102
+ .join("\n")}\n\n`;
103
+ });
104
+
105
+ const total = errorCount + warningCount;
106
+
107
+ /*
108
+ * We can't use a single `styleText` call like `styleText([summaryColor, "bold"], text)` here.
109
+ * This is a bug in `util.styleText` in Node.js versions earlier than v22.15.0 (https://github.com/nodejs/node/issues/56717).
110
+ * As a workaround, we use nested `styleText` calls.
111
+ */
112
+ if (total > 0) {
113
+ output += `${styleText(
114
+ summaryColor,
115
+ styleText(
116
+ "bold",
117
+ [
118
+ "\u2716 ",
119
+ total,
120
+ pluralize(" problem", total),
121
+ " (",
122
+ errorCount,
123
+ pluralize(" error", errorCount),
124
+ ", ",
125
+ warningCount,
126
+ pluralize(" warning", warningCount),
127
+ ")",
128
+ ].join(""),
129
+ ),
130
+ )}\n`;
131
+
132
+ if (fixableErrorCount > 0 || fixableWarningCount > 0) {
133
+ output += `${styleText(
134
+ summaryColor,
135
+ styleText(
136
+ "bold",
137
+ [
138
+ " ",
139
+ fixableErrorCount,
140
+ pluralize(" error", fixableErrorCount),
141
+ " and ",
142
+ fixableWarningCount,
143
+ pluralize(" warning", fixableWarningCount),
144
+ " potentially fixable with the `--fix` option.",
145
+ ].join(""),
146
+ ),
147
+ )}\n`;
148
+ }
149
+ }
150
+
151
+ // Resets output color, for prevent change on top level
152
+ return total > 0 ? styleText("reset", output) : "";
153
+ };
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @fileoverview Optimized version of the `text-table` npm module to improve performance by replacing inefficient regex-based
3
+ * whitespace trimming with a modern built-in method.
4
+ *
5
+ * This modification addresses a performance issue reported in https://github.com/eslint/eslint/issues/18709
6
+ *
7
+ * The `text-table` module is published under the MIT License. For the original source, refer to:
8
+ * https://www.npmjs.com/package/text-table.
9
+ */
10
+
11
+ /*
12
+ *
13
+ * This software is released under the MIT license:
14
+ *
15
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
16
+ * this software and associated documentation files (the "Software"), to deal in
17
+ * the Software without restriction, including without limitation the rights to
18
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
19
+ * the Software, and to permit persons to whom the Software is furnished to do so,
20
+ * subject to the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be included in all
23
+ * copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
27
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
28
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
29
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
+ */
32
+
33
+ "use strict";
34
+
35
+ export default function (rows_, opts) {
36
+ const hsep = " ";
37
+ const align = opts.align;
38
+ const stringLength = opts.stringLength;
39
+
40
+ const sizes = rows_.reduce((acc, row) => {
41
+ row.forEach((c, ix) => {
42
+ const n = stringLength(c);
43
+
44
+ if (!acc[ix] || n > acc[ix]) {
45
+ acc[ix] = n;
46
+ }
47
+ });
48
+ return acc;
49
+ }, []);
50
+
51
+ return rows_
52
+ .map(row =>
53
+ row
54
+ .map((c, ix) => {
55
+ const n = sizes[ix] - stringLength(c) || 0;
56
+ const s = Array(Math.max(n + 1, 1)).join(" ");
57
+
58
+ if (align[ix] === "r") {
59
+ return s + c;
60
+ }
61
+
62
+ return c + s;
63
+ })
64
+ .join(hsep)
65
+ .trimEnd(),
66
+ )
67
+ .join("\n");
68
+ };
@@ -0,0 +1,10 @@
1
+ // NOTE: This file is generated by uniwind and it should not be edited manually.
2
+ /// <reference types="uniwind/types" />
3
+
4
+ declare module 'uniwind' {
5
+ export interface UniwindConfig {
6
+ themes: readonly ['light', 'dark']
7
+ }
8
+ }
9
+
10
+ export {}
@@ -6,7 +6,10 @@
6
6
  "dev": "bash .cozeproj/scripts/dev_run.sh",
7
7
  "build": "bash .cozeproj/scripts/prod_build.sh",
8
8
  "start": "bash .cozeproj/scripts/prod_run.sh",
9
- "preinstall": "npx only-allow pnpm"
9
+ "preinstall": "npx only-allow pnpm",
10
+ "lint:client": "npm run lint --prefix ./client",
11
+ "lint:server": "npm run lint --prefix ./server",
12
+ "lint": "npm run lint --prefix ./client; npm run lint --prefix ./server"
10
13
  },
11
14
  "dependencies": {},
12
15
  "devDependencies": {},