@kausal/themes 0.1.1 → 0.3.2

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.
@@ -13,11 +13,13 @@
13
13
  "imageOverlay": "rgb(16, 114, 81)",
14
14
  "fontUrl": "/static/themes/default/fonts/fonts.css",
15
15
  "fontFamily": "Inter",
16
- "headingsFontFamily": "Inter",
16
+ "fontFamilyHeadings": "Inter",
17
+ "fontFamilyContent": "Inter",
18
+ "fontFamilyTiny": "'-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif",
17
19
  "headingsFontWeight": 700,
18
20
  "headingsColor": "rgb(26, 24, 23)",
19
21
  "fontFamilyFallback": "'-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif",
20
- "headingsFontFamilyFallback": "'-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif",
22
+ "fontFamilyFallbackHeadings": "'-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif",
21
23
  "fontSizeSm": "0.75rem",
22
24
  "fontSizeBase": "1rem",
23
25
  "fontSizeMd": "1.25rem",
@@ -109,11 +111,18 @@
109
111
  "iconActionsUrl": "",
110
112
  "themeCustomStylesUrl": "",
111
113
  "graphColors": {
114
+ "grey000": "rgb(248, 248, 248)",
115
+ "grey005": "rgb(243, 243, 243)",
112
116
  "grey010": "rgb(238, 238, 238)",
117
+ "grey020": "rgb(217, 217, 217)",
113
118
  "grey030": "rgb(199, 199, 199)",
119
+ "grey040": "rgb(183, 183, 183)",
114
120
  "grey050": "rgb(160, 160, 160)",
121
+ "grey060": "rgb(123, 123, 123)",
115
122
  "grey070": "rgb(99, 99, 99)",
123
+ "grey080": "rgb(75, 75, 75)",
116
124
  "grey090": "rgb(63, 63, 63)",
125
+ "grey100": "rgb(29, 29, 29)",
117
126
  "green010": "rgb(167, 235, 192)",
118
127
  "green030": "rgb(86, 195, 142)",
119
128
  "green050": "rgb(39, 154, 109)",
package/index.js CHANGED
@@ -2,17 +2,39 @@ const fs = require('fs');
2
2
  const path = require('path');
3
3
 
4
4
 
5
- function generateThemeSymlinks(destPath) {
5
+ function generateThemeSymlinks(destPath, opts) {
6
+ const { verbose } = opts || {};
7
+
8
+ if (verbose) {
9
+ const packageData = require('./package.json');
10
+ console.log(`🔗 Generating symlinks for themes (${packageData.name} v${packageData.version})`);
11
+ }
6
12
  if (!fs.existsSync(destPath)) {
7
13
  fs.mkdirSync(destPath, { recursive: true });
8
14
  }
15
+ const themesFile = path.join(__dirname, 'themes.json');
16
+ if (!fs.existsSync(themesFile)) {
17
+ if (verbose) {
18
+ console.log(`No theme list file found, doing nothing`);
19
+ }
20
+ return;
21
+ }
9
22
 
10
- const themes = JSON.parse(fs.readFileSync(path.join(__dirname, 'themes.json')));
23
+ const themes = JSON.parse(fs.readFileSync(themesFile));
11
24
  for (const theme of themes) {
12
25
  const symlinkPath = path.join(destPath, theme);
13
26
  const themePath = path.join(__dirname, 'dist', 'themes', theme)
14
- if (fs.existsSync(symlinkPath)) {
15
- continue;
27
+ if (fs.lstatSync(symlinkPath, { throwIfNoEntry: false })) {
28
+ const existingTarget = fs.readlinkSync(symlinkPath);
29
+ if (existingTarget !== themePath) {
30
+ console.log(`Removing existing symlink ${symlinkPath}`);
31
+ fs.unlinkSync(symlinkPath);
32
+ } else {
33
+ if (verbose) {
34
+ console.log(`${symlinkPath} already exists, not linking`);
35
+ }
36
+ continue;
37
+ }
16
38
  }
17
39
  console.log(`🔗 Linking ${themePath} → ${symlinkPath}`);
18
40
  fs.symlinkSync(themePath, symlinkPath);
@@ -20,14 +42,15 @@ function generateThemeSymlinks(destPath) {
20
42
  }
21
43
 
22
44
  class SymlinkThemesPlugin {
23
- constructor(destPath) {
45
+ constructor(destPath, opts) {
46
+ this.opts = opts || {};
24
47
  this.destPath = destPath;
25
48
  }
26
49
  apply(compiler) {
27
50
  compiler.hooks.beforeRun.tap(
28
51
  'Symlink Themes Plugin',
29
52
  (stats) => {
30
- generateThemeSymlinks(this.destPath)
53
+ generateThemeSymlinks(this.destPath, this.opts);
31
54
  }
32
55
  );
33
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kausal/themes",
3
- "version": "0.1.1",
3
+ "version": "0.3.2",
4
4
  "description": "Themes for Kausal products",
5
5
  "main": "index.js",
6
6
  "author": "Tero Tikkanen <tero.tikkanen@kausal.tech>",