@coze-arch/cli 0.0.1-alpha.f626fa → 0.0.1-alpha.f91253
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/lib/__templates__/expo/README.md +2 -0
- package/lib/__templates__/expo/client/components/Screen.tsx +1 -17
- package/lib/__templates__/expo/client/constants/theme.ts +21 -698
- package/lib/__templates__/expo/client/eslint.config.mjs +14 -10
- package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +2486 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +155 -0
- package/lib/__templates__/expo/server/src/index.ts +2 -1
- package/lib/__templates__/nextjs/.babelrc +15 -0
- package/lib/__templates__/nextjs/next.config.ts +1 -1
- package/lib/__templates__/nextjs/package.json +9 -1
- package/lib/__templates__/nextjs/pnpm-lock.yaml +2485 -1714
- package/lib/__templates__/nextjs/src/app/layout.tsx +5 -3
- package/lib/__templates__/nextjs/template.config.js +5 -5
- package/lib/__templates__/vite/package.json +6 -1
- package/lib/__templates__/vite/pnpm-lock.yaml +504 -982
- package/lib/__templates__/vite/template.config.js +6 -4
- package/lib/cli.js +246 -9
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import js from
|
|
2
|
-
import globals from
|
|
3
|
-
import tseslint from
|
|
4
|
-
import pluginReact from
|
|
5
|
-
import reactHooks from
|
|
6
|
-
import regexp from
|
|
7
|
-
import pluginImport from
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
import tseslint from 'typescript-eslint';
|
|
4
|
+
import pluginReact from 'eslint-plugin-react';
|
|
5
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
6
|
+
import regexp from 'eslint-plugin-regexp';
|
|
7
|
+
import pluginImport from 'eslint-plugin-import';
|
|
8
|
+
import fontawesome6 from '../eslint-plugins/fontawesome6/index.js';
|
|
8
9
|
|
|
9
10
|
export default [
|
|
10
11
|
{
|
|
@@ -15,19 +16,20 @@ export default [
|
|
|
15
16
|
'src/api/**', // 排除 src 下的自动生成 API
|
|
16
17
|
'.expo/**', // 排除 Expo 自动生成的文件
|
|
17
18
|
'tailwind.config.js', // 排除 Tailwind 配置文件
|
|
19
|
+
'**/*.d.ts',
|
|
18
20
|
],
|
|
19
21
|
},
|
|
20
22
|
regexp.configs["flat/recommended"],
|
|
21
23
|
js.configs.recommended,
|
|
22
24
|
...tseslint.configs.recommended,
|
|
23
|
-
|
|
25
|
+
|
|
24
26
|
// React 的推荐配置
|
|
25
27
|
pluginReact.configs.flat.recommended,
|
|
26
28
|
pluginReact.configs.flat['jsx-runtime'],
|
|
27
29
|
reactHooks.configs.flat.recommended,
|
|
28
30
|
{
|
|
29
31
|
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
30
|
-
|
|
32
|
+
|
|
31
33
|
// 语言选项:设置全局变量
|
|
32
34
|
languageOptions: {
|
|
33
35
|
globals: {
|
|
@@ -52,6 +54,7 @@ export default [
|
|
|
52
54
|
|
|
53
55
|
plugins: {
|
|
54
56
|
import: pluginImport,
|
|
57
|
+
fontawesome6,
|
|
55
58
|
},
|
|
56
59
|
rules: {
|
|
57
60
|
// 关闭代码风格规则
|
|
@@ -70,6 +73,7 @@ export default [
|
|
|
70
73
|
'no-prototype-builtins': 'off',
|
|
71
74
|
'react/react-in-jsx-scope': 'off',
|
|
72
75
|
'react/jsx-uses-react': 'off',
|
|
76
|
+
'fontawesome6/valid-name': 'error',
|
|
73
77
|
},
|
|
74
78
|
},
|
|
75
79
|
|
|
@@ -91,7 +95,7 @@ export default [
|
|
|
91
95
|
// 在 .js 文件中关闭 TS 规则
|
|
92
96
|
'@typescript-eslint/no-require-imports': 'off',
|
|
93
97
|
// 在 Node.js 文件中允许 require
|
|
94
|
-
'@typescript-eslint/no-var-requires': 'off',
|
|
98
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
95
99
|
'no-undef': 'off',
|
|
96
100
|
},
|
|
97
101
|
},
|
|
@@ -1,13 +1,33 @@
|
|
|
1
|
-
import { Colors } from
|
|
2
|
-
import { useColorScheme } from
|
|
1
|
+
import { Colors } from '@/constants/theme';
|
|
2
|
+
import { useColorScheme } from '@/hooks/useColorScheme';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
enum COLOR_SCHEME_CHOICE {
|
|
5
|
+
FOLLOW_SYSTEM = 'follow-system', // 跟随系统自动变化
|
|
6
|
+
DARK = 'dark', // 固定为 dark 主题,不随系统变化
|
|
7
|
+
LIGHT = 'light', // 固定为 light 主题,不随系统变化
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const userPreferColorScheme: COLOR_SCHEME_CHOICE = COLOR_SCHEME_CHOICE.FOLLOW_SYSTEM;
|
|
11
|
+
|
|
12
|
+
function getTheme(colorScheme?: 'dark' | 'light' | null) {
|
|
13
|
+
const isDark = colorScheme === 'dark';
|
|
14
|
+
const theme = Colors[colorScheme ?? 'light'];
|
|
8
15
|
|
|
9
16
|
return {
|
|
10
17
|
theme,
|
|
11
18
|
isDark,
|
|
12
19
|
};
|
|
13
20
|
}
|
|
21
|
+
|
|
22
|
+
function useTheme() {
|
|
23
|
+
const systemColorScheme = useColorScheme()
|
|
24
|
+
const colorScheme = userPreferColorScheme === COLOR_SCHEME_CHOICE.FOLLOW_SYSTEM ?
|
|
25
|
+
systemColorScheme :
|
|
26
|
+
userPreferColorScheme;
|
|
27
|
+
|
|
28
|
+
return getTheme(colorScheme);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
useTheme,
|
|
33
|
+
}
|