Skip to content

Commit da06a5e

Browse files
committed
up
1 parent 564538b commit da06a5e

File tree

7 files changed

+881
-13
lines changed

7 files changed

+881
-13
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,5 @@ dist
249249
.ionide
250250

251251
# End of https://www.toptal.com/developers/gitignore/api/node,visualstudiocode,intellij+all
252+
253+
github-release-tmp

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"eslint-plugin-promise": "^6.6.0",
3131
"eslint-plugin-react": "^7.37.4",
3232
"eslint-plugin-react-hooks": "^4.6.2",
33+
"tsx": "^4.19.2",
3334
"typescript": "^5.7.3"
3435
}
3536
}

scripts/copy-tooth-files.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import fs from 'node:fs'
2+
import path from 'node:path'
3+
4+
import { readToothMeta } from './utils'
5+
6+
const args = process.argv.slice(2)
7+
const pluginName = args[0]
8+
if (!pluginName) throw new Error('Please provide a plugin name')
9+
10+
const toothMeta = readToothMeta(pluginName)
11+
12+
const tmpFolderPath = 'github-release-tmp'
13+
fs.mkdirSync(tmpFolderPath)
14+
15+
toothMeta.files.place.forEach(({ src }) => {
16+
const folder = path.dirname(src)
17+
fs.mkdirSync(path.join(tmpFolderPath, folder), { recursive: true })
18+
fs.copyFileSync(src, path.join(tmpFolderPath, src))
19+
})
20+
21+
fs.copyFileSync('tooth.json', path.join(tmpFolderPath, 'tooth.json'))

scripts/read-version.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { readToothMeta } from './utils'
2+
3+
const args = process.argv.slice(2)
4+
const pluginName = args[0]
5+
if (!pluginName) throw new Error('Please provide a plugin name')
6+
7+
const toothMeta = readToothMeta(pluginName)
8+
console.log(toothMeta.version)

scripts/tsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../tsconfig.base",
3+
"include": ["."],
4+
"compilerOptions": {
5+
"noEmit": true,
6+
"types": ["node"]
7+
}
8+
}

scripts/utils.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import fs from 'node:fs'
2+
import path from 'node:path'
3+
4+
export interface ToothMetaFilesPlace {
5+
src: string
6+
dest: string
7+
}
8+
9+
export interface ToothMetaFiles {
10+
place: ToothMetaFilesPlace[]
11+
}
12+
13+
export interface ToothMeta {
14+
version: string
15+
files: ToothMetaFiles
16+
}
17+
18+
export function readToothMeta(pluginName: string): ToothMeta {
19+
const toothMetaJson = fs.readFileSync(
20+
path.join('plugins', pluginName, 'tooth.json'),
21+
'utf8',
22+
)
23+
return JSON.parse(toothMetaJson)
24+
}

0 commit comments

Comments
 (0)