@eik/common 4.0.0-next.5 → 4.0.0-next.6

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 (120) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc +34 -0
  3. package/.github/workflows/publish.yml +69 -0
  4. package/.github/workflows/test.yml +45 -0
  5. package/.prettierignore +17 -0
  6. package/.prettierrc +20 -0
  7. package/CHANGELOG.md +7 -0
  8. package/fixtures/client-with-bare-imports.js +16 -0
  9. package/fixtures/client.js +6 -0
  10. package/fixtures/client.js.map +0 -0
  11. package/fixtures/folder/client.js +6 -0
  12. package/fixtures/folder/styles.css +0 -0
  13. package/fixtures/icons/checkbox-sprite.svg +46 -0
  14. package/fixtures/nested/client.js.map +0 -0
  15. package/fixtures/nested/styles.css.map +0 -0
  16. package/fixtures/styles.css +0 -0
  17. package/fixtures/styles.css.map +0 -0
  18. package/package.json +6 -60
  19. package/packages/config-loader/.prettierignore +17 -0
  20. package/packages/config-loader/index.js +13 -0
  21. package/packages/config-loader/package.json +42 -0
  22. package/{lib → packages/config-loader/src}/classes/file-mapping.js +2 -2
  23. package/{lib → packages/config-loader/src}/classes/local-file-location.js +0 -0
  24. package/{lib → packages/config-loader/src}/classes/read-file.js +2 -1
  25. package/{lib → packages/config-loader/src}/classes/remote-file-location.js +0 -0
  26. package/{lib → packages/config-loader/src}/classes/resolved-files.js +3 -2
  27. package/{lib/helpers → packages/config-loader/src}/config-store.js +4 -4
  28. package/{lib/classes → packages/config-loader/src}/eik-config.js +14 -10
  29. package/{lib/classes → packages/config-loader/src/errors}/custom-error.js +4 -2
  30. package/{lib/classes → packages/config-loader/src/errors}/invalid-config-error.js +4 -2
  31. package/{lib/classes → packages/config-loader/src/errors}/missing-config-error.js +4 -2
  32. package/{lib/classes → packages/config-loader/src/errors}/multiple-config-sources-error.js +4 -2
  33. package/{lib/classes → packages/config-loader/src/errors}/no-files-matched-error.js +5 -3
  34. package/{lib/classes → packages/config-loader/src/errors}/single-dest-multiple-source-error.js +4 -2
  35. package/{lib/helpers → packages/config-loader/src}/get-defaults.js +7 -6
  36. package/{lib/helpers → packages/config-loader/src}/local-assets.js +2 -1
  37. package/{lib/helpers → packages/config-loader/src/utils}/resolve-files.js +3 -2
  38. package/packages/config-loader/test/assets/esm.css +0 -0
  39. package/packages/config-loader/test/assets/esm.css.map +0 -0
  40. package/packages/config-loader/test/assets/esm.js +0 -0
  41. package/packages/config-loader/test/assets/esm.js.map +0 -0
  42. package/packages/config-loader/test/config-store.test.js +231 -0
  43. package/packages/config-loader/test/eik-config/cwd.test.js +35 -0
  44. package/packages/config-loader/test/eik-config/map.test.js +31 -0
  45. package/packages/config-loader/test/eik-config/mappings.test.js +507 -0
  46. package/packages/config-loader/test/eik-config/out.test.js +54 -0
  47. package/packages/config-loader/test/eik-config/server.test.js +32 -0
  48. package/packages/config-loader/test/eik-config/toJSON.test.js +19 -0
  49. package/packages/config-loader/test/eik-config/token.test.js +49 -0
  50. package/packages/config-loader/test/eik-config/type.test.js +22 -0
  51. package/packages/config-loader/test/eik-config/validate.test.js +31 -0
  52. package/packages/config-loader/test/eik-config/version.test.js +22 -0
  53. package/packages/config-loader/test/eik.json +10 -0
  54. package/packages/config-loader/test/local-assets.test.js +125 -0
  55. package/packages/config-loader/test/local-file-location/absolute.test.js +35 -0
  56. package/packages/config-loader/test/local-file-location/contentType.test.js +55 -0
  57. package/packages/config-loader/test/local-file-location/extension.test.js +20 -0
  58. package/packages/config-loader/test/local-file-location/mimeType.test.js +43 -0
  59. package/packages/config-loader/test/read-file.test.js +60 -0
  60. package/packages/config-loader/test/resolve-files.test.js +257 -0
  61. package/packages/config-loader/test/resolved-files/iterator.test.js +17 -0
  62. package/packages/config-loader/test/tmp/.gitkeep +0 -0
  63. package/packages/schemas/.prettierignore +17 -0
  64. package/packages/schemas/eikjson.d.ts +41 -0
  65. package/packages/schemas/index.js +7 -0
  66. package/packages/schemas/package.json +40 -0
  67. package/{lib/schemas → packages/schemas/src}/assert.js +3 -2
  68. package/{lib/schemas → packages/schemas/src}/eikjson.schema.json +0 -0
  69. package/{lib/schemas → packages/schemas/src}/validate.js +12 -8
  70. package/{lib/schemas → packages/schemas/src}/validation-error.js +1 -1
  71. package/packages/schemas/test/assert.js +207 -0
  72. package/packages/schemas/test/index.js +182 -0
  73. package/packages/utils/.prettierignore +17 -0
  74. package/packages/utils/index.js +20 -0
  75. package/packages/utils/package.json +29 -0
  76. package/{lib/helpers → packages/utils/src}/path-slashes.js +0 -0
  77. package/packages/utils/src/stream.js +21 -0
  78. package/{lib/helpers → packages/utils/src}/type-slug.js +0 -0
  79. package/{lib/helpers → packages/utils/src}/type-title.js +0 -0
  80. package/packages/utils/tests/eik.json +10 -0
  81. package/packages/validators/.prettierignore +17 -0
  82. package/packages/validators/package.json +34 -0
  83. package/packages/validators/src/index.js +53 -0
  84. package/packages/validators/test/index.js +238 -0
  85. package/release/eik-common-4.0.0-next.6.tgz +0 -0
  86. package/release.config.js +27 -0
  87. package/renovate.json +6 -0
  88. package/tsconfig.json +30 -0
  89. package/lib/helpers/index.js +0 -25
  90. package/lib/index.js +0 -17
  91. package/lib/schemas/index.js +0 -8
  92. package/lib/stream.js +0 -14
  93. package/lib/validators/index.js +0 -66
  94. package/types/classes/custom-error.d.ts +0 -7
  95. package/types/classes/eik-config.d.ts +0 -58
  96. package/types/classes/file-mapping.d.ts +0 -21
  97. package/types/classes/invalid-config-error.d.ts +0 -4
  98. package/types/classes/local-file-location.d.ts +0 -36
  99. package/types/classes/missing-config-error.d.ts +0 -4
  100. package/types/classes/multiple-config-sources-error.d.ts +0 -5
  101. package/types/classes/no-files-matched-error.d.ts +0 -4
  102. package/types/classes/read-file.d.ts +0 -15
  103. package/types/classes/remote-file-location.d.ts +0 -21
  104. package/types/classes/resolved-files.d.ts +0 -20
  105. package/types/classes/single-dest-multiple-source-error.d.ts +0 -4
  106. package/types/helpers/config-store.d.ts +0 -31
  107. package/types/helpers/get-defaults.d.ts +0 -2
  108. package/types/helpers/index.d.ts +0 -11
  109. package/types/helpers/local-assets.d.ts +0 -8
  110. package/types/helpers/path-slashes.d.ts +0 -32
  111. package/types/helpers/resolve-files.d.ts +0 -13
  112. package/types/helpers/type-slug.d.ts +0 -2
  113. package/types/helpers/type-title.d.ts +0 -2
  114. package/types/index.d.ts +0 -7
  115. package/types/schemas/assert.d.ts +0 -8
  116. package/types/schemas/index.d.ts +0 -71
  117. package/types/schemas/validate.d.ts +0 -26
  118. package/types/schemas/validation-error.d.ts +0 -8
  119. package/types/stream.d.ts +0 -2
  120. package/types/validators/index.d.ts +0 -8
package/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ coverage
2
+ types
package/.eslintrc ADDED
@@ -0,0 +1,34 @@
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
+ }
@@ -0,0 +1,69 @@
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 }}
@@ -0,0 +1,45 @@
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
@@ -0,0 +1,17 @@
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 ADDED
@@ -0,0 +1,20 @@
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
+ }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [4.0.0-next.6](https://github.com/eik-lib/common/compare/v4.0.0-next.5...v4.0.0-next.6) (2022-07-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * lint ([edc595f](https://github.com/eik-lib/common/commit/edc595f6f4baf465e736bed8a4cb2e0eb8efe382))
7
+
1
8
  # [4.0.0-next.5](https://github.com/eik-lib/common/compare/v4.0.0-next.4...v4.0.0-next.5) (2022-07-26)
2
9
 
3
10
 
@@ -0,0 +1,16 @@
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();
@@ -0,0 +1,6 @@
1
+ const main = () => {
2
+ const thing = 'this is a test fixture';
3
+ return thing;
4
+ };
5
+
6
+ main();
File without changes
@@ -0,0 +1,6 @@
1
+ const main = () => {
2
+ const thing = 'this is a test fixture';
3
+ return thing;
4
+ };
5
+
6
+ main();
File without changes
@@ -0,0 +1,46 @@
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
package/package.json CHANGED
@@ -1,64 +1,10 @@
1
1
  {
2
2
  "name": "@eik/common",
3
- "version": "4.0.0-next.5",
4
- "description": "Common utilities for Eik modules",
5
- "main": "lib/index.js",
6
- "types": "types/index.d.ts",
7
- "files": [
8
- "CHANGELOG.md",
9
- "package.json",
10
- "lib",
11
- "types",
12
- "eikjson.d.ts"
3
+ "workspaces": [
4
+ "packages/config-loader",
5
+ "packages/utils",
6
+ "packages/schemas",
7
+ "packages/validators"
13
8
  ],
14
- "scripts": {
15
- "test": "tap --no-check-coverage",
16
- "lint:fix": "eslint --fix .",
17
- "lint": "eslint .",
18
- "schema:types": "json2ts lib/schemas/eikjson.schema.json > eikjson.d.ts",
19
- "schema:outdated": "npm run schema:types && git diff --exit-code HEAD:eikjson.d.ts eikjson.d.ts",
20
- "style:check": "prettier -c .",
21
- "style:format": "prettier -w .",
22
- "typecheck": "tsc",
23
- "prepublish": "npm run typecheck"
24
- },
25
- "repository": {
26
- "type": "git",
27
- "url": "git+https://github.com/eik-lib/common.git"
28
- },
29
- "keywords": [],
30
- "author": "",
31
- "license": "ISC",
32
- "bugs": {
33
- "url": "https://github.com/eik-lib/common/issues"
34
- },
35
- "homepage": "https://github.com/eik-lib/common#readme",
36
- "dependencies": {
37
- "ajv": "^8.6.2",
38
- "ajv-formats": "^2.1.0",
39
- "glob": "^8.0.0",
40
- "is-glob": "^4.0.1",
41
- "mime-types": "^2.1.29",
42
- "node-fetch": "^2.6.1",
43
- "semver": "^7.0.0",
44
- "validate-npm-package-name": "^4.0.0"
45
- },
46
- "devDependencies": {
47
- "@hapi/hapi": "20.2.2",
48
- "@semantic-release/changelog": "6.0.1",
49
- "@semantic-release/git": "10.0.1",
50
- "eslint": "7.32.0",
51
- "eslint-config-airbnb-base": "14.2.1",
52
- "eslint-config-prettier": "8.5.0",
53
- "eslint-plugin-import": "2.26.0",
54
- "eslint-plugin-prettier": "4.2.1",
55
- "express": "4.18.1",
56
- "fastify": "3.29.0",
57
- "json-schema-to-typescript": "10.1.5",
58
- "prettier": "2.7.1",
59
- "semantic-release": "18.0.1",
60
- "stoppable": "1.1.0",
61
- "tap": "15.2.3",
62
- "typescript": "4.7.4"
63
- }
9
+ "version": "4.0.0-next.6"
64
10
  }
@@ -0,0 +1,17 @@
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
@@ -0,0 +1,13 @@
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
+ };
@@ -0,0 +1,42 @@
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
+ }
@@ -4,8 +4,8 @@
4
4
  * @type {(value: unknown, message?: string) => asserts value}
5
5
  */
6
6
  const assert = require('assert');
7
- const LocalFileLocation = require('./local-file-location');
8
- const RemoteFileLocation = require('./remote-file-location');
7
+ const LocalFileLocation = require('./local-file-location.js');
8
+ const RemoteFileLocation = require('./remote-file-location.js');
9
9
 
10
10
  /**
11
11
  * Class containing a local file system source location and remote server destination location for a file.
@@ -1,4 +1,4 @@
1
- const { isReadableStream } = require('../stream');
1
+ const { isReadableStream } = require('@eik/common-utils');
2
2
 
3
3
  const ReadFile = class ReadFile {
4
4
  constructor({ mimeType = '', etag = '' } = {}) {
@@ -29,4 +29,5 @@ const ReadFile = class ReadFile {
29
29
  return 'ReadFile';
30
30
  }
31
31
  };
32
+
32
33
  module.exports = ReadFile;
@@ -2,11 +2,12 @@
2
2
  * @type {(value: unknown, message?: string) => asserts value}
3
3
  */
4
4
  const assert = require('assert');
5
- const LocalFileLocation = require('./local-file-location');
6
5
  const {
7
6
  removeLeadingSlash,
8
7
  removeTrailingSlash,
9
- } = require('../helpers/path-slashes');
8
+ } = require('@eik/common-utils');
9
+
10
+ const LocalFileLocation = require('./local-file-location');
10
11
 
11
12
  const originalFiles = Symbol('files');
12
13
 
@@ -2,10 +2,10 @@ const { readFileSync, writeFileSync } = require('fs');
2
2
  const { join } = require('path');
3
3
  const homedir = require('os').homedir();
4
4
 
5
- const EikConfig = require('../classes/eik-config');
6
- const MissingConfigError = require('../classes/missing-config-error');
7
- const MultipleConfigSourcesError = require('../classes/multiple-config-sources-error');
8
- const InvalidConfigError = require('../classes/invalid-config-error');
5
+ const EikConfig = require('./eik-config.js');
6
+ const MissingConfigError = require('./errors/missing-config-error.js');
7
+ const MultipleConfigSourcesError = require('./errors/multiple-config-sources-error.js');
8
+ const InvalidConfigError = require('./errors/invalid-config-error.js');
9
9
 
10
10
  /**
11
11
  * Read a file at a given path and parse it
@@ -5,14 +5,16 @@
5
5
  */
6
6
  const assert = require('assert');
7
7
  const { extname, join, isAbsolute } = require('path');
8
- const NoFilesMatchedError = require('./no-files-matched-error');
9
- const SingleDestMultipleSourcesError = require('./single-dest-multiple-source-error');
10
- const FileMapping = require('./file-mapping');
11
- const RemoteFileLocation = require('./remote-file-location');
12
- const schemas = require('../schemas');
13
- const { removeTrailingSlash } = require('../helpers/path-slashes');
14
- const typeSlug = require('../helpers/type-slug');
15
- const resolveFiles = require('../helpers/resolve-files');
8
+ const { typeSlug, removeTrailingSlash } = require('@eik/common-utils');
9
+
10
+ const schemas = require('@eik/common-schemas');
11
+
12
+ const resolveFiles = require('./utils/resolve-files.js');
13
+
14
+ const RemoteFileLocation = require('./classes/remote-file-location.js');
15
+ const FileMapping = require('./classes/file-mapping.js');
16
+ const SingleDestMultipleSourcesError = require('./errors/single-dest-multiple-source-error.js');
17
+ const NoFilesMatchedError = require('./errors/no-files-matched-error.js');
16
18
 
17
19
  const _config = Symbol('config');
18
20
  const _tokens = Symbol('tokens');
@@ -31,7 +33,7 @@ const normalizeFilesDefinition = (files) =>
31
33
  * @typedef {import ("../../eikjson").EikjsonSchema} EikjsonSchema
32
34
  */
33
35
 
34
- module.exports = class EikConfig {
36
+ class EikConfig {
35
37
  /**
36
38
  * @param {EikjsonSchema?} configHash
37
39
  * @param {[string, string][]?} tokens
@@ -162,4 +164,6 @@ module.exports = class EikConfig {
162
164
  });
163
165
  });
164
166
  }
165
- };
167
+ }
168
+
169
+ module.exports = EikConfig;
@@ -1,4 +1,4 @@
1
- module.exports = class CustomError extends Error {
1
+ class CustomError extends Error {
2
2
  /**
3
3
  * @param {string} message
4
4
  */
@@ -7,4 +7,6 @@ module.exports = class CustomError extends Error {
7
7
  this.name = this.constructor.name;
8
8
  Error.captureStackTrace(this, this.constructor);
9
9
  }
10
- };
10
+ }
11
+
12
+ module.exports = CustomError;
@@ -1,10 +1,12 @@
1
1
  const CustomError = require('./custom-error');
2
2
 
3
- module.exports = class InvalidConfigError extends CustomError {
3
+ class InvalidConfigError extends CustomError {
4
4
  /**
5
5
  * @param {string} msg
6
6
  */
7
7
  constructor(msg) {
8
8
  super(`Eik config object was invalid: '${msg}'`);
9
9
  }
10
- };
10
+ }
11
+
12
+ module.exports = InvalidConfigError;
@@ -1,10 +1,12 @@
1
1
  const CustomError = require('./custom-error');
2
2
 
3
- module.exports = class MissingConfigError extends CustomError {
3
+ class MissingConfigError extends CustomError {
4
4
  /**
5
5
  * @param {string} dir
6
6
  */
7
7
  constructor(dir) {
8
8
  super(`No package.json or eik.json file found in: '${dir}'`);
9
9
  }
10
- };
10
+ }
11
+
12
+ module.exports = MissingConfigError;
@@ -1,9 +1,11 @@
1
1
  const CustomError = require('./custom-error');
2
2
 
3
- module.exports = class MultipleConfigSourcesError extends CustomError {
3
+ class MultipleConfigSourcesError extends CustomError {
4
4
  constructor() {
5
5
  super(
6
6
  `Eik configuration was defined in both in package.json and eik.json. You must specify one or the other.`,
7
7
  );
8
8
  }
9
- };
9
+ }
10
+
11
+ module.exports = MultipleConfigSourcesError;
@@ -1,6 +1,6 @@
1
- const CustomError = require('./custom-error');
1
+ const CustomError = require('./custom-error.js');
2
2
 
3
- module.exports = class NoFilesMatchedError extends CustomError {
3
+ class NoFilesMatchedError extends CustomError {
4
4
  /**
5
5
  * @param {string} file
6
6
  */
@@ -8,4 +8,6 @@ module.exports = class NoFilesMatchedError extends CustomError {
8
8
  const message = `No files found for path: '${file}'`;
9
9
  super(message);
10
10
  }
11
- };
11
+ }
12
+
13
+ module.exports = NoFilesMatchedError;
@@ -1,6 +1,6 @@
1
1
  const CustomError = require('./custom-error');
2
2
 
3
- module.exports = class SingleDestMultipleSourcesError extends CustomError {
3
+ class SingleDestMultipleSourcesError extends CustomError {
4
4
  /**
5
5
  * @param {string} destFilePath
6
6
  */
@@ -9,4 +9,6 @@ module.exports = class SingleDestMultipleSourcesError extends CustomError {
9
9
  `Cannot specify a single file destination for multiple source files. See '${destFilePath}'`,
10
10
  );
11
11
  }
12
- };
12
+ }
13
+
14
+ module.exports = SingleDestMultipleSourcesError;