Comparing version 0.28.5 to 0.29.0
@@ -19,2 +19,2 @@ /// <reference types="node" /> | ||
export declare function monoRepoConfigs(folder: string, includingSelf?: boolean): string[]; | ||
export declare function bumpAsync(prj: mkc.Project, versionFile: string, stage: boolean): Promise<void>; | ||
export declare function bumpAsync(prj: mkc.Project, versionFile: string, stage: boolean, release: "patch" | "minor" | "major"): Promise<void>; |
@@ -20,2 +20,3 @@ "use strict"; | ||
const glob_1 = require("glob"); | ||
const semver_1 = require("semver"); | ||
function spawnAsync(opts) { | ||
@@ -115,3 +116,14 @@ opts.pipe = false; | ||
exports.monoRepoConfigs = monoRepoConfigs; | ||
function bumpAsync(prj, versionFile, stage) { | ||
function collectCurrentVersion(prj) { | ||
const configs = monoRepoConfigs(prj.directory, true); | ||
let version = "0.0.0"; | ||
for (const config of configs) { | ||
const cfg = JSON.parse(fs.readFileSync(config, "utf8")); | ||
const v = (0, semver_1.clean)(cfg.version || ""); | ||
if ((0, semver_1.valid)(v) && (0, semver_1.lt)(version, v)) | ||
version = v; | ||
} | ||
return version; | ||
} | ||
function bumpAsync(prj, versionFile, stage, release) { | ||
var _a, _b; | ||
@@ -126,9 +138,13 @@ return __awaiter(this, void 0, void 0, function* () { | ||
const cfg = prj.mainPkg.config; | ||
const m = /^(\d+\.\d+)\.(\d+)(.*)/.exec(cfg.version); | ||
let newV = m ? m[1] + "." + (parseInt(m[2]) + 1) + m[3] : ""; | ||
newV = yield queryAsync("New version", newV); | ||
const currentVersion = collectCurrentVersion(prj); | ||
let newV = currentVersion; | ||
if (release) | ||
newV = (0, semver_1.inc)(currentVersion, release); | ||
else | ||
newV = yield queryAsync("New version", newV); | ||
const newTag = "v" + newV; | ||
cfg.version = newV; | ||
mkc.log(`new version: ${newV}`); | ||
if (versionFile) { | ||
mkc.log(`writing version ${newV} in ${versionFile}`); | ||
mkc.log(`writing version in ${versionFile}`); | ||
const versionSrc = ` | ||
@@ -135,0 +151,0 @@ // Auto-generated file: do not edit. |
@@ -467,3 +467,3 @@ "use strict"; | ||
const prj = yield resolveProject(opts); | ||
yield bump.bumpAsync(prj, opts === null || opts === void 0 ? void 0 : opts.versionFile, opts === null || opts === void 0 ? void 0 : opts.stage); | ||
yield bump.bumpAsync(prj, opts === null || opts === void 0 ? void 0 : opts.versionFile, opts === null || opts === void 0 ? void 0 : opts.stage, (opts === null || opts === void 0 ? void 0 : opts.major) ? "major" : (opts === null || opts === void 0 ? void 0 : opts.minor) ? "minor" : (opts === null || opts === void 0 ? void 0 : opts.patch) ? "patch" : undefined); | ||
}); | ||
@@ -809,2 +809,5 @@ } | ||
.option("--stage", "skip git commit and push operations") | ||
.option("--patch", "auto-increment patch version number") | ||
.option("--minor", "auto-increment minor version number") | ||
.option("--major", "auto-increment major version number") | ||
.action(bumpCommand); | ||
@@ -811,0 +814,0 @@ createCommand("init") |
{ | ||
"name": "makecode", | ||
"version": "0.28.5", | ||
"version": "0.29.0", | ||
"description": "MakeCode (PXT) - web-cached build tool", | ||
@@ -47,2 +47,3 @@ "keywords": [ | ||
"@types/node": "^16.10.3", | ||
"@types/semver": "^7.3.9", | ||
"semantic-release": "^18.0.0", | ||
@@ -56,3 +57,4 @@ "typescript": "^4.4.3" | ||
"node-fetch": "^2.0.0", | ||
"node-watch": "^0.7.2" | ||
"node-watch": "^0.7.2", | ||
"semver": "^7.3.7" | ||
}, | ||
@@ -59,0 +61,0 @@ "release": { |
@@ -157,2 +157,8 @@ # MKC - command line tool for MakeCode editors | ||
Use ``--major``, ``--minor``, ``--patch`` to automatically increment the version number. | ||
``` | ||
mkc bump --patch | ||
``` | ||
Adding `--version-file` will make `mkc` write a TypeScript file with the version number. | ||
@@ -159,0 +165,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
213915
3243
259
6
9
+ Addedsemver@^7.3.7
+ Addedsemver@7.6.3(transitive)