@eik/common 4.0.0-next.6 → 4.0.0

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.
Files changed (123) hide show
  1. package/CHANGELOG.md +108 -3
  2. package/README.md +9 -5
  3. package/eikjson.d.ts +1 -1
  4. package/{packages/config-loader/src/errors → lib/classes}/custom-error.js +1 -3
  5. package/{packages/config-loader/src → lib/classes}/eik-config.js +19 -17
  6. package/{packages/config-loader/src → lib}/classes/file-mapping.js +4 -6
  7. package/{packages/config-loader/src/errors → lib/classes}/invalid-config-error.js +2 -4
  8. package/{packages/config-loader/src → lib}/classes/local-file-location.js +5 -4
  9. package/{packages/config-loader/src/errors → lib/classes}/missing-config-error.js +2 -4
  10. package/{packages/config-loader/src/errors → lib/classes}/multiple-config-sources-error.js +2 -4
  11. package/{packages/config-loader/src/errors → lib/classes}/no-files-matched-error.js +2 -4
  12. package/{packages/config-loader/src → lib}/classes/read-file.js +4 -3
  13. package/{packages/config-loader/src → lib}/classes/remote-file-location.js +3 -3
  14. package/{packages/config-loader/src → lib}/classes/resolved-files.js +5 -6
  15. package/{packages/config-loader/src/errors → lib/classes}/single-dest-multiple-source-error.js +2 -4
  16. package/{packages/config-loader/src → lib/helpers}/config-store.js +39 -8
  17. package/lib/helpers/get-defaults.js +38 -0
  18. package/lib/helpers/index.js +25 -0
  19. package/{packages/config-loader/src → lib/helpers}/local-assets.js +9 -7
  20. package/{packages/utils/src → lib/helpers}/path-slashes.js +1 -1
  21. package/{packages/config-loader/src/utils → lib/helpers}/resolve-files.js +7 -11
  22. package/{packages/utils/src → lib/helpers}/type-slug.js +4 -1
  23. package/{packages/utils/src → lib/helpers}/type-title.js +4 -1
  24. package/lib/index.js +16 -0
  25. package/{packages/schemas/src → lib/schemas}/assert.js +6 -6
  26. package/lib/schemas/index.js +15 -0
  27. package/{packages/schemas/src → lib/schemas}/validate.js +18 -17
  28. package/{packages/schemas/src → lib/schemas}/validation-error.js +2 -2
  29. package/lib/stream.js +12 -0
  30. package/lib/validators/index.js +65 -0
  31. package/package.json +63 -6
  32. package/types/classes/custom-error.d.ts +6 -0
  33. package/types/classes/eik-config.d.ts +63 -0
  34. package/types/classes/file-mapping.d.ts +21 -0
  35. package/types/classes/invalid-config-error.d.ts +3 -0
  36. package/types/classes/local-file-location.d.ts +36 -0
  37. package/types/classes/missing-config-error.d.ts +3 -0
  38. package/types/classes/multiple-config-sources-error.d.ts +4 -0
  39. package/types/classes/no-files-matched-error.d.ts +3 -0
  40. package/types/classes/read-file.d.ts +15 -0
  41. package/types/classes/remote-file-location.d.ts +21 -0
  42. package/types/classes/resolved-files.d.ts +20 -0
  43. package/types/classes/single-dest-multiple-source-error.d.ts +3 -0
  44. package/types/helpers/config-store.d.ts +28 -0
  45. package/types/helpers/get-defaults.d.ts +9 -0
  46. package/types/helpers/index.d.ts +23 -0
  47. package/types/helpers/local-assets.d.ts +8 -0
  48. package/types/helpers/path-slashes.d.ts +32 -0
  49. package/types/helpers/resolve-files.d.ts +13 -0
  50. package/types/helpers/type-slug.d.ts +2 -0
  51. package/types/helpers/type-title.d.ts +2 -0
  52. package/types/index.d.ts +16 -0
  53. package/types/schemas/assert.d.ts +11 -0
  54. package/types/schemas/index.d.ts +11 -0
  55. package/types/schemas/validate.d.ts +26 -0
  56. package/types/schemas/validation-error.d.ts +8 -0
  57. package/types/stream.d.ts +2 -0
  58. package/types/validators/index.d.ts +8 -0
  59. package/.eslintignore +0 -2
  60. package/.eslintrc +0 -34
  61. package/.github/workflows/publish.yml +0 -69
  62. package/.github/workflows/test.yml +0 -45
  63. package/.prettierignore +0 -17
  64. package/.prettierrc +0 -20
  65. package/fixtures/client-with-bare-imports.js +0 -16
  66. package/fixtures/client.js +0 -6
  67. package/fixtures/client.js.map +0 -0
  68. package/fixtures/folder/client.js +0 -6
  69. package/fixtures/folder/styles.css +0 -0
  70. package/fixtures/icons/checkbox-sprite.svg +0 -46
  71. package/fixtures/nested/client.js.map +0 -0
  72. package/fixtures/nested/styles.css.map +0 -0
  73. package/fixtures/styles.css +0 -0
  74. package/fixtures/styles.css.map +0 -0
  75. package/packages/config-loader/.prettierignore +0 -17
  76. package/packages/config-loader/index.js +0 -13
  77. package/packages/config-loader/package.json +0 -42
  78. package/packages/config-loader/src/get-defaults.js +0 -25
  79. package/packages/config-loader/test/assets/esm.css +0 -0
  80. package/packages/config-loader/test/assets/esm.css.map +0 -0
  81. package/packages/config-loader/test/assets/esm.js +0 -0
  82. package/packages/config-loader/test/assets/esm.js.map +0 -0
  83. package/packages/config-loader/test/config-store.test.js +0 -231
  84. package/packages/config-loader/test/eik-config/cwd.test.js +0 -35
  85. package/packages/config-loader/test/eik-config/map.test.js +0 -31
  86. package/packages/config-loader/test/eik-config/mappings.test.js +0 -507
  87. package/packages/config-loader/test/eik-config/out.test.js +0 -54
  88. package/packages/config-loader/test/eik-config/server.test.js +0 -32
  89. package/packages/config-loader/test/eik-config/toJSON.test.js +0 -19
  90. package/packages/config-loader/test/eik-config/token.test.js +0 -49
  91. package/packages/config-loader/test/eik-config/type.test.js +0 -22
  92. package/packages/config-loader/test/eik-config/validate.test.js +0 -31
  93. package/packages/config-loader/test/eik-config/version.test.js +0 -22
  94. package/packages/config-loader/test/eik.json +0 -10
  95. package/packages/config-loader/test/local-assets.test.js +0 -125
  96. package/packages/config-loader/test/local-file-location/absolute.test.js +0 -35
  97. package/packages/config-loader/test/local-file-location/contentType.test.js +0 -55
  98. package/packages/config-loader/test/local-file-location/extension.test.js +0 -20
  99. package/packages/config-loader/test/local-file-location/mimeType.test.js +0 -43
  100. package/packages/config-loader/test/read-file.test.js +0 -60
  101. package/packages/config-loader/test/resolve-files.test.js +0 -257
  102. package/packages/config-loader/test/resolved-files/iterator.test.js +0 -17
  103. package/packages/config-loader/test/tmp/.gitkeep +0 -0
  104. package/packages/schemas/.prettierignore +0 -17
  105. package/packages/schemas/eikjson.d.ts +0 -41
  106. package/packages/schemas/index.js +0 -7
  107. package/packages/schemas/package.json +0 -40
  108. package/packages/schemas/test/assert.js +0 -207
  109. package/packages/schemas/test/index.js +0 -182
  110. package/packages/utils/.prettierignore +0 -17
  111. package/packages/utils/index.js +0 -20
  112. package/packages/utils/package.json +0 -29
  113. package/packages/utils/src/stream.js +0 -21
  114. package/packages/utils/tests/eik.json +0 -10
  115. package/packages/validators/.prettierignore +0 -17
  116. package/packages/validators/package.json +0 -34
  117. package/packages/validators/src/index.js +0 -53
  118. package/packages/validators/test/index.js +0 -238
  119. package/release/eik-common-4.0.0-next.6.tgz +0 -0
  120. package/release.config.js +0 -27
  121. package/renovate.json +0 -6
  122. package/tsconfig.json +0 -30
  123. /package/{packages/schemas/src → lib/schemas}/eikjson.schema.json +0 -0
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Add a trailing slash to a path if necessary
3
+ *
4
+ * @param {string} val
5
+ *
6
+ * @returns {string}
7
+ */
8
+ export function addTrailingSlash(val: string): string;
9
+ /**
10
+ * Remove a trailing slash from a path if necessary
11
+ *
12
+ * @param {string} val
13
+ *
14
+ * @returns {string}
15
+ */
16
+ export function removeTrailingSlash(val: string): string;
17
+ /**
18
+ * Add a leading slash to a path if necessary
19
+ *
20
+ * @param {string} val
21
+ *
22
+ * @returns {string}
23
+ */
24
+ export function addLeadingSlash(val: string): string;
25
+ /**
26
+ * Remove a leading slash from a path if necessary
27
+ *
28
+ * @param {string} val
29
+ *
30
+ * @returns {string}
31
+ */
32
+ export function removeLeadingSlash(val: string): string;
@@ -0,0 +1,13 @@
1
+ export default resolveFiles;
2
+ /**
3
+ * Uses an Eik JSON "files" definition to resolve files on disk into a data structure
4
+ *
5
+ * @param {{[k: string]: string;}} files
6
+ * @param {string} cwd
7
+ *
8
+ * @returns {Promise<ResolvedFiles[]>}
9
+ */
10
+ declare function resolveFiles(files: {
11
+ [k: string]: string;
12
+ }, cwd: string): Promise<ResolvedFiles[]>;
13
+ import ResolvedFiles from '../classes/resolved-files.js';
@@ -0,0 +1,2 @@
1
+ declare const _default: (type: string) => string;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: (type: string) => string;
2
+ export default _default;
@@ -0,0 +1,16 @@
1
+ declare namespace _default {
2
+ export { validators };
3
+ export { ReadFile };
4
+ export { EikConfig };
5
+ export { schemas };
6
+ export { stream };
7
+ export { helpers };
8
+ }
9
+ export default _default;
10
+ import * as validators from './validators/index.js';
11
+ import ReadFile from './classes/read-file.js';
12
+ import EikConfig from './classes/eik-config.js';
13
+ import schemas from './schemas/index.js';
14
+ import * as stream from './stream.js';
15
+ import helpers from './helpers/index.js';
16
+ export { validators, ReadFile, EikConfig, schemas, stream, helpers };
@@ -0,0 +1,11 @@
1
+ declare namespace _default {
2
+ function eikJSON(value: any): void;
3
+ function name(value: any): void;
4
+ function type(value: any): void;
5
+ function version(value: any): void;
6
+ function server(value: any): void;
7
+ function files(value: any): void;
8
+ function importMap(value: any): void;
9
+ function out(value: any): void;
10
+ }
11
+ export default _default;
@@ -0,0 +1,11 @@
1
+ declare namespace _default {
2
+ export { schema };
3
+ export { validate };
4
+ export { assert };
5
+ export { ValidationError };
6
+ }
7
+ export default _default;
8
+ declare const schema: any;
9
+ import * as validate from './validate.js';
10
+ import assert from './assert.js';
11
+ import ValidationError from './validation-error.js';
@@ -0,0 +1,26 @@
1
+ export function eikJSON(data: any): {
2
+ value: any;
3
+ error: false | import("ajv").ErrorObject<string, Record<string, any>, unknown>[] | null | undefined;
4
+ };
5
+ export function name(value: any): any;
6
+ export function version(value: any): any;
7
+ export function type(data: any): {
8
+ value: any;
9
+ error: false | import("ajv").ErrorObject<string, Record<string, any>, unknown>[] | null | undefined;
10
+ };
11
+ export function server(data: any): {
12
+ value: any;
13
+ error: false | import("ajv").ErrorObject<string, Record<string, any>, unknown>[] | null | undefined;
14
+ };
15
+ export function files(data: any): {
16
+ value: any;
17
+ error: false | import("ajv").ErrorObject<string, Record<string, any>, unknown>[] | null | undefined;
18
+ };
19
+ export function importMap(data: any): {
20
+ value: any;
21
+ error: false | import("ajv").ErrorObject<string, Record<string, any>, unknown>[] | null | undefined;
22
+ };
23
+ export function out(data: any): {
24
+ value: any;
25
+ error: false | import("ajv").ErrorObject<string, Record<string, any>, unknown>[] | null | undefined;
26
+ };
@@ -0,0 +1,8 @@
1
+ export default ValidationError;
2
+ declare class ValidationError extends Error {
3
+ /**
4
+ * @param {string} message
5
+ * @param {Error} err
6
+ */
7
+ constructor(message: string, err: Error);
8
+ }
@@ -0,0 +1,2 @@
1
+ export function isStream(stream: any): boolean;
2
+ export function isReadableStream(stream: any): boolean;
@@ -0,0 +1,8 @@
1
+ export function origin(value: any): any;
2
+ export function org(value: any): any;
3
+ export function name(value: any): any;
4
+ export function version(value: any): string;
5
+ export function alias(value: any): any;
6
+ export function type(value: any): any;
7
+ export function extra(value: any): any;
8
+ export function semverType(value: any): any;
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- coverage
2
- types
package/.eslintrc DELETED
@@ -1,34 +0,0 @@
1
- {
2
- "parser": "@babel/eslint-parser",
3
- "extends": [
4
- "airbnb-base",
5
- "prettier"
6
- ],
7
- "plugins": [
8
- "prettier"
9
- ],
10
- "parserOptions": {
11
- "ecmaVersion": 11,
12
- "sourceType": "module",
13
- "requireConfigFile": false
14
- },
15
- "rules": {
16
- "import/prefer-default-export": "off",
17
- "import/extensions": [
18
- "error",
19
- {
20
- "js": "ignorePackages",
21
- "json": "ignorePackages"
22
- }
23
- ],
24
- "class-methods-use-this": [
25
- 0
26
- ],
27
- "no-underscore-dangle": [
28
- 0
29
- ],
30
- "no-restricted-syntax": [
31
- 0
32
- ]
33
- }
34
- }
@@ -1,69 +0,0 @@
1
- name: Release and Publish
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
- - alpha
8
- - beta
9
- - next
10
-
11
- jobs:
12
- test:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - name: Checkout
16
- uses: actions/checkout@v3
17
- - name: Setup Node.js
18
- uses: actions/setup-node@v3
19
- with:
20
- node-version: 16.x
21
- - name: install dependencies
22
- run: |
23
- npm install --workspaces
24
- env:
25
- CI: true
26
- - name: lint files
27
- run: |
28
- npm run lint --workspaces
29
- env:
30
- CI: true
31
- - name: style check files
32
- run: |
33
- npm run style:check --workspaces
34
- env:
35
- CI: true
36
- - name: typecheck files
37
- run: |
38
- npm run typecheck --workspaces
39
- env:
40
- CI: true
41
- - name: check eik json schema is up to date
42
- run: |
43
- npm run schema:outdated --workspaces
44
- env:
45
- CI: true
46
- - name: run tests
47
- run: |
48
- npm test --workspaces
49
-
50
- release:
51
- name: Release
52
- runs-on: ubuntu-latest
53
- needs: [test]
54
- steps:
55
- - name: Checkout
56
- uses: actions/checkout@v3
57
- - name: Setup Node.js
58
- uses: actions/setup-node@v3
59
- with:
60
- node-version: 16.x
61
- - name: npm install
62
- run: |
63
- npm install --workspaces
64
- - name: npx semantic-release
65
- run: |
66
- npx semantic-release
67
- env:
68
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,45 +0,0 @@
1
- name: Run Lint and Tests
2
-
3
- on: push
4
-
5
- jobs:
6
- build:
7
- runs-on: ubuntu-latest
8
- strategy:
9
- matrix:
10
- os: [ubuntu-latest, macOS-latest, windows-latest]
11
- node-version: [16.x, 18.x]
12
- steps:
13
- - uses: actions/checkout@v3
14
- - name: Use Node.js ${{ matrix.node-version }}
15
- uses: actions/setup-node@v3
16
- with:
17
- node-version: ${{ matrix.node-version }}
18
- - name: install dependencies
19
- run: |
20
- npm install --workspaces
21
- env:
22
- CI: true
23
- - name: lint files
24
- run: |
25
- npm run lint --workspaces
26
- env:
27
- CI: true
28
- - name: style check files
29
- run: |
30
- npm run style:check --workspaces
31
- env:
32
- CI: true
33
- - name: typecheck files
34
- run: |
35
- npm run typecheck --workspaces
36
- env:
37
- CI: true
38
- - name: check eik json schema is up to date
39
- run: |
40
- npm run schema:outdated --workspace=packages/schemas
41
- env:
42
- CI: true
43
- - name: run tests
44
- run: |
45
- npm test --workspaces
package/.prettierignore DELETED
@@ -1,17 +0,0 @@
1
- node_modules/**/*
2
- .nyc_output/**/*
3
- package-lock.json
4
- node_modules/**/*
5
- .DS_Store
6
- tmp/**/*
7
- .idea
8
- .idea/**/*
9
- *.iml
10
- *.log
11
- coverage
12
- .vscode
13
- eikjson.d.ts
14
- CHANGELOG.md
15
- dist
16
- types
17
- renovate.json
package/.prettierrc DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "trailingComma": "all",
4
- "tabWidth": 4,
5
- "overrides": [
6
- {
7
- "files": [
8
- ".prettierrc",
9
- "*.json",
10
- "*.yml",
11
- ".travis.yml",
12
- ".eslintrc",
13
- "release.config.js"
14
- ],
15
- "options": {
16
- "tabWidth": 2
17
- }
18
- }
19
- ]
20
- }
@@ -1,16 +0,0 @@
1
- /* eslint-disable import/no-unresolved */
2
-
3
- import scrollIntoView from 'scroll-into-view-if-needed';
4
-
5
- const main = () => {
6
- // eslint-disable-next-line no-undef
7
- const node = document.getElementById('hero');
8
-
9
- scrollIntoView(node, {
10
- scrollMode: 'if-needed',
11
- block: 'nearest',
12
- inline: 'nearest',
13
- });
14
- };
15
-
16
- main();
@@ -1,6 +0,0 @@
1
- const main = () => {
2
- const thing = 'this is a test fixture';
3
- return thing;
4
- };
5
-
6
- main();
File without changes
@@ -1,6 +0,0 @@
1
- const main = () => {
2
- const thing = 'this is a test fixture';
3
- return thing;
4
- };
5
-
6
- main();
File without changes
@@ -1,46 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="104" height="26">
2
- <defs>
3
- <rect id="checkboxes-a" width="20" height="20" rx="4"/>
4
- <path id="checkboxes-b" d="M4.42 7.6L3 9.03l4.45 4.47 7.05-7.07L13.08 5l-5.63 5.64z"/>
5
- <rect id="checkboxes-d" width="20" height="20" x="3" y="3" rx="4"/>
6
- <rect id="checkboxes-e" width="20" height="20" x="3" y="3" rx="4"/>
7
- <path id="checkboxes-f" d="M4.42 7.6L3 9.03l4.45 4.47 7.05-7.07L13.08 5l-5.63 5.64z"/>
8
- <rect id="checkboxes-h" width="20" height="20" x="3" y="3" rx="4"/>
9
- </defs>
10
- <g fill="none" fill-rule="evenodd">
11
- <g transform="translate(81 3)">
12
- <use fill="#FFF" xlink:href="#checkboxes-a"/>
13
- <rect width="21" height="21" x="-.5" y="-.5" stroke="#DFE4E8" rx="4"/>
14
- <g transform="translate(1 1)">
15
- <path d="M0 0h18v18H0z"/>
16
- <mask id="checkboxes-c" fill="#fff">
17
- <use xlink:href="#checkboxes-b"/>
18
- </mask>
19
- <use fill="#767676" fill-rule="nonzero" xlink:href="#checkboxes-b"/>
20
- <g fill="#DFE4E8" mask="url(#checkboxes-c)">
21
- <rect width="18" height="18" rx="4"/>
22
- </g>
23
- </g>
24
- </g>
25
- <g transform="translate(52)">
26
- <use fill="#FFF" xlink:href="#checkboxes-d"/>
27
- <rect width="21" height="21" x="2.5" y="2.5" stroke="#DFE4E8" rx="4"/>
28
- </g>
29
- <g transform="translate(26)">
30
- <use fill="#FFF" xlink:href="#checkboxes-e"/>
31
- <rect width="21" height="21" x="2.5" y="2.5" stroke="#767676" rx="4"/>
32
- <g transform="translate(4 4)">
33
- <path d="M0 0h18v18H0z"/>
34
- <mask id="checkboxes-g" fill="#fff">
35
- <use xlink:href="#checkboxes-f"/>
36
- </mask>
37
- <use fill="#767676" fill-rule="nonzero" xlink:href="#checkboxes-f"/>
38
- <g fill="#767676" mask="url(#checkboxes-g)">
39
- <rect width="18" height="18" rx="4"/>
40
- </g>
41
- </g>
42
- </g>
43
- <use fill="#FFF" xlink:href="#checkboxes-h"/>
44
- <rect width="21" height="21" x="2.5" y="2.5" stroke="#767676" rx="4"/>
45
- </g>
46
- </svg>
File without changes
File without changes
File without changes
File without changes
@@ -1,17 +0,0 @@
1
- node_modules/**/*
2
- .nyc_output/**/*
3
- package-lock.json
4
- node_modules/**/*
5
- .DS_Store
6
- tmp/**/*
7
- .idea
8
- .idea/**/*
9
- *.iml
10
- *.log
11
- coverage
12
- .vscode
13
- eikjson.d.ts
14
- CHANGELOG.md
15
- dist
16
- types
17
- renovate.json
@@ -1,13 +0,0 @@
1
- const ReadFile = require('./src/classes/read-file.js');
2
- const EikConfig = require('./src/eik-config.js');
3
- const getDefaults = require('./src/get-defaults.js');
4
- const configStore = require('./src/config-store.js');
5
- const localAssets = require('./src/local-assets');
6
-
7
- module.exports = {
8
- ReadFile,
9
- EikConfig,
10
- getDefaults,
11
- configStore,
12
- localAssets,
13
- };
@@ -1,42 +0,0 @@
1
- {
2
- "name": "@eik/common-config-loader",
3
- "version": "1.0.0",
4
- "description": "Shared config loader for Eik packages",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "tap --no-check-coverage",
8
- "test:snapshots:update": "tap --snapshot",
9
- "lint:fix": "eslint --fix .",
10
- "lint": "eslint .",
11
- "style:check": "prettier -c .",
12
- "style:format": "prettier -w .",
13
- "typecheck": "tsc"
14
- },
15
- "license": "ISC",
16
- "dependencies": {
17
- "@eik/common-schemas": "1.0.0",
18
- "@eik/common-utils": "1.0.0",
19
- "glob": "8.0.3",
20
- "is-glob": "4.0.3",
21
- "mime-types": "2.1.35",
22
- "node-fetch": "2.6.6"
23
- },
24
- "devDependencies": {
25
- "@babel/eslint-parser": "7.16.5",
26
- "@hapi/hapi": "20.2.2",
27
- "@semantic-release/changelog": "^6.0.1",
28
- "@semantic-release/git": "^10.0.1",
29
- "@types/node": "18.0.6",
30
- "eslint": "7.32.0",
31
- "eslint-config-airbnb-base": "14.2.1",
32
- "eslint-config-prettier": "8.5.0",
33
- "eslint-plugin-import": "2.26.0",
34
- "eslint-plugin-prettier": "4.2.1",
35
- "express": "4.18.1",
36
- "fastify": "3.29.0",
37
- "prettier": "2.5.1",
38
- "stoppable": "1.1.0",
39
- "tap": "15.2.3",
40
- "typescript": "4.7.4"
41
- }
42
- }
@@ -1,25 +0,0 @@
1
- // @ts-check
2
-
3
- const EikConfig = require('./eik-config.js');
4
- const configStore = require('./config-store.js');
5
-
6
- /**
7
- * Sets up and returns an object containing a set of default values for the app context.
8
- * Default values are fetched from the app's eik.json or package.json file as well as from .eikrc, if present in the users home directory.
9
- *
10
- * @param {string} cwd The current working directory
11
- *
12
- * @returns {import("./eik-config.js")} EikConfig
13
- */
14
- function getDefaults(cwd) {
15
- try {
16
- return configStore.findInDirectory(cwd);
17
- } catch (e) {
18
- if (e.constructor.name === 'MissingConfigError') {
19
- return new EikConfig(null, [], cwd);
20
- }
21
- throw e;
22
- }
23
- }
24
-
25
- module.exports = getDefaults;
File without changes
File without changes
File without changes
File without changes