Skip to content

Commit

Permalink
update publish
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed May 17, 2024
1 parent 427d1c8 commit e9cf4ab
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions build/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@ 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) {
const res = await fetch(url);
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;
}

Expand All @@ -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();

0 comments on commit e9cf4ab

Please sign in to comment.