Skip to content

Commit

Permalink
feat(chore): added set-version.ts file
Browse files Browse the repository at this point in the history
  • Loading branch information
SvetlanaMuravlova committed Dec 7, 2022
1 parent 1afbdbc commit 22fd062
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions libs/ng2-dragula/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"outputs": [],
"options": {
"commands": [
"ts-node ./scripts/set-version.ts",
"conventional-changelog --preset angular --infile CHANGELOG.md --same-file --release-count 1",
"git add -A"
],
Expand Down
19 changes: 19 additions & 0 deletions scripts/set-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { readJson, writeJson } from 'fs-extra';

const packagesGlob = './libs/ng2-dragula/package.json';
const mainPackage = './package.json';

(async () => {
const version = await readJson(mainPackage).then(json => json.version);
const packages = [packagesGlob]
.map(async packagePath => {
const packageJson = await readJson(packagePath);
if (packageJson.version) {
packageJson.version = version;
}

await writeJson(packagePath, packageJson, { spaces: 2 });
});

await Promise.all(packages);
})();

0 comments on commit 22fd062

Please sign in to comment.