From 3361099729e1baed7277c4710e25ff06f342c5c5 Mon Sep 17 00:00:00 2001 From: ssube Date: Mon, 29 Jun 2020 18:56:08 -0500 Subject: [PATCH] fix(test): remove problematic invocation of main from index --- config/rollup.js | 7 ++++++- docs/api/js-yaml-schema.includeschema.md | 2 ++ docs/api/js-yaml-schema.md | 2 +- src/index.ts | 13 ------------- src/type/Include.ts | 4 +++- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/config/rollup.js b/config/rollup.js index ea4e4b1..a79a1b5 100644 --- a/config/rollup.js +++ b/config/rollup.js @@ -3,7 +3,6 @@ import commonjs from 'rollup-plugin-commonjs'; import { eslint } from 'rollup-plugin-eslint'; import json from 'rollup-plugin-json'; import multiEntry from 'rollup-plugin-multi-entry'; -import builtins from 'rollup-plugin-node-builtins'; import globals from 'rollup-plugin-node-globals'; import resolve from 'rollup-plugin-node-resolve'; import replace from 'rollup-plugin-replace'; @@ -43,6 +42,10 @@ const bundle = { return 'vendor'; } + if (id.includes(process.env['HOME'])) { + return 'linked'; + } + /* if (id.includes(`chai`) || id.includes(`sinon`)) { return 'test'; } */ @@ -73,7 +76,9 @@ const bundle = { dir: targetPath, chunkFileNames: '[name].js', entryFileNames: 'entry-[name].js', + exports: 'named', format: 'module', + minifyInternalExports: false, sourcemap: true, }, plugins: [ diff --git a/docs/api/js-yaml-schema.includeschema.md b/docs/api/js-yaml-schema.includeschema.md index 72f32bd..dbb4865 100644 --- a/docs/api/js-yaml-schema.includeschema.md +++ b/docs/api/js-yaml-schema.includeschema.md @@ -4,6 +4,8 @@ ## includeSchema variable +The schema to be used for included files. This is necessary to work around circular dependency errors. + Signature: ```typescript diff --git a/docs/api/js-yaml-schema.md b/docs/api/js-yaml-schema.md index 02a7e14..f92e18f 100644 --- a/docs/api/js-yaml-schema.md +++ b/docs/api/js-yaml-schema.md @@ -10,7 +10,7 @@ | --- | --- | | [CONFIG\_SCHEMA](./js-yaml-schema.config_schema.md) | | | [envType](./js-yaml-schema.envtype.md) | | -| [includeSchema](./js-yaml-schema.includeschema.md) | | +| [includeSchema](./js-yaml-schema.includeschema.md) | The schema to be used for included files. This is necessary to work around circular dependency errors. | | [includeType](./js-yaml-schema.includetype.md) | | | [regexpType](./js-yaml-schema.regexptype.md) | | | [streamType](./js-yaml-schema.streamtype.md) | | diff --git a/src/index.ts b/src/index.ts index cc9573a..921eefe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,18 +1,5 @@ -import { main } from './app'; - export { CONFIG_SCHEMA } from './schema'; export { envType } from './type/Env'; export { includeSchema, includeType } from './type/Include'; export { regexpType } from './type/Regexp'; export { streamType } from './type/Stream'; - -const STATUS_ERROR = 1; - -/** - * This is the main entry-point to the program and the only file not included in the main bundle. - */ -main(process.argv).then((status) => process.exit(status)).catch((err: Error) => { - // eslint-disable-next-line no-console - console.error('uncaught error during main:', err); - process.exit(STATUS_ERROR); -}); diff --git a/src/type/Include.ts b/src/type/Include.ts index 3d3e12c..4b1a6ad 100644 --- a/src/type/Include.ts +++ b/src/type/Include.ts @@ -3,7 +3,9 @@ import { existsSync, readFileSync, realpathSync } from 'fs'; import { SAFE_SCHEMA, safeLoad, Type as YamlType } from 'js-yaml'; import { join } from 'path'; -// work around the circular dependency by setting the schema later +/** + * The schema to be used for included files. This is necessary to work around circular dependency errors. + */ export const includeSchema = { schema: SAFE_SCHEMA, };