@farris/cli 2.2.6 → 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 (113) 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 +8 -1
  8. package/lib/commands/build-components.js.map +1 -1
  9. package/lib/commands/build-lib.js +5 -0
  10. package/lib/commands/build-lib.js.map +1 -1
  11. package/lib/commands/build.js +7 -2
  12. package/lib/commands/build.js.map +1 -1
  13. package/lib/commands/create-app-options.js +0 -2
  14. package/lib/commands/create-app-options.js.map +1 -1
  15. package/lib/commands/create-app.js +6 -1
  16. package/lib/commands/create-app.js.map +1 -1
  17. package/lib/commands/create-options.js +3 -0
  18. package/lib/commands/create-options.js.map +1 -1
  19. package/lib/commands/create.js +95 -42
  20. package/lib/commands/create.js.map +1 -1
  21. package/lib/commands/generate/common.js +13 -12
  22. package/lib/commands/generate/common.js.map +1 -1
  23. package/lib/commands/workspace/add-app.js +10 -175
  24. package/lib/commands/workspace/add-app.js.map +1 -1
  25. package/lib/commands/workspace/create.js +29 -346
  26. package/lib/commands/workspace/create.js.map +1 -1
  27. package/lib/common/agents-doc.js +34 -0
  28. package/lib/common/agents-doc.js.map +1 -0
  29. package/lib/common/generate-app.js +48 -24
  30. package/lib/common/generate-app.js.map +1 -1
  31. package/lib/common/output.js +72 -2
  32. package/lib/common/output.js.map +1 -1
  33. package/lib/common/project-layout.js +143 -0
  34. package/lib/common/project-layout.js.map +1 -0
  35. package/lib/common/safety.js +4 -2
  36. package/lib/common/safety.js.map +1 -1
  37. package/lib/common/template-manifest.js +2 -4
  38. package/lib/common/template-manifest.js.map +1 -1
  39. package/lib/common/verifier.js +143 -99
  40. package/lib/common/verifier.js.map +1 -1
  41. package/lib/common/workspace-contract.js +86 -0
  42. package/lib/common/workspace-contract.js.map +1 -0
  43. package/lib/index.js +31 -2
  44. package/lib/index.js.map +1 -1
  45. package/lib/plugins/create-app-package-json.js +24 -0
  46. package/lib/plugins/create-app-package-json.js.map +1 -0
  47. package/package.json +53 -52
  48. package/templates/create/.gitignore.tpl +12 -0
  49. package/templates/create/AGENTS.md +62 -0
  50. package/templates/create/CLAUDE.md +1 -0
  51. package/templates/create/README.md +14 -1
  52. package/templates/create/package.json +11 -3
  53. package/templates/create/pnpm-workspace.yaml +2 -1
  54. package/templates/lib/.eslintrc.cjs +15 -0
  55. package/templates/lib/.gitignore.tpl +3 -0
  56. package/templates/lib/.prettierrc.json +8 -0
  57. package/templates/lib/index.html +1 -1
  58. package/templates/lib/package.json +38 -3
  59. package/templates/lib/{components → test/components}/button/button.spec.ts +3 -2
  60. package/templates/lib/test/components/button/button.spec.tsx +11 -0
  61. package/templates/lib/tsconfig.json +5 -1
  62. package/templates/lib/vitest.config.ts +1 -1
  63. package/templates/mobile/.gitignore.tpl +31 -0
  64. package/templates/mobile/.gitlab-ci.yml +3 -9
  65. package/templates/mobile/index.html +1 -1
  66. package/templates/mobile/package.json +14 -10
  67. package/templates/mobile/src/main.ts +5 -4
  68. package/templates/mobile/src/router/index.ts +17 -17
  69. package/templates/mobile/test/src/components/TheButton.spec.ts +15 -0
  70. package/templates/mobile/test/src/components/TheButton.spec.tsx +15 -0
  71. package/templates/mobile/tsconfig.json +3 -2
  72. package/templates/mobile/vitest.config.ts +2 -1
  73. package/templates/web/.gitignore.tpl +31 -0
  74. package/templates/web/.gitlab-ci.yml +3 -9
  75. package/templates/web/index.html +1 -1
  76. package/templates/web/package.json +14 -10
  77. package/templates/web/src/locales/index.ts +5 -0
  78. package/templates/web/src/locales/zh-CN.json +1 -0
  79. package/templates/web/src/main.ts +5 -2
  80. package/templates/web/src/router/index.ts +17 -17
  81. package/templates/web/src/styles/index.css +0 -0
  82. package/templates/web/src/styles/index.scss +0 -0
  83. package/templates/web/test/src/components/TheButton.spec.ts +15 -0
  84. package/templates/web/test/src/components/TheButton.spec.tsx +15 -0
  85. package/templates/web/tsconfig.json +3 -2
  86. package/templates/web/vitest.config.ts +2 -1
  87. package/lib/common/project-package-name.js +0 -5
  88. package/lib/common/project-package-name.js.map +0 -1
  89. package/templates/mobile/.changeset/README.md +0 -4
  90. package/templates/mobile/.changeset/config.json +0 -11
  91. package/templates/mobile/project.json +0 -4
  92. package/templates/mobile/src/components/TheButton.spec.ts +0 -8
  93. package/templates/web/.changeset/README.md +0 -4
  94. package/templates/web/.changeset/config.json +0 -11
  95. package/templates/web/project.json +0 -4
  96. package/templates/web/src/components/TheButton.spec.ts +0 -8
  97. package/templates/workspace/app/farris.config.mjs +0 -13
  98. package/templates/workspace/app/index.html +0 -12
  99. package/templates/workspace/app/package.json +0 -22
  100. package/templates/workspace/app/src/App.tsx +0 -11
  101. package/templates/workspace/app/src/main.ts +0 -12
  102. package/templates/workspace/app/src/router/index.ts +0 -16
  103. package/templates/workspace/app/src/views/home/composables/use-home.ts +0 -7
  104. package/templates/workspace/app/src/views/home/home.component.tsx +0 -15
  105. package/templates/workspace/app/src/views/home/index.ts +0 -4
  106. package/templates/workspace/app/tsconfig.json +0 -21
  107. package/templates/workspace/root/README.md +0 -28
  108. package/templates/workspace/root/package.json +0 -13
  109. package/templates/workspace/root/pnpm-workspace.yaml +0 -12
  110. /package/templates/{workspace/app → mobile}/src/locales/index.ts +0 -0
  111. /package/templates/{workspace/app → mobile}/src/locales/zh-CN.json +0 -0
  112. /package/templates/{workspace/app → mobile}/src/styles/index.css +0 -0
  113. /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": "1.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 %>"