Comparing version 0.32.1 to 0.32.2
@@ -18,3 +18,2 @@ /// <reference types="node" /> | ||
export declare function runGitAsync(...args: string[]): Promise<void>; | ||
export declare function monoRepoConfigs(folder: string, includingSelf?: boolean): string[]; | ||
export declare function bumpAsync(prj: mkc.Project, versionFile: string, stage: boolean, release: "patch" | "minor" | "major"): Promise<void>; |
@@ -12,10 +12,9 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.bumpAsync = exports.monoRepoConfigs = exports.runGitAsync = exports.needsGitCleanAsync = exports.queryAsync = exports.spawnWithPipeAsync = exports.spawnAsync = void 0; | ||
exports.bumpAsync = exports.runGitAsync = exports.needsGitCleanAsync = exports.queryAsync = exports.spawnWithPipeAsync = exports.spawnAsync = void 0; | ||
const child_process = require("child_process"); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const mkc = require("./mkc"); | ||
const downloader_1 = require("./downloader"); | ||
const glob_1 = require("glob"); | ||
const semver_1 = require("semver"); | ||
const files_1 = require("./files"); | ||
function spawnAsync(opts) { | ||
@@ -106,21 +105,2 @@ opts.pipe = false; | ||
exports.runGitAsync = runGitAsync; | ||
function monoRepoConfigs(folder, includingSelf = true) { | ||
return glob_1.glob | ||
.sync(folder + "/**/pxt.json") | ||
.filter(e => e.indexOf("pxt_modules") < 0 && | ||
e.indexOf("node_modules") < 0 && | ||
(includingSelf || | ||
path.resolve(folder, "pxt.json") != path.resolve(e))); | ||
} | ||
exports.monoRepoConfigs = monoRepoConfigs; | ||
function collectCurrentVersion(configs) { | ||
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) { | ||
@@ -135,4 +115,4 @@ var _a, _b; | ||
} | ||
const configs = monoRepoConfigs(prj.directory, true); | ||
const currentVersion = collectCurrentVersion(configs); | ||
const configs = (0, files_1.monoRepoConfigs)(prj.directory, true); | ||
const currentVersion = (0, files_1.collectCurrentVersion)(configs); | ||
let newV; | ||
@@ -156,3 +136,3 @@ if (release) | ||
/** | ||
* Version of the library | ||
* Version of the package | ||
*/ | ||
@@ -159,0 +139,0 @@ export const VERSION = "${newTag}" |
@@ -27,2 +27,3 @@ "use strict"; | ||
const stackresolver_1 = require("./stackresolver"); | ||
const files_1 = require("./files"); | ||
const fetch = require("node-fetch"); | ||
@@ -327,3 +328,3 @@ function clone(v) { | ||
if (success && opts.monoRepo) { | ||
const dirs = bump.monoRepoConfigs("."); | ||
const dirs = (0, files_1.monoRepoConfigs)("."); | ||
info(`mono-repo: building ${dirs.length} projects`); | ||
@@ -427,3 +428,3 @@ for (const fullpxtjson of dirs) { | ||
if (opts.monoRepo) { | ||
const dirs = bump.monoRepoConfigs("."); | ||
const dirs = (0, files_1.monoRepoConfigs)("."); | ||
info(`mono-repo: building ${dirs.length} projects`); | ||
@@ -430,0 +431,0 @@ for (const fullpxtjson of dirs) { |
@@ -14,1 +14,3 @@ import * as mkc from "./mkc"; | ||
}>): Promise<void>; | ||
export declare function monoRepoConfigs(folder: string, includingSelf?: boolean): string[]; | ||
export declare function collectCurrentVersion(configs: string[]): string; |
@@ -12,3 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.savePxtModulesAsync = exports.saveBuiltFilesAsync = exports.writeFilesAsync = exports.mkHomeCache = exports.readProjectAsync = exports.readPrjFileAsync = exports.fileExists = exports.relativePath = exports.findProjectDir = exports.findParentDirWith = void 0; | ||
exports.collectCurrentVersion = exports.monoRepoConfigs = exports.savePxtModulesAsync = exports.saveBuiltFilesAsync = exports.writeFilesAsync = exports.mkHomeCache = exports.readProjectAsync = exports.readPrjFileAsync = exports.fileExists = exports.relativePath = exports.findProjectDir = exports.findParentDirWith = void 0; | ||
const fs = require("fs"); | ||
@@ -18,2 +18,4 @@ const path = require("path"); | ||
const mkc = require("./mkc"); | ||
const glob_1 = require("glob"); | ||
const semver_1 = require("semver"); | ||
function findParentDirWith(base, filename) { | ||
@@ -146,2 +148,22 @@ let s = base; | ||
exports.savePxtModulesAsync = savePxtModulesAsync; | ||
function monoRepoConfigs(folder, includingSelf = true) { | ||
return glob_1.glob | ||
.sync(folder + "/**/pxt.json") | ||
.filter(e => e.indexOf("pxt_modules") < 0 && | ||
e.indexOf("node_modules") < 0 && | ||
(includingSelf || | ||
path.resolve(folder, "pxt.json") != path.resolve(e))); | ||
} | ||
exports.monoRepoConfigs = monoRepoConfigs; | ||
function collectCurrentVersion(configs) { | ||
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; | ||
} | ||
exports.collectCurrentVersion = collectCurrentVersion; | ||
//# sourceMappingURL=files.js.map |
@@ -19,2 +19,3 @@ "use strict"; | ||
exports.simserver = require("./simserver"); | ||
const files_1 = require("./files"); | ||
exports.cloudRoot = "https://makecode.com/api/"; | ||
@@ -244,6 +245,8 @@ function jsonCopyFrom(trg, src) { | ||
const webConfig = this.editor.webConfig || this.service.runSync("pxt.webConfig"); | ||
const configs = (0, files_1.monoRepoConfigs)(this.directory, true); | ||
const version = `v${(0, files_1.collectCurrentVersion)(configs) || "0"}`; | ||
const meta = { | ||
simUrl: webConfig.simUrl, | ||
cdnUrl: webConfig.cdnUrl, | ||
version: "v0", | ||
version, | ||
target: appTarget.id, | ||
@@ -250,0 +253,0 @@ targetVersion: appTarget.versions.target, |
{ | ||
"name": "makecode", | ||
"version": "0.32.1", | ||
"version": "0.32.2", | ||
"description": "MakeCode (PXT) - web-cached build tool", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -86,3 +86,3 @@ # MKC - command line tool for MakeCode editors | ||
### mkc build --watch | ||
#### mkc build --watch | ||
@@ -95,2 +95,17 @@ Use `--watch`, or `-w`, with `mkc build` to automatically watch changes in source files and rebuild automatically. | ||
#### mkc build compile switches | ||
Options can be passed to PXT compiler using `--compile-flags` (`-f`) option: | ||
``` | ||
mkc -f size # generate .csv file with function sizes | ||
mkc -f asmdebug # generate more comments in assembly listing | ||
mkc -f profile # enable profiling counters | ||
mkc -f rawELF # don't generate .UF2 but a raw ELF file | ||
mkc -f size,asmdebug # example with two options | ||
``` | ||
The same options (except for `asmdebug`) can be passed to website with `?compiler=...` or `?compile=...` argument | ||
and to the regular `pxt` command line utility with `PXT_COMPILE_SWITCHES=...`. | ||
#### Built files in containers, GitHub Codespace, ... | ||
@@ -169,3 +184,3 @@ | ||
``` | ||
mkc --stage | ||
mkc bump --stage | ||
``` | ||
@@ -216,17 +231,2 @@ | ||
## Compile switches | ||
Options can be passed to PXT compiler using `--compile-flags` (`-f`) option: | ||
``` | ||
mkc -f size # generate .csv file with function sizes | ||
mkc -f asmdebug # generate more comments in assembly listing | ||
mkc -f profile # enable profiling counters | ||
mkc -f rawELF # don't generate .UF2 but a raw ELF file | ||
mkc -f size,asmdebug # example with two options | ||
``` | ||
The same options (except for `asmdebug`) can be passed to website with `?compiler=...` or `?compile=...` argument | ||
and to the regular `pxt` command line utility with `PXT_COMPILE_SWITCHES=...`. | ||
## Local development | ||
@@ -233,0 +233,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
211837
3207