@farris/cli 2.2.5 → 2.3.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.
Files changed (165) hide show
  1. package/lib/commands/add-app.js +6 -0
  2. package/lib/commands/add-app.js.map +1 -0
  3. package/lib/commands/add-lib.js +6 -0
  4. package/lib/commands/add-lib.js.map +1 -0
  5. package/lib/commands/add-project.js +194 -0
  6. package/lib/commands/add-project.js.map +1 -0
  7. package/lib/commands/build-components.js +57 -50
  8. package/lib/commands/build-components.js.map +1 -1
  9. package/lib/commands/build-css.js +38 -38
  10. package/lib/commands/build-css.js.map +1 -1
  11. package/lib/commands/build-lib.js +30 -25
  12. package/lib/commands/build-lib.js.map +1 -1
  13. package/lib/commands/build.js +19 -14
  14. package/lib/commands/build.js.map +1 -1
  15. package/lib/commands/create-app-options.js +72 -74
  16. package/lib/commands/create-app-options.js.map +1 -1
  17. package/lib/commands/create-app.js +131 -126
  18. package/lib/commands/create-app.js.map +1 -1
  19. package/lib/commands/create-options.js +32 -29
  20. package/lib/commands/create-options.js.map +1 -1
  21. package/lib/commands/create.js +277 -224
  22. package/lib/commands/create.js.map +1 -1
  23. package/lib/commands/dev-serve.js +18 -18
  24. package/lib/commands/extract-i18n.js +74 -74
  25. package/lib/commands/extract-i18n.js.map +1 -1
  26. package/lib/commands/generate/api.js +124 -124
  27. package/lib/commands/generate/api.js.map +1 -1
  28. package/lib/commands/generate/common.js +101 -100
  29. package/lib/commands/generate/common.js.map +1 -1
  30. package/lib/commands/generate/component.js +156 -156
  31. package/lib/commands/generate/component.js.map +1 -1
  32. package/lib/commands/generate/view.js +168 -168
  33. package/lib/commands/generate/view.js.map +1 -1
  34. package/lib/commands/preview-serve.js +16 -16
  35. package/lib/commands/workspace/add-app.js +15 -180
  36. package/lib/commands/workspace/add-app.js.map +1 -1
  37. package/lib/commands/workspace/create.js +62 -379
  38. package/lib/commands/workspace/create.js.map +1 -1
  39. package/lib/commands/workspace/inspect.js +30 -30
  40. package/lib/commands/workspace/inspect.js.map +1 -1
  41. package/lib/commands/workspace/verify.js +38 -38
  42. package/lib/commands/workspace/verify.js.map +1 -1
  43. package/lib/common/agents-doc.js +34 -0
  44. package/lib/common/agents-doc.js.map +1 -0
  45. package/lib/common/apply-catalog-deps.js +15 -15
  46. package/lib/common/apply-catalog-deps.js.map +1 -1
  47. package/lib/common/component-file-name.js +3 -3
  48. package/lib/common/constant.js +64 -64
  49. package/lib/common/constant.js.map +1 -1
  50. package/lib/common/create-app-target.js +46 -46
  51. package/lib/common/create-app-target.js.map +1 -1
  52. package/lib/common/generate-app.js +109 -85
  53. package/lib/common/generate-app.js.map +1 -1
  54. package/lib/common/get-dependencies.js +9 -9
  55. package/lib/common/get-farris-config.js +25 -25
  56. package/lib/common/get-farris-config.js.map +1 -1
  57. package/lib/common/get-version.js +6 -6
  58. package/lib/common/get-vite-config.js +106 -106
  59. package/lib/common/get-vite-config.js.map +1 -1
  60. package/lib/common/lib-package-exports.js +24 -24
  61. package/lib/common/lib-package-exports.js.map +1 -1
  62. package/lib/common/list-lib-components.js +23 -23
  63. package/lib/common/list-lib-components.js.map +1 -1
  64. package/lib/common/output.js +164 -94
  65. package/lib/common/output.js.map +1 -1
  66. package/lib/common/project-layout.js +143 -0
  67. package/lib/common/project-layout.js.map +1 -0
  68. package/lib/common/safety.js +173 -171
  69. package/lib/common/safety.js.map +1 -1
  70. package/lib/common/template-manifest.js +14 -16
  71. package/lib/common/template-manifest.js.map +1 -1
  72. package/lib/common/template-renderer.js +114 -114
  73. package/lib/common/template-renderer.js.map +1 -1
  74. package/lib/common/transaction.js +83 -83
  75. package/lib/common/transaction.js.map +1 -1
  76. package/lib/common/verifier.js +194 -150
  77. package/lib/common/verifier.js.map +1 -1
  78. package/lib/common/workspace-contract.js +86 -0
  79. package/lib/common/workspace-contract.js.map +1 -0
  80. package/lib/config/vite-app.js +13 -13
  81. package/lib/config/vite-common.js +20 -20
  82. package/lib/config/vite-common.js.map +1 -1
  83. package/lib/config/vite-component.js +32 -32
  84. package/lib/config/vite-component.js.map +1 -1
  85. package/lib/config/vite-lib.js +26 -26
  86. package/lib/index.js +234 -205
  87. package/lib/index.js.map +1 -1
  88. package/lib/plugins/create-app-package-json.js +24 -0
  89. package/lib/plugins/create-app-package-json.js.map +1 -0
  90. package/lib/plugins/create-component-style.js +44 -44
  91. package/lib/plugins/create-package-json.js +48 -48
  92. package/lib/plugins/create-package-json.js.map +1 -1
  93. package/lib/plugins/dts.js +8 -8
  94. package/lib/plugins/html-system.js +9 -9
  95. package/lib/plugins/replace.js +17 -17
  96. package/lib/plugins/systemjs-bundle.js +15 -15
  97. package/lib/plugins/systemjs-bundle.js.map +1 -1
  98. package/package.json +53 -52
  99. package/templates/create/.gitignore.tpl +12 -0
  100. package/templates/create/.npmrc.tpl +1 -0
  101. package/templates/create/AGENTS.md +62 -0
  102. package/templates/create/CLAUDE.md +1 -0
  103. package/templates/create/README.md +14 -1
  104. package/templates/create/package.json +11 -3
  105. package/templates/create/pnpm-workspace.yaml +2 -1
  106. package/templates/lib/.eslintrc.cjs +15 -0
  107. package/templates/lib/.gitignore.tpl +3 -0
  108. package/templates/lib/.prettierrc.json +8 -0
  109. package/templates/lib/index.html +1 -1
  110. package/templates/lib/package.json +39 -4
  111. package/templates/lib/{components → test/components}/button/button.spec.ts +3 -2
  112. package/templates/lib/test/components/button/button.spec.tsx +11 -0
  113. package/templates/lib/tsconfig.json +5 -1
  114. package/templates/lib/vitest.config.ts +1 -1
  115. package/templates/mobile/.gitignore.tpl +31 -0
  116. package/templates/mobile/.gitlab-ci.yml +3 -9
  117. package/templates/mobile/index.html +1 -1
  118. package/templates/mobile/package.json +14 -10
  119. package/templates/mobile/src/main.ts +5 -4
  120. package/templates/mobile/src/router/index.ts +17 -17
  121. package/templates/mobile/test/src/components/TheButton.spec.ts +15 -0
  122. package/templates/mobile/test/src/components/TheButton.spec.tsx +15 -0
  123. package/templates/mobile/tsconfig.json +3 -2
  124. package/templates/mobile/vitest.config.ts +2 -1
  125. package/templates/web/.gitignore.tpl +31 -0
  126. package/templates/web/.gitlab-ci.yml +3 -9
  127. package/templates/web/index.html +1 -1
  128. package/templates/web/package.json +14 -10
  129. package/templates/web/src/locales/index.ts +5 -0
  130. package/templates/web/src/locales/zh-CN.json +1 -0
  131. package/templates/web/src/main.ts +5 -2
  132. package/templates/web/src/router/index.ts +17 -17
  133. package/templates/web/src/styles/index.css +0 -0
  134. package/templates/web/src/styles/index.scss +0 -0
  135. package/templates/web/test/src/components/TheButton.spec.ts +15 -0
  136. package/templates/web/test/src/components/TheButton.spec.tsx +15 -0
  137. package/templates/web/tsconfig.json +3 -2
  138. package/templates/web/vitest.config.ts +2 -1
  139. package/lib/common/project-package-name.js +0 -5
  140. package/lib/common/project-package-name.js.map +0 -1
  141. package/templates/mobile/.changeset/README.md +0 -4
  142. package/templates/mobile/.changeset/config.json +0 -11
  143. package/templates/mobile/project.json +0 -4
  144. package/templates/mobile/src/components/TheButton.spec.ts +0 -8
  145. package/templates/web/.changeset/README.md +0 -4
  146. package/templates/web/.changeset/config.json +0 -11
  147. package/templates/web/project.json +0 -4
  148. package/templates/web/src/components/TheButton.spec.ts +0 -8
  149. package/templates/workspace/app/farris.config.mjs +0 -13
  150. package/templates/workspace/app/index.html +0 -12
  151. package/templates/workspace/app/package.json +0 -22
  152. package/templates/workspace/app/src/App.tsx +0 -11
  153. package/templates/workspace/app/src/main.ts +0 -12
  154. package/templates/workspace/app/src/router/index.ts +0 -16
  155. package/templates/workspace/app/src/views/home/composables/use-home.ts +0 -7
  156. package/templates/workspace/app/src/views/home/home.component.tsx +0 -15
  157. package/templates/workspace/app/src/views/home/index.ts +0 -4
  158. package/templates/workspace/app/tsconfig.json +0 -21
  159. package/templates/workspace/root/README.md +0 -28
  160. package/templates/workspace/root/package.json +0 -13
  161. package/templates/workspace/root/pnpm-workspace.yaml +0 -12
  162. /package/templates/{workspace/app → mobile}/src/locales/index.ts +0 -0
  163. /package/templates/{workspace/app → mobile}/src/locales/zh-CN.json +0 -0
  164. /package/templates/{workspace/app → mobile}/src/styles/index.css +0 -0
  165. /package/templates/{workspace/app → mobile}/src/styles/index.scss +0 -0
@@ -1,11 +0,0 @@
1
- {
2
- "$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
3
- "changelog": "@changesets/cli/changelog",
4
- "commit": false,
5
- "fixed": [],
6
- "linked": [],
7
- "access": "restricted",
8
- "baseBranch": "main",
9
- "updateInternalDependencies": "patch",
10
- "ignore": []
11
- }
@@ -1,4 +0,0 @@
1
- {
2
- "name": "<%= projectPackageName %>",
3
- "version": "0.0.0"
4
- }
@@ -1,8 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import TheButton from './TheButton.vue';
3
-
4
- describe('TheButton', () => {
5
- it('exports a component', () => {
6
- expect(TheButton).toBeTruthy();
7
- });
8
- });
@@ -1,4 +0,0 @@
1
- Use `npm run changeset` then `npm run version` to write CHANGELOG.md.
2
-
3
- This app template is `private` and is not meant for `npm publish`.
4
- If the default branch is not `main`, edit `baseBranch` in `config.json`.
@@ -1,11 +0,0 @@
1
- {
2
- "$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
3
- "changelog": "@changesets/cli/changelog",
4
- "commit": false,
5
- "fixed": [],
6
- "linked": [],
7
- "access": "restricted",
8
- "baseBranch": "main",
9
- "updateInternalDependencies": "patch",
10
- "ignore": []
11
- }
@@ -1,4 +0,0 @@
1
- {
2
- "name": "<%= projectPackageName %>",
3
- "version": "0.0.0"
4
- }
@@ -1,8 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import TheButton from './TheButton.vue';
3
-
4
- describe('TheButton', () => {
5
- it('exports a component', () => {
6
- expect(TheButton).toBeTruthy();
7
- });
8
- });
@@ -1,13 +0,0 @@
1
- import { fileURLToPath, URL } from 'node:url';
2
-
3
- export default {
4
- base: '<%= base %>',
5
- routerMode: '<%= routerMode %>',
6
- format: '<%= format %>',
7
- minify: true,
8
- externalDependencies: false,
9
- alias: [
10
- { find: '@', replacement: fileURLToPath(new URL('./src', import.meta.url)) }
11
- ],
12
- viteConfig: {}
13
- };
@@ -1,12 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="zh-CN">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title><%= title %></title>
7
- </head>
8
- <body>
9
- <div id="app"></div>
10
- <script type="module" src="/src/main.ts"></script>
11
- </body>
12
- </html>
@@ -1,22 +0,0 @@
1
- {
2
- "name": "<%= appName %>",
3
- "version": "0.1.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "dev": "farris-cli dev",
8
- "build": "farris-cli build",
9
- "preview": "farris-cli preview",
10
- "typecheck": "vue-tsc --noEmit"
11
- },
12
- "dependencies": {
13
- "@farris/ui-vue": "catalog:",
14
- "vue": "catalog:"<%= routerDependency %>
15
- },
16
- "devDependencies": {
17
- "@farris/cli": "catalog:",
18
- "typescript": "catalog:",
19
- "vite": "catalog:",
20
- "vue-tsc": "catalog:"<%= sassDevDependency %>
21
- }
22
- }
@@ -1,11 +0,0 @@
1
- import { defineComponent } from 'vue';<%= appRouterImport %>
2
-
3
- export default defineComponent({
4
- name: 'App',
5
- setup() {
6
- return () => (
7
- <%= appTemplateBody %>
8
- );
9
- }
10
- });
11
-
@@ -1,12 +0,0 @@
1
- import { createApp } from 'vue';
2
- import FarrisUI from '@farris/ui-vue';
3
- import '@farris/ui-vue/index.css';<%= styleImport %><%= routerImport %>
4
- import { localResources } from './locales';
5
- import App from './App';
6
-
7
- const app = createApp(App);
8
-
9
- app.use(FarrisUI, { basePath: '', locale: 'zh-CN', localResources });<%= routerUse %>
10
-
11
- app.mount('#app');
12
-
@@ -1,16 +0,0 @@
1
- import { createRouter, <%= routerHistoryFunction %>, type RouteRecordRaw } from 'vue-router';
2
-
3
- export const routes: RouteRecordRaw[] = [
4
- {
5
- path: '/',
6
- name: 'Home',
7
- component: () => import('../views/home')
8
- },
9
- ];
10
-
11
- const router = createRouter({
12
- history: <%= routerHistoryCall %>,
13
- routes
14
- });
15
-
16
- export default router;
@@ -1,7 +0,0 @@
1
- export function useHome() {
2
- const title = '<%= title %>';
3
-
4
- return {
5
- title
6
- };
7
- }
@@ -1,15 +0,0 @@
1
- import { defineComponent } from 'vue';
2
- import { useHome } from './composables/use-home';
3
-
4
- export default defineComponent({
5
- name: 'HomeView',
6
- setup() {
7
- const { title } = useHome();
8
-
9
- return () => (
10
- <div class="f-page-home">
11
- <h2>{title}</h2>
12
- </div>
13
- );
14
- }
15
- });
@@ -1,4 +0,0 @@
1
- import HomeComponent from './home.component';
2
-
3
- export { HomeComponent };
4
- export default HomeComponent;
@@ -1,21 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "useDefineForClassFields": true,
5
- "module": "ESNext",
6
- "moduleResolution": "Node",
7
- "strict": true,
8
- "jsx": "preserve",
9
- "jsxImportSource": "vue",
10
- "resolveJsonModule": true,
11
- "isolatedModules": true,
12
- "esModuleInterop": true,
13
- "lib": ["ESNext", "DOM"],
14
- "skipLibCheck": true,
15
- "types": ["vite/client"],
16
- "paths": {
17
- "@/*": ["./src/*"]
18
- }
19
- },
20
- "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
21
- }
@@ -1,28 +0,0 @@
1
- # <%= title %>
2
-
3
- 基于 Farris Vue 的前端工程 Workspace。
4
-
5
- ## 目录结构
6
-
7
- ```text
8
- ├── packages/
9
- │ └── <%= appDir %>/ # 应用源码
10
- ├── pnpm-workspace.yaml # pnpm workspace 配置及 Catalog 依赖版本
11
- └── package.json # 根工程脚本
12
- ```
13
-
14
- ## 快速上手
15
-
16
- ```bash
17
- # 安装依赖
18
- pnpm install
19
-
20
- # 启动开发服务器
21
- pnpm --filter "<%= appName %>" dev
22
-
23
- # 执行全量类型检查
24
- pnpm typecheck
25
-
26
- # 构建生产产物
27
- pnpm build
28
- ```
@@ -1,13 +0,0 @@
1
- {
2
- "private": true,
3
- "packageManager": "pnpm@<%= pnpmVersion %>",
4
- "engines": {
5
- "node": "^18.0.0 || >=20.0.0",
6
- "pnpm": ">=9.0.0 <10.0.0"
7
- },
8
- "scripts": {
9
- "build": "pnpm --recursive --if-present run build",
10
- "dev": "pnpm --recursive --if-present run dev",
11
- "typecheck": "pnpm --recursive --if-present run typecheck"
12
- }
13
- }
@@ -1,12 +0,0 @@
1
- packages:
2
- - "packages/*"
3
-
4
- catalog:
5
- "@farris/ui-vue": "<%= farrisUiVueVersion %>"
6
- "@farris/cli": "<%= farrisCliVersion %>"
7
- "typescript": "<%= typescriptVersion %>"
8
- "vite": "<%= viteVersion %>"
9
- "vue": "<%= vueVersion %>"
10
- "vue-router": "<%= vueRouterVersion %>"
11
- "vue-tsc": "<%= vueTscVersion %>"
12
- "sass": "<%= sassVersion %>"