Files
playlet-piped/tools/update-manifest-version.js
T
Brahim Hadricheandgithub-action linter 9d8a3d1cea Create Component Library (#43)
* Move src under playlet-lib

* Update configuration

* Update script

* Update script

* Working version

* Vs code config WIP

* Package lock sync

* Lint fix

* Fix images

* Reuse config files

* Kind of a working setup

* Lock node version

* Rename scripts to tools

* Fix build scripts, lib url system

* Lint fix

* rale

* Fix args and web server

* Load fallbacks and build script cleanups

* Remove unused method

* no message

* no message

* Remove generic message field

* Lint fix

* no message

* Use loading indicator on main app

* Add playlet lib version to settings

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2023-01-29 16:50:28 -05:00

27 lines
1.2 KiB
JavaScript

const path = require('path');
const fs = require('fs');
const { execSync } = require("child_process");
const semverParse = require('semver/functions/parse');
const packageJsonContent = fs.readFileSync("./package.json", { encoding: 'utf8', flag: 'r' });
const packageJson = JSON.parse(packageJsonContent);
const version = packageJson.version;
const parsedVersion = semverParse(version);
["playlet/src/manifest", "playlet-lib/src/manifest"].forEach(function (manifestPath) {
let appManifestContent = fs.readFileSync(manifestPath, { encoding: 'utf8', flag: 'r' });
const majorPattern = /major_version=(\d+)/;
const minorPattern = /minor_version=(\d+)/;
const buildPattern = /build_version=(\d+)/;
appManifestContent = appManifestContent.replace(majorPattern, `major_version=${parsedVersion.major}`);
appManifestContent = appManifestContent.replace(minorPattern, `minor_version=${parsedVersion.minor}`);
appManifestContent = appManifestContent.replace(buildPattern, `build_version=${String(parsedVersion.patch).padStart(5, '0')}`);
fs.writeFileSync(manifestPath, appManifestContent);
})
execSync(`npm version ${version} --allow-same-version`, { cwd: 'playlet-web' });