├── .babelrc
├── .editorconfig
├── .eslintignore
├── .eslintrc.js
├── .github
├── ISSUE_TEMPLATE
│ ├── bug-report.zh-CN.yml
│ ├── config.yml
│ └── feature-report.zh-CN.yml
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ ├── auto-release.yml
│ ├── issue-assignees.temp.yml
│ ├── issue-help-wanted.temp.yml
│ ├── issue-mark-duplicate.temp.yml
│ ├── issue-reply.temp.yml
│ ├── issue-stale-close.temp.yml
│ ├── preview.yml
│ └── tag-push.yml
├── .gitignore
├── .prettierignore
├── .prettierrc.js
├── .vscode
├── extensions.json
└── settings.json
├── CHANGELOG.md
├── LICENSE
├── README-zh_CN.md
├── README.md
├── package.json
├── publish.sh
├── rollup.config.js
├── scripts
└── deploy.ts
├── src
├── core
│ ├── CoreGitDownloader.ts
│ ├── CoreIndex.ts
│ ├── CoreInquirer.ts
│ ├── CoreParsedConfig.ts
│ ├── CoreSelector.ts
│ ├── CoreTemplate.ts
│ ├── core-js-transform
│ │ ├── CoreCodeReplace.ts
│ │ ├── CoreJsTransformInquirer.ts
│ │ ├── CoreJsTransformer.ts
│ │ ├── CoreSfcCompiler.ts
│ │ ├── CoreTsCompiler.ts
│ │ └── README.md
│ ├── core-lite
│ │ ├── CoreBuildToolInquirer.ts
│ │ ├── CoreLiteDownloader.ts
│ │ └── CoreLiteInquirer.ts
│ ├── core-options
│ │ ├── CoreOptionsFilterForReact.ts
│ │ ├── CoreOptionsFilterForVue2.ts
│ │ └── CoreOptionsFilterForVue3.ts
│ └── core-template
│ │ ├── CoreTemplateReactConfig.ts
│ │ ├── CoreTemplateVue2Config.ts
│ │ └── CoreTemplateVue3Config.ts
├── main.ts
├── types
│ ├── index.d.ts
│ └── type.d.ts
└── utils
│ ├── UtilsFile.ts
│ └── UtilsIndex.ts
├── templates
├── farm
│ ├── react-lite
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── farm.config.ts
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ └── tdesign-logo.svg
│ │ ├── src
│ │ │ ├── App.css
│ │ │ ├── App.tsx
│ │ │ ├── assets
│ │ │ │ └── svg
│ │ │ │ │ └── farm-logo.png
│ │ │ ├── main.tsx
│ │ │ └── typings.d.ts
│ │ ├── tsconfig.json
│ │ └── tsconfig.node.json
│ ├── vue-lite
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── farm.config.ts
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ └── tdesign-logo.svg
│ │ ├── src
│ │ │ ├── App.vue
│ │ │ ├── assets
│ │ │ │ └── svg
│ │ │ │ │ └── farm-logo.png
│ │ │ └── main.js
│ │ └── tsconfig.json
│ └── vue-next-lite
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── farm.config.ts
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── public
│ │ ├── favicon.ico
│ │ └── tdesign-logo.svg
│ │ ├── src
│ │ ├── App.vue
│ │ ├── assets
│ │ │ └── svg
│ │ │ │ └── farm-logo.png
│ │ ├── main.ts
│ │ └── vite-env.d.ts
│ │ ├── tsconfig.json
│ │ └── tsconfig.node.json
├── vite
│ ├── react-lite
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ └── tdesign-logo.svg
│ │ ├── src
│ │ │ ├── App.css
│ │ │ ├── App.tsx
│ │ │ ├── assets
│ │ │ │ └── svg
│ │ │ │ │ └── vite-logo.svg
│ │ │ ├── main.tsx
│ │ │ └── vite-env.d.ts
│ │ ├── tsconfig.json
│ │ ├── tsconfig.node.json
│ │ └── vite.config.ts
│ ├── vue-lite
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ └── tdesign-logo.svg
│ │ ├── src
│ │ │ ├── App.vue
│ │ │ ├── assets
│ │ │ │ └── svg
│ │ │ │ │ └── vite-logo.svg
│ │ │ └── main.js
│ │ └── vite.config.js
│ └── vue-next-lite
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── public
│ │ ├── favicon.ico
│ │ └── tdesign-logo.svg
│ │ ├── src
│ │ ├── App.vue
│ │ ├── assets
│ │ │ └── svg
│ │ │ │ └── vite-logo.svg
│ │ ├── main.ts
│ │ └── vite-env.d.ts
│ │ ├── tsconfig.json
│ │ ├── tsconfig.node.json
│ │ └── vite.config.ts
└── webpack
│ ├── react-lite
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ └── tdesign-logo.svg
│ ├── src
│ │ ├── App.css
│ │ ├── App.tsx
│ │ ├── assets
│ │ │ └── svg
│ │ │ │ ├── tdesign-logo.svg
│ │ │ │ └── webpack-logo.svg
│ │ ├── index.tsx
│ │ └── react-app-env.d.ts
│ └── tsconfig.json
│ ├── vue-lite
│ ├── .gitignore
│ ├── README copy.md
│ ├── README.md
│ ├── babel.config.js
│ ├── jsconfig.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ └── index.html
│ ├── src
│ │ ├── App.vue
│ │ ├── assets
│ │ │ └── svg
│ │ │ │ ├── tdesign-logo.svg
│ │ │ │ └── webpack-logo.svg
│ │ └── main.js
│ └── vue.config.js
│ └── vue-next-lite
│ ├── .gitignore
│ ├── README.md
│ ├── babel.config.js
│ ├── jsconfig.json
│ ├── package.json
│ ├── public
│ ├── favicon.ico
│ └── index.html
│ ├── src
│ ├── App.vue
│ ├── assets
│ │ └── svg
│ │ │ ├── tdesign-logo.svg
│ │ │ └── webpack-logo.svg
│ └── main.js
│ └── vue.config.js
└── tsconfig.json
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "@babel/preset-env",
4 | "@babel/preset-typescript"
5 | ]
6 | }
7 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | end_of_line = lf
6 | charset = utf-8
7 | trim_trailing_whitespace = true
8 | insert_final_newline = true
9 |
10 | [*.md]
11 | trim_trailing_whitespace = false
12 |
13 | [*.{ts,js,vue,css}]
14 | indent_size = 2
15 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 | lib
4 | bin
5 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | parser: '@typescript-eslint/parser',
4 | plugins: ['@typescript-eslint'],
5 | extends: ['eslint:recommended', 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended'],
6 | env: {
7 | node: true
8 | },
9 | rules: {
10 | // 'no-console': 'error'
11 | '@typescript-eslint/no-explicit-any': 'off',
12 | '@typescript-eslint/explicit-module-boundary-types': 'off',
13 | '@typescript-eslint/ban-ts-comment': 'off'
14 | }
15 | };
16 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug-report.zh-CN.yml:
--------------------------------------------------------------------------------
1 | name: 反馈 Bug
2 | description: 通过 github 模板进行 Bug 反馈。
3 | title: "[组件名称] 描述问题的标题"
4 | body:
5 | - type: markdown
6 | attributes:
7 | value: |
8 | # 欢迎你的参与
9 | tdesign-starter-cli 的 Issue 列表接受 bug 报告或是新功能请求。也可加入官方社区:
10 |
11 | 在发布一个 Issue 前,请确保:
12 | - 在 [常见问题](https://tdesign.tencent.com/about/faq)、[更新日志](https://tdesign.tencent.com/about/release) 和 [旧Issue列表](https://github.com/Tencent/tdesign-starter-cli/issues?q=is%3Aissue) 中搜索过你的问题。(你的问题可能已有人提出,也可能已在最新版本中被修正)
13 | - 如果你发现一个已经关闭的旧 Issue 在最新版本中仍然存在,不要在旧 Issue 下面留言,请建一个新的 issue。
14 |
15 | - type: input
16 | id: version
17 | attributes:
18 | label: tdesign-starter-cli 版本
19 | description: 请检查在最新项目版本中能否重现此 issue。
20 | placeholder: 请填写
21 | validations:
22 | required: true
23 |
24 | - type: input
25 | id: reproduce
26 | attributes:
27 | label: 重现链接
28 | description: 请提供尽可能精简的 CodePen、CodeSandbox 或 GitHub 仓库的链接。请不要填无关链接,否则你的 Issue 将被关闭。
29 | placeholder: 请填写
30 |
31 | - type: textarea
32 | id: reproduceSteps
33 | attributes:
34 | label: 重现步骤
35 | description: 请清晰的描述重现该 Issue 的步骤,这能帮助我们快速定位问题。没有清晰重现步骤将不会被修复,标有 'need reproduction' 的 Issue 在 7 天内不提供相关步骤,将被关闭。
36 | placeholder: 请填写
37 |
38 | - type: textarea
39 | id: expect
40 | attributes:
41 | label: 期望结果
42 | placeholder: 请填写
43 |
44 | - type: textarea
45 | id: actual
46 | attributes:
47 | label: 实际结果
48 | placeholder: 请填写
49 |
50 | - type: input
51 | id: frameworkVersion
52 | attributes:
53 | label: 框架版本
54 | placeholder: Vue(3.2.0)
55 |
56 | - type: input
57 | id: browsersVersion
58 | attributes:
59 | label: 浏览器版本
60 | placeholder: Chrome(8.213.231.123)
61 |
62 | - type: input
63 | id: systemVersion
64 | attributes:
65 | label: 系统版本
66 | placeholder: MacOS(11.2.3)
67 |
68 | - type: input
69 | id: nodeVersion
70 | attributes:
71 | label: Node版本
72 | placeholder: 请填写
73 |
74 | - type: textarea
75 | id: remarks
76 | attributes:
77 | label: 补充说明
78 | description: 可以是遇到这个 bug 的业务场景、上下文等信息。
79 | placeholder: 请填写
80 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: true
2 | contact_links:
3 | - name: 使用 issue-helper 新建
4 | url: https://Tencent.github.io/tdesign/issue-helper/?lang=zh-CN&repo=Tencent/tdesign
5 | about: 使用 https://Tencent.github.io/tdesign/issue-helper/ 创建 issue,其中包含 bug 和 feature,表单提交更加严格。
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature-report.zh-CN.yml:
--------------------------------------------------------------------------------
1 | name: 反馈新功能
2 | description: 通过 github 模板进行新功能反馈。
3 | title: "[组件名称] 描述问题的标题"
4 | body:
5 | - type: markdown
6 | attributes:
7 | value: |
8 | # 欢迎你的参与
9 | tdesign-starter-cli 的 Issue 列表接受 bug 报告或是新功能请求。也可加入官方社区:
10 |
11 | 在发布一个 Issue 前,请确保:
12 | - 在 [常见问题](https://tdesign.tencent.com/about/faq)、[更新日志](https://tdesign.tencent.com/about/release) 和 [旧Issue列表](https://github.com/Tencent/tdesign-starter-cli/issues?q=is%3Aissue) 中搜索过你的问题。(你的问题可能已有人提出,也可能已在最新版本中被修正)
13 | - 如果你发现一个已经关闭的旧 Issue 在最新版本中仍然存在,不要在旧 Issue 下面留言,请建一个新的 issue。
14 |
15 | - type: textarea
16 | id: functionContent
17 | attributes:
18 | label: 这个功能解决了什么问题
19 | description: 请详尽说明这个需求的用例和场景。最重要的是:解释清楚是怎样的用户体验需求催生了这个功能上的需求。我们将考虑添加在现有 API 无法轻松实现的功能。新功能的用例也应当足够常见。
20 | placeholder: 请填写
21 | validations:
22 | required: true
23 |
24 | - type: textarea
25 | id: functionalExpectations
26 | attributes:
27 | label: 你建议的方案是什么
28 | placeholder: 请填写
29 | validations:
30 | required: true
31 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
6 |
7 | ### 🤔 这个 PR 的性质是?
8 |
9 | - [ ] 日常 bug 修复
10 | - [ ] 新特性提交
11 | - [ ] 文档改进
12 | - [ ] 演示代码改进
13 | - [ ] 组件样式/交互改进
14 | - [ ] CI/CD 改进
15 | - [ ] 重构
16 | - [ ] 代码风格优化
17 | - [ ] 测试用例
18 | - [ ] 分支合并
19 | - [ ] 其他
20 |
21 | ### 🔗 相关 Issue
22 |
23 |
26 |
27 | ### 💡 需求背景和解决方案
28 |
29 |
34 |
35 | ### 📝 更新日志
36 |
37 |
40 |
41 | - fix(组件名称): 处理问题或特性描述 ...
42 |
43 | - [ ] 本条 PR 不需要纳入 Changelog
44 |
45 | ### ☑️ 请求合并前的自查清单
46 |
47 | ⚠️ 请自检并全部**勾选全部选项**。⚠️
48 |
49 | - [ ] 文档已补充或无须补充
50 | - [ ] 代码演示已提供或无须提供
51 | - [ ] TypeScript 定义已补充或无须补充
52 | - [ ] Changelog 已提供或无须提供
53 |
--------------------------------------------------------------------------------
/.github/workflows/auto-release.yml:
--------------------------------------------------------------------------------
1 | name: Auto Release
2 |
3 | on:
4 | pull_request:
5 | branches: [develop]
6 | types: [opened, synchronize, reopened, closed]
7 | paths:
8 | - 'package.json'
9 | issue_comment:
10 | types: [edited]
11 |
12 | jobs:
13 | generator:
14 | runs-on: ubuntu-latest
15 | if: >
16 | github.event_name == 'pull_request' &&
17 | github.event.pull_request.merged == false &&
18 | startsWith(github.head_ref, 'release/')
19 | steps:
20 | - run: echo "The head of this PR starts with 'release/'"
21 | - uses: actions/checkout@v3
22 | - uses: TDesignOteam/tdesign-changelog-action@main
23 | id: changelog
24 | env:
25 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 | - name: Add comment
27 | uses: peter-evans/create-or-update-comment@v1
28 | with:
29 | issue-number: ${{ github.event.pull_request.number }}
30 | body: |
31 | ${{ steps.changelog.outputs.changelog }}
32 | comment_add_log:
33 | runs-on: ubuntu-latest
34 | if: >
35 | github.event_name == 'issue_comment'
36 | && github.event.issue.pull_request
37 | && github.event.sender.login == github.event.issue.user.login
38 | && startsWith(github.event.comment.body, '## 🌈 ')
39 | steps:
40 | - id: comment
41 | shell: bash
42 | run: |
43 | result=$(curl ${{github.event.issue.pull_request.url}} -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}")
44 | headrefreg='"ref": "(release/[[:digit:]]{1,2}\.[[:digit:]]{1,2}\.[[:digit:]]{1,2})",'
45 | if [[ $result =~ $headrefreg ]]
46 | then
47 | echo "属于 release pr 的 comment ${BASH_REMATCH[1]}"
48 | else
49 | echo "不属于 release pr 的 comment" && exit 1
50 | fi
51 | echo "::set-output name=branch::${BASH_REMATCH[1]}"
52 | # zsh $match[1]
53 | - uses: actions/checkout@v3
54 | with:
55 | ref: ${{ steps.comment.outputs.branch }}
56 | - name: Commit and push if needed
57 | env:
58 | BODY: ${{ github.event.comment.body }}
59 | run: |
60 | txt=$(cat CHANGELOG.md)
61 | echo "${txt%%##*}$BODY${txt##*---}" > CHANGELOG.md
62 | git add .
63 | git config --local user.email "github-actions[bot]@users.noreply.github.com"
64 | git config --local user.name "github-actions[bot]"
65 | git commit -m "chore: changelog's changes"
66 | git push
67 | echo "💾 pushed changelog's changes"
68 | merge_tag:
69 | runs-on: ubuntu-latest
70 | if: >
71 | github.event_name == 'pull_request' &&
72 | github.event.pull_request.merged == true &&
73 | startsWith(github.head_ref, 'release/')
74 | steps:
75 | - uses: actions/checkout@v3
76 | with:
77 | ref: develop
78 | token: ${{ secrets.PERSONAL_TOKEN }}
79 | - name: tag and push if needed
80 | run: |
81 | data=$(cat package.json)
82 | re="\"version\": \"([^\"]*)\""
83 | [[ $data =~ $re ]]
84 | echo "${BASH_REMATCH[1]}"
85 | git config --local user.email "github-actions[bot]@users.noreply.github.com"
86 | git config --local user.name "github-actions[bot]"
87 | git tag ${BASH_REMATCH[1]}
88 | git push origin ${BASH_REMATCH[1]}
89 | echo "pushed tag ${BASH_REMATCH[1]}"
90 |
--------------------------------------------------------------------------------
/.github/workflows/issue-assignees.temp.yml:
--------------------------------------------------------------------------------
1 | # force copy from tencent/tdesign
2 | name: Issue Add Assigness
3 |
4 | on:
5 | issues:
6 | types: [opened, edited]
7 |
8 | jobs:
9 | mark-duplicate:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - uses: wow-actions/auto-comment@v1
13 | with:
14 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 | issuesOpened: |
16 | 👋 @{{ author }},感谢给 TDesign 提出了 issue。
17 | 请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。
18 |
19 | # https://docs.github.com/cn/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#issues
20 | - uses: 94dreamer/issue-assignees@main
21 | id: assignees
22 | with:
23 | project_name: ${{github.event.repository.name}}
24 | issue_title: ${{github.event.issue.title}}
25 |
26 | - run: echo ${{ steps.assignees.outputs.contributors }}
27 | - name: Add assigness
28 | if: steps.assignees.outputs.contributors != ''
29 | uses: actions-cool/issues-helper@v3
30 | with:
31 | actions: 'add-assignees'
32 | token: ${{ secrets.GITHUB_TOKEN }}
33 | issue-number: ${{ github.event.issue.number }}
34 | assignees: ${{ steps.assignees.outputs.contributors }}
35 |
36 | - run: |
37 | contributors=${{ steps.assignees.outputs.contributors }}
38 | contributorstring=${contributors//,/ @}
39 | echo "::set-output name=string::@$contributorstring"
40 | id: contributors
41 |
42 | - name: 通知贡献者
43 | if: steps.assignees.outputs.contributors != ''
44 | uses: actions-cool/maintain-one-comment@v2.0.0
45 | with:
46 | token: ${{ secrets.GITHUB_TOKEN }}
47 | body: |
48 | ♥️ 有劳 ${{ steps.contributors.outputs.string }} 尽快确认问题。
49 | 确认有效后将下一步计划和可能需要的时间回复给 @${{ github.event.issue.user.login }} 。
50 |
51 | number: ${{ github.event.issue.number }}
52 | body-include: ""
53 |
--------------------------------------------------------------------------------
/.github/workflows/issue-help-wanted.temp.yml:
--------------------------------------------------------------------------------
1 | # force copy from tencent/tdesign
2 | name: Issue Help wanted
3 | on:
4 | issues:
5 | types:
6 | - labeled
7 | jobs:
8 | add-comment:
9 | if: github.event.label.name == 'help wanted'
10 | runs-on: ubuntu-latest
11 | permissions:
12 | issues: write
13 | steps:
14 | - name: Add comment
15 | uses: peter-evans/create-or-update-comment@v1
16 | with:
17 | issue-number: ${{ github.event.issue.number }}
18 | body: |
19 | 任何人都可以处理此问题。
20 | **请务必在您的 `pull request` 中引用此问题。** :sparkles:
21 | 感谢你的贡献! :sparkles:
22 | reactions: heart
--------------------------------------------------------------------------------
/.github/workflows/issue-mark-duplicate.temp.yml:
--------------------------------------------------------------------------------
1 | # force copy from tencent/tdesign
2 | # 当在 issue 的 comment 回复类似 `Duplicate of #111` 这样的话,issue 将被自动打上 重复提交标签 并且 cloese
3 | name: Issue Mark Duplicate
4 |
5 | on:
6 | issue_comment:
7 | types: [created, edited]
8 |
9 | jobs:
10 | mark-duplicate:
11 | runs-on: ubuntu-latest
12 | steps:
13 | - name: mark-duplicate
14 | uses: actions-cool/issues-helper@v2
15 | with:
16 | actions: "mark-duplicate"
17 | token: ${{ secrets.GITHUB_TOKEN }}
18 | duplicate-labels: "duplicate"
19 | close-issue: true
20 |
--------------------------------------------------------------------------------
/.github/workflows/issue-reply.temp.yml:
--------------------------------------------------------------------------------
1 | # force copy from tencent/tdesign
2 | # 当被打上 Need Reproduce 标签时候,自动提示需要重现实例
3 |
4 | name: ISSUE_REPLY
5 |
6 | on:
7 | issues:
8 | types: [labeled]
9 |
10 | jobs:
11 | issue-reply:
12 | runs-on: ubuntu-latest
13 | steps:
14 | - name: Need Reproduce
15 | if: github.event.label.name == 'Need Reproduce'
16 | uses: actions-cool/issues-helper@v2
17 | with:
18 | actions: 'create-comment'
19 | issue-number: ${{ github.event.issue.number }}
20 | body: |
21 | 你好 @${{ github.event.issue.user.login }}, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 [此处](https://codesandbox.io/) 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。请确保选择准确的版本。
22 |
--------------------------------------------------------------------------------
/.github/workflows/issue-stale-close.temp.yml:
--------------------------------------------------------------------------------
1 | # force copy from tencent/tdesign
2 | # 国际标准时间+8
3 | name: Close stale issues and PRs
4 | on:
5 | schedule:
6 | - cron: "50 5 * * *"
7 |
8 | jobs:
9 | close-issues:
10 | runs-on: ubuntu-latest
11 | permissions:
12 | issues: write
13 | pull-requests: write
14 | steps:
15 | - uses: actions/stale@v4
16 | with:
17 | stale-issue-message: "这个 Issue 被标记为了过时 stale ,因为它已经持续 30 天没有任何活动了。删除 stale 标签或评论,否则将在 7 天内关闭。"
18 | stale-pr-message: '这个 PR 已经过时了,因为它已经持续 45 天没有任何活动了。 删除 stale 的标签或评论,否则将在 10 天内关闭。'
19 | close-issue-message: "此 Issue 被自动关闭,因为它自被标记为过时 stale 以来已闲置 7 天。"
20 | close-pr-message: "此 PR 被自动关闭,因为它已经 stable 停滞了 10 天,没有任何活动。"
21 | days-before-stale: 30
22 | days-before-close: 7
23 | days-before-pr-stale: 45
24 | days-before-pr-close: 10
25 | repo-token: ${{ secrets.GITHUB_TOKEN }}
26 | exempt-issue-labels: 'WIP'
27 | exempt-pr-labels: 'WIP'
--------------------------------------------------------------------------------
/.github/workflows/preview.yml:
--------------------------------------------------------------------------------
1 | name: Build & deploy
2 | on:
3 | pull_request:
4 | branches:
5 | - develop
6 | jobs:
7 | build:
8 | name: Build
9 | runs-on: ubuntu-latest
10 |
11 | steps:
12 | - uses: actions/checkout@v4
13 | - uses: actions/setup-node@v4
14 | with:
15 | node-version: "20"
16 | - uses: oven-sh/setup-bun@v2
17 | with:
18 | bun-version: latest
19 | - run: npm install pnpm -g && pnpm install && pnpm build
20 | - run: bun scripts/deploy.ts
21 | - run: sleep 3s
22 | - run: |
23 | npx surge --project ./dist --domain tdesign-starter-cli.surge.sh --token ${{ secrets.TDESIGN_SURGE_TOKEN }}
24 | ls dist
25 |
--------------------------------------------------------------------------------
/.github/workflows/tag-push.yml:
--------------------------------------------------------------------------------
1 | # 文件名建议统一为 tag-push.yml
2 | # 应用 publish.yml 的 demo
3 |
4 | name: TAG_PUSH
5 |
6 | on: create
7 |
8 | jobs:
9 | call-publish:
10 | uses: Tencent/tdesign/.github/workflows/publish.yml@main
11 | secrets:
12 | TDESIGN_SURGE_TOKEN: ${{ secrets.TDESIGN_SURGE_TOKEN }}
13 | TDESIGN_NPM_TOKEN: ${{ secrets.TDESIGN_NPM_TOKEN }}
14 | PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 | /tests/**/coverage/
5 |
6 | # local env files
7 | .env.local
8 | .env.*.local
9 |
10 | # Log files
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 | pnpm-debug.log*
15 |
16 | # Editor directories and files
17 | .idea
18 | #.vscode
19 | .history
20 | .ionide
21 | *.suo
22 | *.ntvs*
23 | *.njsproj
24 | *.sln
25 | *.sw?
26 | yarn.lock
27 | package-lock.json
28 | pnpm-lock.yaml
29 | .temp
30 | .auth
31 | .env.development
32 | .env.test
33 | src/config/ConfigDev.ts
34 | /test
35 | /bin/*
36 |
37 | # 测试文件
38 | template-vite-*
39 | template-webpack-*
40 | template-farm-*
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | dist
2 | node_modules
3 | bin
4 |
--------------------------------------------------------------------------------
/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | // 一行最多 120 字符
3 | printWidth: 150,
4 | // 使用 2 个空格缩进
5 | tabWidth: 2,
6 | // 不使用缩进符,而使用空格
7 | useTabs: false,
8 | // 行尾需要有分号
9 | semi: true,
10 | // 使用单引号
11 | singleQuote: true,
12 | // 对象的 key 仅在必要时用引号
13 | quoteProps: 'as-needed',
14 | // jsx 不使用单引号,而使用双引号
15 | jsxSingleQuote: false,
16 | // 末尾需要有逗号
17 | trailingComma: 'none',
18 | // 大括号内的首尾需要空格
19 | bracketSpacing: true,
20 | // jsx 标签的反尖括号需要换行
21 | jsxBracketSameLine: false,
22 | // 箭头函数,只有一个参数的时候,也需要括号
23 | arrowParens: 'always',
24 | // 每个文件格式化的范围是文件的全部内容
25 | rangeStart: 0,
26 | rangeEnd: Infinity,
27 | // 不需要写文件开头的 @prettier
28 | requirePragma: false,
29 | // 不需要自动在文件开头插入 @prettier
30 | insertPragma: false,
31 | // 使用默认的折行标准
32 | proseWrap: 'preserve',
33 | // 根据显示样式决定 html 要不要折行
34 | htmlWhitespaceSensitivity: 'css',
35 | // vue 文件中的 script 和 style 内不用缩进
36 | vueIndentScriptAndStyle: false,
37 | // 换行符使用 lf
38 | endOfLine: 'lf'
39 | };
40 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint", "streetsidesoftware.code-spell-checker"]
3 | }
4 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "typescript.preferences.importModuleSpecifier": "relative",
3 | "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
4 | "[html]": {
5 | "editor.formatOnSave": true,
6 | "editor.defaultFormatter": "vscode.html-language-features"
7 | },
8 | "[typescript]": {
9 | "editor.formatOnSave": true,
10 | "editor.defaultFormatter": "vscode.typescript-language-features"
11 | },
12 | "[javascript]": {
13 | "editor.formatOnSave": true,
14 | "editor.defaultFormatter": "esbenp.prettier-vscode"
15 | },
16 | "editor.codeActionsOnSave": {
17 | "source.fixAll.eslint": "explicit"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 |
2 | ## 🌈 0.5.3 `2024-09-05`
3 | ### 🚧 Others
4 | - docs: 添加`tdesign-starter-cli`的使用说明 @RSS1102 ([#84](https://github.com/Tencent/tdesign-starter-cli/pull/84))
5 | ## 🌈 0.5.2 `2024-08-19`
6 | ### 🚀 Features
7 | - style: 统一模板页面样式 @RSS1102 ([#78](https://github.com/Tencent/tdesign-starter-cli/pull/78))
8 | ### 🐞 Bug Fixes
9 | - fix: 修复 `cli` 命令行中构建工具类型 (buildToolType) 缺少 `farm` 参数的问题 @RSS1102 ([#74](https://github.com/Tencent/tdesign-starter-cli/pull/74))
10 |
11 | ## 🌈 0.5.1 `2024-06-05`
12 | ### 🚀 Features
13 | - 新增`farm`模版 @RSS1102 ([#61](https://github.com/Tencent/tdesign-starter-cli/pull/61))
14 | - 新增命令行创建具体模版的功能支持 @RSS1102 ([#63](https://github.com/Tencent/tdesign-starter-cli/pull/63))
15 |
16 | ## 0.5.0 `2024-05-09`
17 |
18 | ### Breaking Change
19 |
20 | - 依赖项目升级至最新版本,要求 Node 版本高于 `16` 使用
21 |
22 | ### Features
23 |
24 | - 优化 Vite Lite 模板内容
25 |
26 | ## 0.4.2 `2023-11-10`
27 |
28 | ### Bug Fixes
29 |
30 | - 修复部分用户按照脚手架冲突的问题
31 |
32 | ## 0.4.1 `2023-07-19`
33 |
34 | ### Features
35 |
36 | - Lite 默认使用最新版本的组件库
37 | - Lite 版本新增 .gitignore 文件
38 |
39 | ## 0.4.0 `2023-05-30`
40 |
41 | ### Features
42 |
43 | - 新增小程序`零售电商`模版下载
44 | - 新增移动端 vue3`即时通讯`模版下载
45 |
46 | ## 0.3.3 `2023-02-22`
47 |
48 | ### Bug Fixes
49 |
50 | - 修复下载 Vue3 版本指定页面选项功能失效的问题
51 |
52 | ## 0.3.2 `2022-09-26`
53 |
54 | ### Features
55 |
56 | - Lite 模板新增 webpack 版本 @sscode02 in #34
57 |
58 | ## 0.3.1 `2022-08-23`
59 |
60 | ### Bug Fixes
61 |
62 | - 修复下载 `Lite` 版本指令在 windows 系统的使用问题
63 |
64 | ## 0.3.0 `2022-08-22`
65 |
66 | ### Features
67 |
68 | - 新增 `Lite` 版本模板下载,只包含基本的 TDesign 引入及使用
69 |
70 | ## 0.2.5 `2022-08-03`
71 |
72 | ### Bug Fixes
73 |
74 | - 修复国内托管平台权限策略变更导致拉取模板失败的问题
75 |
76 | ## 0.2.4 `2022-06-27`
77 |
78 | ### Features
79 |
80 | - 自定义模式下移除无效的引用
81 |
82 | ## 0.2.3 `2022-06-02`
83 |
84 | ### Bug Fixes
85 |
86 | - 修复自定义创建项目时图标加载的问题
87 |
88 | ## 0.2.2 `2022-05-08`
89 |
90 | ### Features
91 |
92 | - 配合模板新增维护中页面升级
93 |
94 | ## 0.2.1 `2022-04-22`
95 |
96 | ### Features
97 |
98 | - 支持 React 模板选择指定页面模块的功能
99 |
100 | ## 0.2.0 `2022-03-08`
101 |
102 | ### Features
103 |
104 | - 新增 React 选项,支持下载 react starter kit
105 |
106 | ## 0.1.0 `2022-02-21`
107 |
108 | ### Features
109 |
110 | - 新增通过 CLI 选择指定页面模块的功能
111 |
112 | ## 0.0.7 `2022-02-14`
113 |
114 | ### Features
115 |
116 | - 使用 coding 平台托管的代码取代 github 代理的镜像用于拉取代码
117 |
118 | ## 0.0.6 `2022-01-20`
119 |
120 | ### Bug Fixes
121 |
122 | 1. 替换请求模板镜像,处理部分国内用户请求问题
123 | 2. 增加请求失败的错误提示
124 |
125 | ## 0.0.5 `2021-12-29`
126 |
127 | ### Bug Fixes
128 |
129 | 1. 修复国内用户请求问题
130 | 2. 修复 windows 系统下的使用问题
131 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021-present TDesign
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/README-zh_CN.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | [English](./README.md) | 简体中文
21 |
22 | > 注意您的本机安装的Node版本需要`>=16`。
23 |
24 | ## 安装
25 |
26 | ```shell
27 | npm install tdesign-starter-cli -g
28 | ```
29 |
30 | ## 使用
31 |
32 | ### 交互式操作
33 |
34 | ```sh
35 |
36 | # 初始化项目
37 | td-starter init
38 |
39 | # 填写 项目名称、项目描述
40 | ? 请输入项目名称: [project-name]
41 | ? 请输入项目描述: Base on tdesign-starter-cli
42 | ...
43 |
44 | cd [project-name]
45 |
46 | # 安装依赖
47 | npm install
48 |
49 | # 运行
50 | npm run dev
51 |
52 | ```
53 |
54 | ### Command Operation
55 |
56 | ```sh
57 |
58 | # 初始化项目
59 | td-starter init [project name] [root]
60 |
61 | cd [project-name]
62 |
63 | # 安装依赖
64 | npm install
65 |
66 | # 运行
67 | npm run dev
68 |
69 | ```
70 |
71 | #### 示例
72 |
73 | ``` sh
74 | td-starter init tdesign-vue3-farm --type vue3 --buildToolType farm
75 | ```
76 |
77 | ``` sh
78 | td-starter init tdesign-vue3-farm -type vue3 -bt farm
79 | ```
80 |
81 | ### 选项
82 |
83 | | 选项 | 描述 |
84 | |-------------------------------------|-----------------------------------------------------------------------------|
85 | | -d, --description \ | 项目描述 (默认: "Base on tdesign-starter-cli") |
86 | | -type, --type \ | 项目框架 vue2 \| vue3 \| react \| miniProgram \| mobileVue (默认: "vue2") |
87 | | -temp, --template \ | 项目模板类型: lite \| all (默认: "lite") |
88 | | -bt, --buildToolType \| Lite 的构建工具: vite \| webpack (默认: "vite") |
89 | | -h, --help | 显示命令的帮助 |
90 |
91 | ## 预览
92 |
93 | ### Vite + React/Vue2/Vue3
94 |
95 | - [vite-react](https://tencent-tdesign-starter-cli.surge.sh/template-vite-react/index.html)
96 | - [vite-vue2](https://tencent-tdesign-starter-cli.surge.sh/template-vite-vue2/index.html)
97 | - [vite-vue3](https://tencent-tdesign-starter-cli.surge.sh/template-vite-vue3/index.html)
98 |
99 | ### Farm + React/Vue2/Vue3
100 |
101 | - [farm-react](https://tencent-tdesign-starter-cli.surge.sh/template-farm-react/index.html)
102 | - [farm-vue2](https://tencent-tdesign-starter-cli.surge.sh/template-farm-vue2/index.html)
103 | - [farm-vue3](https://tencent-tdesign-starter-cli.surge.sh/template-farm-vue3/index.html)
104 |
105 | ### Webpack + React/Vue2/Vue3
106 |
107 | - [webpack-react](https://tencent-tdesign-starter-cli.surge.sh/template-webpack-react/index.html)
108 | - [webpack-vue2](https://tencent-tdesign-starter-cli.surge.sh/template-webpack-vue2/index.html)
109 | - [webpack-vue3](https://tencent-tdesign-starter-cli.surge.sh/template-webpack-vue3/index.html)
110 |
111 | ## 开源协议
112 |
113 | TDesign 遵循 [MIT 协议](https://github.com/Tencent/tdesign-starter-cli/LICENSE)。
114 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | English | [简体中文](./README-zh_CN.md)
21 |
22 | > Please note that the Node version installed on your local machine needs to be `>=16`.
23 |
24 | ## Install
25 |
26 | ```shell
27 | npm install tdesign-starter-cli -g
28 | ```
29 |
30 | ## Usage
31 |
32 | ### Interactive Operation
33 |
34 | ```sh
35 |
36 | # project initialization
37 | td-starter init
38 |
39 | # fill project name and description
40 | ? 请输入项目名称: [project-name]
41 | ? 请输入项目描述: Base on tdesign-starter-cli
42 | ...
43 |
44 | cd [project-name]
45 |
46 | # install dependencies
47 | npm install
48 |
49 | # run dev
50 | npm run dev
51 |
52 | ```
53 |
54 | ### Command Operation
55 |
56 | ```sh
57 |
58 | # project initialization
59 | td-starter init [project name] [root]
60 |
61 | cd [project-name]
62 |
63 | # install dependencies
64 | npm install
65 |
66 | # run dev
67 | npm run dev
68 |
69 | ```
70 |
71 | #### Example
72 |
73 | ``` sh
74 | td-starter init tdesign-vue3-farm --type vue3 --buildToolType farm
75 | ```
76 |
77 | ``` sh
78 | td-starter init tdesign-vue3-farm -type vue3 -bt farm
79 | ```
80 |
81 | ### Command Options
82 |
83 | | Option | Description |
84 | |-------------------------------------|-----------------------------------------------------------------------------|
85 | | -d, --description \ | description of a project (default: "Base on tdesign-starter-cli") |
86 | | -type, --type \ | Code version vue2 \| vue3 \| react \| miniProgram \| mobileVue (default: "vue2") |
87 | | -temp, --template \ | Project template type: lite \| all (default: "lite") |
88 | | -bt, --buildToolType \| The construction tool for lite: vite \| webpack (default: "vite") |
89 | | -h, --help | display help for command |
90 |
91 | ## Preview
92 |
93 | ### Vite + React/Vue2/Vue3
94 |
95 | - [vite-react](https://tencent-tdesign-starter-cli.surge.sh/template-vite-react/index.html)
96 | - [vite-vue2](https://tencent-tdesign-starter-cli.surge.sh/template-vite-vue2/index.html)
97 | - [vite-vue3](https://tencent-tdesign-starter-cli.surge.sh/template-vite-vue3/index.html)
98 |
99 | ### Farm + React/Vue2/Vue3
100 |
101 | - [farm-react](https://tencent-tdesign-starter-cli.surge.sh/template-farm-react/index.html)
102 | - [farm-vue2](https://tencent-tdesign-starter-cli.surge.sh/template-farm-vue2/index.html)
103 | - [farm-vue3](https://tencent-tdesign-starter-cli.surge.sh/template-farm-vue3/index.html)
104 |
105 | ### Webpack + React/Vue2/Vue3
106 |
107 | - [webpack-react](https://tencent-tdesign-starter-cli.surge.sh/template-webpack-react/index.html)
108 | - [webpack-vue2](https://tencent-tdesign-starter-cli.surge.sh/template-webpack-vue2/index.html)
109 | - [webpack-vue3](https://tencent-tdesign-starter-cli.surge.sh/template-webpack-vue3/index.html)
110 |
111 | ### License
112 |
113 | The MIT License. Please see [the license file](LICENSE) for more information.
114 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tdesign-starter-cli",
3 | "version": "0.5.3",
4 | "description": "CLI tool for TDesign Starter project",
5 | "type": "module",
6 | "main": "./src/main.ts",
7 | "lib": "./bin/index.js",
8 | "bin": {
9 | "td-starter": "./bin/index.js"
10 | },
11 | "typings": "./src/types/index.d.ts",
12 | "scripts": {
13 | "watch": "rollup -w -c",
14 | "test": "npm run dev",
15 | "dev": "node ./bin/index.js",
16 | "prebuild": "rimraf bin/",
17 | "build": "rollup -c ",
18 | "lint": "eslint 'src/**/*.{js,ts}'",
19 | "site": "echo 'no need to build site'",
20 | "site:preview": "echo 'no need to run site preview'"
21 | },
22 | "repository": {
23 | "type": "git",
24 | "url": "https://github.com/tencent/tdesign-starter-cli.git"
25 | },
26 | "license": "MIT",
27 | "devDependencies": {
28 | "@babel/cli": "7.24.1",
29 | "@babel/core": "7.24.4",
30 | "@babel/eslint-plugin": "^7.23.5",
31 | "@babel/plugin-proposal-export-default-from": "7.24.1",
32 | "@babel/plugin-transform-runtime": "7.24.3",
33 | "@babel/preset-env": "7.24.4",
34 | "@babel/preset-typescript": "^7.24.1",
35 | "@rollup/plugin-babel": "^6.0.4",
36 | "@rollup/plugin-json": "6.1.0",
37 | "@rollup/plugin-node-resolve": "15.2.3",
38 | "@rollup/plugin-terser": "^0.4.4",
39 | "@rollup/plugin-typescript": "^11.1.6",
40 | "@types/babel__core": "^7.20.5",
41 | "@types/node": "^22.1.0",
42 | "@types/shelljs": "^0.8.15",
43 | "@typescript-eslint/eslint-plugin": "7.7.0",
44 | "@typescript-eslint/parser": "7.7.0",
45 | "babel-loader": "9.1.3",
46 | "eslint": "^8.56.0",
47 | "prettier": "^3.2.5",
48 | "rollup": "^4.29.1",
49 | "rollup-plugin-copy": "3.5.0"
50 | },
51 | "dependencies": {
52 | "@babel/plugin-transform-typescript": "^7.24.4",
53 | "@babel/runtime": "7.24.4",
54 | "@types/chalk": "2.2.0",
55 | "@types/commander": "2.12.2",
56 | "@types/fs-extra": "11.0.4",
57 | "@types/inquirer": "9.0.7",
58 | "@types/node": "20.12.7",
59 | "@types/rimraf": "4.0.5",
60 | "axios": "~1.7.4",
61 | "chalk": "5.3.0",
62 | "clear": "0.1.0",
63 | "commander": "12.0.0",
64 | "del": "7.1.0",
65 | "download-git-repo": "3.0.2",
66 | "figlet": "1.7.0",
67 | "fs-extra": "11.2.0",
68 | "glob": "^10.3.12",
69 | "husky": "9.0.11",
70 | "inquirer": "9.2.19",
71 | "is-ci": "3.0.1",
72 | "lint-staged": "15.2.2",
73 | "lodash": "4.17.21",
74 | "minimist": "1.2.8",
75 | "ora": "8.0.1",
76 | "rimraf": "5.0.5",
77 | "shelljs": "^0.8.5",
78 | "tslib": "2.6.2",
79 | "typescript": "5.4.5"
80 | },
81 | "husky": {
82 | "hooks": {
83 | "pre-commit": "lint-staged"
84 | }
85 | },
86 | "lint-staged": {
87 | "*.{js,ts,json}": [
88 | "prettier --write",
89 | "npm run lint"
90 | ]
91 | },
92 | "files": [
93 | "bin/*",
94 | "dist/*",
95 | "types/*",
96 | "package.json",
97 | "docs/*",
98 | "template/*"
99 | ],
100 | "engines": {
101 | "node": ">=16.0.0"
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/publish.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 | npm config get registry
4 | # 登陆输入自己的npm账号和密码,还有邮箱
5 | echo '登录'
6 | npm login
7 | echo "发布中..."
8 | npm publish
9 |
10 | echo -e "\n发布成功\n"
11 | exit
12 |
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | import path from 'path';
2 |
3 | import babel from '@rollup/plugin-babel';
4 | import nodeResolve from '@rollup/plugin-node-resolve';
5 | import typescript from 'typescript';
6 | import json from '@rollup/plugin-json';
7 | import terser from '@rollup/plugin-terser';
8 | import rollupTypescript from '@rollup/plugin-typescript';
9 | import pkg from './package.json' with { type: 'json' };
10 | import copy from 'rollup-plugin-copy';
11 | import { dirname } from 'path';
12 | import { fileURLToPath } from 'url';
13 |
14 | const __dirname = dirname(fileURLToPath(import.meta.url));
15 |
16 | const extensions = ['.js', '.ts'];
17 |
18 | const external = Object.keys(pkg.dependencies || '');
19 | const globals = external.reduce((prev, current) => {
20 | const newPrev = prev;
21 | newPrev[current] = current;
22 | return newPrev;
23 | }, {});
24 |
25 | const defaultConfig = {
26 | input: pkg.main,
27 | output: {
28 | file: path.join(__dirname, pkg.lib),
29 | format: 'es',
30 | banner: '#!/usr/bin/env node',
31 | globals
32 | },
33 | external,
34 | plugins: [
35 | rollupTypescript({
36 | exclude: 'node_modules/**',
37 | typescript,
38 | tsconfig: './tsconfig.json'
39 | }),
40 | json(),
41 | terser(),
42 | nodeResolve({
43 | extensions,
44 | modulesOnly: true,
45 | // 查找和打包node_modules中的第三方模块
46 | customResolveOptions: {
47 | moduleDirectories: ['src']
48 | },
49 | preferBuiltins: true
50 | }),
51 | babel({
52 | exclude: 'node_modules/**',
53 | extensions
54 | }),
55 | // 复制templates文件; 复制 .gitignore 文件;添加.npmignore文件:"!.gitignore\n.npmignore"
56 | copy({
57 | targets: [
58 | 'templates/farm/vue-lite',
59 | 'templates/farm/vue-next-lite',
60 | 'templates/farm/react-lite',
61 | 'templates/vite/vue-lite',
62 | 'templates/vite/vue-next-lite',
63 | 'templates/vite/react-lite',
64 | 'templates/webpack/vue-lite',
65 | 'templates/webpack/vue-next-lite',
66 | 'templates/webpack/react-lite',
67 | ]
68 | .map((filePath) => [
69 | {
70 | src: [`${filePath}/*`, `${filePath}/.gitignore`, `!${filePath}/node_modules`],
71 | dest: `bin/${filePath}`
72 | },
73 | {
74 | src: `${filePath}/.gitignore`,
75 | dest: `bin/${filePath}`,
76 | rename: '.npmignore',
77 | transform: () => Buffer.from('!.gitignore\n.npmignore', 'utf-8')
78 | }
79 | ])
80 | .flat(),
81 | verbose: true
82 | })
83 | ]
84 | };
85 |
86 | export default defaultConfig;
87 |
--------------------------------------------------------------------------------
/src/core/CoreIndex.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-case-declarations */
2 | import chalk from 'chalk';
3 | import clear from 'clear';
4 | import ora from 'ora';
5 | import figlet from 'figlet';
6 | import { CoreSelector } from './CoreSelector';
7 | import { CoreInquirer } from './CoreInquirer';
8 | import { CoreGitDownloader } from './CoreGitDownloader';
9 | import fs from 'fs';
10 | import { CoreLiteInquirer } from './core-lite/CoreLiteInquirer';
11 | import { CoreBuildToolInquirer } from './core-lite/CoreBuildToolInquirer';
12 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
13 | import { CoreJsTransformInquirer } from './core-js-transform/CoreJsTransformInquirer';
14 | import { CreatorOptions, SupportedTemplateSize } from '../types/type';
15 | import { CoreLiteDownloader } from './core-lite/CoreLiteDownloader';
16 |
17 | class Creator {
18 | constructor(name: string, options: Omit, command: any) {
19 | clear();
20 | console.log('*****************************');
21 | console.log(chalk.green(figlet.textSync('TDesign Starter', { horizontalLayout: 'full' })));
22 | console.log('*****************************');
23 | console.log();
24 |
25 | const spinner = ora('👉 检查构建环境...').start();
26 |
27 |
28 | // 如果有name参数,直接下载模板
29 | if (name) {
30 | const answer: CreatorOptions = {
31 | ...options,
32 | name,
33 | };
34 | let isValid = true;
35 |
36 | outerLoop: for (const key of Object.keys(options)) {
37 | switch (key) {
38 | case 'description':
39 | break;
40 | case 'type':
41 | if (!['vue2', 'vue3', 'react', 'miniProgram', 'mobileVue'].includes(options['type'])) {
42 | spinner.fail(chalk.red('type 参数错误,请输入vue2 | vue3 | react | miniProgram | mobileVue'));
43 | isValid = false;
44 | break outerLoop;
45 | }
46 | break;
47 | case 'template':
48 | if (!['lite', 'all'].includes(options['template'])) {
49 | spinner.fail(chalk.red('template 参数错误,请输入lite | all'));
50 | isValid = false;
51 | break outerLoop;
52 | }
53 | break;
54 | case 'buildToolType':
55 | if (!['vite', 'webpack', 'farm'].includes(options['buildToolType'])) {
56 | spinner.fail(chalk.red('buildToolType 参数错误,请输入vite | webpack | farm'));
57 | isValid = false;
58 | break outerLoop;
59 | }
60 | break;
61 | default:
62 | ora().fail(chalk.red('命令无效'));
63 | isValid = false;
64 | break outerLoop;
65 | }
66 | }
67 | if (!isValid) {
68 | return
69 | };
70 |
71 | spinner.succeed(chalk.green('构建环境正常!'));
72 | console.log();
73 |
74 | if (['miniProgram', 'mobileVue'].includes(options?.type)) {
75 | new CoreGitDownloader().syncDownload(answer);
76 | return;
77 | }
78 |
79 | switch (answer.template) {
80 | case 'lite':
81 | new CoreLiteDownloader().syncDownload(answer);
82 | break;
83 | default:
84 | new CoreSelector().interactionsSelect(answer).then((contentAnswer) => {
85 | new CoreGitDownloader().syncDownload(answer, contentAnswer);
86 | });
87 | }
88 | return;
89 | }
90 |
91 | spinner.succeed(chalk.green('构建环境正常!'));
92 | console.log();
93 | this.init();
94 |
95 | }
96 |
97 | /**
98 | * 前置条件满足,进入子程序
99 | *
100 | *
101 | * @memberOf Creator
102 | */
103 | public async init() {
104 | // 1.基本配置数据获取
105 | const answer = await new CoreInquirer().interactionsHandler();
106 |
107 | if (['miniProgram', 'mobileVue'].includes(answer?.type)) {
108 | await new CoreGitDownloader().syncDownload(answer);
109 | return;
110 | }
111 |
112 | // 2.询问生成简化版还是自定义版本
113 | const listOptions: { template: SupportedTemplateSize; name: string; description?: string } = await new CoreLiteInquirer().interactionsHandler();
114 |
115 | // 3.执行下载生成动作
116 | switch (listOptions.template) {
117 | case 'lite':
118 | // 极简版本处理逻辑
119 | // eslint-disable-next-line no-case-declarations
120 | const { buildToolType } = await new CoreBuildToolInquirer().interactionsHandler();
121 | const typed_Answer = answer as Pick;
122 | typed_Answer.buildToolType = buildToolType;
123 | await new CoreLiteDownloader().syncDownload(typed_Answer);
124 | break;
125 | default:
126 | // 自定义版本处理逻辑
127 | // 3-1.依据基本配置载下配置文件路由模板
128 | const contentAnswer = await new CoreSelector().interactionsSelect(answer);
129 |
130 | // 选择开发语言 javascript/typescript 【暂未发布】
131 | // const languageAnswer = await new CoreJsTransformInquirer().interactionsHandler();
132 | // const finalAnswer = { ...contentAnswer, ...languageAnswer };
133 |
134 | // 3-2.构建配置保存
135 | await new CoreGitDownloader().syncDownload(answer, contentAnswer);
136 | break;
137 | }
138 | }
139 |
140 | /**
141 | * 读写权限检测
142 | *
143 | * @private
144 | * @param {string} path
145 | * @returns {Promise}
146 | *
147 | * @memberOf Creator
148 | */
149 | private async checkReadAndWriteRights(path: string): Promise {
150 | return new Promise((resolve) => {
151 | fs.access(path, fs.constants.R_OK | fs.constants.W_OK, (err) => {
152 | if (err) {
153 | console.log("%s doesn't exist", path);
154 | resolve(false);
155 | } else {
156 | resolve(true);
157 | }
158 | });
159 | });
160 | }
161 | }
162 |
163 | export default Creator;
164 |
--------------------------------------------------------------------------------
/src/core/CoreInquirer.ts:
--------------------------------------------------------------------------------
1 | import inquirer, { QuestionCollection } from 'inquirer';
2 | import { CreatorOptions } from '../types/type';
3 |
4 | export class CoreInquirer {
5 | /**
6 | * 交互命令
7 | * @returns 命令行数组
8 | */
9 | public interactionsHandler() {
10 | // 提问模式
11 | const questions: QuestionCollection> = [
12 | {
13 | type: 'input',
14 | name: 'name',
15 | message: '请输入项目名称:',
16 | validate: (input: string) => {
17 | if (!input) {
18 | return '请输入项目名称!';
19 | }
20 | return true;
21 | }
22 | },
23 | {
24 | type: 'input',
25 | name: 'description',
26 | message: '请输入项目描述:',
27 | default: 'Base on tdesign-starter-cli'
28 | },
29 | {
30 | type: 'list',
31 | name: 'type',
32 | message: '选择模板类型:',
33 | choices: [
34 | { name: 'PC【Vue2】模板', value: 'vue2' },
35 | { name: 'PC【Vue3】模板', value: 'vue3' },
36 | { name: 'PC【React】模板', value: 'react' },
37 | { name: '移动端 【Vue3】即时通讯模板', value: 'mobileVue' },
38 | { name: '小程序 零售电商模板', value: 'miniProgram' }
39 | ],
40 | default: 'vue2' // 默认值为列表项编号,起始为 0
41 | }
42 | ];
43 |
44 | return inquirer.prompt(questions);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/core/CoreParsedConfig.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 数据结构接口
4 | *
5 | * @export
6 | * @interface IParsedSourceData
7 | */
8 | export interface IParsedSourceData {
9 | name?: string;
10 | path?: string;
11 | meta?: any;
12 | /** 是否需要在要排除的目录中 */
13 | isInExcludeList?: boolean;
14 | }
15 |
--------------------------------------------------------------------------------
/src/core/CoreTemplate.ts:
--------------------------------------------------------------------------------
1 | import { SupportedTemplate, ITemplateContent } from "../types/type";
2 |
3 | /**
4 | * 模板地址
5 | */
6 | export const templates: Record = {
7 | vue2: {
8 | url: 'https://github.com/Tencent/tdesign-vue-starter.git',
9 | description: 'TDesign Vue2 Starter',
10 | downloadUrl: 'direct:https://service-5ds77c8c-1257786608.hk.apigw.tencentcs.com/release/tdesign-vue-starter?download=true',
11 | routerData: 'https://service-5ds77c8c-1257786608.hk.apigw.tencentcs.com/release/vue-starter-router?download=true'
12 | },
13 | vue3: {
14 | url: 'https://github.com/Tencent/tdesign-vue-next-starter.git',
15 | description: 'TDesign Vue3 Starter',
16 | downloadUrl: 'direct:https://service-5ds77c8c-1257786608.hk.apigw.tencentcs.com/release/tdesign-vue-next-starter?download=true',
17 | fePermissionDownloadUrl:
18 | 'direct:https://service-5ds77c8c-1257786608.hk.apigw.tencentcs.com/release/tdesign-vue-next-starter/fe-permission?download=true',
19 | routerData: 'https://service-5ds77c8c-1257786608.hk.apigw.tencentcs.com/release/vue-next-starter-router?download=true'
20 | },
21 | react: {
22 | url: 'https://github.com/Tencent/tdesign-react-starter.git',
23 | description: 'TDesign React Starter',
24 | downloadUrl: 'direct:https://service-5ds77c8c-1257786608.hk.apigw.tencentcs.com/release/tdesign-react-starter?download=true',
25 | routerData: 'https://service-5ds77c8c-1257786608.hk.apigw.tencentcs.com/release/react-starter-router?download=true'
26 | },
27 | miniProgram: {
28 | url: 'https://github.com/Tencent/tdesign-miniprogram-starter-retail.git',
29 | description: 'TDesign MiniProgram Starter Retail',
30 | downloadUrl: 'direct:https://service-5ds77c8c-1257786608.hk.apigw.tencentcs.com/release/tdesign-miniprogram-starter-retail?download=true',
31 | routerData: '' // don't need
32 | },
33 | mobileVue: {
34 | url: 'https://github.com/TdesignOteam/tdesign-mobile-vue-starter-chat.git',
35 | description: 'TDesign Mobile Starter Chat',
36 | downloadUrl: 'direct:https://service-5ds77c8c-1257786608.hk.apigw.tencentcs.com/release/tdesign-mobile-starter-chat?download=true',
37 | routerData: '' // don't need
38 | }
39 | };
40 |
--------------------------------------------------------------------------------
/src/core/core-js-transform/CoreCodeReplace.ts:
--------------------------------------------------------------------------------
1 | import fs from 'fs';
2 | import path from 'path';
3 | import fse from 'fs-extra';
4 |
5 | async function replaceCodeCallback(filePath: string) {
6 | fs.readFile(filePath, 'utf-8', (err, content) => {
7 | const res = content.replace(/\.ts/g, '.js');
8 |
9 | // eslint-disable-next-line @typescript-eslint/no-empty-function
10 | fse.outputFile(filePath, res, () => {});
11 | });
12 | }
13 |
14 | function walkSync(paramPath: string) {
15 | fs.readdirSync(paramPath, { withFileTypes: true }).forEach(function (dirent) {
16 | const filePath = path.join(paramPath, dirent.name);
17 |
18 | if (dirent.isFile()) {
19 | replaceCodeCallback(filePath);
20 | } else if (dirent.isDirectory()) {
21 | walkSync(filePath);
22 | }
23 | });
24 | }
25 |
26 | export default function CodeReplaceTransformer(rootPath: string) {
27 | fs.readdirSync(rootPath, { withFileTypes: true }).forEach(function (dirent) {
28 | const filePath = path.join(rootPath, dirent.name);
29 |
30 | if (dirent.isFile()) {
31 | replaceCodeCallback(filePath);
32 | } else if (dirent.isDirectory()) {
33 | walkSync(filePath);
34 | }
35 | });
36 | }
37 |
--------------------------------------------------------------------------------
/src/core/core-js-transform/CoreJsTransformInquirer.ts:
--------------------------------------------------------------------------------
1 | import inquirer from 'inquirer';
2 | import { CoreInquirer } from '../CoreInquirer';
3 |
4 | /**
5 | *
6 | * @export
7 | * @class CoreLiteInquirer
8 | */
9 | export class CoreJsTransformInquirer extends CoreInquirer {
10 | /**
11 | * override 交互命令
12 | * @returns 命令行数组
13 | */
14 | public interactionsHandler() {
15 | const questions: Array<{ type: string; name: string; message: string; choices: Array>; default: string }> = [
16 | {
17 | type: 'list',
18 | name: 'lang',
19 | message: '语言版本选择',
20 | choices: [
21 | { name: 'TS版本', value: 'ts' },
22 | { name: 'JS版本', value: 'js' }
23 | ],
24 | default: 'ts'
25 | }
26 | ];
27 |
28 | return inquirer.prompt(questions);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/core/core-js-transform/CoreJsTransformer.ts:
--------------------------------------------------------------------------------
1 | import CoreTsCompiler from './CoreTsCompiler';
2 | import CoreSfcCompiler from './CoreSfcCompiler';
3 | import CoreCodeReplace from './CoreCodeReplace';
4 | import path from 'path';
5 | import shell from 'shelljs';
6 | import { glob } from 'glob';
7 | import fs from 'fs';
8 | export interface IJsTransformer {
9 | /**
10 | * 转换ts文件
11 | */
12 | transformTsFiles(options: { name: string }): Promise;
13 | /**
14 | * vue项目 转换sfc文件
15 | */
16 | transformSfcFiles(options: { name: string }): Promise;
17 | /**
18 | * 转换部分项目内特定存在的代码 如main.ts -> main.js
19 | */
20 | codeReplace(options: { name: string }): Promise;
21 | /**
22 | * 格式化文件
23 | */
24 | prettierFiles(options: { name: string }): Promise;
25 | /**
26 | * 去除多余的ts文件
27 | */
28 | clearTsFiles(options: { name: string }): Promise;
29 | }
30 |
31 | export class CoreJsTransformer implements IJsTransformer {
32 | public async transformTsFiles(options: { name: string }) {
33 | const destDir = path.resolve(process.cwd(), options.name);
34 | CoreTsCompiler(destDir);
35 | }
36 |
37 | public async transformSfcFiles(options: { name: string }) {
38 | const destDir = path.resolve(process.cwd(), options.name);
39 | CoreSfcCompiler(destDir);
40 | }
41 | public async codeReplace(options: { name: string }) {
42 | const destDir = path.resolve(process.cwd(), options.name);
43 | CoreCodeReplace(destDir);
44 | }
45 | public async prettierFiles(options: { name: string }) {
46 | const destDir = path.resolve(process.cwd(), options.name);
47 | shell.exec(`prettier --write ${destDir}`);
48 | }
49 | public async clearTsFiles(options: { name: string }) {
50 | const destDir = path.resolve(process.cwd(), options.name);
51 | const removeFiles = path.resolve(destDir, '**', '*');
52 | glob(removeFiles).then((files) => {
53 | files.forEach((file) => {
54 | if (/\.(ts|d.js)$/.test(file))
55 | // eslint-disable-next-line @typescript-eslint/no-empty-function
56 | fs.unlink(file, () => { });
57 | });
58 | });
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/core/core-js-transform/CoreSfcCompiler.ts:
--------------------------------------------------------------------------------
1 | import compiler from 'vue-template-compiler';
2 | import fs from 'fs';
3 | import path from 'path';
4 | import babel from '@babel/core';
5 | import fse from 'fs-extra';
6 |
7 | function fileWriteCallback(filePath: string) {
8 | fs.readFile(filePath, 'utf-8', (err, content) => {
9 | const parsed = compiler.parseComponent(content);
10 | const template = parsed.template ? parsed.template.content : '';
11 | // transform script
12 | const script = parsed.script ? parsed.script.content : '';
13 | const transformedScriptCode = babel.transform(script, {
14 | plugins: [
15 | [
16 | '@babel/plugin-transform-typescript',
17 | {
18 | onlyRemoveTypeImports: true
19 | }
20 | ]
21 | ]
22 | })?.code;
23 | const transformedScript = ``;
26 | // transform script setup
27 | // @ts-ignore
28 | const scriptSetup = parsed.scriptSetup ? parsed.scriptSetup.content : '';
29 | const transformedScriptSetupCode = babel.transform(scriptSetup, {
30 | plugins: [
31 | [
32 | '@babel/plugin-transform-typescript',
33 | {
34 | onlyRemoveTypeImports: true
35 | }
36 | ]
37 | ]
38 | })?.code;
39 | const transformedScriptSetup = ``;
42 |
43 | let styleContent = '';
44 | if (parsed.styles)
45 | for (const iterator of parsed.styles) {
46 | if (iterator.lang) {
47 | styleContent += ``;
50 | } else {
51 | styleContent += ``;
54 | }
55 | }
56 | const res = `${template}
57 | \n${transformedScript}\n${transformedScriptSetup}\n${styleContent}`;
58 |
59 | // eslint-disable-next-line @typescript-eslint/no-empty-function
60 | fse.outputFile(filePath, res, () => {});
61 | return res;
62 | });
63 | }
64 |
65 | function walkSync(paramPath: string) {
66 | fs.readdirSync(paramPath, { withFileTypes: true }).forEach(function (dirent) {
67 | const filePath = path.join(paramPath, dirent.name);
68 |
69 | if (dirent.isFile() && /.vue/.test(dirent.name)) {
70 | fileWriteCallback(filePath);
71 | } else if (dirent.isDirectory()) {
72 | walkSync(filePath);
73 | }
74 | });
75 | }
76 |
77 | export default function SfcTransformer(rootPath: string) {
78 | fs.readdirSync(rootPath, { withFileTypes: true }).forEach(function (dirent) {
79 | const filePath = path.join(rootPath, dirent.name);
80 |
81 | if (dirent.isFile() && /.vue/.test(dirent.name)) {
82 | fileWriteCallback(filePath);
83 | } else if (dirent.isDirectory()) {
84 | walkSync(filePath);
85 | }
86 | });
87 | }
88 |
--------------------------------------------------------------------------------
/src/core/core-js-transform/CoreTsCompiler.ts:
--------------------------------------------------------------------------------
1 | import fs from 'fs';
2 | import path from 'path';
3 | import babel from '@babel/core';
4 | import fse from 'fs-extra';
5 |
6 | function fileWriteCallback(filePath: string) {
7 | fs.readFile(filePath, 'utf-8', (err, content) => {
8 | const transformedCode = babel.transform(content, {
9 | // retainLines: true,
10 | plugins: [['@babel/plugin-transform-typescript']]
11 | })?.code;
12 |
13 | const jsPath = filePath.replace('ts', 'js');
14 | // eslint-disable-next-line @typescript-eslint/no-empty-function
15 | fse.outputFile(jsPath, transformedCode, () => {});
16 | });
17 | }
18 |
19 | function walkSync(paramPath: string) {
20 | fs.readdirSync(paramPath, { withFileTypes: true }).forEach(function (dirent) {
21 | const filePath = path.join(paramPath, dirent.name);
22 |
23 | if (dirent.isFile() && /\.(ts|tsx)$/.test(dirent.name)) {
24 | fileWriteCallback(filePath);
25 | } else if (dirent.isDirectory()) {
26 | walkSync(filePath);
27 | }
28 | });
29 | }
30 |
31 | export default function TsTransformer(rootPath: string) {
32 | fs.readdirSync(rootPath, { withFileTypes: true }).forEach(function (dirent) {
33 | const filePath = path.join(rootPath, dirent.name);
34 |
35 | if (dirent.isFile() && /\.(ts|tsx)$/.test(dirent.name)) {
36 | fileWriteCallback(filePath);
37 | } else if (dirent.isDirectory()) {
38 | walkSync(filePath);
39 | }
40 | });
41 | }
42 |
--------------------------------------------------------------------------------
/src/core/core-js-transform/README.md:
--------------------------------------------------------------------------------
1 | ## 基于 TDesign Starter TS 版本转化为 JS 版本
2 |
--------------------------------------------------------------------------------
/src/core/core-lite/CoreBuildToolInquirer.ts:
--------------------------------------------------------------------------------
1 | import inquirer, { QuestionCollection } from 'inquirer';
2 | import { CreatorOptions } from '../../types/type';
3 |
4 | /**
5 | * 简化版询问器
6 | *
7 | * @export
8 | * @class CoreBuildToolInquirer
9 | */
10 | export class CoreBuildToolInquirer {
11 | /**
12 | * override 交互命令
13 | * @returns 命令行数组
14 | */
15 | public interactionsHandler() {
16 | const questions: QuestionCollection> = [
17 | {
18 | type: 'list',
19 | name: 'buildToolType',
20 | message: '请选择构建工具',
21 | choices: [
22 | { name: ' vite', value: 'vite' },
23 | { name: ' webpack', value: 'webpack' },
24 | { name: ' farm', value: 'farm' }
25 | ],
26 | default: 'lite'
27 | }
28 | ];
29 |
30 | return inquirer.prompt(questions);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/core/core-lite/CoreLiteDownloader.ts:
--------------------------------------------------------------------------------
1 | import chalk from 'chalk';
2 | import ora from 'ora';
3 | import path from 'path';
4 | import { CoreGitDownloader } from '../CoreGitDownloader';
5 | import fse from 'fs-extra';
6 | import { pathResolve } from '../../utils/UtilsFile';
7 | import { CreatorOptions } from '../../types/type';
8 |
9 | /**
10 | * 极简版本生成器
11 | *
12 | * @export
13 | * @class CoreLiteDownloader
14 | * @extends {CoreGitDownloader}
15 | */
16 | export class CoreLiteDownloader extends CoreGitDownloader {
17 | /**
18 | * 下载工程目录,依据配置选择是否需要筛选不需要目录
19 | * @returns 命令行数组
20 | */
21 | public async syncDownload(options: Pick) {
22 | console.log();
23 | console.log(chalk.green('👉 开始构建,请稍侯...'));
24 | console.log();
25 | const spinner = ora('正在构建模板...').start();
26 | console.log();
27 |
28 | // 清除测试目录
29 | await this.clearTestFolder();
30 |
31 | await this.copyTemplate(options);
32 |
33 | // 执行成功相关操作
34 | this.executeBuildSuccess(spinner, options);
35 | }
36 |
37 | /**
38 | * 复制模板
39 | *
40 | * @protected
41 | * @param { Pick } options
42 | *
43 | * @memberOf CoreLiteDownloader
44 | */
45 | protected async copyTemplate(options: Pick): Promise {
46 | let copyFolderName = 'vue-lite';
47 | const destDir = path.resolve(process.cwd(), options.name);
48 | switch (options.type) {
49 | case 'vue2':
50 | copyFolderName = 'vue-lite';
51 | break;
52 | case 'vue3':
53 | copyFolderName = 'vue-next-lite';
54 | break;
55 | case 'react':
56 | copyFolderName = 'react-lite';
57 | break;
58 | }
59 | const srcDir = pathResolve(path.posix.join('templates', options.buildToolType, copyFolderName));
60 | try {
61 | await fse.copy(srcDir, destDir);
62 | console.log();
63 | console.log(chalk.green('👉 生成代码完毕...'));
64 | } catch (err) {
65 | console.error(err);
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/core/core-lite/CoreLiteInquirer.ts:
--------------------------------------------------------------------------------
1 | import inquirer, { QuestionCollection } from 'inquirer';
2 | import { CoreInquirer } from '../CoreInquirer';
3 | import { CreatorOptions } from '../../types/type';
4 |
5 | /**
6 | * 简化版询问器
7 | *
8 | * @export
9 | * @class CoreLiteInquirer
10 | */
11 | export class CoreLiteInquirer extends CoreInquirer {
12 | /**
13 | * override 交互命令
14 | * @returns 命令行数组
15 | */
16 | public interactionsHandler() {
17 | const questions: QuestionCollection> = [
18 | {
19 | type: 'list',
20 | name: 'template',
21 | message: '生成代码版本:',
22 | choices: [
23 | { name: ' Lite版本 (只包含TDesign的基本使用和项目工程)', value: 'lite' },
24 | { name: ' 通用模板版本', value: 'custom' }
25 | ],
26 | default: 'lite'
27 | }
28 | ];
29 |
30 | return inquirer.prompt(questions);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/core/core-options/CoreOptionsFilterForReact.ts:
--------------------------------------------------------------------------------
1 | import { CoreOptionsFilterForVue2 } from "./CoreOptionsFilterForVue2";
2 | import { ICoreTemplate } from "../core-template/CoreTemplateVue2Config";
3 | import coreTemplateReactConfig from "../core-template/CoreTemplateReactConfig";
4 | import { IParsedSourceData } from "../CoreParsedConfig";
5 | import path from "path";
6 | import { deleteAsync } from 'del';
7 | import fs from 'fs';
8 |
9 | /**
10 | * 过滤器 React
11 | *
12 | * @export
13 | * @class CoreOptionsFilter
14 | */
15 | export class CoreOptionsFilterForReact extends CoreOptionsFilterForVue2 {
16 |
17 | /** override 生成原始配置 */
18 | public generateSourceModulesData(options: any, finalOptions: any, downloadConfigSource: any = '') {
19 | // REACT比较特殊,使用配置驱动
20 | const configDataContent: any = [
21 | {
22 | path: '/detail',
23 | name: 'detail',
24 | meta: {
25 | title: '详情页',
26 | importStr: "import detail from './modules/detail';",
27 | dotStr: '...detail, '
28 | }
29 | },
30 | {
31 | path: '/form',
32 | name: 'form',
33 | meta: {
34 | title: '表单类',
35 | importStr: "import form from './modules/form';",
36 | dotStr: '...form, '
37 | }
38 | },
39 | {
40 | path: '/list',
41 | name: 'list',
42 | meta: {
43 | title: '列表页',
44 | importStr: "import list from './modules/list';",
45 | dotStr: '...list, '
46 | }
47 | },
48 | {
49 | path: '/result',
50 | name: 'result',
51 | meta: {
52 | title: '结果页',
53 | importStr: "import result from './modules/result';",
54 | dotStr: '...result, '
55 | }
56 | }
57 | ];
58 |
59 | return configDataContent;
60 | }
61 |
62 | /**
63 | * override 排除不用内容
64 | *
65 | * @param { CreatorOptions } options
66 | * @param {*} finalOptions
67 | *
68 | * @memberOf CoreOptionsFilter
69 | */
70 | public async excludeModules(options: any, finalOptions: any) {
71 | // hole finalOptions.selectTypes
72 | // 找出不在列表中的目录,即为需要排除内容
73 | const selectTypeList: Array = [];
74 |
75 | // 找出需要排除的
76 | const parsedConfigData = this.getConfigTemplateInstanceData().getParsedConfigData();
77 | for (let index = 0; index < parsedConfigData.length; index++) {
78 | const elementParsedData: IParsedSourceData = parsedConfigData[index];
79 |
80 | // 为空时代表要排除,返回值代表需要保留
81 | if (!this.checkFileNeedtoKeep(elementParsedData.meta.title, finalOptions)) {
82 | selectTypeList.push(elementParsedData);
83 | }
84 | }
85 |
86 | // 执行删除
87 | for (const iterator of selectTypeList) {
88 | const needToExcludeItem: IParsedSourceData = iterator;
89 | try {
90 | if (needToExcludeItem.name) {
91 | // 1.删除目录
92 | const delPath = path.join(`${process.env.PWD}/${options.name}`, `./src/pages/${this.firstUpperCase(needToExcludeItem.name)}`);
93 | await deleteAsync(delPath);
94 | // console.log('delPath==', delPath);
95 | // 2.删除目录,还要删moudles模块内路由
96 | const delPathFile = path.join(`${process.env.PWD}/${options.name}`, `./src/router/modules/${needToExcludeItem.name}.ts`);
97 | await deleteAsync(delPathFile);
98 | // console.log('delPathFile==', delPathFile);
99 | }
100 | } catch (error) {
101 | console.log('excludeModules error..', error);
102 | }
103 | }
104 | }
105 |
106 | /** 首字母大写 */
107 | public firstUpperCase(str: string) {
108 | return str.toLowerCase().replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
109 | }
110 |
111 | /**
112 | * override 生成特定路由配置
113 | *
114 | * @param {{ type: import(} [options="./CoreTemplate"]
115 | *
116 | * @memberOf CoreOptionsFilter
117 | */
118 | public async generateModulesRoute(options: any, finalOptions: any) {
119 | // 生成原始配置
120 | const sourceModulesData = this.generateSourceModulesData(options, finalOptions);
121 | // console.log('generateModulesRoute React ==', sourceModulesData);
122 | // 保存路由配置文件
123 | this.saveRouterFilter(sourceModulesData, this.getConfigTemplateInstanceData().getConfig(), options, finalOptions);
124 | }
125 |
126 | /**
127 | * override 生成路由配置文件
128 | *
129 | * @private
130 | * @param {any[]} saveedList
131 | * @param {string} configData
132 | *
133 | * @memberOf CoreOptionsFilter
134 | */
135 | protected saveRouterFilter(saveedList: any[], configData: string, options: any, finalOptions: any) {
136 | // 加工configData
137 | // 找出不在列表中的目录,即为需要排除内容
138 | const selectTypeList: Array = [];
139 |
140 | // 找出需要排除的
141 | const parsedConfigData = this.getConfigTemplateInstanceData().getParsedConfigData();
142 | for (let index = 0; index < parsedConfigData.length; index++) {
143 | const elementParsedData: IParsedSourceData = parsedConfigData[index];
144 |
145 | // 为空时代表要排除,返回值代表需要保留
146 | if (!this.checkFileNeedtoKeep(elementParsedData.meta.title, finalOptions)) {
147 | selectTypeList.push(elementParsedData);
148 | }
149 | }
150 |
151 | let saveFileContent = configData;
152 | for (let indexFileContent = 0; indexFileContent < selectTypeList.length; indexFileContent++) {
153 | const elementSelectItem = selectTypeList[indexFileContent];
154 | saveFileContent = saveFileContent.replace(elementSelectItem.meta.importStr, '');
155 | saveFileContent = saveFileContent.replace(elementSelectItem.meta.dotStr, '');
156 | }
157 |
158 | // 生成文件
159 | const elementPath = `${options.name}/src/`;
160 | try {
161 | fs.writeFileSync(path.join(elementPath, 'router/index.ts'), saveFileContent);
162 | } catch (error) {
163 | console.log('saveRouterFilter react..', error);
164 | }
165 | }
166 |
167 | /**
168 | * override 获取当前解析器配置
169 | *
170 | * @returns {ICoreTemplate}
171 | *
172 | * @memberOf CoreOptionsFilterForReact
173 | */
174 | public getConfigTemplateInstanceData(): ICoreTemplate {
175 | return coreTemplateReactConfig;
176 | }
177 | }
178 |
--------------------------------------------------------------------------------
/src/core/core-options/CoreOptionsFilterForVue3.ts:
--------------------------------------------------------------------------------
1 | import { CoreOptionsFilterForVue2 } from "./CoreOptionsFilterForVue2";
2 | import { ICoreTemplate } from "../core-template/CoreTemplateVue2Config";
3 | import coreTemplateVue3Config from "../core-template/CoreTemplateVue3Config";
4 |
5 | /**
6 | * 过滤器 VUE3
7 | *
8 | * @export
9 | * @class CoreOptionsFilter
10 | */
11 | export class CoreOptionsFilterForVue3 extends CoreOptionsFilterForVue2 {
12 |
13 | /**
14 | * override 获取当前解析器配置
15 | *
16 | * @returns {ICoreTemplate}
17 | *
18 | * @memberOf CoreOptionsFilterForVue2
19 | */
20 | public getConfigTemplateInstanceData(): ICoreTemplate {
21 | return coreTemplateVue3Config;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/core/core-template/CoreTemplateReactConfig.ts:
--------------------------------------------------------------------------------
1 | import { IParsedSourceData } from '../CoreParsedConfig';
2 | import { ICoreTemplate } from './CoreTemplateVue2Config';
3 |
4 | /**
5 | * React config
6 | *
7 | * @class CoreTemplateReactConfig
8 | */
9 | class CoreTemplateReactConfig implements ICoreTemplate {
10 | private configData!: any;
11 |
12 | /** 解析的原始数据结构配置 */
13 | private parsedConfigData: Array = [];
14 |
15 | /**
16 | * 配置服务单例
17 | *
18 | * @static
19 | */
20 | public static getInstance(): CoreTemplateReactConfig {
21 | if (!CoreTemplateReactConfig.instance) {
22 | CoreTemplateReactConfig.instance = new CoreTemplateReactConfig();
23 | }
24 |
25 | return CoreTemplateReactConfig.instance;
26 | }
27 |
28 | /**
29 | * 获取解析的原始数据结构配置
30 | *
31 | * @returns {Array}
32 | *
33 | * @memberOf CoreTemplateReactConfig
34 | */
35 | public getParsedConfigData(): Array {
36 | return this.parsedConfigData;
37 | }
38 |
39 | /**
40 | * 设置解析的原始数据结构配置
41 | *
42 | * @param {Array} v
43 | *
44 | * @memberOf CoreTemplateReactConfig
45 | */
46 | public setParsedConfigData(v: Array): void {
47 | this.parsedConfigData = v;
48 | }
49 |
50 | /**
51 | * 设置配置
52 | *
53 | * @param {any} configData
54 | *
55 | * @memberOf CoreTemplateReactConfig
56 | */
57 | public setConfig(configData: any) {
58 | this.configData = configData;
59 | }
60 |
61 | /**
62 | * 获取配置
63 | *
64 | * @returns {*}
65 | *
66 | * @memberOf CoreTemplateReactConfig
67 | */
68 | public getConfig(): any {
69 | if (!this.configData) {
70 | this.configData = `import React, { lazy } from 'react';
71 | import { BrowserRouterProps } from 'react-router-dom';
72 | import dashboard from './modules/dashboard';
73 | import list from './modules/list';
74 | import form from './modules/form';
75 | import detail from './modules/detail';
76 | import result from './modules/result';
77 | import user from './modules/user';
78 | import login from './modules/login';
79 |
80 | export interface IRouter {
81 | path: string;
82 | redirect?: string;
83 | Component?: React.FC | (() => any);
84 | /**
85 | * 当前路由是否全屏显示
86 | */
87 | isFullPage?: boolean;
88 | /**
89 | * meta未赋值 路由不显示到菜单中
90 | */
91 | meta?: {
92 | title?: string;
93 | Icon?: React.FC;
94 | };
95 | children?: IRouter[];
96 | }
97 |
98 | const routes: IRouter[] = [
99 | {
100 | path: '/login',
101 | Component: lazy(() => import('pages/Login')),
102 | isFullPage: true,
103 | },
104 | {
105 | path: '/',
106 | redirect: '/dashboard/base',
107 | },
108 | ];
109 |
110 | const otherRoutes: IRouter[] = [
111 | {
112 | path: '/403',
113 | Component: lazy(() => import('pages/Result/403')),
114 | },
115 | {
116 | path: '/500',
117 | Component: lazy(() => import('pages/Result/500')),
118 | },
119 | {
120 | path: '*',
121 | Component: lazy(() => import('pages/Result/404')),
122 | },
123 | ];
124 |
125 | const allRoutes = [...routes, ...dashboard, ...list, ...form, ...detail, ...result, ...user, ...login, ...otherRoutes];
126 |
127 | export default allRoutes;
128 | `;
129 |
130 | return this.configData;
131 | }
132 |
133 | return this.configData;
134 | }
135 |
136 | private static instance: CoreTemplateReactConfig;
137 | }
138 |
139 | export default CoreTemplateReactConfig.getInstance();
140 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import chalk from 'chalk';
2 | import Creator from './core/CoreIndex';
3 | import { program } from 'commander';
4 | import pkg from '../package.json';
5 |
6 | program.version(chalk.green(`v${pkg.version}`), '-v, --version');
7 |
8 | /**
9 | * 初始化项目
10 | * @description '--d', '--description', '项目描述'
11 | * @description '--type', '--type', '代码版本 vue2 | vue3 | react | miniProgram | mobileVue'
12 | * @description '--temp', '--template', '项目模版类型 lite | all'
13 | * @description '--bt', '--buildToolType', '构建工具类型 vite | webpack'
14 | */
15 | program
16 | .command('init [templateName]')
17 | .alias('i')
18 | .description('欢迎使用 TDesign-Starter')
19 | .option('-d,--description ', 'description of a project', 'Base on tdesign-starter-cli')
20 | .option('-type,--type ', 'Code version vue2 | vue3 | react | miniProgram | mobileVue ', 'vue2')
21 | .option('-temp,--template ', 'Project template type: lite | all', 'lite')
22 | .option('-bt,--buildToolType ', 'The construction tool for lite: vite | webpack', 'vite')
23 | .action((name, options, command) => {
24 | new Creator(name, options, command);
25 | });
26 |
27 | // 解析参数
28 | program.parse(process.argv);
29 |
--------------------------------------------------------------------------------
/src/types/index.d.ts:
--------------------------------------------------------------------------------
1 | declare module 'fs-extra';
2 | declare module 'ora';
3 | declare module 'clear';
4 | declare module 'figlet';
5 | declare module 'download-git-repo';
6 |
--------------------------------------------------------------------------------
/src/types/type.d.ts:
--------------------------------------------------------------------------------
1 | export type SupportedTemplate = 'vue2' | 'vue3' | 'react' | 'miniProgram' | 'mobileVue';
2 |
3 | export type SupportedTemplateSize = 'all' | 'lite'
4 |
5 | export interface ITemplateContent {
6 | url: string;
7 | description: string;
8 | downloadUrl: string;
9 | fePermissionDownloadUrl?: string; // 下载前端权限模型的 适用于部分模板下载场景
10 | routerData: string;
11 | }
12 |
13 | export type CreatorOptions = {
14 | name: string;
15 | description?: string;
16 | type: SupportedTemplate;
17 | buildToolType: 'vite' | 'webpack' | 'farm';
18 | template: SupportedTemplateSize;
19 | }
20 |
--------------------------------------------------------------------------------
/src/utils/UtilsFile.ts:
--------------------------------------------------------------------------------
1 | import path from 'path';
2 | import fs from 'fs';
3 | import pkg from '../../package.json';
4 | import { dirname } from 'path';
5 | import { fileURLToPath } from 'url';
6 |
7 | const __dirname = dirname(fileURLToPath(import.meta.url));
8 |
9 | /**
10 | * 路径
11 | * @param dir 文件夹
12 | * @returns
13 | */
14 | export const pathResolve = (dir: string): string => {
15 | return path.join(__dirname, dir);
16 | };
17 |
18 | /**
19 | * 自动设置版本信息
20 | */
21 | export const versionSet = (): any => {
22 | const vs: Array = pkg.version.split('.');
23 | vs[2]++;
24 | if (vs[2] > 15) {
25 | vs[1]++;
26 | vs[2] = 0;
27 | }
28 | if (vs[1] > 15) {
29 | vs[0]++;
30 | vs[1] = 0;
31 | vs[2] = 0;
32 | }
33 | pkg.version = vs.join('.');
34 | fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2), {
35 | encoding: 'utf8'
36 | });
37 | };
38 |
39 | /**
40 | * 获取目录名称
41 | * @returns
42 | */
43 | export function getCurrentDirectoryBase(): string {
44 | return path.basename(process.cwd());
45 | }
46 |
47 | /**
48 | * 判断目录是否存在
49 | * @param filePath
50 | * @returns
51 | */
52 | export function directoryExists(filePath: string): boolean {
53 | return fs.existsSync(filePath);
54 | }
55 |
--------------------------------------------------------------------------------
/src/utils/UtilsIndex.ts:
--------------------------------------------------------------------------------
1 | export * from './UtilsFile';
2 |
--------------------------------------------------------------------------------
/templates/farm/react-lite/.gitignore:
--------------------------------------------------------------------------------
1 | # Local
2 | .DS_Store
3 | *.local
4 | *.log*
5 |
6 | # Dist
7 | node_modules
8 | dist/
9 |
--------------------------------------------------------------------------------
/templates/farm/react-lite/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | ## 项目简介
18 |
19 | `tdesign-react` 是一个TDesign 适配桌面端的组件库,适合在 React 技术栈项目中使用。
20 |
21 | ## 开发
22 |
23 | ### 安装依赖
24 |
25 | ```bash
26 | npm install
27 | ```
28 |
29 | ### 启动项目
30 |
31 | ```bash
32 | npm run dev
33 | ```
34 |
35 | ## 构建
36 |
37 | ### 构建正式环境
38 |
39 | ```bash
40 | npm run build
41 | ```
42 |
43 | ## 开源协议
44 |
45 | TDesign 遵循 [MIT 协议](https://github.com/Tencent/tdesign-starter-cli/blob/develop/LICENSE)。
46 |
--------------------------------------------------------------------------------
/templates/farm/react-lite/farm.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from '@farmfe/core';
2 |
3 | export default defineConfig({
4 | plugins: ['@farmfe/plugin-react']
5 | });
6 |
--------------------------------------------------------------------------------
/templates/farm/react-lite/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | TDesign React Farm
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/templates/farm/react-lite/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-lite",
3 | "version": "0.0.0",
4 | "type": "module",
5 | "scripts": {
6 | "dev": "farm start",
7 | "start": "farm start",
8 | "build": "farm build",
9 | "preview": "farm preview",
10 | "clean": "farm clean"
11 | },
12 | "dependencies": {
13 | "tdesign-icons-react": "latest",
14 | "tdesign-react": "latest",
15 | "react": "18",
16 | "react-dom": "18"
17 | },
18 | "devDependencies": {
19 | "@farmfe/cli": "^1.0.1",
20 | "@farmfe/core": "^1.1.1",
21 | "@farmfe/plugin-react": "^1.0.1",
22 | "@types/react": "18",
23 | "@types/react-dom": "18",
24 | "react-refresh": "^0.14.0"
25 | }
26 | }
--------------------------------------------------------------------------------
/templates/farm/react-lite/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/tdesign-starter-cli/e45e98e3d423589226dc453dee6359f68f60a221/templates/farm/react-lite/public/favicon.ico
--------------------------------------------------------------------------------
/templates/farm/react-lite/public/tdesign-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/farm/react-lite/src/App.css:
--------------------------------------------------------------------------------
1 | .logo {
2 | height: 6em;
3 | padding: 3em 1.5em;
4 | will-change: filter;
5 | transition: filter 300ms;
6 | }
7 |
8 | .logo.tdesign:hover {
9 | filter: drop-shadow(0 0 2em #194de9);
10 | }
11 |
12 | .logo.farm:hover {
13 | filter: drop-shadow(0 0 2em #bd34fe);
14 | }
15 |
--------------------------------------------------------------------------------
/templates/farm/react-lite/src/App.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import { Button, ConfigProvider, Link, Space } from 'tdesign-react';
3 | import { AddIcon, CloudUploadIcon, DiscountIcon, CloudDownloadIcon, JumpIcon } from 'tdesign-icons-react';
4 | import TDesignLogo from '../public/tdesign-logo.svg';
5 | import FarmLogo from './assets/svg/farm-logo.png';
6 | import './App.css';
7 |
8 | const App: React.FC = () => {
9 | return (
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | Welcome to use
21 |
22 | } target="_blank">
23 | TDesign-react
24 |
25 |
26 | +
27 |
28 | } target="_blank">
29 | Farm
30 |
31 |
32 | !
33 |
34 |
35 | Experience it quickly using the
36 |
37 | } target="_blank">
38 | TDesign Starter
39 |
40 |
41 | page template.
42 |
43 |
44 |
45 | }>
46 | 新建
47 |
48 | }>
49 | 上传文件
50 |
51 | }>
52 | }>
53 |
54 |
55 |
56 |
57 | )
58 | }
59 | export default App
60 |
--------------------------------------------------------------------------------
/templates/farm/react-lite/src/assets/svg/farm-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/tdesign-starter-cli/e45e98e3d423589226dc453dee6359f68f60a221/templates/farm/react-lite/src/assets/svg/farm-logo.png
--------------------------------------------------------------------------------
/templates/farm/react-lite/src/main.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import App from './App';
4 | import 'tdesign-react/es/style/index.css';
5 |
6 | ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
7 |
8 |
9 |
10 | )
11 |
--------------------------------------------------------------------------------
/templates/farm/react-lite/src/typings.d.ts:
--------------------------------------------------------------------------------
1 | declare module '*.svg';
2 | declare module '*.png';
3 | declare module '*.css';
4 |
--------------------------------------------------------------------------------
/templates/farm/react-lite/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
6 | "module": "ESNext",
7 | "skipLibCheck": true,
8 |
9 | /* Bundler mode */
10 | "moduleResolution": "bundler",
11 | "allowImportingTsExtensions": true,
12 | "resolveJsonModule": true,
13 | "isolatedModules": true,
14 | "noEmit": true,
15 | "jsx": "react-jsx",
16 |
17 | /* Linting */
18 | "strict": true,
19 | "noUnusedLocals": true,
20 | "noUnusedParameters": true,
21 | "noFallthroughCasesInSwitch": true
22 | },
23 | "include": ["src"],
24 | "references": [{ "path": "./tsconfig.node.json" }]
25 | }
--------------------------------------------------------------------------------
/templates/farm/react-lite/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "allowSyntheticDefaultImports": true,
8 | "strict": true
9 | },
10 | "include": ["farm.config.ts"]
11 | }
--------------------------------------------------------------------------------
/templates/farm/vue-lite/.gitignore:
--------------------------------------------------------------------------------
1 | # Local
2 | .DS_Store
3 | *.local
4 | *.log*
5 |
6 | # Dist
7 | node_modules
8 | dist/
9 |
--------------------------------------------------------------------------------
/templates/farm/vue-lite/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | ## 项目简介
18 |
19 | `tdesign-vue` 是一个 TDesign 适配桌面端的组件库,适合在 vue 2 技术栈项目中使用。
20 |
21 | ## 开发
22 |
23 | ### 安装依赖
24 |
25 | ```bash
26 | npm install
27 | ```
28 |
29 | ### 启动项目
30 |
31 | ```bash
32 | npm run dev
33 | ```
34 |
35 | ## 构建
36 |
37 | ### 构建正式环境
38 |
39 | ```bash
40 | npm run build
41 | ```
42 |
43 | ## 开源协议
44 |
45 | TDesign 遵循 [MIT 协议](https://github.com/Tencent/tdesign-starter-cli/blob/develop/LICENSE)。
46 |
--------------------------------------------------------------------------------
/templates/farm/vue-lite/farm.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from '@farmfe/core';
2 | import { createVuePlugin } from "vite-plugin-vue2";
3 |
4 | export default defineConfig({
5 | vitePlugins: [
6 | createVuePlugin()
7 | ]
8 | });
9 |
--------------------------------------------------------------------------------
/templates/farm/vue-lite/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | TDesign Vue2 Farm
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/templates/farm/vue-lite/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-next-lite",
3 | "version": "1.0.0",
4 | "type": "module",
5 | "dependencies": {
6 | "tdesign-icons-vue": "latest",
7 | "tdesign-vue": "latest",
8 | "vue": "~2.6.14"
9 | },
10 | "devDependencies": {
11 | "@farmfe/cli": "^1.0.2",
12 | "@farmfe/core": "^1.1.4",
13 | "@tangllty/vite-plugin-svg": "^1.0.0",
14 | "vite-plugin-vue2": "^2.0.3",
15 | "vue-template-compiler": "~2.6.14"
16 | },
17 | "scripts": {
18 | "dev": "farm start",
19 | "start": "farm start",
20 | "build": "farm build",
21 | "preview": "farm preview",
22 | "clean": "farm clean"
23 | }
24 | }
--------------------------------------------------------------------------------
/templates/farm/vue-lite/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/tdesign-starter-cli/e45e98e3d423589226dc453dee6359f68f60a221/templates/farm/vue-lite/public/favicon.ico
--------------------------------------------------------------------------------
/templates/farm/vue-lite/public/tdesign-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/farm/vue-lite/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Welcome to use
12 |
13 |
14 | TDesign-vue
15 |
16 | +
17 |
18 |
19 | Farm
20 |
21 | !
22 |
23 |
24 | Experience it quickly using the
25 |
26 |
27 | TDesign Starter
28 |
29 | page template.
30 |
31 |
32 |
33 |
34 |
35 | 新建
36 |
37 |
38 |
39 | 上传文件
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | 搜索
48 |
49 |
50 |
51 |
52 |
72 |
73 |
90 |
--------------------------------------------------------------------------------
/templates/farm/vue-lite/src/assets/svg/farm-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/tdesign-starter-cli/e45e98e3d423589226dc453dee6359f68f60a221/templates/farm/vue-lite/src/assets/svg/farm-logo.png
--------------------------------------------------------------------------------
/templates/farm/vue-lite/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import TDesign from 'tdesign-vue';
3 | import 'tdesign-vue/es/style/index.css';
4 |
5 | import App from './App.vue';
6 |
7 | Vue.use(TDesign);
8 | new Vue({
9 | render: (h) => h(App)
10 | }).$mount('#app');
11 |
--------------------------------------------------------------------------------
/templates/farm/vue-lite/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "useDefineForClassFields": true,
5 | "module": "ESNext",
6 | "moduleResolution": "Node",
7 | "strict": true,
8 | "jsx": "preserve",
9 | "resolveJsonModule": true,
10 | "isolatedModules": true,
11 | "esModuleInterop": true,
12 | "lib": ["ESNext", "DOM"],
13 | "skipLibCheck": true,
14 | "noEmit": true
15 | },
16 | "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue", "farm.config.ts"]
17 | }
18 |
--------------------------------------------------------------------------------
/templates/farm/vue-next-lite/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.sln
22 | *.sw?
23 |
--------------------------------------------------------------------------------
/templates/farm/vue-next-lite/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | ## 项目简介
18 |
19 | `tdesign-vue-next` 是一个 TDesign 适配桌面端的组件库,适合在 vue3.x 技术栈项目中使用。
20 |
21 | ## 开发
22 |
23 | ### 安装依赖
24 |
25 | ```bash
26 | npm install
27 | ```
28 |
29 | ### 启动项目
30 |
31 | ```bash
32 | npm run dev
33 | ```
34 |
35 | ## 构建
36 |
37 | ### 构建正式环境
38 |
39 | ```bash
40 | npm run build
41 | ```
42 |
43 | ## 开源协议
44 |
45 | TDesign 遵循 [MIT 协议](https://github.com/Tencent/tdesign-starter-cli/blob/develop/LICENSE)。
46 |
--------------------------------------------------------------------------------
/templates/farm/vue-next-lite/farm.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from '@farmfe/core';
2 | import vue from '@vitejs/plugin-vue';
3 |
4 | export default defineConfig({
5 | vitePlugins: [
6 | vue(),
7 | ]
8 | });
9 |
--------------------------------------------------------------------------------
/templates/farm/vue-next-lite/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | TDesign Vue3 Farm
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/templates/farm/vue-next-lite/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-next-lite",
3 | "version": "1.0.0",
4 | "scripts": {
5 | "dev": "farm start",
6 | "start": "farm start",
7 | "build": "farm build",
8 | "preview": "farm preview",
9 | "clean": "farm clean"
10 | },
11 | "dependencies": {
12 | "tdesign-icons-vue-next": "latest",
13 | "tdesign-vue-next": "latest",
14 | "vite-svg-loader": "^5.1.0",
15 | "vue": "^3.4.21"
16 | },
17 | "devDependencies": {
18 | "@farmfe/cli": "^1.0.2",
19 | "@farmfe/core": "^1.1.4",
20 | "@vitejs/plugin-vue": "^5.0.4",
21 | "typescript": "^5.4.4",
22 | "vue-tsc": "^2.0.10"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/templates/farm/vue-next-lite/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/tdesign-starter-cli/e45e98e3d423589226dc453dee6359f68f60a221/templates/farm/vue-next-lite/public/favicon.ico
--------------------------------------------------------------------------------
/templates/farm/vue-next-lite/public/tdesign-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/farm/vue-next-lite/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | Welcome to use
13 |
14 |
15 |
16 |
17 | TDesign-vue-next
18 |
19 | +
20 |
21 |
22 |
23 |
24 | Farm
25 |
26 | !
27 |
28 |
29 |
30 | Experience it quickly using the
31 |
32 |
33 |
34 |
35 | TDesign Starter
36 |
37 | page template.
38 |
39 |
40 |
41 |
42 |
43 | 新建
44 |
45 |
46 |
47 | 上传文件
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | 搜索
56 |
57 |
58 |
59 |
60 |
61 |
73 |
74 |
91 |
--------------------------------------------------------------------------------
/templates/farm/vue-next-lite/src/assets/svg/farm-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/tdesign-starter-cli/e45e98e3d423589226dc453dee6359f68f60a221/templates/farm/vue-next-lite/src/assets/svg/farm-logo.png
--------------------------------------------------------------------------------
/templates/farm/vue-next-lite/src/main.ts:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import TDesign from 'tdesign-vue-next';
3 | import 'tdesign-vue-next/es/style/index.css';
4 |
5 | import App from './App.vue'
6 |
7 | createApp(App).use(TDesign).mount('#app')
8 |
--------------------------------------------------------------------------------
/templates/farm/vue-next-lite/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | //https://cn.vitejs.dev/guide/env-and-mode.html#env-files
4 | declare module '*.vue' {
5 | import type { DefineComponent } from 'vue'
6 | const component: DefineComponent<{}, {}, any>
7 | export default component
8 | }
9 |
--------------------------------------------------------------------------------
/templates/farm/vue-next-lite/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "module": "ESNext",
6 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
7 | "skipLibCheck": true,
8 |
9 | /* Bundler mode */
10 | "moduleResolution": "bundler",
11 | "allowImportingTsExtensions": true,
12 | "resolveJsonModule": true,
13 | "isolatedModules": true,
14 | "noEmit": true,
15 | "jsx": "preserve",
16 |
17 | /* Linting */
18 | "strict": true,
19 | "noUnusedLocals": true,
20 | "noUnusedParameters": true,
21 | "noFallthroughCasesInSwitch": true
22 | },
23 | "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
24 | "references": [{ "path": "./tsconfig.node.json" }]
25 | }
--------------------------------------------------------------------------------
/templates/farm/vue-next-lite/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "allowSyntheticDefaultImports": true,
8 | "strict": true
9 | },
10 | "include": ["farm.config.ts"]
11 | }
12 |
--------------------------------------------------------------------------------
/templates/vite/react-lite/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /coverage
6 |
7 | # production
8 | /dist
9 |
10 | # misc
11 | .DS_Store
12 | .idea
13 | .VSCodeCounter
14 |
15 | # log
16 | npm-debug.log*
17 | yarn-debug.log*
18 | yarn-error.log*
19 |
20 |
21 |
22 | # code editor setting
23 | /.vscode
24 |
--------------------------------------------------------------------------------
/templates/vite/react-lite/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | ## 项目简介
18 |
19 | `tdesign-react` 是一个TDesign 适配桌面端的组件库,适合在 React 技术栈项目中使用。
20 |
21 | ## 开发
22 |
23 | ### 安装依赖
24 |
25 | ```bash
26 | npm install
27 | ```
28 |
29 | ### 启动项目
30 |
31 | ```bash
32 | npm run dev
33 | ```
34 |
35 | ## 构建
36 |
37 | ### 构建正式环境
38 |
39 | ```bash
40 | npm run build
41 | ```
42 |
43 | ## 开源协议
44 |
45 | TDesign 遵循 [MIT 协议](https://github.com/Tencent/tdesign-starter-cli/blob/develop/LICENSE)。
46 |
--------------------------------------------------------------------------------
/templates/vite/react-lite/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | TDesign React Vite
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/templates/vite/react-lite/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-lite",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "tsc && vite build",
9 | "preview": "vite preview"
10 | },
11 | "dependencies": {
12 | "react": "^18.2.0",
13 | "react-dom": "^18.2.0",
14 | "tdesign-icons-react": "latest",
15 | "tdesign-react": "latest"
16 | },
17 | "devDependencies": {
18 | "@types/react": "^18.2.74",
19 | "@types/react-dom": "^18.2.24",
20 | "@vitejs/plugin-react": "^4.2.1",
21 | "typescript": "^5.4.4",
22 | "vite": "^5.2.8"
23 | }
24 | }
--------------------------------------------------------------------------------
/templates/vite/react-lite/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/tdesign-starter-cli/e45e98e3d423589226dc453dee6359f68f60a221/templates/vite/react-lite/public/favicon.ico
--------------------------------------------------------------------------------
/templates/vite/react-lite/public/tdesign-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/vite/react-lite/src/App.css:
--------------------------------------------------------------------------------
1 | .logo {
2 | height: 6em;
3 | padding: 3em 1.5em;
4 | will-change: filter;
5 | transition: filter 300ms;
6 | }
7 |
8 | .logo.tdesign:hover {
9 | filter: drop-shadow(0 0 2em #194de9);
10 | }
11 |
12 |
13 | .logo.vite:hover {
14 | filter: drop-shadow(0 0 2em #bd34fe);
15 | }
16 |
--------------------------------------------------------------------------------
/templates/vite/react-lite/src/App.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import { Button, ConfigProvider, Link, Space } from 'tdesign-react';
3 | import { AddIcon, CloudUploadIcon, DiscountIcon, CloudDownloadIcon, JumpIcon } from 'tdesign-icons-react';
4 | import TDesignLogo from '../public/tdesign-logo.svg';
5 | import ViteLogo from './assets/svg/vite-logo.svg';
6 | import './App.css';
7 |
8 | const App: React.FC = () => {
9 | return (
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | Welcome to use
21 |
22 | } target="_blank">
23 | TDesign-react
24 |
25 |
26 | +
27 |
28 | } target="_blank">
29 | Vite
30 |
31 |
32 | !
33 |
34 |
35 | Experience it quickly using the
36 |
37 | } target="_blank">
38 | TDesign Starter
39 |
40 |
41 | page template.
42 |
43 |
44 |
45 | }>
46 | 新建
47 |
48 | }>
49 | 上传文件
50 |
51 | }>
52 | }>
53 |
54 |
55 |
56 |
57 | )
58 | }
59 | export default App
60 |
--------------------------------------------------------------------------------
/templates/vite/react-lite/src/assets/svg/vite-logo.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/templates/vite/react-lite/src/main.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import App from './App';
4 | import 'tdesign-react/es/style/index.css';
5 |
6 | ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
7 |
8 |
9 |
10 | )
11 |
--------------------------------------------------------------------------------
/templates/vite/react-lite/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
--------------------------------------------------------------------------------
/templates/vite/react-lite/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "useDefineForClassFields": true,
5 | "lib": ["DOM", "DOM.Iterable", "ESNext"],
6 | "allowJs": false,
7 | "skipLibCheck": true,
8 | "esModuleInterop": false,
9 | "allowSyntheticDefaultImports": true,
10 | "strict": true,
11 | "forceConsistentCasingInFileNames": true,
12 | "module": "ESNext",
13 | "moduleResolution": "Node",
14 | "resolveJsonModule": true,
15 | "isolatedModules": true,
16 | "noEmit": true,
17 | "jsx": "react-jsx"
18 | },
19 | "include": ["src"],
20 | "references": [{ "path": "./tsconfig.node.json" }]
21 | }
22 |
--------------------------------------------------------------------------------
/templates/vite/react-lite/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "module": "ESNext",
5 | "moduleResolution": "Node",
6 | "allowSyntheticDefaultImports": true
7 | },
8 | "include": ["vite.config.ts"]
9 | }
10 |
--------------------------------------------------------------------------------
/templates/vite/react-lite/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [react()]
7 | })
8 |
--------------------------------------------------------------------------------
/templates/vite/vue-lite/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/templates/vite/vue-lite/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | ## 项目简介
18 |
19 | `tdesign-vue` 是一个 TDesign 适配桌面端的组件库,适合在 vue 2 技术栈项目中使用。
20 |
21 | ## 开发
22 |
23 | ### 安装依赖
24 |
25 | ```bash
26 | npm install
27 | ```
28 |
29 | ### 启动项目
30 |
31 | ```bash
32 | npm run dev
33 | ```
34 |
35 | ## 构建
36 |
37 | ### 构建正式环境
38 |
39 | ```bash
40 | npm run build
41 | ```
42 |
43 | ## 开源协议
44 |
45 | TDesign 遵循 [MIT 协议](https://github.com/Tencent/tdesign-starter-cli/blob/develop/LICENSE)。
46 |
--------------------------------------------------------------------------------
/templates/vite/vue-lite/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | TDesign Vue2 Vite
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/templates/vite/vue-lite/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-lite",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "preview": "vite preview"
10 | },
11 | "devDependencies": {
12 | "@tangllty/vite-plugin-svg": "^1.0.0",
13 | "vite": "^4.0.0",
14 | "vite-plugin-vue2": "^2.0.3",
15 | "vue-template-compiler": "~2.6.14"
16 | },
17 | "dependencies": {
18 | "tdesign-icons-vue": "latest",
19 | "tdesign-vue": "latest",
20 | "vue": "~2.6.14"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/templates/vite/vue-lite/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/tdesign-starter-cli/e45e98e3d423589226dc453dee6359f68f60a221/templates/vite/vue-lite/public/favicon.ico
--------------------------------------------------------------------------------
/templates/vite/vue-lite/public/tdesign-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/vite/vue-lite/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Welcome to use
12 |
13 |
14 | TDesign-vue
15 |
16 | +
17 |
18 |
19 | Vite
20 |
21 | !
22 |
23 |
24 | Experience it quickly using the
25 |
26 |
27 | TDesign Starter
28 |
29 | page template.
30 |
31 |
32 |
33 |
34 |
35 | 新建
36 |
37 |
38 |
39 | 上传文件
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | 搜索
48 |
49 |
50 |
51 |
52 |
72 |
73 |
89 |
--------------------------------------------------------------------------------
/templates/vite/vue-lite/src/assets/svg/vite-logo.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/templates/vite/vue-lite/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import TDesign from 'tdesign-vue';
3 | import 'tdesign-vue/es/style/index.css';
4 |
5 | import App from './App.vue';
6 |
7 | Vue.use(TDesign);
8 | new Vue({
9 | render: (h) => h(App)
10 | }).$mount('#app');
11 |
--------------------------------------------------------------------------------
/templates/vite/vue-lite/vite.config.js:
--------------------------------------------------------------------------------
1 | import { createVuePlugin } from "vite-plugin-vue2";
2 |
3 | export default {
4 | plugins: [createVuePlugin()]
5 | }
--------------------------------------------------------------------------------
/templates/vite/vue-next-lite/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .DS_Store
3 |
4 | # build files
5 | es/
6 | lib/
7 | dist/
8 | typings/
9 |
10 | _site
11 | package
12 | tmp*
13 | temp*
14 | coverage
15 | test-report.html
16 | .idea/
17 | yarn-error.log
18 | *.zip
19 | .history
20 | .stylelintcache
21 | yarn.lock
22 | package-lock.json
23 | pnpm-lock.yaml
24 |
--------------------------------------------------------------------------------
/templates/vite/vue-next-lite/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | ## 项目简介
18 |
19 | `tdesign-vue-next` 是一个 TDesign 适配桌面端的组件库,适合在 vue3.x 技术栈项目中使用。
20 |
21 | ## 开发
22 |
23 | ### 安装依赖
24 |
25 | ```bash
26 | npm install
27 | ```
28 |
29 | ### 启动项目
30 |
31 | ```bash
32 | npm run dev
33 | ```
34 |
35 | ## 构建
36 |
37 | ### 构建正式环境
38 |
39 | ```bash
40 | npm run build
41 | ```
42 |
43 | ## 开源协议
44 |
45 | TDesign 遵循 [MIT 协议](https://github.com/Tencent/tdesign-starter-cli/blob/develop/LICENSE)。
46 |
--------------------------------------------------------------------------------
/templates/vite/vue-next-lite/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | TDesign Vue3 Vite
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/templates/vite/vue-next-lite/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-next",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vue-tsc --noEmit && vite build",
9 | "preview": "vite preview"
10 | },
11 | "dependencies": {
12 | "tdesign-icons-vue-next": "latest",
13 | "tdesign-vue-next": "latest",
14 | "vite-svg-loader": "^5.1.0",
15 | "vue": "^3.4.21"
16 | },
17 | "devDependencies": {
18 | "@vitejs/plugin-vue": "^5.0.4",
19 | "typescript": "^5.4.4",
20 | "vite": "^5.2.8",
21 | "vue-tsc": "^2.0.10"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/templates/vite/vue-next-lite/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/tdesign-starter-cli/e45e98e3d423589226dc453dee6359f68f60a221/templates/vite/vue-next-lite/public/favicon.ico
--------------------------------------------------------------------------------
/templates/vite/vue-next-lite/public/tdesign-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/vite/vue-next-lite/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | Welcome to use
13 |
14 |
15 |
16 |
17 | TDesign-vue-next
18 |
19 | +
20 |
21 |
22 |
23 |
24 | Vite
25 |
26 | !
27 |
28 |
29 |
30 | Experience it quickly using the
31 |
32 |
33 |
34 |
35 | TDesign Starter
36 |
37 | page template.
38 |
39 |
40 |
41 |
42 |
43 | 新建
44 |
45 |
46 |
47 | 上传文件
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | 搜索
56 |
57 |
58 |
59 |
60 |
61 |
73 |
74 |
90 |
--------------------------------------------------------------------------------
/templates/vite/vue-next-lite/src/assets/svg/vite-logo.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/templates/vite/vue-next-lite/src/main.ts:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import TDesign from 'tdesign-vue-next';
3 | import 'tdesign-vue-next/es/style/index.css';
4 |
5 | import App from './App.vue'
6 |
7 | createApp(App).use(TDesign).mount('#app')
8 |
--------------------------------------------------------------------------------
/templates/vite/vue-next-lite/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | //https://cn.vitejs.dev/guide/env-and-mode.html#env-files
4 | declare module '*.vue' {
5 | import type { DefineComponent } from 'vue'
6 | const component: DefineComponent<{}, {}, any>
7 | export default component
8 | }
9 |
--------------------------------------------------------------------------------
/templates/vite/vue-next-lite/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "useDefineForClassFields": true,
5 | "module": "ESNext",
6 | "moduleResolution": "Node",
7 | "strict": true,
8 | "jsx": "preserve",
9 | "sourceMap": true,
10 | "resolveJsonModule": true,
11 | "isolatedModules": true,
12 | "esModuleInterop": true,
13 | "lib": ["ESNext", "DOM"],
14 | "skipLibCheck": true
15 | },
16 | "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
17 | "references": [{ "path": "./tsconfig.node.json" }]
18 | }
19 |
--------------------------------------------------------------------------------
/templates/vite/vue-next-lite/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "module": "ESNext",
5 | "moduleResolution": "Node",
6 | "allowSyntheticDefaultImports": true
7 | },
8 | "include": ["vite.config.ts"]
9 | }
10 |
--------------------------------------------------------------------------------
/templates/vite/vue-next-lite/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import vue from '@vitejs/plugin-vue'
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [vue()]
7 | })
8 |
--------------------------------------------------------------------------------
/templates/webpack/react-lite/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/templates/webpack/react-lite/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | ## 项目简介
18 |
19 | `tdesign-react` 是一个TDesign 适配桌面端的组件库,适合在 React 技术栈项目中使用。
20 |
21 | ## 开发
22 |
23 | ### 安装依赖
24 |
25 | ```bash
26 | npm install
27 | ```
28 |
29 | ### 启动项目
30 |
31 | ```bash
32 | npm run dev
33 | ```
34 |
35 | ## 构建
36 |
37 | ### 构建正式环境
38 |
39 | ```bash
40 | npm run build
41 | ```
42 |
43 | ## 开源协议
44 |
45 | TDesign 遵循 [MIT 协议](https://github.com/Tencent/tdesign-starter-cli/blob/develop/LICENSE)。
46 |
--------------------------------------------------------------------------------
/templates/webpack/react-lite/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-lite",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@types/node": "^16.18.105",
7 | "@types/react": "^18.3.3",
8 | "@types/react-dom": "^18.3.0",
9 | "react": "^18.3.1",
10 | "react-dom": "^18.3.1",
11 | "react-scripts": "5.0.1",
12 | "typescript": "^4.9.5",
13 | "tdesign-icons-react": "latest",
14 | "tdesign-react": "latest"
15 | },
16 | "scripts": {
17 | "start": "react-scripts start",
18 | "build": "react-scripts build",
19 | "test": "react-scripts test",
20 | "eject": "react-scripts eject"
21 | },
22 | "eslintConfig": {
23 | "extends": [
24 | "react-app"
25 | ]
26 | },
27 | "browserslist": {
28 | "production": [
29 | ">0.2%",
30 | "not dead",
31 | "not op_mini all"
32 | ],
33 | "development": [
34 | "last 1 chrome version",
35 | "last 1 firefox version",
36 | "last 1 safari version"
37 | ]
38 | }
39 | }
--------------------------------------------------------------------------------
/templates/webpack/react-lite/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/tdesign-starter-cli/e45e98e3d423589226dc453dee6359f68f60a221/templates/webpack/react-lite/public/favicon.ico
--------------------------------------------------------------------------------
/templates/webpack/react-lite/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | TDesign React Webpack
9 |
10 |
11 |
12 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/templates/webpack/react-lite/public/tdesign-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/webpack/react-lite/src/App.css:
--------------------------------------------------------------------------------
1 | .logo {
2 | height: 6em;
3 | padding: 3em 1.5em;
4 | will-change: filter;
5 | transition: filter 300ms;
6 | }
7 |
8 | .logo.tdesign:hover {
9 | filter: drop-shadow(0 0 2em #194de9);
10 | }
11 |
12 |
13 | .logo.webpack:hover {
14 | filter: drop-shadow(0 0 2em #bd34fe);
15 | }
16 |
--------------------------------------------------------------------------------
/templates/webpack/react-lite/src/App.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import { Button, ConfigProvider, Link, Space } from 'tdesign-react';
3 | import { AddIcon, CloudUploadIcon, DiscountIcon, CloudDownloadIcon, JumpIcon } from 'tdesign-icons-react';
4 | import TDesignLogo from './assets/svg/tdesign-logo.svg';
5 | import WebpackLogo from './assets/svg/webpack-logo.svg';
6 | import './App.css';
7 |
8 | const App: React.FC = () => {
9 | return (
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | Welcome to use
21 |
22 | } target="_blank">
23 | TDesign-react
24 |
25 |
26 | +
27 |
28 | } target="_blank">
29 | Webpack
30 |
31 |
32 | !
33 |
34 |
35 | Experience it quickly using the
36 |
37 | } target="_blank">
38 | TDesign Starter
39 |
40 |
41 | page template.
42 |
43 |
44 |
45 | }>
46 | 新建
47 |
48 | }>
49 | 上传文件
50 |
51 | }>
52 | }>
53 |
54 |
55 |
56 |
57 | )
58 | }
59 | export default App
60 |
--------------------------------------------------------------------------------
/templates/webpack/react-lite/src/assets/svg/tdesign-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/webpack/react-lite/src/assets/svg/webpack-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/webpack/react-lite/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import App from './App';
4 | import 'tdesign-react/es/style/index.css';
5 |
6 | const root = ReactDOM.createRoot(
7 | document.getElementById('root') as HTMLElement
8 | );
9 | root.render(
10 |
11 |
12 |
13 | );
14 |
--------------------------------------------------------------------------------
/templates/webpack/react-lite/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/templates/webpack/react-lite/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "strict": true,
14 | "forceConsistentCasingInFileNames": true,
15 | "noFallthroughCasesInSwitch": true,
16 | "module": "esnext",
17 | "moduleResolution": "node",
18 | "resolveJsonModule": true,
19 | "isolatedModules": true,
20 | "noEmit": true,
21 | "jsx": "react-jsx"
22 | },
23 | "include": [
24 | "src"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/templates/webpack/vue-lite/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 |
6 | # local env files
7 | .env.local
8 | .env.*.local
9 |
10 | # Log files
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 | pnpm-debug.log*
15 |
16 | # Editor directories and files
17 | .idea
18 | .vscode
19 | *.suo
20 | *.ntvs*
21 | *.njsproj
22 | *.sln
23 | *.sw?
24 |
--------------------------------------------------------------------------------
/templates/webpack/vue-lite/README copy.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | ## 项目简介
18 |
19 | `tdesign-vue` 是一个 TDesign 适配桌面端的组件库,适合在 vue 2 技术栈项目中使用。
20 |
21 | ## 开发
22 |
23 | ### 安装依赖
24 |
25 | ```bash
26 | npm install
27 | ```
28 |
29 | ### 启动项目
30 |
31 | ```bash
32 | npm run dev
33 | ```
34 |
35 | ## 构建
36 |
37 | ### 构建正式环境
38 |
39 | ```bash
40 | npm run build
41 | ```
42 |
43 | ## 开源协议
44 |
45 | TDesign 遵循 [MIT 协议](https://github.com/Tencent/tdesign-starter-cli/blob/develop/LICENSE)。
46 |
--------------------------------------------------------------------------------
/templates/webpack/vue-lite/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | ### 项目简介
18 |
19 | TDesign Vue Starter 是一个基于 tdesign-vue,使用 `Vue2`、`Webpack`开发,可进行个性化主题配置,旨在提供项目开箱即用的、配置式的初始项目。
20 |
21 |
22 | 使用文档
23 |
24 |
25 |
26 | ### 开发
27 |
28 | ```bash
29 | ## 安装依赖
30 | npm install
31 |
32 | ## 启动项目
33 | npm run dev
34 | ```
35 |
36 | ### 构建
37 |
38 | ```bash
39 | ## 构建正式环境
40 | npm run build
41 |
42 |
43 | ### 开源协议
44 |
45 | TDesign 遵循 [MIT 协议](https://github.com/Tencent/tdesign-vue-starter/LICENSE)。
46 |
--------------------------------------------------------------------------------
/templates/webpack/vue-lite/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/templates/webpack/vue-lite/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "module": "esnext",
5 | "baseUrl": "./",
6 | "moduleResolution": "node",
7 | "paths": {
8 | "@/*": [
9 | "src/*"
10 | ]
11 | },
12 | "lib": [
13 | "esnext",
14 | "dom",
15 | "dom.iterable",
16 | "scripthost"
17 | ]
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/templates/webpack/vue-lite/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-lite",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "vue-cli-service serve",
7 | "build": "vue-cli-service build",
8 | "lint": "vue-cli-service lint"
9 | },
10 | "dependencies": {
11 | "core-js": "^3.8.3",
12 | "tdesign-icons-vue": "latest",
13 | "tdesign-vue": "latest",
14 | "vue": "~2.6.14"
15 | },
16 | "devDependencies": {
17 | "@babel/core": "^7.12.16",
18 | "@babel/eslint-parser": "^7.12.16",
19 | "@vue/cli-plugin-babel": "~5.0.0",
20 | "@vue/cli-plugin-eslint": "~5.0.0",
21 | "@vue/cli-service": "~5.0.0",
22 | "eslint": "^7.32.0",
23 | "eslint-plugin-vue": "^8.0.3",
24 | "vue-svg-loader": "^0.16.0",
25 | "vue-template-compiler": "~2.6.14"
26 | },
27 | "eslintConfig": {
28 | "root": true,
29 | "env": {
30 | "node": true
31 | },
32 | "extends": [
33 | "plugin:vue/essential",
34 | "eslint:recommended"
35 | ],
36 | "parserOptions": {
37 | "parser": "@babel/eslint-parser"
38 | },
39 | "rules": {}
40 | },
41 | "browserslist": [
42 | "> 1%",
43 | "last 2 versions",
44 | "not dead"
45 | ]
46 | }
47 |
--------------------------------------------------------------------------------
/templates/webpack/vue-lite/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/tdesign-starter-cli/e45e98e3d423589226dc453dee6359f68f60a221/templates/webpack/vue-lite/public/favicon.ico
--------------------------------------------------------------------------------
/templates/webpack/vue-lite/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | TDesign Vue2 Webpack
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/templates/webpack/vue-lite/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Welcome to use
12 |
13 |
14 | TDesign-vue
15 |
16 | +
17 |
18 |
19 | Webpack
20 |
21 | !
22 |
23 |
24 | Experience it quickly using the
25 |
26 |
27 | TDesign Starter
28 |
29 | page template.
30 |
31 |
32 |
33 |
34 |
35 | 新建
36 |
37 |
38 |
39 | 上传文件
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | 搜索
48 |
49 |
50 |
51 |
52 |
77 |
78 |
94 |
--------------------------------------------------------------------------------
/templates/webpack/vue-lite/src/assets/svg/tdesign-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/webpack/vue-lite/src/assets/svg/webpack-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/webpack/vue-lite/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import TDesign from 'tdesign-vue';
3 | import 'tdesign-vue/es/style/index.css';
4 |
5 | import App from './App.vue'
6 |
7 | Vue.config.productionTip = false
8 | Vue.use(TDesign)
9 |
10 | new Vue({
11 | render: h => h(App),
12 | }).$mount('#app')
--------------------------------------------------------------------------------
/templates/webpack/vue-lite/vue.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | chainWebpack: (config) => {
3 | config.module.rules.delete('svg')
4 | },
5 | configureWebpack: {
6 | module: {
7 | rules: [
8 | {
9 | test: /\.svg$/,
10 | loader: "vue-svg-loader"
11 | }
12 | ]
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/templates/webpack/vue-next-lite/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 |
6 | # local env files
7 | .env.local
8 | .env.*.local
9 |
10 | # Log files
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 | pnpm-debug.log*
15 |
16 | # Editor directories and files
17 | .idea
18 | .vscode
19 | *.suo
20 | *.ntvs*
21 | *.njsproj
22 | *.sln
23 | *.sw?
24 |
--------------------------------------------------------------------------------
/templates/webpack/vue-next-lite/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | ## 项目简介
18 |
19 | `tdesign-vue-next` 是一个 TDesign 适配桌面端的组件库,适合在 vue3.x 技术栈项目中使用。
20 |
21 | ## 开发
22 |
23 | ### 安装依赖
24 |
25 | ```bash
26 | npm install
27 | ```
28 |
29 | ### 启动项目
30 |
31 | ```bash
32 | npm run dev
33 | ```
34 |
35 | ## 构建
36 |
37 | ### 构建正式环境
38 |
39 | ```bash
40 | npm run build
41 | ```
42 |
43 | ## 开源协议
44 |
45 | TDesign 遵循 [MIT 协议](https://github.com/Tencent/tdesign-starter-cli/blob/develop/LICENSE)。
46 |
--------------------------------------------------------------------------------
/templates/webpack/vue-next-lite/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/templates/webpack/vue-next-lite/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "module": "esnext",
5 | "baseUrl": "./",
6 | "moduleResolution": "node",
7 | "paths": {
8 | "@/*": [
9 | "src/*"
10 | ]
11 | },
12 | "lib": [
13 | "esnext",
14 | "dom",
15 | "dom.iterable",
16 | "scripthost"
17 | ]
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/templates/webpack/vue-next-lite/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-next-lite",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "vue-cli-service serve",
7 | "build": "vue-cli-service build",
8 | "lint": "vue-cli-service lint"
9 | },
10 | "dependencies": {
11 | "core-js": "^3.8.3",
12 | "tdesign-icons-vue-next": "latest",
13 | "tdesign-vue-next": "latest",
14 | "vue": "^3.2.13"
15 | },
16 | "devDependencies": {
17 | "@babel/core": "^7.12.16",
18 | "@babel/eslint-parser": "^7.12.16",
19 | "@vue/cli-plugin-babel": "~5.0.0",
20 | "@vue/cli-plugin-eslint": "~5.0.0",
21 | "@vue/cli-service": "~5.0.0",
22 | "eslint": "^7.32.0",
23 | "eslint-plugin-vue": "^8.0.3",
24 | "vue-loader-v16": "^16.0.0-beta.5.4",
25 | "vue-svg-loader": "^0.17.0-beta.2"
26 | },
27 | "eslintConfig": {
28 | "root": true,
29 | "env": {
30 | "node": true
31 | },
32 | "extends": [
33 | "plugin:vue/vue3-essential",
34 | "eslint:recommended"
35 | ],
36 | "parserOptions": {
37 | "parser": "@babel/eslint-parser"
38 | },
39 | "rules": {}
40 | },
41 | "browserslist": [
42 | "> 1%",
43 | "last 2 versions",
44 | "not dead",
45 | "not ie 11"
46 | ]
47 | }
48 |
--------------------------------------------------------------------------------
/templates/webpack/vue-next-lite/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/tdesign-starter-cli/e45e98e3d423589226dc453dee6359f68f60a221/templates/webpack/vue-next-lite/public/favicon.ico
--------------------------------------------------------------------------------
/templates/webpack/vue-next-lite/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | TDesign Vue3 Webpack
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/templates/webpack/vue-next-lite/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | Welcome to use
13 |
14 |
15 |
16 |
17 | TDesign-vue-next
18 |
19 | +
20 |
21 |
22 |
23 |
24 | Webpack
25 |
26 | !
27 |
28 |
29 |
30 | Experience it quickly using the
31 |
32 |
33 |
34 |
35 | TDesign Starter
36 |
37 | page template.
38 |
39 |
40 |
41 |
42 |
43 | 新建
44 |
45 |
46 |
47 | 上传文件
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | 搜索
56 |
57 |
58 |
59 |
60 |
61 |
62 |
75 |
76 |
92 |
--------------------------------------------------------------------------------
/templates/webpack/vue-next-lite/src/assets/svg/tdesign-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/webpack/vue-next-lite/src/assets/svg/webpack-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/webpack/vue-next-lite/src/main.js:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import TDesign from 'tdesign-vue-next';
3 | import 'tdesign-vue-next/es/style/index.css';
4 |
5 | import App from './App.vue'
6 |
7 | createApp(App).use(TDesign).mount('#app')
8 |
--------------------------------------------------------------------------------
/templates/webpack/vue-next-lite/vue.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | chainWebpack: (config) => {
3 | config.module.rules.delete('svg')
4 | },
5 | configureWebpack: {
6 | module: {
7 | rules: [
8 | {
9 | test: /\.svg$/,
10 | use: [
11 | "vue-loader-v16",
12 | "vue-svg-loader"
13 | ]
14 | }
15 | ]
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "module": "ESNext",
5 | "sourceMap": false,
6 | "declaration": false,
7 | "outDir": "./bin",
8 | "moduleResolution": "Node",
9 | "esModuleInterop": true,
10 | "resolveJsonModule": true,
11 | "removeComments": false,
12 | "importHelpers": true,
13 | "strict": true,
14 | "lib": ["ES6", "DOM"]
15 | },
16 | "types": [
17 | "node"
18 | ],
19 | "include": ["src"],
20 | "exclude": ["node_modules"]
21 | }
22 |
--------------------------------------------------------------------------------