@canopy-iiif/app 1.8.4 → 1.8.6

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.
Files changed (2) hide show
  1. package/lib/build/dev.js +35 -11
  2. package/package.json +1 -1
package/lib/build/dev.js CHANGED
@@ -976,13 +976,16 @@ async function dev() {
976
976
  }
977
977
  };
978
978
 
979
- const tailwindCmd = (args = []) => {
980
- const parts = [cli.cmd];
981
- if (Array.isArray(cli.args) && cli.args.length) parts.push(...cli.args);
982
- if (Array.isArray(args) && args.length) parts.push(...args);
983
- return parts.filter(Boolean).join(" ");
979
+ const tailwindArgVector = (args = []) => {
980
+ const vector = [];
981
+ if (cli.cmd) vector.push(cli.cmd);
982
+ if (Array.isArray(cli.args) && cli.args.length) vector.push(...cli.args);
983
+ if (Array.isArray(args) && args.length) vector.push(...args);
984
+ return vector;
984
985
  };
985
986
 
987
+ const tailwindCmd = (args = []) => tailwindArgVector(args).join(" ");
988
+
986
989
  const formatSpawnOutput = (result) => {
987
990
  if (!result) return "";
988
991
  const messages = [];
@@ -1004,6 +1007,28 @@ async function dev() {
1004
1007
  ` config: ${configPath ? prettyPath(configPath) : "<unknown>"}`,
1005
1008
  ` cli: ${tailwindCmd(args)}`,
1006
1009
  ];
1010
+ if (result && typeof result.status === "number") {
1011
+ details.push(` exitCode: ${result.status}`);
1012
+ }
1013
+ if (result && result.error) {
1014
+ const err = result.error;
1015
+ details.push(
1016
+ ` spawnError: ${err && err.message ? err.message : String(err)}`
1017
+ );
1018
+ }
1019
+ if (result && result.signal) {
1020
+ details.push(` signal: ${result.signal}`);
1021
+ }
1022
+ const extraArgs = tailwindArgVector(args)
1023
+ .map((part) => {
1024
+ if (!part || typeof part !== "string") return part;
1025
+ if (part.includes("\n")) return part.replace(/\n/g, "\\n");
1026
+ return part;
1027
+ })
1028
+ .join(" ");
1029
+ if (extraArgs && extraArgs !== tailwindCmd(args)) {
1030
+ details.push(` cliRaw: ${extraArgs}`);
1031
+ }
1007
1032
  const extra = formatSpawnOutput(result);
1008
1033
  if (extra) {
1009
1034
  details.push(
@@ -1026,10 +1051,12 @@ async function dev() {
1026
1051
  "--minify",
1027
1052
  ];
1028
1053
 
1029
- const initial = spawnSync(cli.cmd, [...cli.args, ...baseArgs], {
1054
+ const spawnOptions = {
1030
1055
  stdio: ["ignore", "pipe", "pipe"],
1031
1056
  env: { ...process.env, BROWSERSLIST_IGNORE_OLD_DATA: "1" },
1032
- });
1057
+ };
1058
+
1059
+ const initial = spawnSync(cli.cmd, [...cli.args, ...baseArgs], spawnOptions);
1033
1060
  if (!initial || initial.status !== 0) {
1034
1061
  throw new Error(
1035
1062
  tailwindFailureMessage(
@@ -1083,10 +1110,7 @@ async function dev() {
1083
1110
  }
1084
1111
 
1085
1112
  function compileTailwindOnce() {
1086
- const res = spawnSync(cli.cmd, [...cli.args, ...baseArgs], {
1087
- stdio: ["ignore", "pipe", "pipe"],
1088
- env: { ...process.env, BROWSERSLIST_IGNORE_OLD_DATA: "1" },
1089
- });
1113
+ const res = spawnSync(cli.cmd, [...cli.args, ...baseArgs], spawnOptions);
1090
1114
  if (!res || res.status !== 0) {
1091
1115
  throw new Error(
1092
1116
  tailwindFailureMessage(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopy-iiif/app",
3
- "version": "1.8.4",
3
+ "version": "1.8.6",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Mat Jordan <mat@northwestern.edu>",