-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpublish.js
More file actions
29 lines (24 loc) · 798 Bytes
/
publish.js
File metadata and controls
29 lines (24 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import fs from "fs"
import path from "path"
import { execSync } from 'child_process'
const outputFolder = "rollup"
const format = "vsix"
const config = JSON.parse(fs.readFileSync("package.json", "utf8"))
const version = config.version
if (!fs.existsSync(outputFolder)) {
fs.mkdirSync(outputFolder)
}
const currentTime = new Date().toLocaleString('zh-CN', {
year: '2-digit',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: "2-digit"
}).replace(/[\/:]/g, "").replace(/ /g, "-")
const outputFileName = `OpenCML-Ext-${version}-${currentTime}.${format}`
const outputPath = path.join(outputFolder, outputFileName)
execSync("npm run build")
execSync("vsce package --out " + outputPath)
console.log(`Created ${outputPath}`)
console.log("Done")