Skip to content

Commit 877ed5e

Browse files
committed
up
1 parent da06a5e commit 877ed5e

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

scripts/copy-tooth-files.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'node:fs'
22
import path from 'node:path'
33

4-
import { readToothMeta } from './utils'
4+
import { joinPluginPath, readToothMeta } from './utils'
55

66
const args = process.argv.slice(2)
77
const pluginName = args[0]
@@ -15,7 +15,10 @@ fs.mkdirSync(tmpFolderPath)
1515
toothMeta.files.place.forEach(({ src }) => {
1616
const folder = path.dirname(src)
1717
fs.mkdirSync(path.join(tmpFolderPath, folder), { recursive: true })
18-
fs.copyFileSync(src, path.join(tmpFolderPath, src))
18+
fs.copyFileSync(joinPluginPath(pluginName, src), path.join(tmpFolderPath, src))
1919
})
2020

21-
fs.copyFileSync('tooth.json', path.join(tmpFolderPath, 'tooth.json'))
21+
fs.copyFileSync(
22+
joinPluginPath(pluginName, 'tooth.json'),
23+
path.join(tmpFolderPath, 'tooth.json'),
24+
)

scripts/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ export interface ToothMeta {
1515
files: ToothMetaFiles
1616
}
1717

18+
export function joinPluginPath(pluginName: string, ...paths: string[]): string {
19+
return path.join('plugins', pluginName, ...paths)
20+
}
21+
1822
export function readToothMeta(pluginName: string): ToothMeta {
1923
const toothMetaJson = fs.readFileSync(
20-
path.join('plugins', pluginName, 'tooth.json'),
24+
joinPluginPath(pluginName, 'tooth.json'),
2125
'utf8',
2226
)
2327
return JSON.parse(toothMetaJson)

0 commit comments

Comments
 (0)