diff --git a/build/publish.js b/build/publish.js index 00911a3..8f477d0 100644 --- a/build/publish.js +++ b/build/publish.js @@ -2,13 +2,16 @@ import { Octokit } from 'octokit'; import path from 'path'; import fs from 'fs'; +import {execute} from './execute.js'; + const octokit = new Octokit({ }); const owner = 'greggman'; const repo = 'tintd-bundler'; -function execute(cmd, args) { +function executeL(cmd, args) { console.log(cmd, args.join(' ')); + execute(cmd, args); } async function downloadFile(name, url, filepath) { @@ -16,7 +19,8 @@ async function downloadFile(name, url, filepath) { const data = await res.arrayBuffer(); const filename = path.join(filepath, name); console.log('download:', filename); - fs.writeFileSync(filepath, new Uint8Array(data)); + fs.mkdirSync(filepath, {recursive: true}); + fs.writeFileSync(filename, new Uint8Array(data)); return filename; } @@ -30,9 +34,7 @@ async function main() { .filter(({name}) => name?.endsWith('.vsix')) .map(({name, browser_download_url}) => downloadFile(name, browser_download_url, 'dist')) ); - for (const filename of vsixFilenames) { - execute('./node_modules/.bin/vsce', ['publish', '--packagePath', filename]); - } + executeL('./node_modules/.bin/vsce', ['publish', '--packagePath', ...vsixFilenames]); } main(); \ No newline at end of file