Skip to content

Commit

Permalink
[add] VS Code offline & online development configuration (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
TechQuery authored Mar 21, 2024
1 parent 73ee3c4 commit ebcb99f
Show file tree
Hide file tree
Showing 14 changed files with 3,862 additions and 3,311 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"extends": ["taro/react"],
"plugins": ["simple-import-sort"],
"rules": {
"@typescript-eslint/no-shadow": "off",
"import/first": "off",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"@typescript-eslint/no-shadow": "off",
"react/sort-comp": "off",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off"
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ jobs:
run: pnpm build h5
env:
NODE_ENV: production
- name: Deploy HTML 5 version

- name: Deploy HTML 5 version to GitHub pages
if: ${{ !env.WMA_ID }}
uses: peaceiris/actions-gh-pages@v3
with:
Expand All @@ -45,8 +46,8 @@ jobs:
uses: amondnet/vercel-action@v25
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
working-directory: ./
Expand All @@ -57,16 +58,19 @@ jobs:
run: pnpm build weapp
env:
NODE_ENV: production

- name: Get NPM version
if: ${{ env.WMA_ID }}
uses: martinbeentjes/npm-get-version-action@master
id: package-version

- name: Upload Artifact
if: ${{ env.WMA_ID }}
uses: actions/upload-artifact@v3
with:
name: Taro-miniapp-${{ steps.package-version.outputs.current-version }}-bundle
path: ./dist/

- name: Upload to WeChat
if: ${{ env.WMA_ID }}
run: |
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 @@ -27,7 +27,7 @@ jobs:
- name: Install Dependencies
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }}
run: |
echo '${{ secrets.NPM_RC }}' > .npmrc
echo '${{ secrets.NPM_RC }}' >> .npmrc
pnpm i --frozen-lockfile
- name: Build HTML 5 version
Expand Down
29 changes: 29 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
# and commit this file to your remote git repository to share the goodness with others.

# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart

vscode:
extensions:
- yzhang.markdown-all-in-one
- unifiedjs.vscode-mdx
- xyc.vscode-mdx-preview
- jock.svg
- redhat.vscode-yaml
- clinyong.vscode-css-modules
- akamud.vscode-caniuse
- visualstudioexptteam.intellicode-api-usage-examples
- pflannery.vscode-versionlens
- christian-kohler.npm-intellisense
- esbenp.prettier-vscode
- rangav.vscode-thunder-client
- eamodio.gitlens
- github.vscode-pull-request-github
- github.vscode-github-actions
tasks:
- before: |
pnpm i vercel -g
vercel login --github --oob
init: pnpm i
command: pnpm dev
4 changes: 0 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
#!/bin/sh

. "$(dirname "$0")/_/husky.sh"

npm test
4 changes: 0 additions & 4 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
#!/bin/sh

. "$(dirname "$0")/_/husky.sh"

npm run prepublishOnly
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers = false
19 changes: 19 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"recommendations": [
"yzhang.markdown-all-in-one",
"unifiedjs.vscode-mdx",
"xyc.vscode-mdx-preview",
"jock.svg",
"redhat.vscode-yaml",
"clinyong.vscode-css-modules",
"akamud.vscode-caniuse",
"visualstudioexptteam.intellicode-api-usage-examples",
"pflannery.vscode-versionlens",
"christian-kohler.npm-intellisense",
"esbenp.prettier-vscode",
"rangav.vscode-thunder-client",
"eamodio.gitlens",
"github.vscode-pull-request-github",
"github.vscode-github-actions"
]
}
50 changes: 40 additions & 10 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

[![CI & CD](https://github.com/IdeaMall/mini-app/actions/workflows/main.yml/badge.svg)][6]

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)][7]
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)][8]

## Demo

https://ideamall.github.io/mini-app/
Expand All @@ -13,8 +16,8 @@ https://ideamall.github.io/mini-app/
- Language: [TypeScript v5][2]
- Component engine: [Preact v10][3]
- State management: [MobX v4][4]
- Component suite: [AntM Vant UI v3][5] + [Bootstrap v5 (CSS utility)][7]
- CI / CD: GitHub [Actions][8] + [Pages][9]
- Component suite: [AntM Vant UI v3][5] + [Bootstrap v5 (CSS utility)][9]
- CI / CD: GitHub [Actions][10] + [Pages][11]

## Extra components

Expand All @@ -23,24 +26,49 @@ https://ideamall.github.io/mini-app/

## Development

1. sign in GitHub NPM: https://github.com/IdeaMall/data-model#usage
### Install & Start

1. sign in GitHub NPM: https://github.com/IdeaMall/data-service#type-package

2. execute installation commands:

```shell
npm i pnpm -g
npm set strict-peer-dependencies=false

pnpm i
```

### Start Dev-server

```shell
pnpm dev h5
# pnpm dev weapp
# or
pnpm dev weapp
```

### Mini-app Debug

#### Windows

```shell
winget install Tencent.WeixinDevTools
winget install Tencent.qq-devtool
winget install Alibaba.MiniProgramStudio
winget install ByteDance.DouyinIDE
winget install Baidu.SwanIDE
```

#### Mac OS X

```shell
brew install --cask wechatwebdevtools
```

## Deployment

```shell
pnpm build h5
# pnpm build weapp
# or
pnpm build weapp
```

[1]: https://taro-docs.jd.com/
Expand All @@ -49,6 +77,8 @@ pnpm build h5
[4]: https://github.com/mobxjs/mobx/blob/mobx4and5/docs/
[5]: https://antmjs.github.io/vantui/
[6]: https://github.com/IdeaMall/mini-app/actions/workflows/main.yml
[7]: https://getbootstrap.com/docs/5.3/getting-started/contents/#css-files
[8]: https://github.com/features/actions
[9]: https://pages.github.com/
[7]: https://codespaces.new/IdeaMall/mini-app
[8]: https://gitpod.io/?autostart=true#https://github.com/IdeaMall/mini-app
[9]: https://getbootstrap.com/docs/5.1/getting-started/contents/#css-files
[10]: https://github.com/features/actions
[11]: https://pages.github.com/
5 changes: 4 additions & 1 deletion config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const config = {
750: 1,
828: 1.81 / 2
},
compiler: 'webpack5',
compiler: { type: 'webpack5', prebundle: { enable: false } },
sourceRoot: 'src',
outputRoot: 'dist',
defineConstants: {},
Expand Down Expand Up @@ -49,6 +49,9 @@ const config = {
},
miniCssExtractPluginOption: {
ignoreOrder: true
},
optimizeMainPackage: {
enable: true
}
},
h5: {
Expand Down
108 changes: 54 additions & 54 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"css": "less"
},
"scripts": {
"prepare": "husky install",
"prepare": "husky",
"build": "taro build --type",
"dev": "taro build --watch --type",
"test": "lint-staged",
Expand All @@ -21,67 +21,67 @@
"ios >= 8"
],
"dependencies": {
"@antmjs/vantui": "^3.1.4",
"@authing/miniapp-taro": "^5.1.9",
"@babel/runtime": "^7.22.6",
"@ideamall/data-model": "^1.0.0-rc.2",
"@tarojs/components": "3.6.9",
"@tarojs/helper": "3.6.9",
"@tarojs/plugin-framework-react": "3.6.9",
"@tarojs/plugin-html": "3.6.9",
"@tarojs/plugin-http": "3.6.9",
"@tarojs/plugin-platform-alipay": "3.6.9",
"@tarojs/plugin-platform-h5": "3.6.9",
"@tarojs/plugin-platform-jd": "3.6.9",
"@tarojs/plugin-platform-qq": "3.6.9",
"@tarojs/plugin-platform-swan": "3.6.9",
"@tarojs/plugin-platform-tt": "3.6.9",
"@tarojs/plugin-platform-weapp": "3.6.9",
"@tarojs/runtime": "3.6.9",
"@tarojs/shared": "3.6.9",
"@tarojs/taro": "3.6.9",
"@vant/area-data": "^1.4.1",
"@vant/icons": "^2.0.1",
"bootstrap": "^5.3.0",
"classnames": "^2.3.2",
"koajax": "^0.8.4",
"@antmjs/vantui": "^3.3.5",
"@authing/miniapp-taro": "^5.1.18",
"@babel/runtime": "^7.24.1",
"@ideamall/data-service": "1.0.0-alpha.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",
"@vant/area-data": "^1.5.1",
"@vant/icons": "^3.0.2",
"bootstrap": "^5.3.3",
"classnames": "^2.5.1",
"koajax": "^0.9.6",
"lodash.debounce": "^4.0.8",
"mobx": "^4.15.7",
"mobx-i18n": "^0.3.15",
"mobx-i18n": "^0.4.2",
"mobx-react": "^6.3.1",
"mobx-restful": "^0.6.5",
"preact": "^10.16.0",
"query-string": "^8.1.0",
"web-utility": "^4.0.1"
"mobx-restful": "^0.6.12",
"preact": "^10.20.0",
"query-string": "^9.0.0",
"web-utility": "^4.3.0"
},
"devDependencies": {
"@babel/core": "^7.22.9",
"@octokit/openapi-types": "^18.0.0",
"@prefresh/babel-plugin": "^0.5.0",
"@prefresh/core": "^1.5.1",
"@babel/core": "^7.24.3",
"@octokit/openapi-types": "^20.0.0",
"@prefresh/babel-plugin": "^0.5.1",
"@prefresh/core": "^1.5.2",
"@prefresh/webpack": "~4.0.0",
"@tarojs/cli": "3.6.9",
"@tarojs/webpack5-runner": "3.6.9",
"@types/lodash.debounce": "^4.0.7",
"@types/react": "^18.2.16",
"@types/webpack-env": "^1.18.1",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"babel-plugin-import": "^1.13.6",
"babel-preset-taro": "3.6.9",
"@tarojs/cli": "3.6.25",
"@tarojs/webpack5-runner": "3.6.25",
"@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",
"babel-plugin-import": "^1.13.8",
"babel-preset-taro": "3.6.25",
"cross-env": "^7.0.3",
"eslint": "^8.45.0",
"eslint-config-taro": "3.6.9",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-react": "^7.33.0",
"eslint": "^8.57.0",
"eslint-config-taro": "3.6.25",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.3",
"prettier": "^2.8.8",
"stylelint": "^15.10.2",
"typescript": "~5.0.4",
"webpack": "~5.88.2"
"eslint-plugin-simple-import-sort": "^12.0.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"
},
"prettier": {
"trailingComma": "none",
Expand Down
Loading

0 comments on commit ebcb99f

Please sign in to comment.