ci: 新增 docs 自动部署脚本
parent
17cbfb2e82
commit
5c97f41d68
|
@ -0,0 +1 @@
|
|||
/dist
|
|
@ -4,9 +4,15 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- '**.md'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
name: Deploy Docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- '**.md'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- '**.md'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 7
|
||||
|
||||
- name: Set node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: pnpm
|
||||
|
||||
- name: Install
|
||||
run: pnpm i
|
||||
|
||||
- name: Build
|
||||
run: pnpm docs:build
|
||||
|
||||
- name: Deploy
|
||||
uses: netlify/actions/cli@master
|
||||
with:
|
||||
args: deploy --prod
|
||||
env:
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
"lib": ["DOM", "ESNext"],
|
||||
"strict": true,
|
||||
"jsx": "preserve",
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"noUnusedLocals": true,
|
||||
"strictNullChecks": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"types": ["vite/client", "vite-plugin-pwa/client", "vitepress"]
|
||||
},
|
||||
"include": [
|
||||
"./.vitepress/**/*.ts",
|
||||
"./.vitepress/**/*.vue",
|
||||
"./.vitepress/components.d.ts"
|
||||
],
|
||||
"exclude": ["dist", "node_modules"]
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
[build]
|
||||
command = "npx pnpm i --store=node_modules/.pnpm-store --frozen-lockfile && npm run docs:build"
|
||||
publish = "docs/.vitepress/dist"
|
||||
|
||||
[build.environment]
|
||||
NODE_VERSION = "16"
|
||||
NPM_FLAGS = "--version"
|
|
@ -46,8 +46,6 @@
|
|||
"devDependencies": {
|
||||
"@commitlint/cli": "^17.4.4",
|
||||
"@commitlint/config-conventional": "^17.4.4",
|
||||
"@esbuild-kit/cjs-loader": "^2.4.2",
|
||||
"@types/jest": "^29.5.0",
|
||||
"@types/node": "^18.15.5",
|
||||
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
||||
"@typescript-eslint/parser": "^5.55.0",
|
||||
|
|
172
pnpm-lock.yaml
172
pnpm-lock.yaml
|
@ -6,8 +6,6 @@ importers:
|
|||
specifiers:
|
||||
'@commitlint/cli': ^17.4.4
|
||||
'@commitlint/config-conventional': ^17.4.4
|
||||
'@esbuild-kit/cjs-loader': ^2.4.2
|
||||
'@types/jest': ^29.5.0
|
||||
'@types/node': ^18.15.5
|
||||
'@typescript-eslint/eslint-plugin': ^5.55.0
|
||||
'@typescript-eslint/parser': ^5.55.0
|
||||
|
@ -35,8 +33,6 @@ importers:
|
|||
devDependencies:
|
||||
'@commitlint/cli': 17.5.0
|
||||
'@commitlint/config-conventional': 17.4.4
|
||||
'@esbuild-kit/cjs-loader': 2.4.2
|
||||
'@types/jest': 29.5.0
|
||||
'@types/node': 18.15.5
|
||||
'@typescript-eslint/eslint-plugin': 5.56.0_2hcjazgfnbtq42tcc73br2vup4
|
||||
'@typescript-eslint/parser': 5.56.0_j4766f7ecgqbon3u7zlxn5zszu
|
||||
|
@ -81,6 +77,9 @@ packages:
|
|||
peerDependencies:
|
||||
'@algolia/client-search': '>= 4.9.1 < 6'
|
||||
algoliasearch: '>= 4.9.1 < 6'
|
||||
peerDependenciesMeta:
|
||||
'@algolia/client-search':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@algolia/autocomplete-shared': 1.7.4
|
||||
algoliasearch: 4.16.0
|
||||
|
@ -717,32 +716,6 @@ packages:
|
|||
engines: {node: '>=6.9.0'}
|
||||
dev: true
|
||||
|
||||
/@jest/expect-utils/29.5.0:
|
||||
resolution: {integrity: sha512-fmKzsidoXQT2KwnrwE0SQq3uj8Z763vzR8LnLBwC2qYWEFpjX8daRsk6rHUM1QvNlEW/UJXNXm59ztmJJWs2Mg==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
dependencies:
|
||||
jest-get-type: 29.4.3
|
||||
dev: true
|
||||
|
||||
/@jest/schemas/29.4.3:
|
||||
resolution: {integrity: sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
dependencies:
|
||||
'@sinclair/typebox': 0.25.24
|
||||
dev: true
|
||||
|
||||
/@jest/types/29.5.0:
|
||||
resolution: {integrity: sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
dependencies:
|
||||
'@jest/schemas': 29.4.3
|
||||
'@types/istanbul-lib-coverage': 2.0.4
|
||||
'@types/istanbul-reports': 3.0.1
|
||||
'@types/node': 18.15.5
|
||||
'@types/yargs': 17.0.23
|
||||
chalk: 4.1.2
|
||||
dev: true
|
||||
|
||||
/@jridgewell/resolve-uri/3.1.0:
|
||||
resolution: {integrity: sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
|
@ -795,10 +768,6 @@ packages:
|
|||
rollup: 3.20.0
|
||||
dev: true
|
||||
|
||||
/@sinclair/typebox/0.25.24:
|
||||
resolution: {integrity: sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==}
|
||||
dev: true
|
||||
|
||||
/@tsconfig/node10/1.0.9:
|
||||
resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==}
|
||||
dev: true
|
||||
|
@ -829,29 +798,6 @@ packages:
|
|||
resolution: {integrity: sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==}
|
||||
dev: true
|
||||
|
||||
/@types/istanbul-lib-coverage/2.0.4:
|
||||
resolution: {integrity: sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==}
|
||||
dev: true
|
||||
|
||||
/@types/istanbul-lib-report/3.0.0:
|
||||
resolution: {integrity: sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==}
|
||||
dependencies:
|
||||
'@types/istanbul-lib-coverage': 2.0.4
|
||||
dev: true
|
||||
|
||||
/@types/istanbul-reports/3.0.1:
|
||||
resolution: {integrity: sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==}
|
||||
dependencies:
|
||||
'@types/istanbul-lib-report': 3.0.0
|
||||
dev: true
|
||||
|
||||
/@types/jest/29.5.0:
|
||||
resolution: {integrity: sha512-3Emr5VOl/aoBwnWcH/EFQvlSAmjV+XtV9GGu5mwdYew5vhQh0IUZx/60x0TzHDu09Bi7HMx10t/namdJw5QIcg==}
|
||||
dependencies:
|
||||
expect: 29.5.0
|
||||
pretty-format: 29.5.0
|
||||
dev: true
|
||||
|
||||
/@types/json-schema/7.0.11:
|
||||
resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==}
|
||||
dev: true
|
||||
|
@ -872,24 +818,10 @@ packages:
|
|||
resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==}
|
||||
dev: true
|
||||
|
||||
/@types/stack-utils/2.0.1:
|
||||
resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==}
|
||||
dev: true
|
||||
|
||||
/@types/web-bluetooth/0.0.16:
|
||||
resolution: {integrity: sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==}
|
||||
dev: true
|
||||
|
||||
/@types/yargs-parser/21.0.0:
|
||||
resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==}
|
||||
dev: true
|
||||
|
||||
/@types/yargs/17.0.23:
|
||||
resolution: {integrity: sha512-yuogunc04OnzGQCrfHx+Kk883Q4X0aSwmYZhKjI21m+SVYzjIbrWl8dOOwSv5hf2Um2pdCOXWo9isteZTNXUZQ==}
|
||||
dependencies:
|
||||
'@types/yargs-parser': 21.0.0
|
||||
dev: true
|
||||
|
||||
/@typescript-eslint/eslint-plugin/5.56.0_2hcjazgfnbtq42tcc73br2vup4:
|
||||
resolution: {integrity: sha512-ZNW37Ccl3oMZkzxrYDUX4o7cnuPgU+YrcaYXzsRtLB16I1FR5SHMqga3zGsaSliZADCWo2v8qHWqAYIj8nWCCg==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
|
@ -1426,11 +1358,6 @@ packages:
|
|||
resolution: {integrity: sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==}
|
||||
dev: true
|
||||
|
||||
/ci-info/3.8.0:
|
||||
resolution: {integrity: sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==}
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/clean-stack/2.2.0:
|
||||
resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==}
|
||||
engines: {node: '>=6'}
|
||||
|
@ -1788,11 +1715,6 @@ packages:
|
|||
resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}
|
||||
dev: true
|
||||
|
||||
/diff-sequences/29.4.3:
|
||||
resolution: {integrity: sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
dev: true
|
||||
|
||||
/diff/4.0.2:
|
||||
resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==}
|
||||
engines: {node: '>=0.3.1'}
|
||||
|
@ -1893,11 +1815,6 @@ packages:
|
|||
engines: {node: '>=0.8.0'}
|
||||
dev: true
|
||||
|
||||
/escape-string-regexp/2.0.0:
|
||||
resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==}
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/escape-string-regexp/4.0.0:
|
||||
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
|
||||
engines: {node: '>=10'}
|
||||
|
@ -2052,17 +1969,6 @@ packages:
|
|||
strip-final-newline: 3.0.0
|
||||
dev: true
|
||||
|
||||
/expect/29.5.0:
|
||||
resolution: {integrity: sha512-yM7xqUrCO2JdpFo4XpM82t+PJBFybdqoQuJLDGeDX2ij8NZzqRHyu3Hp188/JX7SWqud+7t4MUdvcgGBICMHZg==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
dependencies:
|
||||
'@jest/expect-utils': 29.5.0
|
||||
jest-get-type: 29.4.3
|
||||
jest-matcher-utils: 29.5.0
|
||||
jest-message-util: 29.5.0
|
||||
jest-util: 29.5.0
|
||||
dev: true
|
||||
|
||||
/fast-deep-equal/3.1.3:
|
||||
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
||||
dev: true
|
||||
|
@ -2474,58 +2380,6 @@ packages:
|
|||
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
|
||||
dev: true
|
||||
|
||||
/jest-diff/29.5.0:
|
||||
resolution: {integrity: sha512-LtxijLLZBduXnHSniy0WMdaHjmQnt3g5sa16W4p0HqukYTTsyTW3GD1q41TyGl5YFXj/5B2U6dlh5FM1LIMgxw==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
dependencies:
|
||||
chalk: 4.1.2
|
||||
diff-sequences: 29.4.3
|
||||
jest-get-type: 29.4.3
|
||||
pretty-format: 29.5.0
|
||||
dev: true
|
||||
|
||||
/jest-get-type/29.4.3:
|
||||
resolution: {integrity: sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
dev: true
|
||||
|
||||
/jest-matcher-utils/29.5.0:
|
||||
resolution: {integrity: sha512-lecRtgm/rjIK0CQ7LPQwzCs2VwW6WAahA55YBuI+xqmhm7LAaxokSB8C97yJeYyT+HvQkH741StzpU41wohhWw==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
dependencies:
|
||||
chalk: 4.1.2
|
||||
jest-diff: 29.5.0
|
||||
jest-get-type: 29.4.3
|
||||
pretty-format: 29.5.0
|
||||
dev: true
|
||||
|
||||
/jest-message-util/29.5.0:
|
||||
resolution: {integrity: sha512-Kijeg9Dag6CKtIDA7O21zNTACqD5MD/8HfIV8pdD94vFyFuer52SigdC3IQMhab3vACxXMiFk+yMHNdbqtyTGA==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
dependencies:
|
||||
'@babel/code-frame': 7.18.6
|
||||
'@jest/types': 29.5.0
|
||||
'@types/stack-utils': 2.0.1
|
||||
chalk: 4.1.2
|
||||
graceful-fs: 4.2.11
|
||||
micromatch: 4.0.5
|
||||
pretty-format: 29.5.0
|
||||
slash: 3.0.0
|
||||
stack-utils: 2.0.6
|
||||
dev: true
|
||||
|
||||
/jest-util/29.5.0:
|
||||
resolution: {integrity: sha512-RYMgG/MTadOr5t8KdhejfvUU82MxsCu5MF6KuDUHl+NuwzUt+Sm6jJWxTJVrDR1j5M/gJVCPKQEpWXY+yIQ6lQ==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
dependencies:
|
||||
'@jest/types': 29.5.0
|
||||
'@types/node': 18.15.5
|
||||
chalk: 4.1.2
|
||||
ci-info: 3.8.0
|
||||
graceful-fs: 4.2.11
|
||||
picomatch: 2.3.1
|
||||
dev: true
|
||||
|
||||
/joycon/3.1.1:
|
||||
resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==}
|
||||
engines: {node: '>=10'}
|
||||
|
@ -3215,15 +3069,6 @@ packages:
|
|||
react-is: 17.0.2
|
||||
dev: true
|
||||
|
||||
/pretty-format/29.5.0:
|
||||
resolution: {integrity: sha512-V2mGkI31qdttvTFX7Mt4efOqHXqJWMu4/r66Xh3Z3BwZaPfPJgp6/gbwoujRpPUtfEF6AUUWx3Jim3GCw5g/Qw==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
dependencies:
|
||||
'@jest/schemas': 29.4.3
|
||||
ansi-styles: 5.2.0
|
||||
react-is: 18.2.0
|
||||
dev: true
|
||||
|
||||
/process-nextick-args/2.0.1:
|
||||
resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
|
||||
dev: true
|
||||
|
@ -3251,10 +3096,6 @@ packages:
|
|||
resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==}
|
||||
dev: true
|
||||
|
||||
/react-is/18.2.0:
|
||||
resolution: {integrity: sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==}
|
||||
dev: true
|
||||
|
||||
/read-pkg-up/3.0.0:
|
||||
resolution: {integrity: sha512-YFzFrVvpC6frF1sz8psoHDBGF7fLPc+llq/8NB43oagqWkx8ar5zYtsTORtOjw9W2RHLpWP+zTWwBvf1bCmcSw==}
|
||||
engines: {node: '>=4'}
|
||||
|
@ -3591,13 +3432,6 @@ packages:
|
|||
readable-stream: 3.6.2
|
||||
dev: true
|
||||
|
||||
/stack-utils/2.0.6:
|
||||
resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==}
|
||||
engines: {node: '>=10'}
|
||||
dependencies:
|
||||
escape-string-regexp: 2.0.0
|
||||
dev: true
|
||||
|
||||
/stackback/0.0.2:
|
||||
resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}
|
||||
dev: true
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import path from 'node:path';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import esbuildPlugin from 'rollup-plugin-esbuild';
|
||||
import dtsPlugin from 'rollup-plugin-dts';
|
||||
import { __dirname, distPath, getPkgJSON } from './scripts/utils.js';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
const pkg = getPkgJSON();
|
||||
const inputPath = path.resolve(__dirname, 'src/index.ts');
|
||||
|
@ -20,11 +20,6 @@ function main() {
|
|||
return configs;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} format
|
||||
* @returns {import('rollup').InputOptions}
|
||||
*/
|
||||
function buildConfig(format) {
|
||||
const isDts = format === 'dts';
|
||||
const output = {
|
||||
|
@ -72,8 +67,8 @@ function compleTypePlugin(files) {
|
|||
(file) =>
|
||||
`// ${file.replace(__dirname, '')}\n${readFileSync(
|
||||
file,
|
||||
).toString()}\n// ${file.replace(__dirname, '')} end\n`,
|
||||
).toString()}\n// ${file.replace(__dirname, '')} end`,
|
||||
)
|
||||
.join('')}\n${code}`,
|
||||
.join('\n')}\n${code}`,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -17,13 +17,24 @@ async function main() {
|
|||
}
|
||||
|
||||
function generateZip(inputPath: string, outputPath: string) {
|
||||
const start = Date.now();
|
||||
|
||||
const inputName = getFileName(inputPath);
|
||||
const outputName = getFileName(outputPath);
|
||||
|
||||
console.log(chalk.cyanBright.bold(`${inputPath} → dist/${outputName}...`));
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const inputName = getFileName(inputPath);
|
||||
const outputName = getFileName(outputPath);
|
||||
const finish = (result) => {
|
||||
console.log(
|
||||
`${chalk.green('created')} ${chalk.greenBright.bold(
|
||||
`dist/${outputName} in ${Date.now() - start}ms\n`,
|
||||
)}`,
|
||||
);
|
||||
exec(`rimraf ${inputPath}`);
|
||||
resolve(result);
|
||||
};
|
||||
|
||||
console.log(chalk.cyanBright.bold(`${inputPath} → dist/${outputName}...`));
|
||||
|
||||
const start = Date.now();
|
||||
JSZip()
|
||||
.file(inputName, fs.createReadStream(inputPath), {
|
||||
compressionOptions: {
|
||||
|
@ -32,15 +43,7 @@ function generateZip(inputPath: string, outputPath: string) {
|
|||
})
|
||||
.generateNodeStream({ type: 'nodebuffer', streamFiles: true })
|
||||
.pipe(fs.createWriteStream(outputPath))
|
||||
.on('finish', (result) => {
|
||||
console.log(
|
||||
`${chalk.green('created')} ${chalk.greenBright.bold(
|
||||
`dist/${outputName} in ${Date.now() - start}ms\n`,
|
||||
)}`,
|
||||
);
|
||||
exec(`rimraf ${inputPath}`);
|
||||
resolve(result);
|
||||
})
|
||||
.on('finish', finish)
|
||||
.on('error', reject);
|
||||
});
|
||||
}
|
||||
|
@ -48,7 +51,7 @@ function generateZip(inputPath: string, outputPath: string) {
|
|||
function getFileName(filePath: string) {
|
||||
const result = filePath.match(/\/([^/]*)$/);
|
||||
if (!result) {
|
||||
throw new Error(`无效的文件路径 ${filePath}`);
|
||||
throw new Error(`无效的文件路径: ${filePath}`);
|
||||
}
|
||||
return result[1];
|
||||
}
|
||||
|
|
|
@ -80,11 +80,11 @@ async function inputVersion() {
|
|||
const { yes: confirmRelease } = await enquirer.prompt<{ yes: boolean }>({
|
||||
type: 'confirm',
|
||||
name: 'yes',
|
||||
message: `确定发布 v${targetVersion} ?`,
|
||||
message: `确定发版: v${targetVersion} ?`,
|
||||
});
|
||||
|
||||
if (!confirmRelease) {
|
||||
exit(`取消发布: v${targetVersion}`);
|
||||
exit(`取消发版: v${targetVersion}`);
|
||||
}
|
||||
|
||||
return targetVersion;
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": ["src", "global.d.ts"]
|
||||
}
|
Loading…
Reference in New Issue