Skip to content

Commit

Permalink
refactor: import plugin file
Browse files Browse the repository at this point in the history
  • Loading branch information
monsat committed Jun 18, 2022
1 parent 0d3b464 commit 9848a7c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
32 changes: 2 additions & 30 deletions src/node/index.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,3 @@
import type { PluginObject } from '@vuepress/core'
import { path } from '@vuepress/utils'
import { netabareSwitchPlugin } from './netabareSwitchPlugin'

export interface NetaBarePluginOptions {
componentPrefix?: string
keyPrefix?: string
}

export const netabareSwitchPlugin = (options?: NetaBarePluginOptions): PluginObject => {
const name = 'vuepress-plugin-netabare-switch'
const clientConfigFile = path.resolve(
__dirname,
`../client/clientConfig.mjs`
)
const {
componentPrefix = 'NetaBare',
keyPrefix = 'netabare',
}: NetaBarePluginOptions = options || {}
const define = {
__NETABARE_COMPONENT_PREFIX__: componentPrefix,
__NETABARE_KEY_PREFIX__: keyPrefix,
}

return {
name,
clientConfigFile,
define,
}
}

export default netabareSwitchPlugin
export * from './netabareSwitchPlugin'
29 changes: 29 additions & 0 deletions src/node/netabareSwitchPlugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { PluginObject } from '@vuepress/core'
import { path } from '@vuepress/utils'

export interface NetaBarePluginOptions {
componentPrefix?: string
keyPrefix?: string
}

export const netabareSwitchPlugin = (options?: NetaBarePluginOptions): PluginObject => {
const name = 'vuepress-plugin-netabare-switch'
const clientConfigFile = path.resolve(
__dirname,
`../client/clientConfig.mjs`
)
const {
componentPrefix = 'NetaBare',
keyPrefix = 'netabare',
}: NetaBarePluginOptions = options || {}
const define = {
__NETABARE_COMPONENT_PREFIX__: componentPrefix,
__NETABARE_KEY_PREFIX__: keyPrefix,
}

return {
name,
clientConfigFile,
define,
}
}

0 comments on commit 9848a7c

Please sign in to comment.