@farris/cli 2.2.0-beta.1 → 2.2.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.
- package/bin/index.js +1 -1
- package/lib/commands/build-components.js +48 -48
- package/lib/commands/build-components.js.map +1 -1
- package/lib/commands/build-css.js +38 -38
- package/lib/commands/build-css.js.map +1 -1
- package/lib/commands/build-lib.js +25 -25
- package/lib/commands/build.js +14 -15
- package/lib/commands/build.js.map +1 -1
- package/lib/commands/create-app-options.js +75 -0
- package/lib/commands/create-app-options.js.map +1 -0
- package/lib/commands/create-app.js +123 -54
- package/lib/commands/create-app.js.map +1 -1
- package/lib/commands/dev-serve.js +18 -18
- package/lib/commands/extract-i18n.js +74 -74
- package/lib/commands/extract-i18n.js.map +1 -1
- package/lib/commands/generate/api.js +188 -0
- package/lib/commands/generate/api.js.map +1 -0
- package/lib/commands/generate/common.js +101 -0
- package/lib/commands/generate/common.js.map +1 -0
- package/lib/commands/generate/component.js +164 -0
- package/lib/commands/generate/component.js.map +1 -0
- package/lib/commands/generate/view.js +198 -0
- package/lib/commands/generate/view.js.map +1 -0
- package/lib/commands/preview-serve.js +16 -16
- package/lib/commands/workspace/add-app.js +181 -0
- package/lib/commands/workspace/add-app.js.map +1 -0
- package/lib/commands/workspace/create.js +380 -0
- package/lib/commands/workspace/create.js.map +1 -0
- package/lib/commands/workspace/inspect.js +31 -0
- package/lib/commands/workspace/inspect.js.map +1 -0
- package/lib/commands/workspace/verify.js +39 -0
- package/lib/commands/workspace/verify.js.map +1 -0
- package/lib/common/component-file-name.js +3 -3
- package/lib/common/constant.js +64 -22
- package/lib/common/constant.js.map +1 -1
- package/lib/common/generate-app.js +54 -51
- package/lib/common/generate-app.js.map +1 -1
- package/lib/common/get-dependencies.js +9 -9
- package/lib/common/get-farris-config.js +25 -25
- package/lib/common/get-farris-config.js.map +1 -1
- package/lib/common/get-version.js +6 -6
- package/lib/common/get-vite-config.js +106 -49
- package/lib/common/get-vite-config.js.map +1 -1
- package/lib/common/lib-package-exports.js +20 -20
- package/lib/common/list-lib-components.js +23 -23
- package/lib/common/list-lib-components.js.map +1 -1
- package/lib/common/output.js +95 -0
- package/lib/common/output.js.map +1 -0
- package/lib/common/project-package-name.js +5 -0
- package/lib/common/project-package-name.js.map +1 -0
- package/lib/common/safety.js +172 -0
- package/lib/common/safety.js.map +1 -0
- package/lib/common/template-manifest.js +16 -16
- package/lib/common/template-manifest.js.map +1 -1
- package/lib/common/template-renderer.js +115 -0
- package/lib/common/template-renderer.js.map +1 -0
- package/lib/common/transaction.js +84 -0
- package/lib/common/transaction.js.map +1 -0
- package/lib/common/verifier.js +151 -0
- package/lib/common/verifier.js.map +1 -0
- package/lib/config/vite-app.js +13 -13
- package/lib/config/vite-common.js +20 -20
- package/lib/config/vite-common.js.map +1 -1
- package/lib/config/vite-component.js +32 -32
- package/lib/config/vite-component.js.map +1 -1
- package/lib/config/vite-lib.js +26 -26
- package/lib/index.js +185 -87
- package/lib/index.js.map +1 -1
- package/lib/plugins/create-component-style.js +44 -44
- package/lib/plugins/create-package-json.js +48 -48
- package/lib/plugins/create-package-json.js.map +1 -1
- package/lib/plugins/dts.js +8 -8
- package/lib/plugins/html-system.js +9 -9
- package/lib/plugins/replace.js +17 -17
- package/lib/plugins/systemjs-bundle.js +15 -15
- package/lib/plugins/systemjs-bundle.js.map +1 -1
- package/package.json +12 -9
- package/templates/lib/.gitlab-ci.yml +85 -0
- package/templates/lib/README.md +1 -15
- package/templates/lib/components/button/button.spec.ts +8 -0
- package/templates/lib/index.html +12 -0
- package/templates/lib/package.json +6 -1
- package/templates/lib/src/App.vue +7 -0
- package/templates/lib/src/main.ts +4 -0
- package/templates/lib/vitest.config.ts +9 -0
- package/templates/mobile/.gitlab-ci.yml +88 -0
- package/templates/mobile/package.json +5 -1
- package/templates/mobile/project.json +4 -0
- package/templates/mobile/src/components/TheButton.spec.ts +8 -0
- package/templates/mobile/vitest.config.ts +9 -0
- package/templates/web/.gitlab-ci.yml +88 -0
- package/templates/web/package.json +5 -1
- package/templates/web/project.json +4 -0
- package/templates/web/src/components/TheButton.spec.ts +8 -0
- package/templates/web/vitest.config.ts +9 -0
- package/templates/workspace/app/farris.config.mjs +13 -0
- package/templates/workspace/app/index.html +12 -0
- package/templates/workspace/app/package.json +22 -0
- package/templates/workspace/app/src/App.tsx +11 -0
- package/templates/workspace/app/src/locales/index.ts +5 -0
- package/templates/workspace/app/src/locales/zh-CN.json +1 -0
- package/templates/workspace/app/src/main.ts +12 -0
- package/templates/workspace/app/src/router/index.ts +16 -0
- package/templates/workspace/app/src/styles/index.css +0 -0
- package/templates/workspace/app/src/styles/index.scss +0 -0
- package/templates/workspace/app/src/views/home/composables/use-home.ts +7 -0
- package/templates/workspace/app/src/views/home/home.component.tsx +15 -0
- package/templates/workspace/app/src/views/home/index.ts +4 -0
- package/templates/workspace/app/tsconfig.json +21 -0
- package/templates/workspace/root/README.md +28 -0
- package/templates/workspace/root/package.json +13 -0
- package/templates/workspace/root/pnpm-workspace.yaml +12 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
image: registry.inspures.com/public/docker.io/library/node:22
|
|
2
|
+
|
|
3
|
+
variables:
|
|
4
|
+
PROJECT_ROOT: "."
|
|
5
|
+
NPM_REGISTRY: "https://repos.iec.io/repository/npm-igix/"
|
|
6
|
+
NPM_RELEASE_REGISTRY: "https://repos.iec.io/repository/npm-igix-release/"
|
|
7
|
+
|
|
8
|
+
stages:
|
|
9
|
+
- pre
|
|
10
|
+
- build
|
|
11
|
+
- publish
|
|
12
|
+
- publishproject
|
|
13
|
+
|
|
14
|
+
pre-job:
|
|
15
|
+
stage: pre
|
|
16
|
+
tags:
|
|
17
|
+
- environment:cloud
|
|
18
|
+
script:
|
|
19
|
+
- export commit_author=$(git log -1 --pretty=format:%an)
|
|
20
|
+
- export commit_email=$(git log -1 --pretty=format:%ce)
|
|
21
|
+
|
|
22
|
+
build-job:
|
|
23
|
+
stage: build
|
|
24
|
+
tags:
|
|
25
|
+
- environment:cloud
|
|
26
|
+
before_script:
|
|
27
|
+
- |
|
|
28
|
+
if [ -z "${ARTIFACTS_REPO_USERNAME}" ] || [ -z "${ARTIFACTS_REPO_PASSWORD}" ]; then
|
|
29
|
+
echo "ARTIFACTS_REPO_USERNAME or ARTIFACTS_REPO_PASSWORD is empty on ${CI_COMMIT_REF_NAME}."
|
|
30
|
+
echo "If these GitLab CI/CD variables are Protected, they are not available on unprotected branches."
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
- if [ ! -f .npmrc ]; then wget -O - https://repos.iec.io/gitlab-ci/template/experimental/script/npmrc | sh; fi
|
|
34
|
+
- echo _auth=$(echo -n ${ARTIFACTS_REPO_USERNAME}:${ARTIFACTS_REPO_PASSWORD} | base64) >> .npmrc
|
|
35
|
+
- echo always-auth=true >> .npmrc
|
|
36
|
+
- sed -i "s#registry=.*#registry=$NPM_REGISTRY#g" $CI_PROJECT_DIR/.npmrc
|
|
37
|
+
- cp .npmrc ~/
|
|
38
|
+
- npm config fix
|
|
39
|
+
script:
|
|
40
|
+
- npm i --no-package-lock
|
|
41
|
+
- npm test
|
|
42
|
+
- npm run build
|
|
43
|
+
artifacts:
|
|
44
|
+
expire_in: '5days'
|
|
45
|
+
name: 'dist'
|
|
46
|
+
paths:
|
|
47
|
+
- $CI_PROJECT_DIR/dist
|
|
48
|
+
|
|
49
|
+
publish-one:
|
|
50
|
+
stage: publish
|
|
51
|
+
tags:
|
|
52
|
+
- environment:cloud
|
|
53
|
+
only:
|
|
54
|
+
refs:
|
|
55
|
+
- cicd
|
|
56
|
+
changes:
|
|
57
|
+
- packages/**/package.json
|
|
58
|
+
script:
|
|
59
|
+
- echo "skip publish-one, app package is private"
|
|
60
|
+
|
|
61
|
+
publish-project:
|
|
62
|
+
stage: publishproject
|
|
63
|
+
tags:
|
|
64
|
+
- environment:cloud
|
|
65
|
+
only:
|
|
66
|
+
refs:
|
|
67
|
+
- cicd
|
|
68
|
+
changes:
|
|
69
|
+
- project.json
|
|
70
|
+
before_script:
|
|
71
|
+
- |
|
|
72
|
+
if [ -z "${ARTIFACTS_REPO_USERNAME}" ] || [ -z "${ARTIFACTS_REPO_PASSWORD}" ]; then
|
|
73
|
+
echo "ARTIFACTS_REPO_USERNAME or ARTIFACTS_REPO_PASSWORD is empty on ${CI_COMMIT_REF_NAME}."
|
|
74
|
+
echo "If these GitLab CI/CD variables are Protected, they are not available on unprotected branches."
|
|
75
|
+
exit 1
|
|
76
|
+
fi
|
|
77
|
+
- if [ ! -f .npmrc ]; then wget -O - https://repos.iec.io/gitlab-ci/template/experimental/script/npmrc | sh; fi
|
|
78
|
+
- echo _auth=$(echo -n ${ARTIFACTS_REPO_USERNAME}:${ARTIFACTS_REPO_PASSWORD} | base64) >> .npmrc
|
|
79
|
+
- echo always-auth=true >> .npmrc
|
|
80
|
+
- sed -i "s#registry=.*#registry=$NPM_RELEASE_REGISTRY#g" $CI_PROJECT_DIR/.npmrc
|
|
81
|
+
- cp .npmrc ~/
|
|
82
|
+
- npm config fix
|
|
83
|
+
script:
|
|
84
|
+
- npm config set //repos.iec.io/repository/npm-igix-release/:_auth=$(echo -n ${ARTIFACTS_REPO_USERNAME}:${ARTIFACTS_REPO_PASSWORD} | base64)
|
|
85
|
+
- cp ./project.json ./dist
|
|
86
|
+
- cd ./dist
|
|
87
|
+
- mv ./project.json ./package.json
|
|
88
|
+
- npm publish
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
"preview": "farris-cli preview",
|
|
10
10
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
11
11
|
"format": "prettier --write src/",
|
|
12
|
+
"test": "vitest run",
|
|
13
|
+
"test:watch": "vitest",
|
|
12
14
|
"changeset": "changeset",
|
|
13
15
|
"version": "changeset version"
|
|
14
16
|
},
|
|
@@ -24,9 +26,11 @@
|
|
|
24
26
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
25
27
|
"@vue/eslint-config-typescript": "^13.0.0",
|
|
26
28
|
"@vue/tsconfig": "^0.5.1",
|
|
29
|
+
"@vitejs/plugin-vue": "^4.0.0",
|
|
27
30
|
"eslint": "^8.57.0",
|
|
28
31
|
"eslint-plugin-vue": "^9.23.0",
|
|
29
32
|
"prettier": "^3.2.5",
|
|
30
|
-
"typescript": "~5.4.0"
|
|
33
|
+
"typescript": "~5.4.0",
|
|
34
|
+
"vitest": "^1.6.1"
|
|
31
35
|
}
|
|
32
36
|
}
|
|
@@ -0,0 +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
|
+
};
|
|
@@ -0,0 +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>
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
|
|
@@ -0,0 +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;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +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
|
+
});
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +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
|
+
```
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +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 %>"
|