build: update create package template
This commit is contained in:
parent
7b88251c7b
commit
e1e845a470
@ -39,8 +39,8 @@ const generatorFile = async (config) => {
|
||||
}
|
||||
const include = [
|
||||
!client && 'client',
|
||||
!client && 'tsconfig.esm.json',
|
||||
!shared && 'shared',
|
||||
!shared && 'client/index.js'
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join('|')
|
||||
|
||||
@ -18,10 +18,16 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "pengzhanbo <volodymyr@foxmail.com>",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./lib/node/index.js",
|
||||
{{#if shared }}
|
||||
"./client": "./lib/client/index.js",
|
||||
{{/if}}
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "lib/node/index.js",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "pnpm run clean && pnpm run copy && pnpm run ts",
|
||||
"clean": "rimraf lib *.tsbuildinfo",
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
import { defineClientAppEnhance } from '@vuepress/client'
|
||||
|
||||
export default defineClientAppEnhance(({ router }) => {
|
||||
// do something
|
||||
})
|
||||
8
scripts/create/template/src/client/clientConfig.ts.tpl
Normal file
8
scripts/create/template/src/client/clientConfig.ts.tpl
Normal file
@ -0,0 +1,8 @@
|
||||
import { defineClientConfig } from '@vuepress/client'
|
||||
|
||||
|
||||
export default defineClientConfig({
|
||||
setup() {
|
||||
// do something
|
||||
},
|
||||
})
|
||||
1
scripts/create/template/src/client/index.ts.tpl
Normal file
1
scripts/create/template/src/client/index.ts.tpl
Normal file
@ -0,0 +1 @@
|
||||
export * from '../shared/index.js'
|
||||
@ -1,8 +1,8 @@
|
||||
import { {{ lowerName }}Plugin } from './plugin'
|
||||
import { {{ lowerName }}Plugin } from './plugin.js'
|
||||
|
||||
export * from './plugin'
|
||||
export * from './plugin.js'
|
||||
{{#if shared }}
|
||||
export * from '../shared'
|
||||
export * from '../shared/index.js'
|
||||
{{/if}}
|
||||
|
||||
export default {{ lowerName }}Plugin
|
||||
|
||||
@ -3,7 +3,7 @@ import type { App, Plugin } from '@vuepress/core'
|
||||
import { path } from '@vuepress/utils'
|
||||
{{/if}}
|
||||
{{#if shared}}
|
||||
import type { {{ upperName }}Options } from '../shared'
|
||||
import type { {{ upperName }}Options } from '../shared/index.js'
|
||||
{{else}}
|
||||
|
||||
export interface {{ upperName }}Options {
|
||||
@ -16,10 +16,7 @@ export const {{ lowerName }}Plugin = (options: {{ upperName }}Options): Plugin =
|
||||
return {
|
||||
name: '@vuepress-plume/vuepress-{{ pkgName }}',
|
||||
{{#if client}}
|
||||
clientAppEnhanceFiles: path.resolve(
|
||||
__dirname,
|
||||
'../client/clientAppEnhance.js'
|
||||
),
|
||||
clientConfigFile: path.resolve(__dirname, '../client/clientConfig.js'),
|
||||
{{/if}}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"references": [
|
||||
{{#if client}}
|
||||
{
|
||||
"path": "./tsconfig.esm.json"
|
||||
},
|
||||
{{/if}}
|
||||
{
|
||||
"path": "./tsconfig.cjs.json"
|
||||
}
|
||||
],
|
||||
"files": []
|
||||
"extends": "../tsconfig.build.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
}
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "CommonJS",
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib"
|
||||
},
|
||||
"include": [
|
||||
{{#if shared}}
|
||||
"./src/shared",
|
||||
{{/if}}
|
||||
"./src/node"
|
||||
]
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "ES2020",
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib",
|
||||
"types": [
|
||||
"@vuepress/client/types"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
{{#if shared}}
|
||||
"./src/shared",
|
||||
{{/if}}
|
||||
"./src/client"
|
||||
]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user