pxt-core 13.1.2 → 13.1.4

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 CHANGED
@@ -841,6 +841,9 @@ function gitUploadAsync(opts, uplReqs) {
841
841
  });
842
842
  }
843
843
  async function uploadToGitRepoAsync(opts, uplReqs) {
844
+ if (process.env["PXT_SKIP_GIT_COMMIT"]) {
845
+ return writeFilesToPushAsync(opts, uplReqs);
846
+ }
844
847
  let label = opts.label;
845
848
  if (!label) {
846
849
  console.log('no label; skip release upload');
@@ -941,6 +944,40 @@ async function uploadToGitRepoAsync(opts, uplReqs) {
941
944
  }
942
945
  });
943
946
  }
947
+ async function writeFilesToPushAsync(opts, uplReqs) {
948
+ let label = opts.label;
949
+ if (!label) {
950
+ console.log('no label; skip release upload');
951
+ return Promise.resolve();
952
+ }
953
+ let tid = pxt.appTarget.id;
954
+ if (U.startsWith(label, tid + "/"))
955
+ label = label.slice(tid.length + 1);
956
+ if (!/^v\d/.test(label)) {
957
+ console.log(`label "${label}" is not a version; skipping release upload`);
958
+ return Promise.resolve();
959
+ }
960
+ const releasesDir = path.resolve("tmp/releases");
961
+ const outDir = path.join(releasesDir, "built");
962
+ console.log("writing release files to " + releasesDir);
963
+ nodeutil.mkdirP(outDir);
964
+ const info = await ciBuildInfoAsync();
965
+ const releaseInfo = {
966
+ url: info.commitUrl,
967
+ tag: label
968
+ };
969
+ // this gets read by the github actions workflow
970
+ fs.writeFileSync(path.join(releasesDir, "release.json"), JSON.stringify(releaseInfo, null, 2), { encoding: "utf8" });
971
+ // copy the files into the built directory. the actual push to the git repo will be
972
+ // handled by the github actions workflow
973
+ for (let u of U.values(uplReqs)) {
974
+ let fpath = path.join(outDir, u.filename);
975
+ nodeutil.mkdirP(path.dirname(fpath));
976
+ fs.writeFileSync(fpath, u.content, { encoding: u.encoding });
977
+ }
978
+ // make sure there's always something to commit
979
+ fs.writeFileSync(path.join(outDir, "stamp.txt"), new Date().toString());
980
+ }
944
981
  function uploadedArtFileCdnUrl(fn) {
945
982
  if (!fn || /^(https?|data):/.test(fn))
946
983
  return fn; // nothing to do
package/built/pxt.js CHANGED
@@ -120947,6 +120947,8 @@ ${code}
120947
120947
  tutorial_1.shouldFilterProject = shouldFilterProject;
120948
120948
  function mergeTutorialDependencies(projectDependencies, tutorialDependencies) {
120949
120949
  const merged = Object.assign({}, projectDependencies);
120950
+ if (!tutorialDependencies)
120951
+ return merged;
120950
120952
  for (const dep of Object.keys(tutorialDependencies)) {
120951
120953
  const ver = tutorialDependencies[dep];
120952
120954
  if (ver.toLowerCase() === "remove") {
@@ -165002,6 +165004,9 @@ function gitUploadAsync(opts, uplReqs) {
165002
165004
  });
165003
165005
  }
165004
165006
  async function uploadToGitRepoAsync(opts, uplReqs) {
165007
+ if (process.env["PXT_SKIP_GIT_COMMIT"]) {
165008
+ return writeFilesToPushAsync(opts, uplReqs);
165009
+ }
165005
165010
  let label = opts.label;
165006
165011
  if (!label) {
165007
165012
  console.log('no label; skip release upload');
@@ -165102,6 +165107,40 @@ async function uploadToGitRepoAsync(opts, uplReqs) {
165102
165107
  }
165103
165108
  });
165104
165109
  }
165110
+ async function writeFilesToPushAsync(opts, uplReqs) {
165111
+ let label = opts.label;
165112
+ if (!label) {
165113
+ console.log('no label; skip release upload');
165114
+ return Promise.resolve();
165115
+ }
165116
+ let tid = pxt.appTarget.id;
165117
+ if (U.startsWith(label, tid + "/"))
165118
+ label = label.slice(tid.length + 1);
165119
+ if (!/^v\d/.test(label)) {
165120
+ console.log(`label "${label}" is not a version; skipping release upload`);
165121
+ return Promise.resolve();
165122
+ }
165123
+ const releasesDir = path.resolve("tmp/releases");
165124
+ const outDir = path.join(releasesDir, "built");
165125
+ console.log("writing release files to " + releasesDir);
165126
+ nodeutil.mkdirP(outDir);
165127
+ const info = await ciBuildInfoAsync();
165128
+ const releaseInfo = {
165129
+ url: info.commitUrl,
165130
+ tag: label
165131
+ };
165132
+ // this gets read by the github actions workflow
165133
+ fs.writeFileSync(path.join(releasesDir, "release.json"), JSON.stringify(releaseInfo, null, 2), { encoding: "utf8" });
165134
+ // copy the files into the built directory. the actual push to the git repo will be
165135
+ // handled by the github actions workflow
165136
+ for (let u of U.values(uplReqs)) {
165137
+ let fpath = path.join(outDir, u.filename);
165138
+ nodeutil.mkdirP(path.dirname(fpath));
165139
+ fs.writeFileSync(fpath, u.content, { encoding: u.encoding });
165140
+ }
165141
+ // make sure there's always something to commit
165142
+ fs.writeFileSync(path.join(outDir, "stamp.txt"), new Date().toString());
165143
+ }
165105
165144
  function uploadedArtFileCdnUrl(fn) {
165106
165145
  if (!fn || /^(https?|data):/.test(fn))
165107
165146
  return fn; // nothing to do
package/built/pxtlib.js CHANGED
@@ -23226,6 +23226,8 @@ ${code}
23226
23226
  tutorial_1.shouldFilterProject = shouldFilterProject;
23227
23227
  function mergeTutorialDependencies(projectDependencies, tutorialDependencies) {
23228
23228
  const merged = Object.assign({}, projectDependencies);
23229
+ if (!tutorialDependencies)
23230
+ return merged;
23229
23231
  for (const dep of Object.keys(tutorialDependencies)) {
23230
23232
  const ver = tutorialDependencies[dep];
23231
23233
  if (ver.toLowerCase() === "remove") {