@opengis/fastify-table 1.2.93 → 1.2.94

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "1.2.93",
3
+ "version": "1.2.94",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [
@@ -1,10 +1,12 @@
1
- import path from 'path';
2
- import fs, { existsSync, readdirSync } from 'fs';
1
+ import path from 'node:path';
2
+ import fs, { existsSync, readdirSync, readFileSync } from 'node:fs';
3
3
 
4
4
  import config from '../../../../config.js';
5
5
 
6
6
  import loadTemplatePath from './loadTemplatePath.js';
7
7
  import userTemplateDir from './userTemplateDir.js';
8
+ import customTokens from './customTokens.js';
9
+ import yml2json from '../../yml/funcs/yml2json.js';
8
10
 
9
11
  const cwd = process.cwd();
10
12
 
@@ -18,8 +20,16 @@ export default function getTemplatePath(type) {
18
20
 
19
21
  const moduleList = [];
20
22
  const moduleDir = path.join(cwd, 'module');
23
+
21
24
  if (fs.existsSync(moduleDir) && !moduleList.length) {
22
- readdirSync(moduleDir).forEach(el => moduleList.push(path.join(moduleDir, el, type)));
25
+ readdirSync(moduleDir).forEach(el => {
26
+ if (existsSync(path.join(cwd, 'module', el, 'tokens.yml'))) {
27
+ const json = yml2json(readFileSync(path.join(cwd, 'module', el, 'tokens.yml')));
28
+ Object.assign(customTokens, { ...json });
29
+ console.log('load user tokens: root', `${cwd}/${el}`);
30
+ }
31
+ moduleList.push(path.join(moduleDir, el, type))
32
+ });
23
33
  }
24
34
 
25
35
  // add user template dir