@ms-cloudpack/config 0.23.7 → 0.24.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/lib/checkMatch.d.ts +15 -0
- package/lib/checkMatch.d.ts.map +1 -0
- package/lib/checkMatch.js +27 -0
- package/lib/checkMatch.js.map +1 -0
- package/lib/getPackageSettings.d.ts +0 -14
- package/lib/getPackageSettings.d.ts.map +1 -1
- package/lib/getPackageSettings.js +1 -25
- package/lib/getPackageSettings.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/readAppConfig.d.ts +4 -1
- package/lib/readAppConfig.d.ts.map +1 -1
- package/lib/readAppConfig.js +6 -2
- package/lib/readAppConfig.js.map +1 -1
- package/lib/readGeneratedConfig.d.ts +2 -0
- package/lib/readGeneratedConfig.d.ts.map +1 -1
- package/lib/readGeneratedConfig.js +3 -1
- package/lib/readGeneratedConfig.js.map +1 -1
- package/lib/sortGeneratedConfig.d.ts.map +1 -1
- package/lib/sortGeneratedConfig.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PackageSettings } from '@ms-cloudpack/common-types';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the package is a match for the given package settings.
|
|
4
|
+
*/
|
|
5
|
+
export declare function checkMatch(params: {
|
|
6
|
+
/** The name of the package. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** The version of the package. */
|
|
9
|
+
version: string;
|
|
10
|
+
/** The match to check against. */
|
|
11
|
+
match: PackageSettings['match'];
|
|
12
|
+
/** If true, require an exact match for the name (don't process wildcards). */
|
|
13
|
+
exactMatch?: boolean;
|
|
14
|
+
}): boolean;
|
|
15
|
+
//# sourceMappingURL=checkMatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkMatch.d.ts","sourceRoot":"","sources":["../src/checkMatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE;IACjC,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IAChC,8EAA8E;IAC9E,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,OAAO,CAwBV"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { satisfies } from 'semver';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the package is a match for the given package settings.
|
|
4
|
+
*/
|
|
5
|
+
export function checkMatch(params) {
|
|
6
|
+
const { name, version, match, exactMatch } = params;
|
|
7
|
+
if (!match) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
let matchName;
|
|
11
|
+
let matchVersion;
|
|
12
|
+
if (typeof match === 'string') {
|
|
13
|
+
matchName = match;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
matchName = match?.name;
|
|
17
|
+
// If any version is allowed, unset the version to skip the satisfies() check for efficiency.
|
|
18
|
+
matchVersion = match?.version === '*' ? undefined : match?.version;
|
|
19
|
+
}
|
|
20
|
+
// For exact or non-wildcard matches, check the full name and possibly the version.
|
|
21
|
+
if (exactMatch || !matchName.endsWith('*')) {
|
|
22
|
+
return matchName === name && (!matchVersion || satisfies(version, matchVersion));
|
|
23
|
+
}
|
|
24
|
+
// Remove the trailing wildcard and check for a prefix match and possibly the version.
|
|
25
|
+
return name.startsWith(matchName.slice(0, -1)) && (!matchVersion || satisfies(version, matchVersion));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=checkMatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkMatch.js","sourceRoot":"","sources":["../src/checkMatch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,MAS1B;IACC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAEpD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,SAAiB,CAAC;IACtB,IAAI,YAAgC,CAAC;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,SAAS,GAAG,KAAK,CAAC;IACpB,CAAC;SAAM,CAAC;QACN,SAAS,GAAG,KAAK,EAAE,IAAI,CAAC;QACxB,6FAA6F;QAC7F,YAAY,GAAG,KAAK,EAAE,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC;IACrE,CAAC;IAED,mFAAmF;IACnF,IAAI,UAAU,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,OAAO,SAAS,KAAK,IAAI,IAAI,CAAC,CAAC,YAAY,IAAI,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;IACnF,CAAC;IAED,sFAAsF;IACtF,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,IAAI,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AACxG,CAAC","sourcesContent":["import type { PackageSettings } from '@ms-cloudpack/common-types';\nimport { satisfies } from 'semver';\n\n/**\n * Checks if the package is a match for the given package settings.\n */\nexport function checkMatch(params: {\n /** The name of the package. */\n name: string;\n /** The version of the package. */\n version: string;\n /** The match to check against. */\n match: PackageSettings['match'];\n /** If true, require an exact match for the name (don't process wildcards). */\n exactMatch?: boolean;\n}): boolean {\n const { name, version, match, exactMatch } = params;\n\n if (!match) {\n return true;\n }\n\n let matchName: string;\n let matchVersion: string | undefined;\n if (typeof match === 'string') {\n matchName = match;\n } else {\n matchName = match?.name;\n // If any version is allowed, unset the version to skip the satisfies() check for efficiency.\n matchVersion = match?.version === '*' ? undefined : match?.version;\n }\n\n // For exact or non-wildcard matches, check the full name and possibly the version.\n if (exactMatch || !matchName.endsWith('*')) {\n return matchName === name && (!matchVersion || satisfies(version, matchVersion));\n }\n\n // Remove the trailing wildcard and check for a prefix match and possibly the version.\n return name.startsWith(matchName.slice(0, -1)) && (!matchVersion || satisfies(version, matchVersion));\n}\n"]}
|
|
@@ -16,18 +16,4 @@ export declare function getPackageSettings(params: {
|
|
|
16
16
|
userPackageSettings: PackageSettings | undefined;
|
|
17
17
|
generatedPackageSettings: PackageSettings | undefined;
|
|
18
18
|
};
|
|
19
|
-
/**
|
|
20
|
-
* Checks if the package is a match for the given package settings.
|
|
21
|
-
* @returns True if the package is a match for the given package settings.
|
|
22
|
-
*/
|
|
23
|
-
export declare function checkMatch(params: {
|
|
24
|
-
/** The name of the package. */
|
|
25
|
-
name: string;
|
|
26
|
-
/** The version of the package. */
|
|
27
|
-
version: string;
|
|
28
|
-
/** The match to check against. */
|
|
29
|
-
match: PackageSettings['match'];
|
|
30
|
-
/** If true, require an exact match for the name (don't process wildcards). */
|
|
31
|
-
exactMatch?: boolean;
|
|
32
|
-
}): boolean;
|
|
33
19
|
//# sourceMappingURL=getPackageSettings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageSettings.d.ts","sourceRoot":"","sources":["../src/getPackageSettings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getPackageSettings.d.ts","sourceRoot":"","sources":["../src/getPackageSettings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAIlE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,EAAE,eAAe,EAAE,GAAG,SAAS,CAAC;IACnD,wBAAwB,EAAE,eAAe,EAAE,GAAG,SAAS,CAAC;IACxD;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG;IACF,mBAAmB,EAAE,eAAe,GAAG,SAAS,CAAC;IACjD,wBAAwB,EAAE,eAAe,GAAG,SAAS,CAAC;CACvD,CAUA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { satisfies } from 'semver';
|
|
2
1
|
import { mergePackageSettings } from './mergePackageSettings.js';
|
|
2
|
+
import { checkMatch } from './checkMatch.js';
|
|
3
3
|
/**
|
|
4
4
|
* Gets the single set of package settings for a given package using the given config.
|
|
5
5
|
*/
|
|
@@ -24,28 +24,4 @@ function filterSettings(params) {
|
|
|
24
24
|
const filteredSettings = packageSettings?.filter(({ match }) => checkMatch({ name, version, match }));
|
|
25
25
|
return filteredSettings?.length ? mergePackageSettings(filteredSettings) : undefined;
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Checks if the package is a match for the given package settings.
|
|
29
|
-
* @returns True if the package is a match for the given package settings.
|
|
30
|
-
*/
|
|
31
|
-
export function checkMatch(params) {
|
|
32
|
-
const { name, version, match, exactMatch } = params;
|
|
33
|
-
let matchName, matchVersion;
|
|
34
|
-
if (!match) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
else if (typeof match === 'string') {
|
|
38
|
-
matchName = match;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
matchName = match?.name;
|
|
42
|
-
matchVersion = match?.version === '*' ? undefined : match?.version;
|
|
43
|
-
}
|
|
44
|
-
// For exact or non-wildcard matches, check the full name and possibly the version.
|
|
45
|
-
if (exactMatch || !matchName.endsWith('*')) {
|
|
46
|
-
return matchName === name && (!matchVersion || satisfies(version, matchVersion));
|
|
47
|
-
}
|
|
48
|
-
// Remove the trailing wildcard and check for a prefix match and possibly the version.
|
|
49
|
-
return name.startsWith(matchName.slice(0, -1)) && (!matchVersion || satisfies(version, matchVersion));
|
|
50
|
-
}
|
|
51
27
|
//# sourceMappingURL=getPackageSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageSettings.js","sourceRoot":"","sources":["../src/getPackageSettings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getPackageSettings.js","sourceRoot":"","sources":["../src/getPackageSettings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAUlC;IAIC,MAAM,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,GAAG,MAAM,CAAC;IAEjE,OAAO;QACL,mBAAmB,EAAE,cAAc,CAAC,EAAE,GAAG,MAAM,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAC;QACxF,wBAAwB,EAAE,cAAc,CAAC;YACvC,GAAG,MAAM;YACT,eAAe,EAAE,wBAAwB;SAC1C,CAAC;KACH,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CACrB,MAEC;IAED,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAE9D,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,eAAe,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IAC5G,CAAC;IACD,MAAM,gBAAgB,GAAG,eAAe,EAAE,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACtG,OAAO,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACvF,CAAC","sourcesContent":["import type { PackageSettings } from '@ms-cloudpack/common-types';\nimport { mergePackageSettings } from './mergePackageSettings.js';\nimport { checkMatch } from './checkMatch.js';\n\n/**\n * Gets the single set of package settings for a given package using the given config.\n */\nexport function getPackageSettings(params: {\n name: string;\n version: string;\n userPackageSettings: PackageSettings[] | undefined;\n generatedPackageSettings: PackageSettings[] | undefined;\n /**\n * If true, only the first matching package settings will be returned, rather than the merge of all viable settings.\n * This is useful in the `init` case, where we want to attach new settings to the first matching entry.\n */\n firstMatch?: boolean;\n}): {\n userPackageSettings: PackageSettings | undefined;\n generatedPackageSettings: PackageSettings | undefined;\n} {\n const { userPackageSettings, generatedPackageSettings } = params;\n\n return {\n userPackageSettings: filterSettings({ ...params, packageSettings: userPackageSettings }),\n generatedPackageSettings: filterSettings({\n ...params,\n packageSettings: generatedPackageSettings,\n }),\n };\n}\n\n/**\n * Get the package settings for a given package name and version.\n */\nfunction filterSettings(\n params: Omit<Parameters<typeof getPackageSettings>[0], 'config'> & {\n packageSettings: PackageSettings[] | undefined;\n },\n): PackageSettings | undefined {\n const { name, version, packageSettings, firstMatch } = params;\n\n if (firstMatch) {\n return packageSettings?.find(({ match }) => checkMatch({ name, version, match, exactMatch: firstMatch }));\n }\n const filteredSettings = packageSettings?.filter(({ match }) => checkMatch({ name, version, match }));\n return filteredSettings?.length ? mergePackageSettings(filteredSettings) : undefined;\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
export { checkMatch } from './checkMatch.js';
|
|
1
2
|
export { configTemplate } from './configTemplate.js';
|
|
2
3
|
export { generatedConfigFileName, appConfigFileName } from './constants.js';
|
|
3
4
|
export { createPackageDefinitions } from './createPackageDefinitions.js';
|
|
4
5
|
export { getConfigPath } from './getConfigPath.js';
|
|
5
|
-
export { getPackageSettings
|
|
6
|
+
export { getPackageSettings } from './getPackageSettings.js';
|
|
6
7
|
export { readConfig } from './readConfig.js';
|
|
7
8
|
export { readGeneratedConfig } from './readGeneratedConfig.js';
|
|
8
9
|
export { readAppConfig } from './readAppConfig.js';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
export { checkMatch } from './checkMatch.js';
|
|
1
2
|
export { configTemplate } from './configTemplate.js';
|
|
2
3
|
export { generatedConfigFileName, appConfigFileName } from './constants.js';
|
|
3
4
|
export { createPackageDefinitions } from './createPackageDefinitions.js';
|
|
4
5
|
export { getConfigPath } from './getConfigPath.js';
|
|
5
|
-
export { getPackageSettings
|
|
6
|
+
export { getPackageSettings } from './getPackageSettings.js';
|
|
6
7
|
export { readConfig } from './readConfig.js';
|
|
7
8
|
export { readGeneratedConfig } from './readGeneratedConfig.js';
|
|
8
9
|
export { readAppConfig } from './readAppConfig.js';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC","sourcesContent":["export { checkMatch } from './checkMatch.js';\nexport { configTemplate } from './configTemplate.js';\nexport { generatedConfigFileName, appConfigFileName } from './constants.js';\nexport { createPackageDefinitions } from './createPackageDefinitions.js';\nexport { getConfigPath } from './getConfigPath.js';\nexport { getPackageSettings } from './getPackageSettings.js';\nexport { readConfig } from './readConfig.js';\nexport { readGeneratedConfig } from './readGeneratedConfig.js';\nexport { readAppConfig } from './readAppConfig.js';\nexport { writeGeneratedConfig } from './writeGeneratedConfig.js';\nexport { writeAppConfig } from './writeAppConfig.js';\nexport { ensureGeneratedSettingsForPackage } from './ensureGeneratedSettingsForPackage.js';\n"]}
|
package/lib/readAppConfig.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { AppConfig } from '@ms-cloudpack/common-types';
|
|
2
2
|
/**
|
|
3
|
-
* Reads the user config file and merges with any parent configs asynchronously.
|
|
3
|
+
* Reads the user config file and merges with any parent configs asynchronously.
|
|
4
|
+
* Note this is only useful for making modifications to the user config.
|
|
4
5
|
* For a full merged representation of config, use `readConfig` instead.
|
|
6
|
+
*
|
|
7
|
+
* Throws an error if the config file exists but is not valid JSON (or there's some error reading it).
|
|
5
8
|
*/
|
|
6
9
|
export declare function readAppConfig(appPath: string): Promise<AppConfig>;
|
|
7
10
|
//# sourceMappingURL=readAppConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readAppConfig.d.ts","sourceRoot":"","sources":["../src/readAppConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAM5D
|
|
1
|
+
{"version":3,"file":"readAppConfig.d.ts","sourceRoot":"","sources":["../src/readAppConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAM5D;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAIvE"}
|
package/lib/readAppConfig.js
CHANGED
|
@@ -3,8 +3,11 @@ import { getConfigPath } from './getConfigPath.js';
|
|
|
3
3
|
import { mergeParentConfig } from './mergeParentConfig.js';
|
|
4
4
|
import { resolveParentConfig } from './resolveParentConfig.js';
|
|
5
5
|
/**
|
|
6
|
-
* Reads the user config file and merges with any parent configs asynchronously.
|
|
6
|
+
* Reads the user config file and merges with any parent configs asynchronously.
|
|
7
|
+
* Note this is only useful for making modifications to the user config.
|
|
7
8
|
* For a full merged representation of config, use `readConfig` instead.
|
|
9
|
+
*
|
|
10
|
+
* Throws an error if the config file exists but is not valid JSON (or there's some error reading it).
|
|
8
11
|
*/
|
|
9
12
|
export async function readAppConfig(appPath) {
|
|
10
13
|
const { appConfigPath } = getConfigPath(appPath);
|
|
@@ -12,9 +15,10 @@ export async function readAppConfig(appPath) {
|
|
|
12
15
|
}
|
|
13
16
|
/**
|
|
14
17
|
* Reads the user config, with any `extends` parent configs merged in.
|
|
18
|
+
* Throws an error if the config file exists but is not valid JSON, or there's some error reading it.
|
|
15
19
|
*/
|
|
16
20
|
async function readAppConfigInternal(configPath) {
|
|
17
|
-
const AppConfig = await readJson(configPath, {
|
|
21
|
+
const AppConfig = await readJson(configPath, { mode: 'permissive', throwOnError: true });
|
|
18
22
|
if (!AppConfig) {
|
|
19
23
|
return undefined;
|
|
20
24
|
}
|
package/lib/readAppConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readAppConfig.js","sourceRoot":"","sources":["../src/readAppConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D
|
|
1
|
+
{"version":3,"file":"readAppConfig.js","sourceRoot":"","sources":["../src/readAppConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAe;IACjD,MAAM,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAEjD,OAAO,CAAC,MAAM,qBAAqB,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,qBAAqB,CAAC,UAAkB;IACrD,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAY,UAAU,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;IACpG,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO;QACpC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC;YAChC,CAAC,CAAC,SAAS,CAAC,OAAO;YACnB,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC;QACvB,CAAC,CAAC,EAAE,CAAC;IAEP,2CAA2C;IAC3C,MAAM,aAAa,GAAgB,EAAE,CAAC;IACtC,KAAK,MAAM,eAAe,IAAI,YAAY,EAAE,CAAC;QAC3C,MAAM,YAAY,GAAG,mBAAmB,CAAC,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC,CAAC;QAC1E,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,YAAY,GAAG,MAAM,qBAAqB,CAAC,YAAY,CAAC,CAAC;YAC/D,IAAI,YAAY,EAAE,CAAC;gBACjB,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,uBAAuB,CAAC,iBAAiB,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC;AAClF,CAAC;AAED;;GAEG;AACH,SAAS,uBAAuB,CAAC,MAAiB;IAChD,sCAAsC;IACtC,MAAM,EAAE,SAAS,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;IAEnD,IAAI,SAAS,EAAE,MAAM,EAAE,CAAC;QACtB,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QACjC,OAAO,SAAS,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE,CAAC;QACtC,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YACxB,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;YACtC,OAAO,OAAO,CAAC,WAAW,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;IACd,qCAAqC;AACvC,CAAC","sourcesContent":["import type { AppConfig } from '@ms-cloudpack/common-types';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport { getConfigPath } from './getConfigPath.js';\nimport { mergeParentConfig } from './mergeParentConfig.js';\nimport { resolveParentConfig } from './resolveParentConfig.js';\n\n/**\n * Reads the user config file and merges with any parent configs asynchronously.\n * Note this is only useful for making modifications to the user config.\n * For a full merged representation of config, use `readConfig` instead.\n *\n * Throws an error if the config file exists but is not valid JSON (or there's some error reading it).\n */\nexport async function readAppConfig(appPath: string): Promise<AppConfig> {\n const { appConfigPath } = getConfigPath(appPath);\n\n return (await readAppConfigInternal(appConfigPath)) || {};\n}\n\n/**\n * Reads the user config, with any `extends` parent configs merged in.\n * Throws an error if the config file exists but is not valid JSON, or there's some error reading it.\n */\nasync function readAppConfigInternal(configPath: string): Promise<AppConfig | undefined> {\n const AppConfig = await readJson<AppConfig>(configPath, { mode: 'permissive', throwOnError: true });\n if (!AppConfig) {\n return undefined;\n }\n\n const extendsArray = AppConfig.extends\n ? Array.isArray(AppConfig.extends)\n ? AppConfig.extends\n : [AppConfig.extends]\n : [];\n\n // Recursively read any parent config files\n const parentConfigs: AppConfig[] = [];\n for (const importSpecifier of extendsArray) {\n const resolvedPath = resolveParentConfig({ configPath, importSpecifier });\n if (resolvedPath) {\n const parentConfig = await readAppConfigInternal(resolvedPath);\n if (parentConfig) {\n parentConfigs.push(parentConfig);\n }\n }\n }\n\n return processDeprecatedValues(mergeParentConfig({ AppConfig, parentConfigs }));\n}\n\n/**\n * Delete deprecated values and convert them to the new format. (This mutates the `config` object.)\n */\nfunction processDeprecatedValues(config: AppConfig) {\n /* eslint-disable etc/no-deprecated */\n const { devServer, packageSettings = [] } = config;\n\n if (devServer?.routes) {\n config.routes = devServer.routes;\n delete devServer.routes;\n }\n\n for (const setting of packageSettings) {\n if (setting.bundlerType) {\n setting.bundler = setting.bundlerType;\n delete setting.bundlerType;\n }\n }\n\n return config;\n /* eslint-enable etc/no-deprecated */\n}\n"]}
|
|
@@ -2,6 +2,8 @@ import type { GeneratedConfig } from '@ms-cloudpack/common-types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Reads the generated config file asynchronously. This is only useful for the `init` verb generating or updated
|
|
4
4
|
* the generated overrides. For a full merged representation of config, use `readConfig` instead.
|
|
5
|
+
*
|
|
6
|
+
* Throws an error if the config file exists but is not valid JSON (or there's some error reading it).
|
|
5
7
|
*/
|
|
6
8
|
export declare function readGeneratedConfig(appPath: string): Promise<GeneratedConfig>;
|
|
7
9
|
//# sourceMappingURL=readGeneratedConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readGeneratedConfig.d.ts","sourceRoot":"","sources":["../src/readGeneratedConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,4BAA4B,CAAC;AAEnF
|
|
1
|
+
{"version":3,"file":"readGeneratedConfig.d.ts","sourceRoot":"","sources":["../src/readGeneratedConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,4BAA4B,CAAC;AAEnF;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAMnF"}
|
|
@@ -3,10 +3,12 @@ import { getConfigPath } from './getConfigPath.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* Reads the generated config file asynchronously. This is only useful for the `init` verb generating or updated
|
|
5
5
|
* the generated overrides. For a full merged representation of config, use `readConfig` instead.
|
|
6
|
+
*
|
|
7
|
+
* Throws an error if the config file exists but is not valid JSON (or there's some error reading it).
|
|
6
8
|
*/
|
|
7
9
|
export async function readGeneratedConfig(appPath) {
|
|
8
10
|
const { generatedConfigPath } = getConfigPath(appPath);
|
|
9
|
-
return processDeprecatedValues((await readJson(generatedConfigPath, {
|
|
11
|
+
return processDeprecatedValues((await readJson(generatedConfigPath, { throwOnError: true, mode: 'permissive' })) || {});
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Delete deprecated values and convert them to the new format. Note that this function
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readGeneratedConfig.js","sourceRoot":"","sources":["../src/readGeneratedConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD
|
|
1
|
+
{"version":3,"file":"readGeneratedConfig.js","sourceRoot":"","sources":["../src/readGeneratedConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAAe;IACvD,MAAM,EAAE,mBAAmB,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAEvD,OAAO,uBAAuB,CAC5B,CAAC,MAAM,QAAQ,CAAC,mBAAmB,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE,CACxF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,uBAAuB,CAAC,MAAuB;IACtD,6CAA6C;IAC7C,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC;IAEpC,8EAA8E;IAC9E,IAAI,gBAAgB,EAAE,CAAC;QACrB,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,EAAE,CAAC;QAEtD,KAAK,MAAM,QAAQ,IAAI,gBAAgB,EAAE,CAAC;YACxC,MAAM,QAAQ,GAAoB;gBAChC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,kBAAkB,EAAE;gBACpE,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,OAAO;aACpC,CAAC;YACF,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxC,CAAC;QAED,6CAA6C;QAC7C,OAAO,MAAM,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { readJson } from '@ms-cloudpack/json-utilities';\nimport { getConfigPath } from './getConfigPath.js';\nimport type { GeneratedConfig, PackageSettings } from '@ms-cloudpack/common-types';\n\n/**\n * Reads the generated config file asynchronously. This is only useful for the `init` verb generating or updated\n * the generated overrides. For a full merged representation of config, use `readConfig` instead.\n *\n * Throws an error if the config file exists but is not valid JSON (or there's some error reading it).\n */\nexport async function readGeneratedConfig(appPath: string): Promise<GeneratedConfig> {\n const { generatedConfigPath } = getConfigPath(appPath);\n\n return processDeprecatedValues(\n (await readJson(generatedConfigPath, { throwOnError: true, mode: 'permissive' })) || {},\n );\n}\n\n/**\n * Delete deprecated values and convert them to the new format. Note that this function\n * mutates the passed-in config object to avoid reallocation.\n */\nfunction processDeprecatedValues(config: GeneratedConfig) {\n // eslint-disable-next-line etc/no-deprecated\n const { packageOverrides } = config;\n\n // Convert package overrides into settings to preserve the deprecated support.\n if (packageOverrides) {\n config.packageSettings = config.packageSettings || [];\n\n for (const override of packageOverrides) {\n const settings: PackageSettings = {\n match: { name: override.name, version: override.versionRequirement },\n exports: override.overrides.exports,\n };\n config.packageSettings.push(settings);\n }\n\n // eslint-disable-next-line etc/no-deprecated\n delete config.packageOverrides;\n }\n\n return config;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortGeneratedConfig.d.ts","sourceRoot":"","sources":["../src/sortGeneratedConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"sortGeneratedConfig.d.ts","sourceRoot":"","sources":["../src/sortGeneratedConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAyC,MAAM,4BAA4B,CAAC;AAKzG;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,eAAe,QAmC7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortGeneratedConfig.js","sourceRoot":"","sources":["../src/sortGeneratedConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAA0B;IAC5D,6CAA6C;IAC7C,MAAM,EAAE,eAAe,GAAG,EAAE,EAAE,gBAAgB,EAAE,GAAG,SAAS,CAAC;IAE7D,qFAAqF;IACrF,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACzC,eAAe,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChD,8DAA8D;QAC9D,MAAM,eAAe,GAAG,eAAe,CAAC,CAAC,CAAwB,CAAC;QAClE,MAAM,gBAAgB,GAGlB;YACF,mEAAmE;YACnE,KAAK,EAAE,eAAe,CAAC,KAAK;SAC7B,CAAC;QAEF,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,EAA+B,EAAE,CAAC;YACnF,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;gBACpB,mEAAmE;gBACnE,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;gBACnC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBACzB,gBAAgB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;gBACvC,CAAC;qBAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;oBACvD,gBAAgB,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;gBAChD,CAAC;qBAAM,CAAC;oBACN,gBAAgB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;gBAChC,CAAC;YACH,CAAC;QACH,CAAC;QAED,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;IACjD,CAAC;AACH,CAAC","sourcesContent":["import type { GeneratedConfig, PackageSettings } from '@ms-cloudpack/common-types';\nimport { sortObjectKeys } from './sortObjectKeys.js';\nimport { compareSettings } from './compareSettings.js';\nimport { compareOverrides } from './compareOverrides.js';\n\n/**\n * Sorts the generated config so that we don't have unneeded changes due to differences in\n * order of operations.\n */\nexport function sortGeneratedConfig(generated: GeneratedConfig) {\n // eslint-disable-next-line etc/no-deprecated\n const { packageSettings = [], packageOverrides } = generated;\n\n // Ensure package overrides are sorted based on package name and version requirement.\n packageOverrides?.sort(compareOverrides);\n packageSettings.sort(compareSettings);\n\n for (let i = 0; i < packageSettings.length; i++) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const originalSetting = packageSettings[i] as Record<string, any>;\n const formattedSetting: {\n match:
|
|
1
|
+
{"version":3,"file":"sortGeneratedConfig.js","sourceRoot":"","sources":["../src/sortGeneratedConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAA0B;IAC5D,6CAA6C;IAC7C,MAAM,EAAE,eAAe,GAAG,EAAE,EAAE,gBAAgB,EAAE,GAAG,SAAS,CAAC;IAE7D,qFAAqF;IACrF,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACzC,eAAe,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChD,8DAA8D;QAC9D,MAAM,eAAe,GAAG,eAAe,CAAC,CAAC,CAAwB,CAAC;QAClE,MAAM,gBAAgB,GAGlB;YACF,mEAAmE;YACnE,KAAK,EAAE,eAAe,CAAC,KAAK;SAC7B,CAAC;QAEF,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,EAA+B,EAAE,CAAC;YACnF,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;gBACpB,mEAAmE;gBACnE,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;gBACnC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBACzB,gBAAgB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;gBACvC,CAAC;qBAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;oBACvD,gBAAgB,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;gBAChD,CAAC;qBAAM,CAAC;oBACN,gBAAgB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;gBAChC,CAAC;YACH,CAAC;QACH,CAAC;QAED,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;IACjD,CAAC;AACH,CAAC","sourcesContent":["import type { GeneratedConfig, PackageSettings, PackageSettingsMatch } from '@ms-cloudpack/common-types';\nimport { sortObjectKeys } from './sortObjectKeys.js';\nimport { compareSettings } from './compareSettings.js';\nimport { compareOverrides } from './compareOverrides.js';\n\n/**\n * Sorts the generated config so that we don't have unneeded changes due to differences in\n * order of operations.\n */\nexport function sortGeneratedConfig(generated: GeneratedConfig) {\n // eslint-disable-next-line etc/no-deprecated\n const { packageSettings = [], packageOverrides } = generated;\n\n // Ensure package overrides are sorted based on package name and version requirement.\n packageOverrides?.sort(compareOverrides);\n packageSettings.sort(compareSettings);\n\n for (let i = 0; i < packageSettings.length; i++) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const originalSetting = packageSettings[i] as Record<string, any>;\n const formattedSetting: {\n match: PackageSettingsMatch;\n [key: string]: unknown;\n } = {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n match: originalSetting.match,\n };\n\n for (const key of Object.keys(originalSetting).sort() as (keyof PackageSettings)[]) {\n if (key !== 'match') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const value = originalSetting[key];\n if (Array.isArray(value)) {\n formattedSetting[key] = value.sort();\n } else if (typeof value === 'object' && value !== null) {\n formattedSetting[key] = sortObjectKeys(value);\n } else {\n formattedSetting[key] = value;\n }\n }\n }\n\n packageSettings.splice(i, 1, formattedSetting);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Configuration handling for cloudpack.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@ms-cloudpack/common-types": "^0.13.
|
|
18
|
-
"@ms-cloudpack/json-utilities": "^0.1.
|
|
19
|
-
"@ms-cloudpack/package-utilities": "^8.0.
|
|
17
|
+
"@ms-cloudpack/common-types": "^0.13.3",
|
|
18
|
+
"@ms-cloudpack/json-utilities": "^0.1.6",
|
|
19
|
+
"@ms-cloudpack/package-utilities": "^8.0.1",
|
|
20
20
|
"import-meta-resolve": "^4.0.0",
|
|
21
21
|
"semver": "^7.6.0"
|
|
22
22
|
},
|