arcadible 0.1.49 → 0.1.51

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/bin/arc-login.js CHANGED
@@ -103,7 +103,7 @@ const handler = function ({ browser, qrcode: qr, shown, sw }) {
103
103
 
104
104
  const start = function (argv) {
105
105
  const shown = { link: false };
106
- const sw = new SpinnerWheel("Logging in... %s");
106
+ const sw = new SpinnerWheel("Logging in… %s");
107
107
  sw.start();
108
108
  return login({
109
109
  handler: handler({
package/package.json CHANGED
@@ -79,5 +79,5 @@
79
79
  "scripts": {
80
80
  "test": "node --test \"test/**/*.test.js\""
81
81
  },
82
- "version": "0.1.49"
82
+ "version": "0.1.51"
83
83
  }
@@ -22,6 +22,7 @@ const ArcError = error.ArcError;
22
22
  const detectVersion = manifest.detectVersion;
23
23
  const join = path.join;
24
24
  const prepare = manifest.prepare;
25
+ const readdir = fs.readdir;
25
26
  const remove = fs.remove;
26
27
  const resolve = path.resolve;
27
28
 
@@ -37,6 +38,28 @@ const removeLicense = function (dest) {
37
38
 
38
39
  // [function]
39
40
 
41
+ const unavailable = function (src, cause) {
42
+ return new ArcError(
43
+ cfgcode.TEMPLATE_UNAVAILABLE,
44
+ phrase.templateUnavailable(src),
45
+ { cause },
46
+ );
47
+ };
48
+
49
+ // [function]
50
+
51
+ // degit copies nothing, without failing, from a folder a repository doesn't
52
+ // have, so an empty project fails as a missing repository does.
53
+ const ensureCopied = async function (src, dest) {
54
+ const names = await readdir(dest).catch(() => []);
55
+ if (names.length === 0) {
56
+ await remove(dest);
57
+ throw unavailable(src);
58
+ }
59
+ };
60
+
61
+ // [function]
62
+
40
63
  const scaffold = function (src, dest, { onInitBegin }) {
41
64
  if (onInitBegin) {
42
65
  onInitBegin({ dest, src });
@@ -44,14 +67,9 @@ const scaffold = function (src, dest, { onInitBegin }) {
44
67
  return degit(src, { cache: false, force: true, verbose: false })
45
68
  .clone(dest)
46
69
  .catch((ex) => {
47
- throw new ArcError(
48
- cfgcode.TEMPLATE_UNAVAILABLE,
49
- phrase.templateUnavailable(src),
50
- {
51
- cause: ex,
52
- },
53
- );
54
- });
70
+ throw unavailable(src, ex);
71
+ })
72
+ .then(() => ensureCopied(src, dest));
55
73
  };
56
74
 
57
75
  // [function]
package/src/phrase.js CHANGED
@@ -243,7 +243,7 @@ const loggedOut = function () {
243
243
  // [function]
244
244
 
245
245
  const loggingIn = function () {
246
- return "Logging in...";
246
+ return "Logging in…";
247
247
  };
248
248
 
249
249
  // [function]
@@ -299,13 +299,13 @@ const remoteName = function (name) {
299
299
 
300
300
  // arc serve's copy of one of Arcadible's files, kept from `fetchedAt`.
301
301
  const remoteKept = function (name, fetchedAt) {
302
- return `${TITLE} can't be reached: serving ${remoteName(name)} from ${fetchedAt.slice(0, 10)}.`;
302
+ return `${TITLE} can't be reached, so serving ${remoteName(name)} saved on ${fetchedAt.slice(0, 10)}.`;
303
303
  };
304
304
 
305
305
  // [function]
306
306
 
307
307
  const remoteUnreachable = function (name) {
308
- return `${TITLE} can't be reached, and there's no copy of ${remoteName(name)} yet: the game runs without it until ${TITLE} can be.`;
308
+ return `${TITLE} can't be reached, and ${remoteName(name)} isn't saved yet. The game runs without it until ${TITLE} is back.`;
309
309
  };
310
310
 
311
311
  // [function]
@@ -317,7 +317,7 @@ const reloaded = function () {
317
317
  // [function]
318
318
 
319
319
  const serveAlone = function () {
320
- return "The game alone, without the play page:";
320
+ return "Game only:";
321
321
  };
322
322
 
323
323
  // [function]
@@ -347,7 +347,7 @@ const serveNextUrl = function () {
347
347
  // [function]
348
348
 
349
349
  const urlInvalid = function () {
350
- return "The URL must be an http or https one, such as http://localhost:5173.";
350
+ return "The URL must start with http:// or https://, such as http://localhost:5173.";
351
351
  };
352
352
 
353
353
  // [function]
@@ -356,7 +356,8 @@ const urlInvalid = function () {
356
356
  // says how to add them.
357
357
  const urlNotFrameable = function (url, link) {
358
358
  return blocks(
359
- `⚠ ${url} can't be framed by the play page: it needs to send Cross-Origin-Embedder-Policy: require-corp and Cross-Origin-Resource-Policy: cross-origin.`,
359
+ `⚠ The play page can't frame ${url}.`,
360
+ "Send Cross-Origin-Embedder-Policy: require-corp and Cross-Origin-Resource-Policy: cross-origin.",
360
361
  ["Add them to your server, as the starters' vite.config.js does:", link],
361
362
  );
362
363
  };
@@ -370,7 +371,7 @@ const urlUnreachable = function (url) {
370
371
  // [function]
371
372
 
372
373
  const pressEnterToOpen = function () {
373
- return "Press Enter to open the URL.";
374
+ return "Press Enter to open the link.";
374
375
  };
375
376
 
376
377
  // [function]
@@ -384,7 +385,7 @@ const releaseFailedHeading = function () {
384
385
  // origin isn't the game's connected repository: none is, or another is.
385
386
  const repoNotConnected = function (game, repo, url) {
386
387
  return blocks(`${repo} isn't ${game}'s repository on ${TITLE}.`, [
387
- `The game's owner connects it in ${TITLE} Studio, on the game's Repository tab, and connects it again if it was renamed on GitHub:`,
388
+ `Connect it in ${TITLE} Studio, on the game's Repository tab (again if it was renamed on GitHub):`,
388
389
  url,
389
390
  ]);
390
391
  };
@@ -497,7 +498,7 @@ const httpError = function (name, status, detail) {
497
498
  // [function]
498
499
 
499
500
  const imageAspect = function (aspect) {
500
- return `Image aspect ratio must be: ${aspect}`;
501
+ return `Image must be ${aspect}.`;
501
502
  };
502
503
 
503
504
  // [function]
@@ -509,13 +510,13 @@ const imageFound = function (width, height) {
509
510
  // [function]
510
511
 
511
512
  const imageHeightMax = function (height) {
512
- return `Image height must not exceed: ${height}px`;
513
+ return `Image must be at most ${height}px tall.`;
513
514
  };
514
515
 
515
516
  // [function]
516
517
 
517
518
  const imageHeightMin = function (height) {
518
- return `Image height must be at least: ${height}px`;
519
+ return `Image must be at least ${height}px tall.`;
519
520
  };
520
521
 
521
522
  // [function]
@@ -527,7 +528,7 @@ const imageInvalid = function () {
527
528
  // [function]
528
529
 
529
530
  const imageSizeMax = function (size) {
530
- return `Image size must not exceed: ${size}`;
531
+ return `Image must be at most ${size}.`;
531
532
  };
532
533
 
533
534
  // [function]
@@ -539,13 +540,13 @@ const imageUnsupported = function () {
539
540
  // [function]
540
541
 
541
542
  const imageWidthMax = function (width) {
542
- return `Image width must not exceed: ${width}px`;
543
+ return `Image must be at most ${width}px wide.`;
543
544
  };
544
545
 
545
546
  // [function]
546
547
 
547
548
  const imageWidthMin = function (width) {
548
- return `Image width must be at least: ${width}px`;
549
+ return `Image must be at least ${width}px wide.`;
549
550
  };
550
551
 
551
552
  // [function]
@@ -933,19 +934,19 @@ const versionUnchecked = function (version) {
933
934
  // [function]
934
935
 
935
936
  const videoAspect = function (aspect) {
936
- return `Video aspect ratio must be: ${aspect}`;
937
+ return `Video must be ${aspect}.`;
937
938
  };
938
939
 
939
940
  // [function]
940
941
 
941
942
  const videoDurationMax = function (maxDuration) {
942
- return `Video duration must not exceed: ${maxDuration}s`;
943
+ return `Video must be at most ${maxDuration}s long.`;
943
944
  };
944
945
 
945
946
  // [function]
946
947
 
947
948
  const videoDurationMin = function (duration) {
948
- return `Video duration must be at least: ${duration}s`;
949
+ return `Video must be at least ${duration}s long.`;
949
950
  };
950
951
 
951
952
  // [function]
@@ -957,13 +958,13 @@ const videoFound = function (width, height, duration) {
957
958
  // [function]
958
959
 
959
960
  const videoHeightMax = function (height) {
960
- return `Video height must not exceed: ${height}px`;
961
+ return `Video must be at most ${height}px tall.`;
961
962
  };
962
963
 
963
964
  // [function]
964
965
 
965
966
  const videoHeightMin = function (height) {
966
- return `Video height must be at least: ${height}px`;
967
+ return `Video must be at least ${height}px tall.`;
967
968
  };
968
969
 
969
970
  // [function]
@@ -975,7 +976,7 @@ const videoInvalid = function () {
975
976
  // [function]
976
977
 
977
978
  const videoSizeMax = function (size) {
978
- return `Video size must not exceed: ${size}`;
979
+ return `Video must be at most ${size}.`;
979
980
  };
980
981
 
981
982
  // [function]
@@ -987,13 +988,13 @@ const videoUnsupported = function () {
987
988
  // [function]
988
989
 
989
990
  const videoWidthMax = function (width) {
990
- return `Video width must not exceed: ${width}px`;
991
+ return `Video must be at most ${width}px wide.`;
991
992
  };
992
993
 
993
994
  // [function]
994
995
 
995
996
  const videoWidthMin = function (width) {
996
- return `Video width must be at least: ${width}px`;
997
+ return `Video must be at least ${width}px wide.`;
997
998
  };
998
999
 
999
1000
  // [export]