Skip to content

Commit

Permalink
chore: fix publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Oct 20, 2021
1 parent e04d61d commit 986966a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/publish.js
@@ -1,14 +1,15 @@
const { workspaces } = require('../package.json');
const { join } = require('path');
const { execSync } = require('child_process');
const { readFileSync } = require('fs');
const { readFileSync, readdirSync } = require('fs');

console.log(`Publish to tag ${'latest'}`)

const workspaces = readdirSync(join(__dirname, '../packages'))

for (const workspace of workspaces) {
const cwd = join(__dirname, '..', workspace);
const packageName = workspace.replace('packages', '@xmcl');
const cwd = join(__dirname, '..', 'packages', workspace);
const packageContent = JSON.parse(readFileSync(join(cwd, 'package.json')).toString());
const packageName = packageContent.name;
const packageVersion = packageContent.version;
const published = execSync(`npm show ${packageName} versions`);
if (published.indexOf(packageVersion) === -1) {
Expand Down

0 comments on commit 986966a

Please sign in to comment.