Skip to content

Commit

Permalink
[add] Initialization script & action of GitHub template repository
Browse files Browse the repository at this point in the history
[add] PR badge configuration
[optimize] upgrade to PNPM 9 & other latest Upstream packages
  • Loading branch information
TechQuery committed Jun 27, 2024
1 parent a25e770 commit 83173e9
Show file tree
Hide file tree
Showing 8 changed files with 9,755 additions and 7,668 deletions.
17 changes: 17 additions & 0 deletions .github/pr-badge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- icon: visualstudio
label: 'GitHub.dev'
message: 'PR-$prNumber'
color: 'blue'
url: 'https://github.dev/$owner/$repo/pull/$prNumber'

- icon: github
label: 'GitHub codespaces'
message: 'PR-$prNumber'
color: 'black'
url: 'https://codespaces.new/$owner/$repo/pull/$prNumber'

- icon: git
label: 'GitPod.io'
message: 'PR-$prNumber'
color: 'orange'
url: 'https://gitpod.io/?autostart=true#https://github.com/$owner/$repo/pull/$prNumber'
25 changes: 25 additions & 0 deletions .github/workflows/init-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Template Repository initialization
on:
push:
branches:
- master
env:
TEMPLATE_OWNER: idea2app
TEMPLATE_NAME: Taro-Vant-MobX-ts

jobs:
replace-repository-name:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- if: github.repository != format('{0}/{1}', env.TEMPLATE_OWNER, env.TEMPLATE_NAME)
run: |
sh .github/workflows/replace-repository-name.sh \
${{ env.TEMPLATE_OWNER }} ${{ env.TEMPLATE_NAME }} \
${{ github.repository_owner }} ${{ github.event.repository.name }}
rm -f .github/workflows/init-template.yml
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: '[fix] replace Repository Name'
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 8
version: 9
- uses: actions/setup-node@v3
with:
node-version: 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: pnpm/action-setup@v2
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }}
with:
version: 8
version: 9
- uses: actions/setup-node@v3
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }}
with:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/replace-repository-name.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#! /usr/bin/env bash

SourceOwner=$1
SourceName=$2
TargetOwner=$3
TargetName=$4

sed -i "s/$SourceOwner\/$SourceName/$TargetOwner\/$TargetName/ig" \
$(grep -i $SourceOwner/$SourceName -rl . --exclude-dir=.git --exclude-dir=node_modules)
sed -i "s/$SourceName/$TargetName/ig" \
$(grep -i $SourceName -rl . --exclude-dir=.git --exclude-dir=node_modules)
39 changes: 24 additions & 15 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Taro-Vant-MobX.ts
# Taro-Vant-MobX-ts

[Taro][1] project scaffold based on [TypeScript][2], [Preact][3], [MobX][4] & [Vant][5]

Expand All @@ -14,7 +14,7 @@ https://idea2app.github.io/Taro-Vant-MobX-ts/
## Technology stack

- Language: [TypeScript v5][2]
- Component engine: [Preact 10][3]
- Component engine: [Preact v10][3]
- State management: [MobX v4][4]
- Component suite: [AntM Vant UI v3][5] + [Bootstrap v5 (CSS utility)][9]
- CI / CD: GitHub [Actions][10] + [Pages][11]
Expand All @@ -26,15 +26,22 @@ https://idea2app.github.io/Taro-Vant-MobX-ts/

## Best practice

1. Install **[Settings][12] GitHub app** in your account or organization
2. Click the **[<kbd>Use this template</kbd>][13] button** on the top of this GitHub repository's home page, then create your own repository in the app-installed namespace above
3. Click the **[<kbd>Open in GitHub codespaces</kbd>][7] button** on the top of ReadMe file, then an **online VS Code development environment** will be started immediately
1. Install GitHub apps in your organization or account:

4. Set [Vercel variables][14] as [Repository secrets][15], then every commit will get an independent **Preview URL**
1. [Probot settings][12]: set up Issue labels & Pull Request rules
2. [PR badge][13]: set up Online [VS Code][14] editor entries in Pull Request description

5. Recommend to add a [Notification step in GitHub actions][16] for your Team IM app
6. Remind the PMs & users of your product to submit **Feature/Enhancement** requests or **Bug** reports with [Issue forms][17] instead of IM messages or Mobile Phone calls
7. Collect all these issues into [Project kanbans][18], then create **Pull requests** & add `closes #issue_number` into its description for automation
2. Click the **[<kbd>Use this template</kbd>][15] button** on the top of this GitHub repository's home page, then create your own repository in the app-installed namespace above

3. Click the **[<kbd>Open in GitHub codespaces</kbd>][7] button** on the top of ReadMe file, then an **online VS Code development environment** will be started immediately

4. Set [Vercel variables][16] as [Repository secrets][17], then every commit will get an independent **Preview URL**

5. Recommend to add a [Notification step in GitHub actions][18] for your Team IM app

6. Remind the PMs & users of your product to submit **Feature/Enhancement** requests or **Bug** reports with [Issue forms][19] instead of IM messages or Mobile Phone calls

7. Collect all these issues into [Project kanbans][20], then create **Pull requests** & add `closes #issue_number` into its description for automation

## Development

Expand Down Expand Up @@ -91,9 +98,11 @@ pnpm build weapp
[10]: https://github.com/features/actions
[11]: https://pages.github.com/
[12]: https://github.com/apps/settings
[13]: https://github.com/new?template_name=Taro-Vant-MobX-ts&template_owner=idea2app
[14]: https://github.com/idea2app/Next-Bootstrap-ts/blob/80967ed49045af9dbcf4d3695a2c39d53a6f71f1/.github/workflows/pull-request.yml#L9-L11
[15]: https://github.com/idea2app/Taro-Vant-MobX-ts/settings/secrets/actions
[16]: https://github.com/kaiyuanshe/kaiyuanshe.github.io/blob/bb4675a56bf1d6b207231313da5ed0af7cf0ebd6/.github/workflows/pull-request.yml#L32-L56
[17]: https://github.com/idea2app/Taro-Vant-MobX-ts/issues/new/choose
[18]: https://github.com/idea2app/Taro-Vant-MobX-ts/projects
[13]: https://pullrequestbadge.com/
[14]: https://code.visualstudio.com/
[15]: https://github.com/new?template_name=Taro-Vant-MobX-ts&template_owner=idea2app
[16]: https://github.com/idea2app/Taro-Vant-MobX-ts/blob/a25e770ae6b405eb1b152cec2f17f354c00be9fb/.github/workflows/main.yml#L12-L15
[17]: https://github.com/idea2app/Taro-Vant-MobX-ts/settings/secrets/actions
[18]: https://github.com/kaiyuanshe/kaiyuanshe.github.io/blob/bb4675a56bf1d6b207231313da5ed0af7cf0ebd6/.github/workflows/pull-request.yml#L32-L56
[19]: https://github.com/idea2app/Taro-Vant-MobX-ts/issues/new/choose
[20]: https://github.com/idea2app/Taro-Vant-MobX-ts/projects
81 changes: 41 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@idea2app/taro-vant-mobx-ts",
"name": "taro-vant-mobx-ts",
"version": "1.0.0",
"private": true,
"description": "Taro project scaffold based on TypeScript, Preact, MobX & Vant",
Expand All @@ -21,65 +21,66 @@
"ios >= 8"
],
"dependencies": {
"@antmjs/vantui": "^3.3.5",
"@babel/runtime": "^7.24.1",
"@tarojs/components": "3.6.25",
"@tarojs/helper": "3.6.25",
"@tarojs/plugin-framework-react": "3.6.25",
"@tarojs/plugin-html": "3.6.25",
"@tarojs/plugin-http": "3.6.25",
"@tarojs/plugin-platform-alipay": "3.6.25",
"@tarojs/plugin-platform-h5": "3.6.25",
"@tarojs/plugin-platform-jd": "3.6.25",
"@tarojs/plugin-platform-qq": "3.6.25",
"@tarojs/plugin-platform-swan": "3.6.25",
"@tarojs/plugin-platform-tt": "3.6.25",
"@tarojs/plugin-platform-weapp": "3.6.25",
"@tarojs/runtime": "3.6.25",
"@tarojs/shared": "3.6.25",
"@tarojs/taro": "3.6.25",
"@antmjs/vantui": "^3.4.4",
"@babel/runtime": "^7.24.7",
"@tarojs/components": "3.6.32",
"@tarojs/helper": "3.6.32",
"@tarojs/plugin-framework-react": "3.6.32",
"@tarojs/plugin-html": "3.6.32",
"@tarojs/plugin-http": "3.6.32",
"@tarojs/plugin-platform-alipay": "3.6.32",
"@tarojs/plugin-platform-h5": "3.6.32",
"@tarojs/plugin-platform-jd": "3.6.32",
"@tarojs/plugin-platform-qq": "3.6.32",
"@tarojs/plugin-platform-swan": "3.6.32",
"@tarojs/plugin-platform-tt": "3.6.32",
"@tarojs/plugin-platform-weapp": "3.6.32",
"@tarojs/react": "3.6.32",
"@tarojs/runtime": "3.6.32",
"@tarojs/shared": "3.6.32",
"@tarojs/taro": "3.6.32",
"@vant/area-data": "^1.5.1",
"@vant/icons": "^3.0.2",
"bootstrap": "^5.3.3",
"classnames": "^2.5.1",
"koajax": "^0.9.6",
"koajax": "^1.1.2",
"lodash.debounce": "^4.0.8",
"mobx": "^4.15.7",
"mobx-i18n": "^0.4.2",
"mobx-react": "^6.3.1",
"mobx-restful": "^0.6.12",
"preact": "^10.20.0",
"preact": "^10.22.0",
"query-string": "^9.0.0",
"web-utility": "^4.3.0"
"web-utility": "^4.4.0"
},
"devDependencies": {
"@babel/core": "^7.24.3",
"@octokit/openapi-types": "^20.0.0",
"@babel/core": "^7.24.7",
"@octokit/openapi-types": "^22.2.0",
"@prefresh/babel-plugin": "^0.5.1",
"@prefresh/core": "^1.5.2",
"@prefresh/webpack": "~4.0.0",
"@tarojs/cli": "3.6.25",
"@tarojs/webpack5-runner": "3.6.25",
"@prefresh/webpack": "~4.0.1",
"@tarojs/cli": "3.6.32",
"@tarojs/webpack5-runner": "3.6.32",
"@types/lodash.debounce": "^4.0.9",
"@types/react": "^18.2.67",
"@types/webpack-env": "^1.18.4",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"@types/react": "^18.3.3",
"@types/webpack-env": "^1.18.5",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"babel-plugin-import": "^1.13.8",
"babel-preset-taro": "3.6.25",
"babel-preset-taro": "3.6.32",
"cross-env": "^7.0.3",
"eslint": "^8.57.0",
"eslint-config-taro": "3.6.25",
"eslint-config-taro": "3.6.32",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-simple-import-sort": "^12.1.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"stylelint": "^16.2.1",
"typescript": "~5.4.3",
"webpack": "~5.91.0"
"lint-staged": "^15.2.7",
"prettier": "^3.3.2",
"stylelint": "^16.6.1",
"typescript": "~5.5.2",
"webpack": "~5.92.1"
},
"prettier": {
"trailingComma": "none",
Expand Down
Loading

1 comment on commit 83173e9

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for taro-vant-mobx-ts ready!

✅ Preview
https://taro-vant-mobx-ljls4ykon-techquerys-projects.vercel.app

Built with commit 83173e9.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.