@canopy-iiif/app 0.12.7 → 0.12.8

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,25 +1,75 @@
1
+ const fs = require('fs');
1
2
  const path = require('path');
2
3
 
3
4
  const DEFAULT_CONFIG_NAME = 'canopy.yml';
4
5
 
6
+ function toAbsolute(value) {
7
+ if (!value && value !== 0) return '';
8
+ const stringValue = String(value).trim();
9
+ if (!stringValue) return '';
10
+ try {
11
+ return path.resolve(stringValue);
12
+ } catch (_) {
13
+ return '';
14
+ }
15
+ }
16
+
17
+ function fileExists(p) {
18
+ try {
19
+ return !!(p && fs.existsSync(p));
20
+ } catch (_) {
21
+ return false;
22
+ }
23
+ }
24
+
25
+ function isConfigPresent(root, fileName) {
26
+ if (!root) return false;
27
+ const candidate = path.resolve(root, fileName);
28
+ return fileExists(candidate);
29
+ }
30
+
5
31
  function resolveWorkspaceRoot(options = {}) {
6
- const rawCwd = options && options.cwd ? String(options.cwd).trim() : '';
7
- if (rawCwd) return path.resolve(rawCwd);
8
- const initCwd = String(process.env.INIT_CWD || '').trim();
9
- if (initCwd) return path.resolve(initCwd);
32
+ const candidates = [];
33
+ if (options && options.cwd) candidates.push(options.cwd);
34
+ candidates.push(process.env.INIT_CWD || '');
35
+ candidates.push(process.env.GITHUB_WORKSPACE || '');
36
+ candidates.push(process.cwd());
37
+
38
+ const seen = new Set();
39
+ for (const raw of candidates) {
40
+ const abs = toAbsolute(raw);
41
+ if (!abs || seen.has(abs)) continue;
42
+ seen.add(abs);
43
+ if (fileExists(abs)) return abs;
44
+ }
10
45
  return process.cwd();
11
46
  }
12
47
 
13
48
  function resolveCanopyConfigPath(options = {}) {
14
- const root = resolveWorkspaceRoot(options);
15
49
  const explicit = options && options.configPath ? String(options.configPath).trim() : '';
16
- if (explicit) {
17
- return path.isAbsolute(explicit) ? explicit : path.resolve(root, explicit);
18
- }
19
50
  const override = options && options.configFile ? String(options.configFile).trim() : '';
20
51
  const envOverride = String(process.env.CANOPY_CONFIG || '').trim();
21
52
  const fileName = override || envOverride || DEFAULT_CONFIG_NAME;
22
- return path.resolve(root, fileName);
53
+
54
+ const roots = [];
55
+ const primaryRoot = resolveWorkspaceRoot(options);
56
+ if (primaryRoot) roots.push(primaryRoot);
57
+ const cwdFallback = toAbsolute(process.cwd());
58
+ if (cwdFallback && !roots.includes(cwdFallback)) roots.push(cwdFallback);
59
+ const githubWorkspace = toAbsolute(process.env.GITHUB_WORKSPACE || '');
60
+ if (githubWorkspace && !roots.includes(githubWorkspace)) roots.push(githubWorkspace);
61
+
62
+ if (explicit) {
63
+ const base = roots[0] || process.cwd();
64
+ return path.isAbsolute(explicit) ? explicit : path.resolve(base, explicit);
65
+ }
66
+
67
+ for (const root of roots) {
68
+ if (isConfigPresent(root, fileName)) return path.resolve(root, fileName);
69
+ }
70
+
71
+ const fallbackRoot = roots[0] || process.cwd();
72
+ return path.resolve(fallbackRoot, fileName);
23
73
  }
24
74
 
25
75
  module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopy-iiif/app",
3
- "version": "0.12.7",
3
+ "version": "0.12.8",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Mat Jordan <mat@northwestern.edu>",
@@ -1,74 +1,74 @@
1
1
  /* canopy-theme */
2
2
  @layer properties {
3
3
  :root {
4
- --color-accent-50: #fdfdfe;
5
- --color-accent-100: #edf2fe;
6
- --color-accent-200: #e1e9ff;
7
- --color-accent-300: #c1d0ff;
8
- --color-accent-400: #abbdf9;
9
- --color-accent-500: #8da4ef;
10
- --color-accent-600: #3e63dd;
11
- --color-accent-700: #3358d4;
12
- --color-accent-800: #3a5bc7;
13
- --color-accent-900: #172245;
14
- --color-accent-default: #3358d4;
15
- --color-gray-50: #fcfcfd;
16
- --color-gray-100: #f0f0f3;
17
- --color-gray-200: #e8e8ec;
18
- --color-gray-300: #d9d9e0;
19
- --color-gray-400: #cdced6;
20
- --color-gray-500: #b9bbc6;
21
- --color-gray-600: #8b8d98;
22
- --color-gray-700: #80838d;
23
- --color-gray-800: #60646c;
24
- --color-gray-900: #111316;
25
- --color-gray-default: #111316;
26
- --color-gray-muted: #8b8d98;
27
- --colors-accent: #3358d4 !important;
28
- --colors-accentAlt: #3a5bc7 !important;
29
- --colors-accentMuted: #abbdf9 !important;
30
- --colors-primary: #111316 !important;
31
- --colors-primaryAlt: #111316 !important;
32
- --colors-primaryMuted: #111316 !important;
33
- --colors-secondary: #fcfcfd !important;
34
- --colors-secondaryAlt: #fcfcfd !important;
35
- --colors-secondaryMuted: #fcfcfd !important;
36
- color-scheme: light;
4
+ --color-accent-50: #141110;
5
+ --color-accent-100: #262220;
6
+ --color-accent-200: #302a27;
7
+ --color-accent-300: #493e3a;
8
+ --color-accent-400: #5a4c47;
9
+ --color-accent-500: #6f5f58;
10
+ --color-accent-600: #a18072;
11
+ --color-accent-700: #ae8c7e;
12
+ --color-accent-800: #d4b3a5;
13
+ --color-accent-900: #f2e8e3;
14
+ --color-accent-default: #ae8c7e;
15
+ --color-gray-50: #111110;
16
+ --color-gray-100: #222221;
17
+ --color-gray-200: #2a2a28;
18
+ --color-gray-300: #3b3a37;
19
+ --color-gray-400: #494844;
20
+ --color-gray-500: #62605b;
21
+ --color-gray-600: #6f6d66;
22
+ --color-gray-700: #7c7b74;
23
+ --color-gray-800: #b5b3ad;
24
+ --color-gray-900: #f5f5f4;
25
+ --color-gray-default: #f5f5f4;
26
+ --color-gray-muted: #6f6d66;
27
+ --colors-accent: #ae8c7e !important;
28
+ --colors-accentAlt: #d4b3a5 !important;
29
+ --colors-accentMuted: #5a4c47 !important;
30
+ --colors-primary: #f5f5f4 !important;
31
+ --colors-primaryAlt: #f5f5f4 !important;
32
+ --colors-primaryMuted: #f5f5f4 !important;
33
+ --colors-secondary: #111110 !important;
34
+ --colors-secondaryAlt: #111110 !important;
35
+ --colors-secondaryMuted: #111110 !important;
36
+ color-scheme: dark;
37
37
  }
38
38
  :host {
39
- --color-accent-50: #fdfdfe;
40
- --color-accent-100: #edf2fe;
41
- --color-accent-200: #e1e9ff;
42
- --color-accent-300: #c1d0ff;
43
- --color-accent-400: #abbdf9;
44
- --color-accent-500: #8da4ef;
45
- --color-accent-600: #3e63dd;
46
- --color-accent-700: #3358d4;
47
- --color-accent-800: #3a5bc7;
48
- --color-accent-900: #172245;
49
- --color-accent-default: #3358d4;
50
- --color-gray-50: #fcfcfd;
51
- --color-gray-100: #f0f0f3;
52
- --color-gray-200: #e8e8ec;
53
- --color-gray-300: #d9d9e0;
54
- --color-gray-400: #cdced6;
55
- --color-gray-500: #b9bbc6;
56
- --color-gray-600: #8b8d98;
57
- --color-gray-700: #80838d;
58
- --color-gray-800: #60646c;
59
- --color-gray-900: #111316;
60
- --color-gray-default: #111316;
61
- --color-gray-muted: #8b8d98;
62
- --colors-accent: #3358d4 !important;
63
- --colors-accentAlt: #3a5bc7 !important;
64
- --colors-accentMuted: #abbdf9 !important;
65
- --colors-primary: #111316 !important;
66
- --colors-primaryAlt: #111316 !important;
67
- --colors-primaryMuted: #111316 !important;
68
- --colors-secondary: #fcfcfd !important;
69
- --colors-secondaryAlt: #fcfcfd !important;
70
- --colors-secondaryMuted: #fcfcfd !important;
71
- color-scheme: light;
39
+ --color-accent-50: #141110;
40
+ --color-accent-100: #262220;
41
+ --color-accent-200: #302a27;
42
+ --color-accent-300: #493e3a;
43
+ --color-accent-400: #5a4c47;
44
+ --color-accent-500: #6f5f58;
45
+ --color-accent-600: #a18072;
46
+ --color-accent-700: #ae8c7e;
47
+ --color-accent-800: #d4b3a5;
48
+ --color-accent-900: #f2e8e3;
49
+ --color-accent-default: #ae8c7e;
50
+ --color-gray-50: #111110;
51
+ --color-gray-100: #222221;
52
+ --color-gray-200: #2a2a28;
53
+ --color-gray-300: #3b3a37;
54
+ --color-gray-400: #494844;
55
+ --color-gray-500: #62605b;
56
+ --color-gray-600: #6f6d66;
57
+ --color-gray-700: #7c7b74;
58
+ --color-gray-800: #b5b3ad;
59
+ --color-gray-900: #f5f5f4;
60
+ --color-gray-default: #f5f5f4;
61
+ --color-gray-muted: #6f6d66;
62
+ --colors-accent: #ae8c7e !important;
63
+ --colors-accentAlt: #d4b3a5 !important;
64
+ --colors-accentMuted: #5a4c47 !important;
65
+ --colors-primary: #f5f5f4 !important;
66
+ --colors-primaryAlt: #f5f5f4 !important;
67
+ --colors-primaryMuted: #f5f5f4 !important;
68
+ --colors-secondary: #111110 !important;
69
+ --colors-secondaryAlt: #111110 !important;
70
+ --colors-secondaryMuted: #111110 !important;
71
+ color-scheme: dark;
72
72
  }
73
73
  }
74
74
  /* canopy-theme:end */