pxt-core 8.2.16 → 8.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/built/cli.js +76 -73
- package/built/pxt.js +76 -73
- package/built/pxtlib.d.ts +1 -0
- package/built/server.js +4 -0
- package/built/target.js +1 -1
- package/built/web/ai.0.js +1 -1
- package/built/web/main.js +1 -1
- package/built/web/multiplayer/css/main.b0b14e9a.css +2 -0
- package/built/web/multiplayer/js/main.448c5eda.js +2 -0
- package/built/web/pxtasseteditor.js +1 -1
- package/built/web/react-common-authcode.css +4 -6973
- package/built/web/react-common-multiplayer.css +13 -0
- package/built/web/rtlreact-common-authcode.css +13 -0
- package/built/web/rtlreact-common-multiplayer.css +13 -0
- package/built/web/skillmap/css/main.242f7a98.css +1 -0
- package/built/web/skillmap/js/main.f143771a.js +2 -0
- package/package.json +53 -51
- package/react-common/components/controls/Modal.tsx +2 -0
- package/react-common/components/profile/UserPane.tsx +0 -1
- package/react-common/styles/react-common-authcode-core.less +1 -1
- package/react-common/styles/react-common-authcode.less +1 -1
- package/react-common/styles/react-common-multiplayer-core.less +10 -0
- package/react-common/styles/react-common-multiplayer.less +12 -0
- package/webapp/package.json +15 -0
- package/webapp/public/multiplayer.html +1 -0
- package/webapp/public/skillmap.html +1 -32
- package/built/web/skillmap/css/main.3684f34d.chunk.css +0 -1
- package/built/web/skillmap/js/2.960f04a5.chunk.js +0 -2
- package/built/web/skillmap/js/main.44b2383f.chunk.js +0 -1
- package/built/web/skillmap/js/runtime-main.37bd2885.js +0 -1
package/built/cli.js
CHANGED
|
@@ -306,7 +306,8 @@ function pxtFileList(pref) {
|
|
|
306
306
|
.concat(nodeutil.allFiles(pref + "built/web/fonts", { maxDepth: 1 }))
|
|
307
307
|
.concat(nodeutil.allFiles(pref + "built/web/vs", { maxDepth: 4 }))
|
|
308
308
|
.concat(nodeutil.allFiles(pref + "built/web/skillmap", { maxDepth: 4 }))
|
|
309
|
-
.concat(nodeutil.allFiles(pref + "built/web/authcode", { maxDepth: 4 }))
|
|
309
|
+
.concat(nodeutil.allFiles(pref + "built/web/authcode", { maxDepth: 4 }))
|
|
310
|
+
.concat(nodeutil.allFiles(pref + "built/web/multiplayer", { maxDepth: 4 }));
|
|
310
311
|
}
|
|
311
312
|
function semverCmp(a, b) {
|
|
312
313
|
let parse = (s) => {
|
|
@@ -387,7 +388,8 @@ function ciAsync() {
|
|
|
387
388
|
.then(() => buildWebStringsAsync())
|
|
388
389
|
.then(() => crowdin.execCrowdinAsync("upload", "built/webstrings.json"))
|
|
389
390
|
.then(() => crowdin.execCrowdinAsync("upload", "built/skillmap-strings.json"))
|
|
390
|
-
.then(() => crowdin.execCrowdinAsync("upload", "built/authcode-strings.json"))
|
|
391
|
+
.then(() => crowdin.execCrowdinAsync("upload", "built/authcode-strings.json"))
|
|
392
|
+
.then(() => crowdin.execCrowdinAsync("upload", "built/multiplayer-strings.json"));
|
|
391
393
|
if (uploadApiStrings)
|
|
392
394
|
p = p.then(() => crowdin.execCrowdinAsync("upload", "built/strings.json"));
|
|
393
395
|
if (uploadDocs || uploadApiStrings)
|
|
@@ -906,6 +908,7 @@ function uploadCoreAsync(opts) {
|
|
|
906
908
|
"asseteditorUrl": opts.localDir + "asseteditor.html",
|
|
907
909
|
"skillmapUrl": opts.localDir + "skillmap.html",
|
|
908
910
|
"authcodeUrl": opts.localDir + "authcode.html",
|
|
911
|
+
"multiplayerUrl": opts.localDir + "multiplayer.html",
|
|
909
912
|
"isStatic": true,
|
|
910
913
|
};
|
|
911
914
|
const targetImagePaths = targetImages.map(k => `${opts.localDir}${path.join('./docs', logos[k])}`);
|
|
@@ -952,14 +955,16 @@ function uploadCoreAsync(opts) {
|
|
|
952
955
|
"multi.html",
|
|
953
956
|
"asseteditor.html",
|
|
954
957
|
"skillmap.html",
|
|
955
|
-
"authcode.html"
|
|
958
|
+
"authcode.html",
|
|
959
|
+
"multiplayer.html",
|
|
956
960
|
];
|
|
957
961
|
// expandHtml is manually called on these files before upload
|
|
958
962
|
// runs <!-- @include --> substitutions, fills in locale, etc
|
|
959
963
|
let expandFiles = [
|
|
960
964
|
"index.html",
|
|
961
965
|
"skillmap.html",
|
|
962
|
-
"authcode.html"
|
|
966
|
+
"authcode.html",
|
|
967
|
+
"multiplayer.html",
|
|
963
968
|
];
|
|
964
969
|
nodeutil.mkdirP("built/uploadrepl");
|
|
965
970
|
function encodeURLs(urls) {
|
|
@@ -1753,33 +1758,29 @@ async function buildSemanticUIAsync(parsed) {
|
|
|
1753
1758
|
]
|
|
1754
1759
|
});
|
|
1755
1760
|
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
"
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
let skillmapCss = await readFileAsync(`built/web/react-common-skillmap.css`, "utf8");
|
|
1780
|
-
skillmapCss = await linkFontAsync("fa-solid-900", skillmapCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
|
|
1781
|
-
skillmapCss = await linkFontAsync("fa-regular-400", skillmapCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
|
|
1782
|
-
await writeFileAsync(`built/web/react-common-skillmap.css`, skillmapCss, "utf8");
|
|
1761
|
+
async function generateReactCommonCss(app) {
|
|
1762
|
+
const appFile = isPxtCore ? `react-common/styles/react-common-${app}-core.less` :
|
|
1763
|
+
`node_modules/pxt-core/react-common/styles/react-common-${app}.less`;
|
|
1764
|
+
await nodeutil.spawnAsync({
|
|
1765
|
+
cmd: "node",
|
|
1766
|
+
args: [
|
|
1767
|
+
lessCPath,
|
|
1768
|
+
appFile,
|
|
1769
|
+
`built/web/react-common-${app}.css`,
|
|
1770
|
+
"--include-path=" + lessIncludePaths
|
|
1771
|
+
]
|
|
1772
|
+
});
|
|
1773
|
+
let appCss = await readFileAsync(`built/web/react-common-${app}.css`, "utf8");
|
|
1774
|
+
appCss = await linkFontAsync("fa-solid-900", appCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
|
|
1775
|
+
appCss = await linkFontAsync("fa-regular-400", appCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
|
|
1776
|
+
await writeFileAsync(`built/web/react-common-${app}.css`, appCss, "utf8");
|
|
1777
|
+
}
|
|
1778
|
+
// Generate react-common css for skillmap, authcode, and multiplayer
|
|
1779
|
+
await Promise.all([
|
|
1780
|
+
generateReactCommonCss("skillmap"),
|
|
1781
|
+
generateReactCommonCss("authcode"),
|
|
1782
|
+
generateReactCommonCss("multiplayer")
|
|
1783
|
+
]);
|
|
1783
1784
|
// Run postcss with autoprefixer and rtlcss
|
|
1784
1785
|
pxt.debug("running postcss");
|
|
1785
1786
|
const postcss = require('postcss');
|
|
@@ -1799,7 +1800,7 @@ async function buildSemanticUIAsync(parsed) {
|
|
|
1799
1800
|
autoprefixer: { browsers: browserList, add: true }
|
|
1800
1801
|
});
|
|
1801
1802
|
const rtlcss = require("rtlcss");
|
|
1802
|
-
const files = ["semantic.css", "blockly.css", "react-common-skillmap.css"];
|
|
1803
|
+
const files = ["semantic.css", "blockly.css", "react-common-skillmap.css", "react-common-authcode.css", "react-common-multiplayer.css"];
|
|
1803
1804
|
for (const cssFile of files) {
|
|
1804
1805
|
const css = await readFileAsync(`built/web/${cssFile}`, "utf8");
|
|
1805
1806
|
const processed = await postcss([cssnano])
|
|
@@ -1812,7 +1813,11 @@ async function buildSemanticUIAsync(parsed) {
|
|
|
1812
1813
|
if (!isPxtCore) {
|
|
1813
1814
|
// This is just to support the local skillmap serve for development
|
|
1814
1815
|
nodeutil.cp("built/web/react-common-skillmap.css", "node_modules/pxt-core/skillmap/public/blb");
|
|
1816
|
+
nodeutil.cp("built/web/react-common-authcode.css", "node_modules/pxt-core/authcode/public/blb");
|
|
1817
|
+
nodeutil.cp("built/web/react-common-multiplayer.css", "node_modules/pxt-core/multiplayer/public/blb");
|
|
1815
1818
|
nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/skillmap/public/blb");
|
|
1819
|
+
nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/authcode/public/blb");
|
|
1820
|
+
nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/multiplayer/public/blb");
|
|
1816
1821
|
}
|
|
1817
1822
|
}
|
|
1818
1823
|
async function linkFontAsync(font, semCss, sourceDir = "node_modules/semantic-ui-less/themes/default/assets/fonts/", refDir = "fonts\\/") {
|
|
@@ -1831,47 +1836,10 @@ function buildWebStringsAsync() {
|
|
|
1831
1836
|
nodeutil.writeFileSync("built/webstrings.json", nodeutil.stringify(webstringsJson()));
|
|
1832
1837
|
return Promise.resolve();
|
|
1833
1838
|
}
|
|
1834
|
-
function
|
|
1839
|
+
function buildReactAppAsync(app, parsed) {
|
|
1835
1840
|
// local serve
|
|
1836
|
-
const
|
|
1837
|
-
const reactScriptsConfigRoot = `${skillmapRoot}/node_modules/react-scripts/config`;
|
|
1841
|
+
const appRoot = `node_modules/pxt-core/${app}`;
|
|
1838
1842
|
const docsPath = parsed.flags["docs"];
|
|
1839
|
-
return rimrafAsync(`${skillmapRoot}/public/blb`, {})
|
|
1840
|
-
.then(() => rimrafAsync(`${skillmapRoot}/build/assets`, {}))
|
|
1841
|
-
.then(() => rimrafAsync(`${skillmapRoot}/public/docs`, {}))
|
|
1842
|
-
.then(() => rimrafAsync(`${skillmapRoot}/public/static`, {}))
|
|
1843
|
-
.then(() => {
|
|
1844
|
-
// read pxtarget.json, save into 'pxtTargetBundle' global variable
|
|
1845
|
-
let cfg = readLocalPxTarget();
|
|
1846
|
-
nodeutil.writeFileSync(`${skillmapRoot}/public/blb/target.js`, "// eslint-disable-next-line \n" + targetJsPrefix + JSON.stringify(cfg));
|
|
1847
|
-
nodeutil.cp("node_modules/pxt-core/built/pxtlib.js", `${skillmapRoot}/public/blb`);
|
|
1848
|
-
nodeutil.cp("built/web/semantic.css", `${skillmapRoot}/public/blb`);
|
|
1849
|
-
nodeutil.cp("node_modules/pxt-core/built/web/icons.css", `${skillmapRoot}/public/blb`);
|
|
1850
|
-
nodeutil.cp("node_modules/pxt-core/built/web/react-common-skillmap.css", `${skillmapRoot}/public/blb`);
|
|
1851
|
-
// copy 'assets' over from docs/static
|
|
1852
|
-
nodeutil.cpR("docs/static/skillmap/assets", `${skillmapRoot}/public/assets`);
|
|
1853
|
-
// copy default react-scripts webpack config into a webpack.config.base file if necessary
|
|
1854
|
-
if (!fs.existsSync(`${reactScriptsConfigRoot}/webpack.config.base.js`)) {
|
|
1855
|
-
nodeutil.cp(`${reactScriptsConfigRoot}/webpack.config.js`, reactScriptsConfigRoot, "webpack.config.base.js");
|
|
1856
|
-
}
|
|
1857
|
-
// wrap the config in our webpack.config.override for build customization
|
|
1858
|
-
nodeutil.cp(`${skillmapRoot}/webpack.config.override.js`, reactScriptsConfigRoot, "webpack.config.js");
|
|
1859
|
-
if (docsPath) {
|
|
1860
|
-
// copy docs over from specified path
|
|
1861
|
-
nodeutil.cpR(`docs/${docsPath}`, `${skillmapRoot}/public/docs/${docsPath}`);
|
|
1862
|
-
nodeutil.cpR(`docs/static/${docsPath}`, `${skillmapRoot}/public/static/${docsPath}`);
|
|
1863
|
-
}
|
|
1864
|
-
return nodeutil.spawnAsync({
|
|
1865
|
-
cmd: os.platform() === "win32" ? "npm.cmd" : "npm",
|
|
1866
|
-
args: ["run-script", "start"],
|
|
1867
|
-
cwd: skillmapRoot,
|
|
1868
|
-
shell: true
|
|
1869
|
-
});
|
|
1870
|
-
});
|
|
1871
|
-
}
|
|
1872
|
-
function buildAuthcodeAsync(parsed) {
|
|
1873
|
-
// local serve
|
|
1874
|
-
const appRoot = "node_modules/pxt-core/authcode";
|
|
1875
1843
|
return rimrafAsync(`${appRoot}/public/blb`, {})
|
|
1876
1844
|
.then(() => rimrafAsync(`${appRoot}/build/assets`, {}))
|
|
1877
1845
|
.then(() => rimrafAsync(`${appRoot}/public/docs`, {}))
|
|
@@ -1883,9 +1851,14 @@ function buildAuthcodeAsync(parsed) {
|
|
|
1883
1851
|
nodeutil.cp("node_modules/pxt-core/built/pxtlib.js", `${appRoot}/public/blb`);
|
|
1884
1852
|
nodeutil.cp("built/web/semantic.css", `${appRoot}/public/blb`);
|
|
1885
1853
|
nodeutil.cp("node_modules/pxt-core/built/web/icons.css", `${appRoot}/public/blb`);
|
|
1886
|
-
nodeutil.cp(
|
|
1854
|
+
nodeutil.cp(`node_modules/pxt-core/built/web/react-common-${app}.css`, `${appRoot}/public/blb`);
|
|
1887
1855
|
// copy 'assets' over from docs/static
|
|
1888
|
-
nodeutil.cpR(
|
|
1856
|
+
nodeutil.cpR(`docs/static/${app}/assets`, `${appRoot}/public/assets`);
|
|
1857
|
+
if (docsPath) {
|
|
1858
|
+
// copy docs over from specified path
|
|
1859
|
+
nodeutil.cpR(`docs/${docsPath}`, `${appRoot}/public/docs/${docsPath}`);
|
|
1860
|
+
nodeutil.cpR(`docs/static/${docsPath}`, `${appRoot}/public/static/${docsPath}`);
|
|
1861
|
+
}
|
|
1889
1862
|
return nodeutil.spawnAsync({
|
|
1890
1863
|
cmd: os.platform() === "win32" ? "npm.cmd" : "npm",
|
|
1891
1864
|
args: ["run-script", "start"],
|
|
@@ -1894,6 +1867,15 @@ function buildAuthcodeAsync(parsed) {
|
|
|
1894
1867
|
});
|
|
1895
1868
|
});
|
|
1896
1869
|
}
|
|
1870
|
+
function buildSkillMapAsync(parsed) {
|
|
1871
|
+
return buildReactAppAsync("skillmap", parsed);
|
|
1872
|
+
}
|
|
1873
|
+
function buildAuthcodeAsync(parsed) {
|
|
1874
|
+
return buildReactAppAsync("authcode", parsed);
|
|
1875
|
+
}
|
|
1876
|
+
function buildMultiplayerAsync(parsed) {
|
|
1877
|
+
return buildReactAppAsync("multiplayer", parsed);
|
|
1878
|
+
}
|
|
1897
1879
|
function updateDefaultProjects(cfg) {
|
|
1898
1880
|
let defaultProjects = [
|
|
1899
1881
|
pxt.BLOCKS_PROJECT_NAME,
|
|
@@ -6285,9 +6267,30 @@ ${pxt.crowdin.KEY_VARIABLE} - crowdin key
|
|
|
6285
6267
|
flags: {
|
|
6286
6268
|
serve: {
|
|
6287
6269
|
description: "Serve the authcode app locally after building (npm start)"
|
|
6270
|
+
},
|
|
6271
|
+
docs: {
|
|
6272
|
+
description: "Path to local docs folder to copy into authcode",
|
|
6273
|
+
type: "string",
|
|
6274
|
+
argument: "docs"
|
|
6288
6275
|
}
|
|
6289
6276
|
}
|
|
6290
6277
|
}, buildAuthcodeAsync);
|
|
6278
|
+
p.defineCommand({
|
|
6279
|
+
name: "buildmultiplayer",
|
|
6280
|
+
aliases: ["multiplayer", "mp"],
|
|
6281
|
+
advanced: true,
|
|
6282
|
+
help: "Serves the multiplayer webapp",
|
|
6283
|
+
flags: {
|
|
6284
|
+
serve: {
|
|
6285
|
+
description: "Serve the multiplayer app locally after building (npm start)"
|
|
6286
|
+
},
|
|
6287
|
+
docs: {
|
|
6288
|
+
description: "Path to local docs folder to copy into multiplayer",
|
|
6289
|
+
type: "string",
|
|
6290
|
+
argument: "docs"
|
|
6291
|
+
}
|
|
6292
|
+
}
|
|
6293
|
+
}, buildMultiplayerAsync);
|
|
6291
6294
|
advancedCommand("augmentdocs", "test markdown docs replacements", augmnetDocsAsync, "<temlate.md> <doc.md>");
|
|
6292
6295
|
advancedCommand("crowdin", "upload, download, clean, stats files to/from crowdin", pc => crowdin.execCrowdinAsync.apply(undefined, pc.args), "<cmd> <path> [output]");
|
|
6293
6296
|
advancedCommand("hidlist", "list HID devices", hid.listAsync);
|
package/built/pxt.js
CHANGED
|
@@ -158167,7 +158167,8 @@ function pxtFileList(pref) {
|
|
|
158167
158167
|
.concat(nodeutil.allFiles(pref + "built/web/fonts", { maxDepth: 1 }))
|
|
158168
158168
|
.concat(nodeutil.allFiles(pref + "built/web/vs", { maxDepth: 4 }))
|
|
158169
158169
|
.concat(nodeutil.allFiles(pref + "built/web/skillmap", { maxDepth: 4 }))
|
|
158170
|
-
.concat(nodeutil.allFiles(pref + "built/web/authcode", { maxDepth: 4 }))
|
|
158170
|
+
.concat(nodeutil.allFiles(pref + "built/web/authcode", { maxDepth: 4 }))
|
|
158171
|
+
.concat(nodeutil.allFiles(pref + "built/web/multiplayer", { maxDepth: 4 }));
|
|
158171
158172
|
}
|
|
158172
158173
|
function semverCmp(a, b) {
|
|
158173
158174
|
let parse = (s) => {
|
|
@@ -158248,7 +158249,8 @@ function ciAsync() {
|
|
|
158248
158249
|
.then(() => buildWebStringsAsync())
|
|
158249
158250
|
.then(() => crowdin.execCrowdinAsync("upload", "built/webstrings.json"))
|
|
158250
158251
|
.then(() => crowdin.execCrowdinAsync("upload", "built/skillmap-strings.json"))
|
|
158251
|
-
.then(() => crowdin.execCrowdinAsync("upload", "built/authcode-strings.json"))
|
|
158252
|
+
.then(() => crowdin.execCrowdinAsync("upload", "built/authcode-strings.json"))
|
|
158253
|
+
.then(() => crowdin.execCrowdinAsync("upload", "built/multiplayer-strings.json"));
|
|
158252
158254
|
if (uploadApiStrings)
|
|
158253
158255
|
p = p.then(() => crowdin.execCrowdinAsync("upload", "built/strings.json"));
|
|
158254
158256
|
if (uploadDocs || uploadApiStrings)
|
|
@@ -158767,6 +158769,7 @@ function uploadCoreAsync(opts) {
|
|
|
158767
158769
|
"asseteditorUrl": opts.localDir + "asseteditor.html",
|
|
158768
158770
|
"skillmapUrl": opts.localDir + "skillmap.html",
|
|
158769
158771
|
"authcodeUrl": opts.localDir + "authcode.html",
|
|
158772
|
+
"multiplayerUrl": opts.localDir + "multiplayer.html",
|
|
158770
158773
|
"isStatic": true,
|
|
158771
158774
|
};
|
|
158772
158775
|
const targetImagePaths = targetImages.map(k => `${opts.localDir}${path.join('./docs', logos[k])}`);
|
|
@@ -158813,14 +158816,16 @@ function uploadCoreAsync(opts) {
|
|
|
158813
158816
|
"multi.html",
|
|
158814
158817
|
"asseteditor.html",
|
|
158815
158818
|
"skillmap.html",
|
|
158816
|
-
"authcode.html"
|
|
158819
|
+
"authcode.html",
|
|
158820
|
+
"multiplayer.html",
|
|
158817
158821
|
];
|
|
158818
158822
|
// expandHtml is manually called on these files before upload
|
|
158819
158823
|
// runs <!-- @include --> substitutions, fills in locale, etc
|
|
158820
158824
|
let expandFiles = [
|
|
158821
158825
|
"index.html",
|
|
158822
158826
|
"skillmap.html",
|
|
158823
|
-
"authcode.html"
|
|
158827
|
+
"authcode.html",
|
|
158828
|
+
"multiplayer.html",
|
|
158824
158829
|
];
|
|
158825
158830
|
nodeutil.mkdirP("built/uploadrepl");
|
|
158826
158831
|
function encodeURLs(urls) {
|
|
@@ -159614,33 +159619,29 @@ async function buildSemanticUIAsync(parsed) {
|
|
|
159614
159619
|
]
|
|
159615
159620
|
});
|
|
159616
159621
|
}
|
|
159617
|
-
|
|
159618
|
-
|
|
159619
|
-
|
|
159620
|
-
|
|
159621
|
-
|
|
159622
|
-
|
|
159623
|
-
|
|
159624
|
-
|
|
159625
|
-
|
|
159626
|
-
|
|
159627
|
-
|
|
159628
|
-
|
|
159629
|
-
|
|
159630
|
-
"
|
|
159631
|
-
|
|
159632
|
-
|
|
159633
|
-
|
|
159634
|
-
|
|
159635
|
-
|
|
159636
|
-
|
|
159637
|
-
|
|
159638
|
-
|
|
159639
|
-
|
|
159640
|
-
let skillmapCss = await readFileAsync(`built/web/react-common-skillmap.css`, "utf8");
|
|
159641
|
-
skillmapCss = await linkFontAsync("fa-solid-900", skillmapCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
|
|
159642
|
-
skillmapCss = await linkFontAsync("fa-regular-400", skillmapCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
|
|
159643
|
-
await writeFileAsync(`built/web/react-common-skillmap.css`, skillmapCss, "utf8");
|
|
159622
|
+
async function generateReactCommonCss(app) {
|
|
159623
|
+
const appFile = isPxtCore ? `react-common/styles/react-common-${app}-core.less` :
|
|
159624
|
+
`node_modules/pxt-core/react-common/styles/react-common-${app}.less`;
|
|
159625
|
+
await nodeutil.spawnAsync({
|
|
159626
|
+
cmd: "node",
|
|
159627
|
+
args: [
|
|
159628
|
+
lessCPath,
|
|
159629
|
+
appFile,
|
|
159630
|
+
`built/web/react-common-${app}.css`,
|
|
159631
|
+
"--include-path=" + lessIncludePaths
|
|
159632
|
+
]
|
|
159633
|
+
});
|
|
159634
|
+
let appCss = await readFileAsync(`built/web/react-common-${app}.css`, "utf8");
|
|
159635
|
+
appCss = await linkFontAsync("fa-solid-900", appCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
|
|
159636
|
+
appCss = await linkFontAsync("fa-regular-400", appCss, fontAwesomeSource, "\\.\\.\\/webfonts\\/");
|
|
159637
|
+
await writeFileAsync(`built/web/react-common-${app}.css`, appCss, "utf8");
|
|
159638
|
+
}
|
|
159639
|
+
// Generate react-common css for skillmap, authcode, and multiplayer
|
|
159640
|
+
await Promise.all([
|
|
159641
|
+
generateReactCommonCss("skillmap"),
|
|
159642
|
+
generateReactCommonCss("authcode"),
|
|
159643
|
+
generateReactCommonCss("multiplayer")
|
|
159644
|
+
]);
|
|
159644
159645
|
// Run postcss with autoprefixer and rtlcss
|
|
159645
159646
|
pxt.debug("running postcss");
|
|
159646
159647
|
const postcss = require('postcss');
|
|
@@ -159660,7 +159661,7 @@ async function buildSemanticUIAsync(parsed) {
|
|
|
159660
159661
|
autoprefixer: { browsers: browserList, add: true }
|
|
159661
159662
|
});
|
|
159662
159663
|
const rtlcss = require("rtlcss");
|
|
159663
|
-
const files = ["semantic.css", "blockly.css", "react-common-skillmap.css"];
|
|
159664
|
+
const files = ["semantic.css", "blockly.css", "react-common-skillmap.css", "react-common-authcode.css", "react-common-multiplayer.css"];
|
|
159664
159665
|
for (const cssFile of files) {
|
|
159665
159666
|
const css = await readFileAsync(`built/web/${cssFile}`, "utf8");
|
|
159666
159667
|
const processed = await postcss([cssnano])
|
|
@@ -159673,7 +159674,11 @@ async function buildSemanticUIAsync(parsed) {
|
|
|
159673
159674
|
if (!isPxtCore) {
|
|
159674
159675
|
// This is just to support the local skillmap serve for development
|
|
159675
159676
|
nodeutil.cp("built/web/react-common-skillmap.css", "node_modules/pxt-core/skillmap/public/blb");
|
|
159677
|
+
nodeutil.cp("built/web/react-common-authcode.css", "node_modules/pxt-core/authcode/public/blb");
|
|
159678
|
+
nodeutil.cp("built/web/react-common-multiplayer.css", "node_modules/pxt-core/multiplayer/public/blb");
|
|
159676
159679
|
nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/skillmap/public/blb");
|
|
159680
|
+
nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/authcode/public/blb");
|
|
159681
|
+
nodeutil.cp("built/web/semantic.css", "node_modules/pxt-core/multiplayer/public/blb");
|
|
159677
159682
|
}
|
|
159678
159683
|
}
|
|
159679
159684
|
async function linkFontAsync(font, semCss, sourceDir = "node_modules/semantic-ui-less/themes/default/assets/fonts/", refDir = "fonts\\/") {
|
|
@@ -159692,47 +159697,10 @@ function buildWebStringsAsync() {
|
|
|
159692
159697
|
nodeutil.writeFileSync("built/webstrings.json", nodeutil.stringify(webstringsJson()));
|
|
159693
159698
|
return Promise.resolve();
|
|
159694
159699
|
}
|
|
159695
|
-
function
|
|
159700
|
+
function buildReactAppAsync(app, parsed) {
|
|
159696
159701
|
// local serve
|
|
159697
|
-
const
|
|
159698
|
-
const reactScriptsConfigRoot = `${skillmapRoot}/node_modules/react-scripts/config`;
|
|
159702
|
+
const appRoot = `node_modules/pxt-core/${app}`;
|
|
159699
159703
|
const docsPath = parsed.flags["docs"];
|
|
159700
|
-
return rimrafAsync(`${skillmapRoot}/public/blb`, {})
|
|
159701
|
-
.then(() => rimrafAsync(`${skillmapRoot}/build/assets`, {}))
|
|
159702
|
-
.then(() => rimrafAsync(`${skillmapRoot}/public/docs`, {}))
|
|
159703
|
-
.then(() => rimrafAsync(`${skillmapRoot}/public/static`, {}))
|
|
159704
|
-
.then(() => {
|
|
159705
|
-
// read pxtarget.json, save into 'pxtTargetBundle' global variable
|
|
159706
|
-
let cfg = readLocalPxTarget();
|
|
159707
|
-
nodeutil.writeFileSync(`${skillmapRoot}/public/blb/target.js`, "// eslint-disable-next-line \n" + targetJsPrefix + JSON.stringify(cfg));
|
|
159708
|
-
nodeutil.cp("node_modules/pxt-core/built/pxtlib.js", `${skillmapRoot}/public/blb`);
|
|
159709
|
-
nodeutil.cp("built/web/semantic.css", `${skillmapRoot}/public/blb`);
|
|
159710
|
-
nodeutil.cp("node_modules/pxt-core/built/web/icons.css", `${skillmapRoot}/public/blb`);
|
|
159711
|
-
nodeutil.cp("node_modules/pxt-core/built/web/react-common-skillmap.css", `${skillmapRoot}/public/blb`);
|
|
159712
|
-
// copy 'assets' over from docs/static
|
|
159713
|
-
nodeutil.cpR("docs/static/skillmap/assets", `${skillmapRoot}/public/assets`);
|
|
159714
|
-
// copy default react-scripts webpack config into a webpack.config.base file if necessary
|
|
159715
|
-
if (!fs.existsSync(`${reactScriptsConfigRoot}/webpack.config.base.js`)) {
|
|
159716
|
-
nodeutil.cp(`${reactScriptsConfigRoot}/webpack.config.js`, reactScriptsConfigRoot, "webpack.config.base.js");
|
|
159717
|
-
}
|
|
159718
|
-
// wrap the config in our webpack.config.override for build customization
|
|
159719
|
-
nodeutil.cp(`${skillmapRoot}/webpack.config.override.js`, reactScriptsConfigRoot, "webpack.config.js");
|
|
159720
|
-
if (docsPath) {
|
|
159721
|
-
// copy docs over from specified path
|
|
159722
|
-
nodeutil.cpR(`docs/${docsPath}`, `${skillmapRoot}/public/docs/${docsPath}`);
|
|
159723
|
-
nodeutil.cpR(`docs/static/${docsPath}`, `${skillmapRoot}/public/static/${docsPath}`);
|
|
159724
|
-
}
|
|
159725
|
-
return nodeutil.spawnAsync({
|
|
159726
|
-
cmd: os.platform() === "win32" ? "npm.cmd" : "npm",
|
|
159727
|
-
args: ["run-script", "start"],
|
|
159728
|
-
cwd: skillmapRoot,
|
|
159729
|
-
shell: true
|
|
159730
|
-
});
|
|
159731
|
-
});
|
|
159732
|
-
}
|
|
159733
|
-
function buildAuthcodeAsync(parsed) {
|
|
159734
|
-
// local serve
|
|
159735
|
-
const appRoot = "node_modules/pxt-core/authcode";
|
|
159736
159704
|
return rimrafAsync(`${appRoot}/public/blb`, {})
|
|
159737
159705
|
.then(() => rimrafAsync(`${appRoot}/build/assets`, {}))
|
|
159738
159706
|
.then(() => rimrafAsync(`${appRoot}/public/docs`, {}))
|
|
@@ -159744,9 +159712,14 @@ function buildAuthcodeAsync(parsed) {
|
|
|
159744
159712
|
nodeutil.cp("node_modules/pxt-core/built/pxtlib.js", `${appRoot}/public/blb`);
|
|
159745
159713
|
nodeutil.cp("built/web/semantic.css", `${appRoot}/public/blb`);
|
|
159746
159714
|
nodeutil.cp("node_modules/pxt-core/built/web/icons.css", `${appRoot}/public/blb`);
|
|
159747
|
-
nodeutil.cp(
|
|
159715
|
+
nodeutil.cp(`node_modules/pxt-core/built/web/react-common-${app}.css`, `${appRoot}/public/blb`);
|
|
159748
159716
|
// copy 'assets' over from docs/static
|
|
159749
|
-
nodeutil.cpR(
|
|
159717
|
+
nodeutil.cpR(`docs/static/${app}/assets`, `${appRoot}/public/assets`);
|
|
159718
|
+
if (docsPath) {
|
|
159719
|
+
// copy docs over from specified path
|
|
159720
|
+
nodeutil.cpR(`docs/${docsPath}`, `${appRoot}/public/docs/${docsPath}`);
|
|
159721
|
+
nodeutil.cpR(`docs/static/${docsPath}`, `${appRoot}/public/static/${docsPath}`);
|
|
159722
|
+
}
|
|
159750
159723
|
return nodeutil.spawnAsync({
|
|
159751
159724
|
cmd: os.platform() === "win32" ? "npm.cmd" : "npm",
|
|
159752
159725
|
args: ["run-script", "start"],
|
|
@@ -159755,6 +159728,15 @@ function buildAuthcodeAsync(parsed) {
|
|
|
159755
159728
|
});
|
|
159756
159729
|
});
|
|
159757
159730
|
}
|
|
159731
|
+
function buildSkillMapAsync(parsed) {
|
|
159732
|
+
return buildReactAppAsync("skillmap", parsed);
|
|
159733
|
+
}
|
|
159734
|
+
function buildAuthcodeAsync(parsed) {
|
|
159735
|
+
return buildReactAppAsync("authcode", parsed);
|
|
159736
|
+
}
|
|
159737
|
+
function buildMultiplayerAsync(parsed) {
|
|
159738
|
+
return buildReactAppAsync("multiplayer", parsed);
|
|
159739
|
+
}
|
|
159758
159740
|
function updateDefaultProjects(cfg) {
|
|
159759
159741
|
let defaultProjects = [
|
|
159760
159742
|
pxt.BLOCKS_PROJECT_NAME,
|
|
@@ -164146,9 +164128,30 @@ ${pxt.crowdin.KEY_VARIABLE} - crowdin key
|
|
|
164146
164128
|
flags: {
|
|
164147
164129
|
serve: {
|
|
164148
164130
|
description: "Serve the authcode app locally after building (npm start)"
|
|
164131
|
+
},
|
|
164132
|
+
docs: {
|
|
164133
|
+
description: "Path to local docs folder to copy into authcode",
|
|
164134
|
+
type: "string",
|
|
164135
|
+
argument: "docs"
|
|
164149
164136
|
}
|
|
164150
164137
|
}
|
|
164151
164138
|
}, buildAuthcodeAsync);
|
|
164139
|
+
p.defineCommand({
|
|
164140
|
+
name: "buildmultiplayer",
|
|
164141
|
+
aliases: ["multiplayer", "mp"],
|
|
164142
|
+
advanced: true,
|
|
164143
|
+
help: "Serves the multiplayer webapp",
|
|
164144
|
+
flags: {
|
|
164145
|
+
serve: {
|
|
164146
|
+
description: "Serve the multiplayer app locally after building (npm start)"
|
|
164147
|
+
},
|
|
164148
|
+
docs: {
|
|
164149
|
+
description: "Path to local docs folder to copy into multiplayer",
|
|
164150
|
+
type: "string",
|
|
164151
|
+
argument: "docs"
|
|
164152
|
+
}
|
|
164153
|
+
}
|
|
164154
|
+
}, buildMultiplayerAsync);
|
|
164152
164155
|
advancedCommand("augmentdocs", "test markdown docs replacements", augmnetDocsAsync, "<temlate.md> <doc.md>");
|
|
164153
164156
|
advancedCommand("crowdin", "upload, download, clean, stats files to/from crowdin", pc => crowdin.execCrowdinAsync.apply(undefined, pc.args), "<cmd> <path> [output]");
|
|
164154
164157
|
advancedCommand("hidlist", "list HID devices", hid.listAsync);
|
package/built/pxtlib.d.ts
CHANGED
package/built/server.js
CHANGED
|
@@ -1050,6 +1050,10 @@ function serveAsync(options) {
|
|
|
1050
1050
|
sendFile(path.join(publicDir, 'authcode.html'));
|
|
1051
1051
|
return;
|
|
1052
1052
|
}
|
|
1053
|
+
if (pathname == "/--multiplayer") {
|
|
1054
|
+
sendFile(path.join(publicDir, 'multiplayer.html'));
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1053
1057
|
if (/\/-[-]*docs.*$/.test(pathname)) {
|
|
1054
1058
|
sendFile(path.join(publicDir, 'docs.html'));
|
|
1055
1059
|
return;
|