Skip to content

Commit

Permalink
chore(scripts): set correct dirName
Browse files Browse the repository at this point in the history
  • Loading branch information
robingenz committed May 4, 2023
1 parent 0cede4d commit 4daa32a
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions scripts/publish-sponsorware.mjs
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
import * as fs from "fs";
import { execute } from "./lib/cli.mjs";
import { exec } from "./lib/subprocess.mjs";
import * as fs from 'fs';
import { execute } from './lib/cli.mjs';
import { exec } from './lib/subprocess.mjs';

execute(async () => {
const packagesParam = process.argv.find((arg) =>
arg.startsWith("--packages="),
);
const packagesParam = process.argv.find(arg => arg.startsWith('--packages='));
if (!packagesParam) {
console.error("ERR: --packages parameter is missing.");
console.error('ERR: --packages parameter is missing.');
process.exit(1);
}

const packagesParamValue = packagesParam.split("=")[1];
const packagesParamValue = packagesParam.split('=')[1];
const packages = JSON.parse(packagesParamValue);
const packagesToPublish = packages.filter((pkg) => {
const dirName = pkg.name.split("/")[1];
const packagesToPublish = packages.filter(pkg => {
const dirName = pkg.name.split('/')[1].replace('capacitor-', '');
return (
pkg.name.startsWith("@capawesome-team/") &&
!pkg.version.includes("-") &&
pkg.name.startsWith('@capawesome-team/') &&
!pkg.version.includes('-') &&
fs.existsSync(`./packages/${dirName}/package.json`)
);
});

for (const pkg of packagesToPublish) {
const dirName = pkg.name.split("/")[1];
const dirName = pkg.name.split('/')[1].replace('capacitor-', '');
console.log(`Publishing ${pkg.name}@${pkg.version}...`);
await exec(
`npm pkg set repository.url=git+https://github.com/capawesome-team/sponsorware.git`,
Expand Down

0 comments on commit 4daa32a

Please sign in to comment.