@digipair/skill-common 0.75.8 → 0.75.9

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/index.cjs.js CHANGED
@@ -61,8 +61,12 @@ let CommonService = class CommonService {
61
61
  var _context_privates_EDITOR_PATH;
62
62
  const path = (_context_privates_EDITOR_PATH = (_context_privates = context.privates) == null ? void 0 : _context_privates.EDITOR_PATH) != null ? _context_privates_EDITOR_PATH : process.env['DIGIPAIR_FACTORY_PATH'] ? `${process.env['DIGIPAIR_FACTORY_PATH']}/digipairs` : './factory/digipairs';
63
63
  const { digipair } = params;
64
- const text = await fs.promises.readFile(`${path}/${digipair}/schema.json`, 'utf8');
65
- const content = JSON.parse(text);
64
+ let content = {};
65
+ // check if schema.json exists
66
+ if (fs.existsSync(`${path}/${digipair}/schema.json`)) {
67
+ const text = await fs.promises.readFile(`${path}/${digipair}/schema.json`, 'utf8');
68
+ content = JSON.parse(text);
69
+ }
66
70
  const files = await fs.promises.readdir(`${path}/${digipair}`);
67
71
  const actions = (await Promise.all(files.map((file)=>{
68
72
  var _exec;
package/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { promises } from 'fs';
1
+ import { promises, existsSync } from 'fs';
2
2
 
3
3
  function _extends() {
4
4
  _extends = Object.assign || function assign(target) {
@@ -57,8 +57,12 @@ let CommonService = class CommonService {
57
57
  var _context_privates_EDITOR_PATH;
58
58
  const path = (_context_privates_EDITOR_PATH = (_context_privates = context.privates) == null ? void 0 : _context_privates.EDITOR_PATH) != null ? _context_privates_EDITOR_PATH : process.env['DIGIPAIR_FACTORY_PATH'] ? `${process.env['DIGIPAIR_FACTORY_PATH']}/digipairs` : './factory/digipairs';
59
59
  const { digipair } = params;
60
- const text = await promises.readFile(`${path}/${digipair}/schema.json`, 'utf8');
61
- const content = JSON.parse(text);
60
+ let content = {};
61
+ // check if schema.json exists
62
+ if (existsSync(`${path}/${digipair}/schema.json`)) {
63
+ const text = await promises.readFile(`${path}/${digipair}/schema.json`, 'utf8');
64
+ content = JSON.parse(text);
65
+ }
62
66
  const files = await promises.readdir(`${path}/${digipair}`);
63
67
  const actions = (await Promise.all(files.map((file)=>{
64
68
  var _exec;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-common",
3
- "version": "0.75.8",
3
+ "version": "0.75.9",
4
4
  "keywords": [
5
5
  "digipair",
6
6
  "service",