Skip to content

Commit 41c04c6

Browse files
committed
Initial commit
0 parents  commit 41c04c6

36 files changed

+727
-0
lines changed

.github/workflows/ci.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build & Deploy
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
build-deploy:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: 14
15+
16+
- run: npm i npm@7 -g
17+
# - run: npm ci
18+
- run: npm install
19+
# - run: npm run hoist
20+
- run: npm run bootstrap
21+
- run: npm run build
22+
- run: npm run build:website
23+
24+
- name: Create Tag
25+
id: create_tag
26+
uses: jaywcjlove/[email protected]
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
package-path: ./packages/base/package.json
30+
31+
- name: Generate Changelog
32+
id: changelog
33+
uses: jaywcjlove/[email protected]
34+
if: steps.create_tag.outputs.successful
35+
with:
36+
token: ${{ secrets.GITHUB_TOKEN }}
37+
head-ref: ${{steps.create_tag.outputs.version}}
38+
filter-author: (renovate-bot|Renovate Bot)
39+
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'
40+
41+
- name: Create Release
42+
uses: jaywcjlove/[email protected]
43+
with:
44+
package-path: ./packages/base/package.json
45+
release: true
46+
body: |
47+
${{ steps.changelog.outputs.compareurl }}
48+
49+
${{ steps.changelog.outputs.changelog }}
50+
51+
- name: Deploy
52+
uses: peaceiris/actions-gh-pages@v3
53+
with:
54+
github_token: ${{ secrets.GITHUB_TOKEN }}
55+
publish_dir: ./website/dist

.gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
node_modules
2+
dist
3+
lib
4+
esm
5+
cjs
6+
7+
8+
# local env files
9+
.env.local
10+
.env.*.local
11+
12+
# Log files
13+
npm-debug.log*
14+
yarn.lock
15+
yarn-debug.log*
16+
yarn-error.log*
17+
pnpm-debug.log*
18+
package-lock.json
19+
20+
# Editor directories and files
21+
.DS_Store
22+
.idea
23+
.vscode
24+
*.suo
25+
*.ntvs*
26+
*.njsproj
27+
*.sln
28+
*.sw?

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
./node_modules/.bin/pretty-quick --staged

.prettierignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
**/*.md
2+
**/*.svg
3+
**/*.ejs
4+
**/*.yml
5+
package.json
6+
node_modules
7+
dist
8+
build
9+
lib
10+
esm
11+
cjs
12+
test

.prettierrc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 120,
5+
"overrides": [
6+
{
7+
"files": ".prettierrc",
8+
"options": { "parser": "json" }
9+
}
10+
]
11+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 TSBB
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
vue-simple-package
2+
===
3+
4+
简单的 [`vue 3`](https://v3.vuejs.org/) 包开发工程实例模板。
5+
6+
### 目录结构
7+
8+
```shell
9+
.
10+
├── README.md
11+
├── lerna.json
12+
├── package.json
13+
├── packages # 放置包的目录
14+
│   ├── base # 📦 包 @vue-simple-package/base
15+
│   │   ├── cjs # 🔄 编译后的 cjs 目录
16+
│   │   ├── esm # 🔄 编译后的 esm 目录
17+
│   │   ├── package.json
18+
│   │   ├── src # 包源码目录
19+
│   │   └── tsconfig.json
20+
│   └── simple # 📦 包 @vue-simple-package/simple
21+
├── tsconfig.json
22+
└── website # 🐝 包实例测试,网站
23+
├── README.md
24+
├── babel.config.js
25+
├── package.json
26+
├── public
27+
├── src
28+
└── vue.config.js
29+
```
30+
31+
### 开发
32+
33+
1. 安装
34+
35+
```shell
36+
npm install
37+
```
38+
39+
2. 安装包和实例中的依赖
40+
41+
```shell
42+
npm run bootstrap
43+
```
44+
45+
3. 编译包中代码
46+
47+
```shell
48+
npm run build # 编译所有包 📦 代码
49+
50+
npm run watch:simple # 实时编译 📦 @vue-simple-package/simple
51+
npm run watch:base # 实时编译 📦 @vue-simple-package/base
52+
```
53+
54+
4. 启动 `website` 实例网站
55+
56+
```shell
57+
npm run start
58+
```
59+
60+
### License
61+
62+
Licensed under the MIT License.

lerna.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"version": "1.0.0",
3+
"packages": ["website", "packages/*"]
4+
}

package.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "vue-simple-package",
3+
"private": true,
4+
"scripts": {
5+
"prepare": "husky install",
6+
"start": "lerna exec \"npm run serve\" --scope website",
7+
"build:website": "lerna exec \"npm run build\" --scope website",
8+
"build": "lerna exec \"tsbb build --use-vue\" --scope @vue-simple-package/*",
9+
"watch:simple": "lerna exec \"tsbb watch --use-vue\" --scope @vue-simple-package/simple",
10+
"watch:base": "lerna exec \"tsbb watch --use-vue\" --scope @vue-simple-package/base",
11+
"prettier": "prettier --write \"**/*.{js,jsx,vue,tsx,ts,less,md,json}\"",
12+
"clean": "lerna clean --yes",
13+
"hoist": "lerna bootstrap --hoist",
14+
"bootstrap": "lerna bootstrap --force-local --no-ci"
15+
},
16+
"author": "jaywcjlove",
17+
"license": "MIT",
18+
"devDependencies": {
19+
"husky": "7.0.4",
20+
"prettier": "2.4.1",
21+
"pretty-quick": "3.1.2",
22+
"lerna": "4.0.0",
23+
"tsbb": "^3.5.0"
24+
}
25+
}

packages/base/README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@vue-simple-package/base
2+
===
3+
4+
```bash
5+
npm i @vue-simple-package/base
6+
```
7+
8+
```vue
9+
<template>
10+
<div>
11+
<v-base title="002"></v-base>
12+
</div>
13+
</template>
14+
15+
<script>
16+
import { defineComponent } from 'vue'
17+
import VBase from '@vue-simple-package/base';
18+
19+
export default defineComponent({
20+
components: {
21+
VBase
22+
}
23+
});
24+
</script>
25+
```

packages/base/package.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@vue-simple-package/base",
3+
"version": "1.0.0",
4+
"description": "base package.",
5+
"main": "./cjs/index.js",
6+
"module": "./esm/index.js",
7+
"license": "MIT",
8+
"peerDependencies": {
9+
"vue": ">=3.0.0"
10+
},
11+
"devDependencies": {
12+
"vue": "^3.0.0"
13+
}
14+
}

packages/base/src/index.tsx

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { defineComponent, h } from 'vue';
2+
3+
export default defineComponent({
4+
name: 'Base',
5+
props: {
6+
title: {
7+
type: String,
8+
defalut: 'title',
9+
},
10+
},
11+
setup(props) {
12+
return {
13+
...props,
14+
};
15+
},
16+
render() {
17+
const { title } = this;
18+
return <div>Package Base, {title}</div>;
19+
},
20+
});

packages/base/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../tsconfig",
3+
"compilerOptions": {
4+
"baseUrl": ".",
5+
"outDir": "cjs",
6+
"noEmit": false
7+
}
8+
}

packages/simple/README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@vue-simple-package/simple
2+
===
3+
4+
```bash
5+
npm i @vue-simple-package/simple
6+
```
7+
8+
```vue
9+
<template>
10+
<div>
11+
<simple title="001"></simple>
12+
</div>
13+
</template>
14+
15+
<script>
16+
import { defineComponent } from 'vue'
17+
import Simple from '@vue-simple-package/simple';
18+
19+
export default defineComponent({
20+
components: {
21+
Simple
22+
}
23+
});
24+
</script>
25+
```

packages/simple/package.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@vue-simple-package/simple",
3+
"version": "1.0.0",
4+
"description": "simple package.",
5+
"main": "./cjs/index.js",
6+
"module": "./esm/index.js",
7+
"license": "MIT",
8+
"peerDependencies": {
9+
"vue": ">=3.0.0"
10+
},
11+
"devDependencies": {
12+
"vue": "^3.0.0"
13+
}
14+
}

packages/simple/src/index.tsx

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { defineComponent, h } from 'vue';
2+
3+
export default defineComponent({
4+
name: 'Simple',
5+
props: {
6+
title: {
7+
type: String,
8+
defalut: 'title',
9+
},
10+
},
11+
setup(props) {
12+
console.log(props);
13+
return {
14+
...props,
15+
};
16+
},
17+
render() {
18+
const { title } = this;
19+
return <div>Package Simple, {title}</div>;
20+
},
21+
});

packages/simple/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../tsconfig",
3+
"compilerOptions": {
4+
"baseUrl": ".",
5+
"outDir": "cjs",
6+
"noEmit": false
7+
}
8+
}

renovate.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": [
3+
"config:base"
4+
]
5+
}

0 commit comments

Comments
 (0)