@epic-web/workshop-utils 6.28.1 → 6.29.0

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.
@@ -1,7 +1,7 @@
1
1
  import './init-env.js';
2
2
  import dayjsLib from 'dayjs';
3
3
  export declare const dayjs: typeof dayjsLib;
4
- export declare function getErrorMessage(error: unknown): string;
4
+ export declare function getErrorMessage(error: unknown, fallbackMessage?: string): string;
5
5
  export declare function handleGitHubRepoAndRoot({ githubRepo, githubRoot, }: {
6
6
  githubRepo?: string;
7
7
  githubRoot?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAGtB,OAAO,QAAQ,MAAM,OAAO,CAAA;AAK5B,eAAO,MAAM,KAAK,iBAKhB,CAAA;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,UAY7C;AAED,wBAAgB,uBAAuB,CAAC,EACvC,UAAU,EACV,UAAU,GACV,EAAE;IACF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;;;EAaA"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAGtB,OAAO,QAAQ,MAAM,OAAO,CAAA;AAK5B,eAAO,MAAM,KAAK,iBAKhB,CAAA;AAEF,wBAAgB,eAAe,CAC9B,KAAK,EAAE,OAAO,EACd,eAAe,SAAkB,GAC/B,MAAM,CAYR;AAED,wBAAgB,uBAAuB,CAAC,EACvC,UAAU,EACV,UAAU,GACV,EAAE;IACF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;;;EAaA"}
package/dist/esm/utils.js CHANGED
@@ -10,7 +10,7 @@ export const dayjs = remember('dayjs', () => {
10
10
  dayjsLib.extend(relativeTimePlugin);
11
11
  return dayjsLib;
12
12
  });
13
- export function getErrorMessage(error) {
13
+ export function getErrorMessage(error, fallbackMessage = 'Unknown Error') {
14
14
  if (typeof error === 'string')
15
15
  return error;
16
16
  if (error &&
@@ -20,7 +20,7 @@ export function getErrorMessage(error) {
20
20
  return error.message;
21
21
  }
22
22
  console.error('Unable to get error message for error', error);
23
- return 'Unknown Error';
23
+ return fallbackMessage;
24
24
  }
25
25
  export function handleGitHubRepoAndRoot({ githubRepo, githubRoot, }) {
26
26
  if (githubRepo) {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAEtB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,QAAQ,MAAM,OAAO,CAAA;AAC5B,OAAO,kBAAkB,MAAM,8BAA8B,CAAA;AAC7D,OAAO,cAAc,MAAM,0BAA0B,CAAA;AACrD,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAE3C,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IAC3C,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAC1B,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;IAC/B,QAAQ,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAA;IACnC,OAAO,QAAQ,CAAA;AAChB,CAAC,CAAC,CAAA;AAEF,MAAM,UAAU,eAAe,CAAC,KAAc;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC3C,IACC,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,SAAS,IAAI,KAAK;QAClB,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EAChC,CAAC;QACF,OAAO,KAAK,CAAC,OAAO,CAAA;IACrB,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAA;IAC7D,OAAO,eAAe,CAAA;AACvB,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,EACvC,UAAU,EACV,UAAU,GAIV;IACA,IAAI,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QAC1C,UAAU,GAAG,GAAG,UAAU,YAAY,CAAA;IACvC,CAAC;SAAM,IAAI,UAAU,EAAE,CAAC;QACvB,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAA;QACzD,UAAU,GAAG,GAAG,UAAU,YAAY,CAAA;IACvC,CAAC;SAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACd,sJAAsJ,CACtJ,CAAA;IACF,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,CAAA;AAClC,CAAC","sourcesContent":["import './init-env.js'\n\nimport { remember } from '@epic-web/remember'\nimport dayjsLib from 'dayjs'\nimport relativeTimePlugin from 'dayjs/plugin/relativeTime.js'\nimport timeZonePlugin from 'dayjs/plugin/timezone.js'\nimport utcPlugin from 'dayjs/plugin/utc.js'\n\nexport const dayjs = remember('dayjs', () => {\n\tdayjsLib.extend(utcPlugin)\n\tdayjsLib.extend(timeZonePlugin)\n\tdayjsLib.extend(relativeTimePlugin)\n\treturn dayjsLib\n})\n\nexport function getErrorMessage(error: unknown) {\n\tif (typeof error === 'string') return error\n\tif (\n\t\terror &&\n\t\ttypeof error === 'object' &&\n\t\t'message' in error &&\n\t\ttypeof error.message === 'string'\n\t) {\n\t\treturn error.message\n\t}\n\tconsole.error('Unable to get error message for error', error)\n\treturn 'Unknown Error'\n}\n\nexport function handleGitHubRepoAndRoot({\n\tgithubRepo,\n\tgithubRoot,\n}: {\n\tgithubRepo?: string\n\tgithubRoot?: string\n}) {\n\tif (githubRepo) {\n\t\tgithubRepo = githubRepo.replace(/\\/$/, '')\n\t\tgithubRoot = `${githubRepo}/tree/main`\n\t} else if (githubRoot) {\n\t\tgithubRepo = githubRoot.replace(/\\/(blob|tree)\\/.*$/, '')\n\t\tgithubRoot = `${githubRepo}/tree/main`\n\t} else {\n\t\tthrow new Error(\n\t\t\t`Either githubRepo or githubRoot is required. Please ensure your epicshop package.json config includes either githubRepo or githubRoot configuration.`,\n\t\t)\n\t}\n\treturn { githubRepo, githubRoot }\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAEtB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,QAAQ,MAAM,OAAO,CAAA;AAC5B,OAAO,kBAAkB,MAAM,8BAA8B,CAAA;AAC7D,OAAO,cAAc,MAAM,0BAA0B,CAAA;AACrD,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAE3C,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IAC3C,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAC1B,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;IAC/B,QAAQ,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAA;IACnC,OAAO,QAAQ,CAAA;AAChB,CAAC,CAAC,CAAA;AAEF,MAAM,UAAU,eAAe,CAC9B,KAAc,EACd,eAAe,GAAG,eAAe;IAEjC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC3C,IACC,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,SAAS,IAAI,KAAK;QAClB,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EAChC,CAAC;QACF,OAAO,KAAK,CAAC,OAAO,CAAA;IACrB,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAA;IAC7D,OAAO,eAAe,CAAA;AACvB,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,EACvC,UAAU,EACV,UAAU,GAIV;IACA,IAAI,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QAC1C,UAAU,GAAG,GAAG,UAAU,YAAY,CAAA;IACvC,CAAC;SAAM,IAAI,UAAU,EAAE,CAAC;QACvB,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAA;QACzD,UAAU,GAAG,GAAG,UAAU,YAAY,CAAA;IACvC,CAAC;SAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACd,sJAAsJ,CACtJ,CAAA;IACF,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,CAAA;AAClC,CAAC","sourcesContent":["import './init-env.js'\n\nimport { remember } from '@epic-web/remember'\nimport dayjsLib from 'dayjs'\nimport relativeTimePlugin from 'dayjs/plugin/relativeTime.js'\nimport timeZonePlugin from 'dayjs/plugin/timezone.js'\nimport utcPlugin from 'dayjs/plugin/utc.js'\n\nexport const dayjs = remember('dayjs', () => {\n\tdayjsLib.extend(utcPlugin)\n\tdayjsLib.extend(timeZonePlugin)\n\tdayjsLib.extend(relativeTimePlugin)\n\treturn dayjsLib\n})\n\nexport function getErrorMessage(\n\terror: unknown,\n\tfallbackMessage = 'Unknown Error',\n): string {\n\tif (typeof error === 'string') return error\n\tif (\n\t\terror &&\n\t\ttypeof error === 'object' &&\n\t\t'message' in error &&\n\t\ttypeof error.message === 'string'\n\t) {\n\t\treturn error.message\n\t}\n\tconsole.error('Unable to get error message for error', error)\n\treturn fallbackMessage\n}\n\nexport function handleGitHubRepoAndRoot({\n\tgithubRepo,\n\tgithubRoot,\n}: {\n\tgithubRepo?: string\n\tgithubRoot?: string\n}) {\n\tif (githubRepo) {\n\t\tgithubRepo = githubRepo.replace(/\\/$/, '')\n\t\tgithubRoot = `${githubRepo}/tree/main`\n\t} else if (githubRoot) {\n\t\tgithubRepo = githubRoot.replace(/\\/(blob|tree)\\/.*$/, '')\n\t\tgithubRoot = `${githubRepo}/tree/main`\n\t} else {\n\t\tthrow new Error(\n\t\t\t`Either githubRepo or githubRoot is required. Please ensure your epicshop package.json config includes either githubRepo or githubRoot configuration.`,\n\t\t)\n\t}\n\treturn { githubRepo, githubRoot }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epic-web/workshop-utils",
3
- "version": "6.28.1",
3
+ "version": "6.29.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },