@eik/common 4.1.0 → 5.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.
- package/CHANGELOG.md +19 -0
- package/lib/classes/custom-error.js +8 -8
- package/lib/classes/eik-config.js +148 -152
- package/lib/classes/file-mapping.js +25 -25
- package/lib/classes/invalid-config-error.js +7 -7
- package/lib/classes/local-file-location.js +45 -48
- package/lib/classes/missing-config-error.js +7 -7
- package/lib/classes/multiple-config-sources-error.js +6 -6
- package/lib/classes/no-files-matched-error.js +8 -8
- package/lib/classes/read-file.js +25 -25
- package/lib/classes/remote-file-location.js +30 -30
- package/lib/classes/resolved-files.js +38 -44
- package/lib/classes/single-dest-multiple-source-error.js +9 -9
- package/lib/helpers/config-store.js +103 -103
- package/lib/helpers/get-defaults.js +24 -24
- package/lib/helpers/index.js +21 -21
- package/lib/helpers/local-assets.js +49 -49
- package/lib/helpers/path-slashes.js +25 -12
- package/lib/helpers/resolve-files.js +64 -50
- package/lib/helpers/type-slug.js +3 -3
- package/lib/helpers/type-title.js +4 -4
- package/lib/index.js +12 -12
- package/lib/schemas/assert.js +41 -41
- package/lib/schemas/index.js +7 -7
- package/lib/schemas/validate.js +64 -64
- package/lib/schemas/validation-error.js +11 -11
- package/lib/stream.js +11 -11
- package/lib/validators/index.js +37 -37
- package/package.json +14 -13
- package/types/classes/eik-config.d.ts +1 -1
- package/types/classes/file-mapping.d.ts +2 -2
- package/types/classes/invalid-config-error.d.ts +1 -1
- package/types/classes/missing-config-error.d.ts +1 -1
- package/types/classes/multiple-config-sources-error.d.ts +1 -1
- package/types/classes/no-files-matched-error.d.ts +1 -1
- package/types/classes/resolved-files.d.ts +1 -1
- package/types/classes/single-dest-multiple-source-error.d.ts +1 -1
- package/types/helpers/config-store.d.ts +1 -1
- package/types/helpers/index.d.ts +10 -10
- package/types/helpers/path-slashes.d.ts +2 -28
- package/types/helpers/resolve-files.d.ts +1 -1
- package/types/index.d.ts +6 -6
- package/types/schemas/index.d.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# [5.0.0](https://github.com/eik-lib/common/compare/v4.1.1...v5.0.0) (2024-11-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update validate-npm-package-name ([0dac235](https://github.com/eik-lib/common/commit/0dac23582de09bb739a730a8ca9bee7370146bcc))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* Requires Node >=20.5.0
|
|
12
|
+
|
|
13
|
+
## [4.1.1](https://github.com/eik-lib/common/compare/v4.1.0...v4.1.1) (2024-08-16)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* windows support ([#303](https://github.com/eik-lib/common/issues/303)) ([4e6a307](https://github.com/eik-lib/common/commit/4e6a3078861a0a03b7275bfb5b2875adda1f2c2e))
|
|
19
|
+
|
|
1
20
|
# [4.1.0](https://github.com/eik-lib/common/compare/v4.0.9...v4.1.0) (2024-08-14)
|
|
2
21
|
|
|
3
22
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export default class CustomError extends Error {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @param {string} message
|
|
4
|
+
*/
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = this.constructor.name;
|
|
8
|
+
Error.captureStackTrace(this, this.constructor);
|
|
9
|
+
}
|
|
10
10
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @type {(value: unknown, message?: string) => asserts value}
|
|
3
3
|
*/
|
|
4
|
-
import assert from
|
|
5
|
-
import { extname, join, isAbsolute } from
|
|
6
|
-
import NoFilesMatchedError from
|
|
7
|
-
import SingleDestMultipleSourcesError from
|
|
8
|
-
import FileMapping from
|
|
9
|
-
import RemoteFileLocation from
|
|
10
|
-
import schemas from
|
|
11
|
-
import { removeTrailingSlash } from
|
|
12
|
-
import typeSlug from
|
|
13
|
-
import resolveFiles from
|
|
14
|
-
|
|
15
|
-
const _config = Symbol(
|
|
16
|
-
const _tokens = Symbol(
|
|
4
|
+
import assert from "node:assert";
|
|
5
|
+
import { extname, join, isAbsolute } from "node:path";
|
|
6
|
+
import NoFilesMatchedError from "./no-files-matched-error.js";
|
|
7
|
+
import SingleDestMultipleSourcesError from "./single-dest-multiple-source-error.js";
|
|
8
|
+
import FileMapping from "./file-mapping.js";
|
|
9
|
+
import RemoteFileLocation from "./remote-file-location.js";
|
|
10
|
+
import schemas from "../schemas/index.js";
|
|
11
|
+
import { removeTrailingSlash, ensurePosix } from "../helpers/path-slashes.js";
|
|
12
|
+
import typeSlug from "../helpers/type-slug.js";
|
|
13
|
+
import resolveFiles from "../helpers/resolve-files.js";
|
|
14
|
+
|
|
15
|
+
const _config = Symbol("config");
|
|
16
|
+
const _tokens = Symbol("tokens");
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Normalizes Eik JSON "files" definition to object form if in string form
|
|
@@ -23,149 +23,145 @@ const _tokens = Symbol('tokens');
|
|
|
23
23
|
* @returns {{[k: string]: string;}}
|
|
24
24
|
*/
|
|
25
25
|
const normalizeFilesDefinition = (files) =>
|
|
26
|
-
|
|
26
|
+
typeof files === "string" ? { "/": files } : files;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @typedef {import ("../../eikjson.js").EikjsonSchema} EikjsonSchema
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
export default class EikConfig {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return new FileMapping(localFile, remoteDestination);
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
}
|
|
33
|
+
/**
|
|
34
|
+
* @param {EikjsonSchema?} configHash
|
|
35
|
+
* @param {[string, string][]?} tokens
|
|
36
|
+
* @param {string?} configRootDir
|
|
37
|
+
*/
|
|
38
|
+
constructor(configHash, tokens = null, configRootDir = process.cwd()) {
|
|
39
|
+
/** @type EikjsonSchema */
|
|
40
|
+
this[_config] = JSON.parse(JSON.stringify(configHash)) || {};
|
|
41
|
+
this[_tokens] = new Map(tokens);
|
|
42
|
+
|
|
43
|
+
assert(
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
isAbsolute(configRootDir),
|
|
46
|
+
`"configRootDir" must be an absolute path: "${configRootDir}" given`,
|
|
47
|
+
);
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
this.cwd = removeTrailingSlash(configRootDir);
|
|
50
|
+
/** @type {string[]} */
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
this.map = [].concat(this[_config]["import-map"] || []);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** @type {EikjsonSchema["name"]} */
|
|
56
|
+
get name() {
|
|
57
|
+
return this[_config].name;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** @type {EikjsonSchema["version"]} */
|
|
61
|
+
get version() {
|
|
62
|
+
return this[_config].version;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
set version(newVersion) {
|
|
66
|
+
schemas.assert.version(newVersion);
|
|
67
|
+
this[_config].version = newVersion;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** @type {EikjsonSchema["type"]} */
|
|
71
|
+
get type() {
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
return this[_config].type || schemas.schema.properties.type.default;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** @type {string} */
|
|
77
|
+
get server() {
|
|
78
|
+
const configuredServer = this[_config].server;
|
|
79
|
+
if (configuredServer) {
|
|
80
|
+
return configuredServer;
|
|
81
|
+
}
|
|
82
|
+
return this[_tokens].keys().next().value;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** @type {[string, string][]} */
|
|
86
|
+
get token() {
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
return this[_tokens].get(this.server);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** @type {EikjsonSchema["files"]} */
|
|
92
|
+
get files() {
|
|
93
|
+
return this[_config].files;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Normalized relative directory path with any leading ./ or
|
|
98
|
+
* trailing / characters stripped. Defaults to .eik
|
|
99
|
+
*
|
|
100
|
+
* @returns {string} out path string
|
|
101
|
+
*/
|
|
102
|
+
get out() {
|
|
103
|
+
const defaulted = this[_config].out || ".eik";
|
|
104
|
+
const out = defaulted.startsWith("./") ? defaulted.substr(2) : defaulted;
|
|
105
|
+
return removeTrailingSlash(out);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Serializes internal values to an object
|
|
110
|
+
*
|
|
111
|
+
* @returns {EikjsonSchema} object consistent with EikjsonSchema
|
|
112
|
+
*/
|
|
113
|
+
toJSON() {
|
|
114
|
+
return { ...this[_config] };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Validates config values against the eik JSON schema
|
|
119
|
+
*
|
|
120
|
+
* @return {void}
|
|
121
|
+
*/
|
|
122
|
+
validate() {
|
|
123
|
+
schemas.assert.eikJSON(this[_config]);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Resolves file locations on disk based on values defined in files property
|
|
128
|
+
* of config object.
|
|
129
|
+
*
|
|
130
|
+
* @returns {Promise<FileMapping[]>}
|
|
131
|
+
*/
|
|
132
|
+
async mappings() {
|
|
133
|
+
const normalizedFiles = normalizeFilesDefinition(this.files);
|
|
134
|
+
const resolvedFiles = await resolveFiles(normalizedFiles, this.cwd);
|
|
135
|
+
|
|
136
|
+
return resolvedFiles.flatMap((files) => {
|
|
137
|
+
// @ts-ignore
|
|
138
|
+
const { destination, source } = files;
|
|
139
|
+
// @ts-ignore
|
|
140
|
+
const filesArray = Array.from(files);
|
|
141
|
+
if (filesArray.length === 0) {
|
|
142
|
+
throw new NoFilesMatchedError(source);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (extname(destination) !== "" && filesArray.length > 1) {
|
|
146
|
+
throw new SingleDestMultipleSourcesError(destination);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return filesArray.map((localFile) => {
|
|
150
|
+
const shouldMapFilename = extname(destination);
|
|
151
|
+
const relativePathname = shouldMapFilename
|
|
152
|
+
? destination
|
|
153
|
+
: ensurePosix(join(destination, localFile.relative));
|
|
154
|
+
const packagePathname = ensurePosix(
|
|
155
|
+
join(typeSlug(this.type), this.name, this.version),
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
const remoteDestination = new RemoteFileLocation(
|
|
159
|
+
relativePathname,
|
|
160
|
+
packagePathname,
|
|
161
|
+
this.server,
|
|
162
|
+
);
|
|
163
|
+
return new FileMapping(localFile, remoteDestination);
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
171
167
|
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @type {(value: unknown, message?: string) => asserts value}
|
|
3
3
|
*/
|
|
4
|
-
import assert from
|
|
5
|
-
import LocalFileLocation from
|
|
6
|
-
import RemoteFileLocation from
|
|
4
|
+
import assert from "node:assert";
|
|
5
|
+
import LocalFileLocation from "./local-file-location.js";
|
|
6
|
+
import RemoteFileLocation from "./remote-file-location.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Class containing a local file system source location and remote server destination location for a file.
|
|
10
10
|
*/
|
|
11
11
|
class FileMapping {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @param {LocalFileLocation} source
|
|
14
|
+
* @param {RemoteFileLocation} destination
|
|
15
|
+
*/
|
|
16
|
+
constructor(source, destination) {
|
|
17
|
+
assert(
|
|
18
|
+
source instanceof LocalFileLocation,
|
|
19
|
+
'"source" must be an instance of LocalFileLocation',
|
|
20
|
+
);
|
|
21
|
+
assert(
|
|
22
|
+
destination instanceof RemoteFileLocation,
|
|
23
|
+
'"destination" must be an instance of RemoteFileLocation',
|
|
24
|
+
);
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
/**
|
|
27
|
+
* @type {LocalFileLocation} source
|
|
28
|
+
*/
|
|
29
|
+
this.source = source;
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
/**
|
|
32
|
+
* @type {RemoteFileLocation} destination
|
|
33
|
+
*/
|
|
34
|
+
this.destination = destination;
|
|
35
|
+
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export default FileMapping;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import CustomError from
|
|
1
|
+
import CustomError from "./custom-error.js";
|
|
2
2
|
|
|
3
3
|
export default class InvalidConfigError extends CustomError {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @param {string} msg
|
|
6
|
+
*/
|
|
7
|
+
constructor(msg) {
|
|
8
|
+
super(`Eik config object was invalid: '${msg}'`);
|
|
9
|
+
}
|
|
10
10
|
}
|
|
@@ -1,60 +1,57 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @type {(value: unknown, message?: string) => asserts value}
|
|
3
3
|
*/
|
|
4
|
-
import assert from
|
|
5
|
-
import { join, extname, isAbsolute } from
|
|
4
|
+
import assert from "node:assert";
|
|
5
|
+
import { join, extname, isAbsolute } from "node:path";
|
|
6
6
|
// @ts-ignore
|
|
7
|
-
import mime from
|
|
7
|
+
import mime from "mime-types";
|
|
8
|
+
import { ensurePosix } from "../helpers/path-slashes.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Class containing information about a local file
|
|
11
12
|
*/
|
|
12
13
|
class LocalFileLocation {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*/
|
|
55
|
-
this.mimeType =
|
|
56
|
-
mime.lookup(this.extension) || 'application/octet-stream';
|
|
57
|
-
}
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} path path to file on disk relative to basePath
|
|
16
|
+
* @param {string} basePath basePath to the file's location on disk
|
|
17
|
+
*/
|
|
18
|
+
constructor(path, basePath) {
|
|
19
|
+
assert(typeof path === "string", '"path" must be of type "string"');
|
|
20
|
+
assert(typeof basePath === "string", '"basePath" must be of type "string"');
|
|
21
|
+
assert(!isAbsolute(path), `"path" must be a relative path, got ${path}`);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @type {string} path to file on disk relative to this.basePath
|
|
25
|
+
*/
|
|
26
|
+
this.relative = path;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @type {string} absolute path to root files location on disk
|
|
30
|
+
*/
|
|
31
|
+
this.basePath = basePath;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @type {string} absolute path to file on disk,
|
|
35
|
+
* this is a concatentation of this.basePath and this.relative
|
|
36
|
+
*/
|
|
37
|
+
this.absolute = ensurePosix(join(basePath, path));
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @type {string} file extension with "." character included. (eg. ".json")
|
|
41
|
+
*/
|
|
42
|
+
this.extension = extname(path);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @type {string} full content-type header value for file
|
|
46
|
+
*/
|
|
47
|
+
this.contentType =
|
|
48
|
+
mime.contentType(this.extension) || "application/octet-stream";
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @type {string} mime type of file
|
|
52
|
+
*/
|
|
53
|
+
this.mimeType = mime.lookup(this.extension) || "application/octet-stream";
|
|
54
|
+
}
|
|
58
55
|
}
|
|
59
56
|
|
|
60
57
|
export default LocalFileLocation;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import CustomError from
|
|
1
|
+
import CustomError from "./custom-error.js";
|
|
2
2
|
|
|
3
3
|
export default class MissingConfigError extends CustomError {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @param {string} dir
|
|
6
|
+
*/
|
|
7
|
+
constructor(dir) {
|
|
8
|
+
super(`No package.json or eik.json file found in: '${dir}'`);
|
|
9
|
+
}
|
|
10
10
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import CustomError from
|
|
1
|
+
import CustomError from "./custom-error.js";
|
|
2
2
|
|
|
3
3
|
export default class MultipleConfigSourcesError extends CustomError {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
constructor() {
|
|
5
|
+
super(
|
|
6
|
+
`Eik configuration was defined in both in package.json and eik.json. You must specify one or the other.`,
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
9
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import CustomError from
|
|
1
|
+
import CustomError from "./custom-error.js";
|
|
2
2
|
|
|
3
3
|
export default class NoFilesMatchedError extends CustomError {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @param {string} file
|
|
6
|
+
*/
|
|
7
|
+
constructor(file) {
|
|
8
|
+
const message = `No files found for path: '${file}'`;
|
|
9
|
+
super(message);
|
|
10
|
+
}
|
|
11
11
|
}
|