Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[add] Initialization script & action of GitHub template repository #10

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
- main
env:
TEMPLATE_OWNER: EasyWebApp
TEMPLATE_NAME: WebCell-scaffold

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 @@ -15,7 +15,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/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 8
version: 9
- uses: actions/setup-node@v3
with:
node-version: 18
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)
55 changes: 33 additions & 22 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
![](src/image/WebCell-0.png)

# WebCell scaffold
# WebCell-scaffold

App Project scaffold of **WebCell** v3
App Project scaffold of [WebCell][1] v3

https://web-cell-scaffold.vercel.app/

[![CI & CD](https://github.com/EasyWebApp/scaffold/actions/workflows/main.yml/badge.svg)][2]
[![CI & CD](https://github.com/EasyWebApp/WebCell-scaffold/actions/workflows/main.yml/badge.svg)][2]

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

## Technology stack

- Language: [TypeScript v5][5]
- Component engine: [WebCell v3][6]
- Component engine: [WebCell v3][1]
- Component suite: [BootCell v2][7]
- PWA framework: [Workbox v7][8]
- Package bundler: [Parcel v2][9]
Expand All @@ -36,28 +36,39 @@ pnpm build

## Best practice

1. Install **[Settings][12] GitHub app** in your account or organization
2. Click the **[Use this template][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 **[Open in GitHub codespaces][3] button** on the top of ReadMe file, then an **online VS Code development environment** will be started immediately
4. Set [Vercel variables][14] as [Repository secrets][15], then every commit will get an independent **Preview URL**
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]: https://github.com/EasyWebApp/scaffold/actions/workflows/main.yml
[3]: https://codespaces.new/EasyWebApp/scaffold
[4]: https://gitpod.io/?autostart=true#https://github.com/EasyWebApp/scaffold
1. Install GitHub apps in your organization or account:

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

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>][3] 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

[1]: https://web-cell.dev/
[2]: https://github.com/EasyWebApp/WebCell-scaffold/actions/workflows/main.yml
[3]: https://codespaces.new/EasyWebApp/WebCell-scaffold
[4]: https://gitpod.io/?autostart=true#https://github.com/EasyWebApp/WebCell-scaffold
[5]: https://typescriptlang.org/
[6]: https://web-cell.dev/
[7]: https://bootstrap.web-cell.dev/
[8]: https://developers.google.com/web/tools/workbox
[9]: https://parceljs.org/
[10]: https://github.com/features/actions
[11]: https://pages.github.com/
[12]: https://github.com/apps/settings
[13]: https://github.com/new?template_name=scaffold&template_owner=EasyWebApp
[14]: https://github.com/idea2app/Next-Bootstrap-ts/blob/80967ed49045af9dbcf4d3695a2c39d53a6f71f1/.github/workflows/pull-request.yml#L9-L12
[15]: https://github.com/EasyWebApp/scaffold/settings/secrets/actions
[16]: https://github.com/kaiyuanshe/kaiyuanshe.github.io/blob/bb4675a56bf1d6b207231313da5ed0af7cf0ebd6/.github/workflows/pull-request.yml#L32-L56
[17]: https://github.com/EasyWebApp/scaffold/issues/new/choose
[18]: https://github.com/EasyWebApp/scaffold/projects
[13]: https://pullrequestbadge.com/
[14]: https://code.visualstudio.com/
[15]: https://github.com/new?template_name=WebCell-scaffold&template_owner=EasyWebApp
[16]: https://github.com/EasyWebApp/WebCell-scaffold/blob/eaa710bc8d737a52bf726ebe339e2a29db7e3e04/.github/workflows/main.yml#L9-L11
[17]: https://github.com/EasyWebApp/WebCell-scaffold/settings/secrets/actions
[18]: https://github.com/kaiyuanshe/kaiyuanshe.github.io/blob/bb4675a56bf1d6b207231313da5ed0af7cf0ebd6/.github/workflows/pull-request.yml#L32-L56
[19]: https://github.com/EasyWebApp/WebCell-scaffold/issues/new/choose
[20]: https://github.com/EasyWebApp/WebCell-scaffold/projects
51 changes: 26 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,39 @@
],
"repository": {
"type": "git",
"url": "git+https://github.com/EasyWebApp/scaffold.git"
"url": "git+https://github.com/EasyWebApp/WebCell-scaffold.git"
},
"bugs": {
"url": "https://github.com/EasyWebApp/scaffold/issues"
"url": "https://github.com/EasyWebApp/WebCell-scaffold/issues"
},
"dependencies": {
"boot-cell": "^2.0.0-beta.18",
"boot-cell": "^2.0.0-beta.29",
"browser-unhandled-rejection": "^1.0.2",
"cell-router": "^3.0.0-rc.5",
"cell-router": "^3.0.0-rc.8",
"classnames": "^2.5.1",
"dom-renderer": "^2.1.3",
"mobx": "^6.12.0",
"web-cell": "^3.0.0-rc.15",
"web-utility": "^4.1.3"
"dom-renderer": "^2.1.8",
"iterable-observer": "^1.0.1",
"mobx": "^6.12.4",
"web-cell": "^3.0.0-rc.16",
"web-utility": "^4.4.0"
},
"devDependencies": {
"@parcel/config-default": "~2.11.0",
"@parcel/packager-raw-url": "~2.11.0",
"@parcel/transformer-less": "~2.11.0",
"@parcel/transformer-typescript-tsc": "~2.11.0",
"@parcel/transformer-webmanifest": "~2.11.0",
"@types/node": "^18.19.15",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"eslint": "^8.56.0",
"@parcel/config-default": "~2.12.0",
"@parcel/packager-raw-url": "~2.12.0",
"@parcel/transformer-less": "~2.12.0",
"@parcel/transformer-typescript-tsc": "~2.12.0",
"@parcel/transformer-webmanifest": "~2.12.0",
"@types/node": "^18.19.39",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"husky": "^9.0.10",
"lint-staged": "^15.2.2",
"parcel": "~2.11.0",
"prettier": "^3.2.5",
"typescript": "~5.3.3",
"workbox-cli": "^7.0.0"
"husky": "^9.0.11",
"lint-staged": "^15.2.7",
"parcel": "~2.12.0",
"prettier": "^3.3.2",
"typescript": "~5.5.2",
"workbox-cli": "^7.1.0"
},
"prettier": {
"singleQuote": true,
Expand All @@ -54,10 +55,10 @@
"*.{js,ts,tsx}": "eslint --fix"
},
"scripts": {
"prepare": "husky install",
"prepare": "husky",
"test": "lint-staged",
"clean": "rm -rf .parcel-cache/ dist/",
"start": "npm run clean && parcel src/index.html --open",
"start": "npm run clean && parcel src/index.html",
"pack": "npm run clean && parcel build src/index.html --public-url .",
"build": "npm run pack && workbox generateSW"
}
Expand Down
Loading
Loading