@dotcom-tool-kit/config 1.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 +26 -0
- package/lib/index.d.ts +60 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +2 -0
- package/package.json +18 -0
- package/src/index.ts +51 -0
- package/tsconfig.json +15 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0 (2024-09-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* rename SchemaOptions to PluginOptions
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **cli:** add support for tags in config that resolve based on options ([8df97b9](https://github.com/Financial-Times/dotcom-tool-kit/commit/8df97b9e6d595740d4b94f34fe5a3f0dccef0994))
|
|
13
|
+
* collect and store the hook-managed files in config ([190afc5](https://github.com/Financial-Times/dotcom-tool-kit/commit/190afc50bdbded129d3e090ebb0e041ba8443b27))
|
|
14
|
+
* load plugin rcfile task options into config ([3f1b1b1](https://github.com/Financial-Times/dotcom-tool-kit/commit/3f1b1b149e9e5c9c0d00b7f85697469b0ece472a))
|
|
15
|
+
* split remaining bits of types into config and plugins packages ([6cde9b9](https://github.com/Financial-Times/dotcom-tool-kit/commit/6cde9b90d4cd02383ae1b18ca38e0843e6c3d3ab))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **cli:** avoid hook installation conflicts between niblings ([1d70759](https://github.com/Financial-Times/dotcom-tool-kit/commit/1d70759a8139dca5c4d45f6833828914a47e96f0))
|
|
21
|
+
* remove conflicts from task options in valid config type ([5c8a1e0](https://github.com/Financial-Times/dotcom-tool-kit/commit/5c8a1e0845eac058d76512d86702bf9805572f55))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Code Refactoring
|
|
25
|
+
|
|
26
|
+
* rename SchemaOptions to PluginOptions ([0ce24db](https://github.com/Financial-Times/dotcom-tool-kit/commit/0ce24db808d077a0e4647d3bef9eaf55223a1cdf))
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Validated } from '@dotcom-tool-kit/validated';
|
|
2
|
+
import type { CommandTask, EntryPoint, Plugin, OptionsForPlugin, OptionsForTask } from '@dotcom-tool-kit/plugin';
|
|
3
|
+
import type { PluginOptions } from '@dotcom-tool-kit/schemas';
|
|
4
|
+
import type { Conflict } from '@dotcom-tool-kit/conflict';
|
|
5
|
+
export interface RawConfig {
|
|
6
|
+
root: string;
|
|
7
|
+
plugins: {
|
|
8
|
+
[id: string]: Validated<Plugin>;
|
|
9
|
+
};
|
|
10
|
+
resolutionTrackers: {
|
|
11
|
+
resolvedPluginOptions: Set<string>;
|
|
12
|
+
substitutedPlugins: Set<string>;
|
|
13
|
+
resolvedPlugins: Set<string>;
|
|
14
|
+
reducedInstallationPlugins: Set<string>;
|
|
15
|
+
};
|
|
16
|
+
tasks: {
|
|
17
|
+
[id: string]: EntryPoint | Conflict<EntryPoint>;
|
|
18
|
+
};
|
|
19
|
+
commandTasks: {
|
|
20
|
+
[id: string]: CommandTask | Conflict<CommandTask>;
|
|
21
|
+
};
|
|
22
|
+
pluginOptions: {
|
|
23
|
+
[id: string]: OptionsForPlugin | Conflict<OptionsForPlugin> | undefined;
|
|
24
|
+
};
|
|
25
|
+
taskOptions: {
|
|
26
|
+
[id: string]: OptionsForTask | Conflict<OptionsForTask> | undefined;
|
|
27
|
+
};
|
|
28
|
+
hooks: {
|
|
29
|
+
[id: string]: EntryPoint | Conflict<EntryPoint>;
|
|
30
|
+
};
|
|
31
|
+
inits: EntryPoint[];
|
|
32
|
+
hookManagedFiles: Set<string>;
|
|
33
|
+
}
|
|
34
|
+
export type ValidPluginsConfig = Omit<RawConfig, 'plugins'> & {
|
|
35
|
+
plugins: {
|
|
36
|
+
[id: string]: Plugin;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type ValidOptionsForPlugin<Id extends keyof PluginOptions> = Omit<OptionsForPlugin, 'options'> & {
|
|
40
|
+
options: PluginOptions[Id];
|
|
41
|
+
};
|
|
42
|
+
export type ValidPluginOptions = {
|
|
43
|
+
[Id in keyof PluginOptions]: ValidOptionsForPlugin<Id>;
|
|
44
|
+
};
|
|
45
|
+
export type ValidConfig = Omit<ValidPluginsConfig, 'tasks' | 'commandTasks' | 'pluginOptions' | 'taskOptions' | 'hooks'> & {
|
|
46
|
+
tasks: {
|
|
47
|
+
[id: string]: EntryPoint;
|
|
48
|
+
};
|
|
49
|
+
commandTasks: {
|
|
50
|
+
[id: string]: CommandTask;
|
|
51
|
+
};
|
|
52
|
+
pluginOptions: ValidPluginOptions;
|
|
53
|
+
taskOptions: {
|
|
54
|
+
[id: string]: OptionsForTask;
|
|
55
|
+
};
|
|
56
|
+
hooks: {
|
|
57
|
+
[id: string]: EntryPoint;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,cAAc,EACf,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAEzD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAA;K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CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;KAC9B,EAAE,IAAI,MAAM,aAAa,GAAG,qBAAqB,CAAC,EAAE,CAAC;CACvD,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,CAC5B,kBAAkB,EAClB,OAAO,GAAG,cAAc,GAAG,eAAe,GAAG,aAAa,GAAG,OAAO,CACrE,GAAG;IACF,KAAK,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE,CAAA;IACnC,YAAY,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,CAAA;KAAE,CAAA;IAC3C,aAAa,EAAE,kBAAkB,CAAA;IACjC,WAAW,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,CAAA;IAC7C,KAAK,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE,CAAA;CACpC,CAAA"}
|
package/lib/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dotcom-tool-kit/config",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "lib",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@dotcom-tool-kit/conflict": "^1.0.0",
|
|
14
|
+
"@dotcom-tool-kit/plugin": "^1.0.0",
|
|
15
|
+
"@dotcom-tool-kit/schemas": "^1.0.0",
|
|
16
|
+
"@dotcom-tool-kit/validated": "^1.0.0"
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Validated } from '@dotcom-tool-kit/validated'
|
|
2
|
+
import type {
|
|
3
|
+
CommandTask,
|
|
4
|
+
EntryPoint,
|
|
5
|
+
Plugin,
|
|
6
|
+
OptionsForPlugin,
|
|
7
|
+
OptionsForTask
|
|
8
|
+
} from '@dotcom-tool-kit/plugin'
|
|
9
|
+
import type { PluginOptions } from '@dotcom-tool-kit/schemas'
|
|
10
|
+
import type { Conflict } from '@dotcom-tool-kit/conflict'
|
|
11
|
+
|
|
12
|
+
export interface RawConfig {
|
|
13
|
+
root: string
|
|
14
|
+
plugins: { [id: string]: Validated<Plugin> }
|
|
15
|
+
resolutionTrackers: {
|
|
16
|
+
resolvedPluginOptions: Set<string>
|
|
17
|
+
substitutedPlugins: Set<string>
|
|
18
|
+
resolvedPlugins: Set<string>
|
|
19
|
+
reducedInstallationPlugins: Set<string>
|
|
20
|
+
}
|
|
21
|
+
tasks: { [id: string]: EntryPoint | Conflict<EntryPoint> }
|
|
22
|
+
commandTasks: { [id: string]: CommandTask | Conflict<CommandTask> }
|
|
23
|
+
pluginOptions: { [id: string]: OptionsForPlugin | Conflict<OptionsForPlugin> | undefined }
|
|
24
|
+
taskOptions: { [id: string]: OptionsForTask | Conflict<OptionsForTask> | undefined }
|
|
25
|
+
hooks: { [id: string]: EntryPoint | Conflict<EntryPoint> }
|
|
26
|
+
inits: EntryPoint[]
|
|
27
|
+
hookManagedFiles: Set<string>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type ValidPluginsConfig = Omit<RawConfig, 'plugins'> & {
|
|
31
|
+
plugins: { [id: string]: Plugin }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type ValidOptionsForPlugin<Id extends keyof PluginOptions> = Omit<OptionsForPlugin, 'options'> & {
|
|
35
|
+
options: PluginOptions[Id]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type ValidPluginOptions = {
|
|
39
|
+
[Id in keyof PluginOptions]: ValidOptionsForPlugin<Id>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type ValidConfig = Omit<
|
|
43
|
+
ValidPluginsConfig,
|
|
44
|
+
'tasks' | 'commandTasks' | 'pluginOptions' | 'taskOptions' | 'hooks'
|
|
45
|
+
> & {
|
|
46
|
+
tasks: { [id: string]: EntryPoint }
|
|
47
|
+
commandTasks: { [id: string]: CommandTask }
|
|
48
|
+
pluginOptions: ValidPluginOptions
|
|
49
|
+
taskOptions: { [id: string]: OptionsForTask }
|
|
50
|
+
hooks: { [id: string]: EntryPoint }
|
|
51
|
+
}
|