@farris/cli 2.1.2 → 2.1.4

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 (76) hide show
  1. package/lib/commands/build-components.js +39 -39
  2. package/lib/commands/build-components.js.map +1 -1
  3. package/lib/commands/build-css.js +38 -38
  4. package/lib/commands/build-css.js.map +1 -1
  5. package/lib/commands/build-lib.js +25 -25
  6. package/lib/commands/build.js +14 -14
  7. package/lib/commands/build.js.map +1 -1
  8. package/lib/commands/create-app.js +54 -54
  9. package/lib/commands/dev-serve.js +18 -18
  10. package/lib/commands/extract-i18n.js +74 -74
  11. package/lib/commands/extract-i18n.js.map +1 -1
  12. package/lib/commands/generate/api.js +186 -186
  13. package/lib/commands/generate/api.js.map +1 -1
  14. package/lib/commands/generate/common.js +100 -100
  15. package/lib/commands/generate/common.js.map +1 -1
  16. package/lib/commands/generate/component.js +163 -163
  17. package/lib/commands/generate/component.js.map +1 -1
  18. package/lib/commands/generate/view.js +193 -193
  19. package/lib/commands/generate/view.js.map +1 -1
  20. package/lib/commands/preview-serve.js +16 -16
  21. package/lib/commands/workspace/add-app.js +180 -180
  22. package/lib/commands/workspace/add-app.js.map +1 -1
  23. package/lib/commands/workspace/create.js +379 -379
  24. package/lib/commands/workspace/create.js.map +1 -1
  25. package/lib/commands/workspace/inspect.js +30 -30
  26. package/lib/commands/workspace/inspect.js.map +1 -1
  27. package/lib/commands/workspace/verify.js +38 -38
  28. package/lib/commands/workspace/verify.js.map +1 -1
  29. package/lib/common/constant.js +64 -63
  30. package/lib/common/constant.js.map +1 -1
  31. package/lib/common/generate-app.js +44 -44
  32. package/lib/common/get-dependencies.js +9 -9
  33. package/lib/common/get-farris-config.js +11 -11
  34. package/lib/common/get-farris-config.js.map +1 -1
  35. package/lib/common/get-version.js +6 -6
  36. package/lib/common/get-vite-config.js +105 -105
  37. package/lib/common/get-vite-config.js.map +1 -1
  38. package/lib/common/output.js +94 -94
  39. package/lib/common/output.js.map +1 -1
  40. package/lib/common/safety.js +171 -171
  41. package/lib/common/safety.js.map +1 -1
  42. package/lib/common/template-renderer.js +114 -114
  43. package/lib/common/template-renderer.js.map +1 -1
  44. package/lib/common/transaction.js +83 -83
  45. package/lib/common/transaction.js.map +1 -1
  46. package/lib/common/verifier.js +146 -146
  47. package/lib/common/verifier.js.map +1 -1
  48. package/lib/config/vite-app.js +13 -13
  49. package/lib/config/vite-common.js +20 -20
  50. package/lib/config/vite-common.js.map +1 -1
  51. package/lib/config/vite-component.js +30 -30
  52. package/lib/config/vite-component.js.map +1 -1
  53. package/lib/config/vite-lib.js +26 -26
  54. package/lib/index.js +175 -175
  55. package/lib/plugins/create-component-style.js +44 -44
  56. package/lib/plugins/create-package-json.js +33 -33
  57. package/lib/plugins/create-package-json.js.map +1 -1
  58. package/lib/plugins/dts.js +8 -8
  59. package/lib/plugins/html-system.js +9 -9
  60. package/lib/plugins/replace.js +17 -17
  61. package/lib/plugins/systemjs-bundle.js +15 -15
  62. package/lib/plugins/systemjs-bundle.js.map +1 -1
  63. package/package.json +1 -1
  64. package/templates/workspace/app/farris.config.mjs +13 -13
  65. package/templates/workspace/app/index.html +12 -12
  66. package/templates/workspace/app/package.json +22 -22
  67. package/templates/workspace/app/src/App.tsx +11 -11
  68. package/templates/workspace/app/src/main.ts +11 -11
  69. package/templates/workspace/app/src/router/index.ts +16 -16
  70. package/templates/workspace/app/src/views/home/composables/use-home.ts +7 -7
  71. package/templates/workspace/app/src/views/home/home.component.tsx +15 -15
  72. package/templates/workspace/app/src/views/home/index.ts +4 -4
  73. package/templates/workspace/app/tsconfig.json +21 -21
  74. package/templates/workspace/root/README.md +28 -28
  75. package/templates/workspace/root/package.json +13 -13
  76. package/templates/workspace/root/pnpm-workspace.yaml +12 -12
@@ -1,9 +1,9 @@
1
- import dts from "vite-plugin-dts";
2
- export function generateTypes(entry, outDir) {
3
- return dts({
4
- entryRoot: entry,
5
- outDir
6
- });
7
- }
8
- ;
1
+ import dts from "vite-plugin-dts";
2
+ export function generateTypes(entry, outDir) {
3
+ return dts({
4
+ entryRoot: entry,
5
+ outDir
6
+ });
7
+ }
8
+ ;
9
9
  //# sourceMappingURL=dts.js.map
@@ -1,12 +1,12 @@
1
- export const htmlSystemPlugin = () => {
2
- return {
3
- name: 'html-transform-system',
4
- transformIndexHtml(html) {
5
- const regexp = /<script.*type="module".*src="(.*?)"><\/script>/;
1
+ export const htmlSystemPlugin = () => {
2
+ return {
3
+ name: 'html-transform-system',
4
+ transformIndexHtml(html) {
5
+ const regexp = /<script.*type="module".*src="(.*?)"><\/script>/;
6
6
  return html.replace(regexp, (str, p1) => `
7
7
  <script src="https://cdn.bootcdn.net/ajax/libs/systemjs/6.15.1/system.js"></script>
8
- <script >System.import("${p1}");</script>`);
9
- }
10
- };
11
- };
8
+ <script >System.import("${p1}");</script>`);
9
+ }
10
+ };
11
+ };
12
12
  //# sourceMappingURL=html-system.js.map
@@ -1,18 +1,18 @@
1
- import { getPackageName } from '../common/constant.js';
2
- export function replace(path) {
3
- return {
4
- name: 'farris-replace-path',
5
- renderChunk(code, chunk) {
6
- const fileNames = chunk.fileName.split('.');
7
- const format = fileNames[fileNames.length - 2];
8
- // const regExpress = new RegExp(/@farris\/mobile-ui-vue\/([\w-]+)/g);
9
- const dynamicRegExp = new RegExp(`${getPackageName().replace(/\//g, '\\/')}\\/([\\w-]+)`, // 自动转义斜杠
10
- 'g');
11
- return code.replace(dynamicRegExp, (match, captureGroup) => {
12
- return path(format, [captureGroup]);
13
- });
14
- }
15
- };
16
- }
17
- ;
1
+ import { getPackageName } from '../common/constant.js';
2
+ export function replace(path) {
3
+ return {
4
+ name: 'farris-replace-path',
5
+ renderChunk(code, chunk) {
6
+ const fileNames = chunk.fileName.split('.');
7
+ const format = fileNames[fileNames.length - 2];
8
+ // const regExpress = new RegExp(/@farris\/mobile-ui-vue\/([\w-]+)/g);
9
+ const dynamicRegExp = new RegExp(`${getPackageName().replace(/\//g, '\\/')}\\/([\\w-]+)`, // 自动转义斜杠
10
+ 'g');
11
+ return code.replace(dynamicRegExp, (match, captureGroup) => {
12
+ return path(format, [captureGroup]);
13
+ });
14
+ }
15
+ };
16
+ }
17
+ ;
18
18
  //# sourceMappingURL=replace.js.map
@@ -1,16 +1,16 @@
1
- export function systemjsBundle() {
2
- return {
3
- name: 'systemjs-bundle',
4
- outputOptions(options) {
5
- if (options.format === 'systemjs') {
6
- return {
7
- ...options,
8
- name: undefined
9
- };
10
- }
11
- return options;
12
- }
13
- };
14
- }
15
- ;
1
+ export function systemjsBundle() {
2
+ return {
3
+ name: 'systemjs-bundle',
4
+ outputOptions(options) {
5
+ if (options.format === 'systemjs') {
6
+ return {
7
+ ...options,
8
+ name: undefined
9
+ };
10
+ }
11
+ return options;
12
+ }
13
+ };
14
+ }
15
+ ;
16
16
  //# sourceMappingURL=systemjs-bundle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"systemjs-bundle.js","sourceRoot":"","sources":["../../src/plugins/systemjs-bundle.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,aAAa,CAAC,OAAY;YACxB,IAAG,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;gBAChC,OAAO;oBACL,GAAG,OAAO;oBACV,IAAI,EAAE,SAAS;iBAChB,CAAC;aACH;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC;AAAA,CAAC"}
1
+ {"version":3,"file":"systemjs-bundle.js","sourceRoot":"","sources":["../../src/plugins/systemjs-bundle.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,aAAa,CAAC,OAAY;YACxB,IAAG,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;gBACjC,OAAO;oBACL,GAAG,OAAO;oBACV,IAAI,EAAE,SAAS;iBAChB,CAAC;YACJ,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC;AAAA,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@farris/cli",
3
3
  "private": false,
4
- "version": "2.1.2",
4
+ "version": "2.1.4",
5
5
  "type": "module",
6
6
  "typings": "lib/index.d.ts",
7
7
  "bin": {
@@ -1,13 +1,13 @@
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
+ 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 +1,12 @@
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
+ <!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 +1,22 @@
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
+ {
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 +1,11 @@
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
+ import { defineComponent } from 'vue';<%= appRouterImport %>
2
+
3
+ export default defineComponent({
4
+ name: 'App',
5
+ setup() {
6
+ return () => (
7
+ <%= appTemplateBody %>
8
+ );
9
+ }
10
+ });
11
+
@@ -1,11 +1,11 @@
1
- import { createApp } from 'vue';
2
- import FarrisUI from '@farris/ui-vue';
3
- import '@farris/ui-vue/index.css'; <%= styleImport %> <%= routerImport %> <%= i18nImport %>
4
- import App from './App';
5
-
6
- const app = createApp(App);
7
-
8
- app.use(FarrisUI); <%= routerUse %> <%= i18nUse %>
9
-
10
- app.mount('#app');
11
-
1
+ import { createApp } from 'vue';
2
+ import FarrisUI from '@farris/ui-vue';
3
+ import '@farris/ui-vue/index.css'; <%= styleImport %> <%= routerImport %> <%= i18nImport %>
4
+ import App from './App';
5
+
6
+ const app = createApp(App);
7
+
8
+ app.use(FarrisUI); <%= routerUse %> <%= i18nUse %>
9
+
10
+ app.mount('#app');
11
+
@@ -1,16 +1,16 @@
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
+ 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 +1,7 @@
1
- export function useHome() {
2
- const title = '<%= title %>';
3
-
4
- return {
5
- title
6
- };
7
- }
1
+ export function useHome() {
2
+ const title = '<%= title %>';
3
+
4
+ return {
5
+ title
6
+ };
7
+ }
@@ -1,15 +1,15 @@
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
+ 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 +1,4 @@
1
- import HomeComponent from './home.component';
2
-
3
- export { HomeComponent };
4
- export default HomeComponent;
1
+ import HomeComponent from './home.component';
2
+
3
+ export { HomeComponent };
4
+ export default HomeComponent;
@@ -1,21 +1,21 @@
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
+ {
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 +1,28 @@
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
+ # <%= 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 +1,13 @@
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
+ {
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 +1,12 @@
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 %>"
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 %>"