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

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 CHANGED
@@ -1,3 +1,49 @@
1
+ # [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
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update dependency glob to v8 ([#225](https://github.com/eik-lib/common/issues/225)) ([fd01a56](https://github.com/eik-lib/common/commit/fd01a566b404164bdc847cc7a1803b124e131e41))
7
+ * **deps:** update dependency validate-npm-package-name to v4 ([#222](https://github.com/eik-lib/common/issues/222)) ([c3721ab](https://github.com/eik-lib/common/commit/c3721abf058c93d4e500945c3c014c748c1f2acd))
8
+
9
+ ## [3.0.1](https://github.com/eik-lib/common/compare/v3.0.0...v3.0.1) (2022-05-04)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **deps:** update dependency glob to v8 ([#225](https://github.com/eik-lib/common/issues/225)) ([fd01a56](https://github.com/eik-lib/common/commit/fd01a566b404164bdc847cc7a1803b124e131e41))
15
+ * **deps:** update dependency validate-npm-package-name to v4 ([#222](https://github.com/eik-lib/common/issues/222)) ([c3721ab](https://github.com/eik-lib/common/commit/c3721abf058c93d4e500945c3c014c748c1f2acd))
16
+
17
+ # [3.0.0](https://github.com/eik-lib/common/compare/v2.0.3...v3.0.0) (2021-08-12)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * ensure absolute file paths work as expected ([4f6ce5e](https://github.com/eik-lib/common/commit/4f6ce5e251dcbf0df0b51cc36f73b10585b96538))
23
+ * include eik json schema file in package when publishing ([f0c3c45](https://github.com/eik-lib/common/commit/f0c3c45439a637e8a3cb3a475bca70f2a77c1901))
24
+ * update require statements to avoid circular dependencies ([4359bec](https://github.com/eik-lib/common/commit/4359bec140539c6144be48f7b9ff774b9601d068))
25
+
26
+
27
+ ### Features
28
+
29
+ * add extension, mime-type and content-type to file location ([a9b4fe1](https://github.com/eik-lib/common/commit/a9b4fe15cf39425070b9bd260183656933d94c5d))
30
+ * Add hapi support for local assets ([7528c32](https://github.com/eik-lib/common/commit/7528c3277c537e7e0a4228c949988bc7e7a90074))
31
+ * add mappings() method to eik config object ([f989ae0](https://github.com/eik-lib/common/commit/f989ae0e2de0aa5646fd33d0f5854bc7e74c8734)), closes [/github.com/eik-lib/issues/issues/2#issuecomment-779099732](https://github.com//github.com/eik-lib/issues/issues/2/issues/issuecomment-779099732)
32
+
33
+
34
+ * refactor!: packageURL removed, localAssets fixed and updated ([90fd181](https://github.com/eik-lib/common/commit/90fd1818f69384d4edeb056dc2c8367e51b21d44))
35
+ * refactor!: remove pathsAndFiles methods ([90d8a12](https://github.com/eik-lib/common/commit/90d8a12e4df8e3a37f295c6136e94bf4ade68cb4))
36
+ * feat!: preserve directory structure when globbing in config ([dff2830](https://github.com/eik-lib/common/commit/dff28301f9bc6e37ef9db32455fa64f5a7a9e80a))
37
+
38
+
39
+ ### BREAKING CHANGES
40
+
41
+ * packageURL was removed as it no longer makes sense given the changes to eik json files config
42
+
43
+ localAssets has been refactored to use the new mappings method of eik config
44
+ * Consumers of the Eik Config class will all need to be updated to use the newer .mappings() method instead.
45
+ * directory structures are no longer flattened
46
+
1
47
  # [4.0.0-next.4](https://github.com/eik-lib/common/compare/v4.0.0-next.3...v4.0.0-next.4) (2021-02-23)
2
48
 
3
49
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eik/common",
3
- "version": "4.0.0-next.4",
3
+ "version": "4.0.0-next.5",
4
4
  "description": "Common utilities for Eik modules",
5
5
  "main": "lib/index.js",
6
6
  "types": "types/index.d.ts",
@@ -12,7 +12,7 @@
12
12
  "eikjson.d.ts"
13
13
  ],
14
14
  "scripts": {
15
- "test": "tap --test-regex=.test.js --test-ignore=node_modules",
15
+ "test": "tap --no-check-coverage",
16
16
  "lint:fix": "eslint --fix .",
17
17
  "lint": "eslint .",
18
18
  "schema:types": "json2ts lib/schemas/eikjson.schema.json > eikjson.d.ts",
@@ -34,34 +34,31 @@
34
34
  },
35
35
  "homepage": "https://github.com/eik-lib/common#readme",
36
36
  "dependencies": {
37
- "ajv": "^7.0.0",
38
- "ajv-formats": "^1.5.1",
39
- "glob": "^7.1.6",
37
+ "ajv": "^8.6.2",
38
+ "ajv-formats": "^2.1.0",
39
+ "glob": "^8.0.0",
40
40
  "is-glob": "^4.0.1",
41
41
  "mime-types": "^2.1.29",
42
42
  "node-fetch": "^2.6.1",
43
43
  "semver": "^7.0.0",
44
- "validate-npm-package-name": "^3.0.0"
44
+ "validate-npm-package-name": "^4.0.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@hapi/hapi": "^20.1.0",
48
- "@semantic-release/changelog": "5.0.1",
49
- "@semantic-release/commit-analyzer": "8.0.1",
50
- "@semantic-release/git": "9.0.0",
51
- "@semantic-release/github": "7.2.0",
52
- "@semantic-release/npm": "7.0.10",
53
- "@semantic-release/release-notes-generator": "9.0.1",
54
- "eslint": "7.20.0",
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",
55
51
  "eslint-config-airbnb-base": "14.2.1",
56
- "eslint-config-prettier": "7.2.0",
57
- "eslint-plugin-import": "2.22.1",
58
- "eslint-plugin-prettier": "3.3.1",
59
- "express": "4.17.1",
60
- "fastify": "3.12.0",
61
- "json-schema-to-typescript": "^10.1.3",
62
- "prettier": "2.2.1",
63
- "semantic-release": "17.3.9",
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",
64
60
  "stoppable": "1.1.0",
65
- "tap": "14.11.0"
61
+ "tap": "15.2.3",
62
+ "typescript": "4.7.4"
66
63
  }
67
64
  }
@@ -49,9 +49,10 @@ declare class EikConfig {
49
49
  *
50
50
  * @returns {Promise<FileMapping[]>}
51
51
  */
52
- mappings(): Promise<import("./file-mapping")[]>;
52
+ mappings(): Promise<FileMapping[]>;
53
53
  }
54
54
  declare namespace EikConfig {
55
55
  export { EikjsonSchema };
56
56
  }
57
57
  type EikjsonSchema = import("../../eikjson").EikjsonSchema;
58
+ import FileMapping = require("./file-mapping");
@@ -7,13 +7,15 @@ declare class FileMapping {
7
7
  * @param {LocalFileLocation} source
8
8
  * @param {RemoteFileLocation} destination
9
9
  */
10
- constructor(source: import("./local-file-location"), destination: import("./remote-file-location"));
10
+ constructor(source: LocalFileLocation, destination: RemoteFileLocation);
11
11
  /**
12
12
  * @type {LocalFileLocation} source
13
13
  */
14
- source: import("./local-file-location");
14
+ source: LocalFileLocation;
15
15
  /**
16
16
  * @type {RemoteFileLocation} destination
17
17
  */
18
- destination: import("./remote-file-location");
18
+ destination: RemoteFileLocation;
19
19
  }
20
+ import LocalFileLocation = require("./local-file-location");
21
+ import RemoteFileLocation = require("./remote-file-location");
@@ -1,13 +1,4 @@
1
1
  export = InvalidConfigError;
2
- declare const InvalidConfigError_base: {
3
- new (message: string): import("./custom-error");
4
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
5
- prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
6
- stackTraceLimit: number;
7
- };
8
- declare class InvalidConfigError extends InvalidConfigError_base {
9
- /**
10
- * @param {string} msg
11
- */
12
- constructor(msg: string);
2
+ declare class InvalidConfigError extends CustomError {
13
3
  }
4
+ import CustomError = require("./custom-error");
@@ -1,13 +1,4 @@
1
1
  export = MissingConfigError;
2
- declare const MissingConfigError_base: {
3
- new (message: string): import("./custom-error");
4
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
5
- prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
6
- stackTraceLimit: number;
7
- };
8
- declare class MissingConfigError extends MissingConfigError_base {
9
- /**
10
- * @param {string} dir
11
- */
12
- constructor(dir: string);
2
+ declare class MissingConfigError extends CustomError {
13
3
  }
4
+ import CustomError = require("./custom-error");
@@ -1,9 +1,5 @@
1
1
  export = MultipleConfigSourcesError;
2
- declare const MultipleConfigSourcesError_base: {
3
- new (message: string): import("./custom-error");
4
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
5
- prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
6
- stackTraceLimit: number;
7
- };
8
- declare class MultipleConfigSourcesError extends MultipleConfigSourcesError_base {
2
+ declare class MultipleConfigSourcesError extends CustomError {
3
+ constructor();
9
4
  }
5
+ import CustomError = require("./custom-error");
@@ -1,13 +1,4 @@
1
1
  export = NoFilesMatchedError;
2
- declare const NoFilesMatchedError_base: {
3
- new (message: string): import("./custom-error");
4
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
5
- prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
6
- stackTraceLimit: number;
7
- };
8
- declare class NoFilesMatchedError extends NoFilesMatchedError_base {
9
- /**
10
- * @param {string} file
11
- */
12
- constructor(file: string);
2
+ declare class NoFilesMatchedError extends CustomError {
13
3
  }
4
+ import CustomError = require("./custom-error");
@@ -13,7 +13,8 @@ declare class ResolvedFiles {
13
13
  source: string;
14
14
  basePath: string;
15
15
  pattern: string;
16
- [Symbol.iterator](): Generator<import("./local-file-location"), void, unknown>;
16
+ [Symbol.iterator](): Generator<LocalFileLocation, void, unknown>;
17
17
  [originalFiles]: string[];
18
18
  }
19
+ import LocalFileLocation = require("./local-file-location");
19
20
  declare const originalFiles: unique symbol;
@@ -1,13 +1,4 @@
1
1
  export = SingleDestMultipleSourcesError;
2
- declare const SingleDestMultipleSourcesError_base: {
3
- new (message: string): import("./custom-error");
4
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
5
- prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
6
- stackTraceLimit: number;
7
- };
8
- declare class SingleDestMultipleSourcesError extends SingleDestMultipleSourcesError_base {
9
- /**
10
- * @param {string} destFilePath
11
- */
12
- constructor(destFilePath: string);
2
+ declare class SingleDestMultipleSourcesError extends CustomError {
13
3
  }
4
+ import CustomError = require("./custom-error");
@@ -1,3 +1,4 @@
1
+ import EikConfig = require("../classes/eik-config");
1
2
  /**
2
3
  * Tries to find the configuration for eik in the provided directory.
3
4
  *
@@ -6,7 +7,7 @@
6
7
  *
7
8
  * @returns {EikConfig}
8
9
  */
9
- export declare function findInDirectory(configRootDir: string, loadJSONFromDisk?: Function): import("../classes/eik-config");
10
+ export function findInDirectory(configRootDir: string, loadJSONFromDisk?: Function): EikConfig;
10
11
  /**
11
12
  * Tries to find the configuration for eik in the provided directory.
12
13
  *
@@ -15,16 +16,16 @@ export declare function findInDirectory(configRootDir: string, loadJSONFromDisk?
15
16
  *
16
17
  * @returns {EikConfig}
17
18
  */
18
- export declare function findInDirectory(configRootDir: string, loadJSONFromDisk?: Function): import("../classes/eik-config");
19
+ export function findInDirectory(configRootDir: string, loadJSONFromDisk?: Function): EikConfig;
19
20
  /**
20
21
  * Persist config changes to disk as <cwd>/eik.json
21
22
  *
22
23
  * @param {import('../classes/eik-config')} config
23
24
  */
24
- export declare function persistToDisk(config: import("../classes/eik-config")): void;
25
+ export function persistToDisk(config: EikConfig): void;
25
26
  /**
26
27
  * Persist config changes to disk as <cwd>/eik.json
27
28
  *
28
29
  * @param {import('../classes/eik-config')} config
29
30
  */
30
- export declare function persistToDisk(config: import("../classes/eik-config")): void;
31
+ export function persistToDisk(config: EikConfig): void;
@@ -1,15 +1,11 @@
1
- export const localAssets: typeof import("./local-assets");
2
- export const getDefaults: (cwd: string) => import("../classes/eik-config");
3
- export const configStore: {
4
- findInDirectory(configRootDir: string, loadJSONFromDisk?: Function): import("../classes/eik-config");
5
- persistToDisk(config: import("../classes/eik-config")): void;
6
- };
7
- export const typeSlug: (type: any) => any;
8
- export const typeTitle: (type: any) => "PACKAGE" | "NPM" | "MAP";
9
- export const addTrailingSlash: (val: string) => string;
10
- export const removeTrailingSlash: (val: string) => string;
11
- export const addLeadingSlash: (val: string) => string;
12
- export const removeLeadingSlash: (val: string) => string;
13
- export const resolveFiles: (files: {
14
- [k: string]: string;
15
- }, cwd: string) => Promise<import("../classes/resolved-files")[]>;
1
+ import localAssets = require("./local-assets");
2
+ import getDefaults = require("./get-defaults");
3
+ import configStore = require("./config-store");
4
+ import typeSlug = require("./type-slug");
5
+ import typeTitle = require("./type-title");
6
+ import { addTrailingSlash } from "./path-slashes";
7
+ import { removeTrailingSlash } from "./path-slashes";
8
+ import { addLeadingSlash } from "./path-slashes";
9
+ import { removeLeadingSlash } from "./path-slashes";
10
+ import resolveFiles = require("./resolve-files");
11
+ export { localAssets, getDefaults, configStore, typeSlug, typeTitle, addTrailingSlash, removeTrailingSlash, addLeadingSlash, removeLeadingSlash, resolveFiles };
@@ -9,4 +9,5 @@ export = resolveFiles;
9
9
  */
10
10
  declare function resolveFiles(files: {
11
11
  [k: string]: string;
12
- }, cwd: string): Promise<import("../classes/resolved-files")[]>;
12
+ }, cwd: string): Promise<ResolvedFiles[]>;
13
+ import ResolvedFiles = require("../classes/resolved-files");
package/types/index.d.ts CHANGED
@@ -1,115 +1,7 @@
1
- export const validators: typeof import("./validators");
2
- export const ReadFile: {
3
- new ({ mimeType, etag }?: {
4
- mimeType?: string;
5
- etag?: string;
6
- }): {
7
- _mimeType: string;
8
- _stream: any;
9
- _etag: string;
10
- readonly mimeType: string;
11
- stream: any;
12
- readonly etag: string;
13
- readonly [Symbol.toStringTag]: string;
14
- };
15
- };
16
- export const EikConfig: typeof import("./classes/eik-config");
17
- export const schemas: {
18
- schema: {
19
- $schema: string;
20
- additionalProperties: boolean;
21
- type: string;
22
- properties: {
23
- server: {
24
- description: string;
25
- type: string;
26
- format: string;
27
- };
28
- name: {
29
- description: string;
30
- type: string;
31
- maxLength: number;
32
- minLength: number;
33
- };
34
- version: {
35
- description: string;
36
- type: string;
37
- minLength: number;
38
- };
39
- type: {
40
- description: string;
41
- type: string;
42
- enum: string[];
43
- default: string;
44
- };
45
- files: {
46
- description: string;
47
- oneOf: ({
48
- type: string;
49
- minProperties: number;
50
- additionalProperties: {
51
- type: string;
52
- };
53
- minLength?: undefined;
54
- } | {
55
- type: string;
56
- minLength: number;
57
- minProperties?: undefined;
58
- additionalProperties?: undefined;
59
- })[];
60
- };
61
- "import-map": {
62
- description: string;
63
- oneOf: ({
64
- type: string;
65
- format: string;
66
- items?: undefined;
67
- } | {
68
- type: string;
69
- items: {
70
- type: string;
71
- format: string;
72
- };
73
- format?: undefined;
74
- })[];
75
- };
76
- out: {
77
- description: string;
78
- type: string;
79
- format: string;
80
- minLength: number;
81
- };
82
- };
83
- required: string[];
84
- };
85
- validate: typeof import("./schemas/validate");
86
- assert: {
87
- eikJSON: (value: any) => void;
88
- name: (value: any) => void;
89
- type: (value: any) => void;
90
- version: (value: any) => void;
91
- server: (value: any) => void;
92
- files: (value: any) => void;
93
- importMap: (value: any) => void;
94
- out: (value: any) => void;
95
- };
96
- ValidationError: typeof import("./schemas/validation-error");
97
- };
98
- export const stream: typeof import("./stream");
99
- export const helpers: {
100
- localAssets: typeof import("./helpers/local-assets");
101
- getDefaults: (cwd: string) => import("./classes/eik-config");
102
- configStore: {
103
- findInDirectory(configRootDir: string, loadJSONFromDisk?: Function): import("./classes/eik-config");
104
- persistToDisk(config: import("./classes/eik-config")): void;
105
- };
106
- typeSlug: (type: any) => any;
107
- typeTitle: (type: any) => "PACKAGE" | "NPM" | "MAP";
108
- addTrailingSlash: (val: string) => string;
109
- removeTrailingSlash: (val: string) => string;
110
- addLeadingSlash: (val: string) => string;
111
- removeLeadingSlash: (val: string) => string;
112
- resolveFiles: (files: {
113
- [k: string]: string;
114
- }, cwd: string) => Promise<import("./classes/resolved-files")[]>;
115
- };
1
+ import validators = require("./validators");
2
+ import ReadFile = require("./classes/read-file");
3
+ import EikConfig = require("./classes/eik-config");
4
+ import schemas = require("./schemas");
5
+ import stream = require("./stream");
6
+ import helpers = require("./helpers");
7
+ export { validators, ReadFile, EikConfig, schemas, stream, helpers };
@@ -1,11 +1,8 @@
1
- declare const _exports: {
2
- eikJSON: (value: any) => void;
3
- name: (value: any) => void;
4
- type: (value: any) => void;
5
- version: (value: any) => void;
6
- server: (value: any) => void;
7
- files: (value: any) => void;
8
- importMap: (value: any) => void;
9
- out: (value: any) => void;
10
- };
11
- export = _exports;
1
+ export function eikJSON(value: any): void;
2
+ export function name(value: any): void;
3
+ export function type(value: any): void;
4
+ export function version(value: any): void;
5
+ export function server(value: any): void;
6
+ export function files(value: any): void;
7
+ export function importMap(value: any): void;
8
+ export function out(value: any): void;
@@ -65,15 +65,7 @@ export const schema: {
65
65
  };
66
66
  required: string[];
67
67
  };
68
- export const validate: typeof import("./validate");
69
- export const assert: {
70
- eikJSON: (value: any) => void;
71
- name: (value: any) => void;
72
- type: (value: any) => void;
73
- version: (value: any) => void;
74
- server: (value: any) => void;
75
- files: (value: any) => void;
76
- importMap: (value: any) => void;
77
- out: (value: any) => void;
78
- };
79
- export const ValidationError: typeof import("./validation-error");
68
+ import validate = require("./validate");
69
+ import assert = require("./assert");
70
+ import ValidationError = require("./validation-error");
71
+ export { validate, assert, ValidationError };