@ms-cloudpack/config 0.35.1 → 0.35.3

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.
@@ -17,7 +17,7 @@ export declare const fileHeaderComment = "/**\n * THIS FILE IS AUTO-GENERATED.\n
17
17
  */
18
18
  export declare function writeGeneratedConfig(config: GeneratedConfig, appPath: string): Promise<'written' | 'deleted' | 'no-op'>;
19
19
  /**
20
- * Due to optimization, some package settings may end up with a "match" key but nothing else.
20
+ * Due to optimization, some package settings may end up with empty settings.
21
21
  * These would add useless bloat, so filter them out before writing the generated config.
22
22
  * This function removes those settings by mutating the input generated config.
23
23
  */
@@ -1 +1 @@
1
- {"version":3,"file":"writeGeneratedConfig.d.ts","sourceRoot":"","sources":["../../src/writeConfig/writeGeneratedConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAOlE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,oFAAoF,CAAC;AAEnH;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC,CAwB1C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAElE"}
1
+ {"version":3,"file":"writeGeneratedConfig.d.ts","sourceRoot":"","sources":["../../src/writeConfig/writeGeneratedConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAOlE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,oFAAoF,CAAC;AAEnH;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC,CAwB1C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAsBlE"}
@@ -37,11 +37,29 @@ export async function writeGeneratedConfig(config, appPath) {
37
37
  return 'written';
38
38
  }
39
39
  /**
40
- * Due to optimization, some package settings may end up with a "match" key but nothing else.
40
+ * Due to optimization, some package settings may end up with empty settings.
41
41
  * These would add useless bloat, so filter them out before writing the generated config.
42
42
  * This function removes those settings by mutating the input generated config.
43
43
  */
44
44
  export function cleanGeneratedConfig(config) {
45
- config.packageSettings = config.packageSettings?.filter((s) => Object.keys(s).length > 1);
45
+ if (!config.packageSettings) {
46
+ return;
47
+ }
48
+ // Remove empty settings
49
+ config.packageSettings.forEach((s) => {
50
+ if (s.exports && Object.keys(s.exports).length === 0) {
51
+ delete s.exports;
52
+ }
53
+ if (s.dynamicImports?.length === 0) {
54
+ delete s.dynamicImports;
55
+ }
56
+ if (s.excludedDependencies?.length === 0) {
57
+ delete s.excludedDependencies;
58
+ }
59
+ if (s.includedDependencies?.length === 0) {
60
+ delete s.includedDependencies;
61
+ }
62
+ });
63
+ config.packageSettings = config.packageSettings.filter((s) => Object.keys(s).length > 1);
46
64
  }
47
65
  //# sourceMappingURL=writeGeneratedConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"writeGeneratedConfig.js","sourceRoot":"","sources":["../../src/writeConfig/writeGeneratedConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,iFAAiF,CAAC;AAEnH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAuB,EACvB,OAAe;IAEf,MAAM,EAAE,mBAAmB,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAEvD,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAE5B,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAE7B,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;QACpC,IAAI,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,CAAC;YACvC,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;YACnC,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,SAAS,CACb,mBAAmB,EACnB;QACE,OAAO,EAAE,2BAA2B;QACpC,GAAG,MAAM;KACV,EACD,EAAE,iBAAiB,EAAE,CACtB,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAuB;IAC1D,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC5F,CAAC","sourcesContent":["import type { GeneratedConfig } from '@ms-cloudpack/common-types';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport fs from 'fs';\nimport { getConfigPath } from '../getConfigPath.js';\nimport { generatedAppConfigSchemaUrl } from '../constants.js';\nimport { sortGeneratedConfig } from './sortGeneratedConfig.js';\n\n/**\n * Comment added to the top of the generated file (exported for testing only).\n * @internal\n */\nexport const fileHeaderComment = `/**\\n * THIS FILE IS AUTO-GENERATED.\\n * DO NOT MANUALLY EDIT THIS FILE.\\n */\\n`;\n\n/**\n * Clean up the generated config (sort it and remove empty settings) and write it to\n * cloudpack.generated.json. This is used at the end of `init`.\n *\n * If the config file exists but is no longer needed, it will be deleted.\n *\n * @returns\n * - `'written'` if the config was written\n * - `'deleted'` if the config previously existed but is now empty and was deleted\n * - `'no-op'` if the config didn't previously exist and is still empty\n */\nexport async function writeGeneratedConfig(\n config: GeneratedConfig,\n appPath: string,\n): Promise<'written' | 'deleted' | 'no-op'> {\n const { generatedConfigPath } = getConfigPath(appPath);\n\n sortGeneratedConfig(config);\n\n cleanGeneratedConfig(config);\n\n if (!config.packageSettings?.length) {\n if (fs.existsSync(generatedConfigPath)) {\n fs.unlinkSync(generatedConfigPath);\n return 'deleted';\n }\n return 'no-op';\n }\n\n await writeJson(\n generatedConfigPath,\n {\n $schema: generatedAppConfigSchemaUrl,\n ...config,\n },\n { fileHeaderComment },\n );\n return 'written';\n}\n\n/**\n * Due to optimization, some package settings may end up with a \"match\" key but nothing else.\n * These would add useless bloat, so filter them out before writing the generated config.\n * This function removes those settings by mutating the input generated config.\n */\nexport function cleanGeneratedConfig(config: GeneratedConfig): void {\n config.packageSettings = config.packageSettings?.filter((s) => Object.keys(s).length > 1);\n}\n"]}
1
+ {"version":3,"file":"writeGeneratedConfig.js","sourceRoot":"","sources":["../../src/writeConfig/writeGeneratedConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,iFAAiF,CAAC;AAEnH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAuB,EACvB,OAAe;IAEf,MAAM,EAAE,mBAAmB,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IA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MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC3F,CAAC","sourcesContent":["import type { GeneratedConfig } from '@ms-cloudpack/common-types';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport fs from 'fs';\nimport { getConfigPath } from '../getConfigPath.js';\nimport { generatedAppConfigSchemaUrl } from '../constants.js';\nimport { sortGeneratedConfig } from './sortGeneratedConfig.js';\n\n/**\n * Comment added to the top of the generated file (exported for testing only).\n * @internal\n */\nexport const fileHeaderComment = `/**\\n * THIS FILE IS AUTO-GENERATED.\\n * DO NOT MANUALLY EDIT THIS FILE.\\n */\\n`;\n\n/**\n * Clean up the generated config (sort it and remove empty settings) and write it to\n * cloudpack.generated.json. This is used at the end of `init`.\n *\n * If the config file exists but is no longer needed, it will be deleted.\n *\n * @returns\n * - `'written'` if the config was written\n * - `'deleted'` if the config previously existed but is now empty and was deleted\n * - `'no-op'` if the config didn't previously exist and is still empty\n */\nexport async function writeGeneratedConfig(\n config: GeneratedConfig,\n appPath: string,\n): Promise<'written' | 'deleted' | 'no-op'> {\n const { generatedConfigPath } = getConfigPath(appPath);\n\n sortGeneratedConfig(config);\n\n cleanGeneratedConfig(config);\n\n if (!config.packageSettings?.length) {\n if (fs.existsSync(generatedConfigPath)) {\n fs.unlinkSync(generatedConfigPath);\n return 'deleted';\n }\n return 'no-op';\n }\n\n await writeJson(\n generatedConfigPath,\n {\n $schema: generatedAppConfigSchemaUrl,\n ...config,\n },\n { fileHeaderComment },\n );\n return 'written';\n}\n\n/**\n * Due to optimization, some package settings may end up with empty settings.\n * These would add useless bloat, so filter them out before writing the generated config.\n * This function removes those settings by mutating the input generated config.\n */\nexport function cleanGeneratedConfig(config: GeneratedConfig): void {\n if (!config.packageSettings) {\n return;\n }\n\n // Remove empty settings\n config.packageSettings.forEach((s) => {\n if (s.exports && Object.keys(s.exports).length === 0) {\n delete s.exports;\n }\n if (s.dynamicImports?.length === 0) {\n delete s.dynamicImports;\n }\n if (s.excludedDependencies?.length === 0) {\n delete s.excludedDependencies;\n }\n if (s.includedDependencies?.length === 0) {\n delete s.includedDependencies;\n }\n });\n\n config.packageSettings = config.packageSettings.filter((s) => Object.keys(s).length > 1);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/config",
3
- "version": "0.35.1",
3
+ "version": "0.35.3",
4
4
  "description": "Configuration handling for cloudpack.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,12 +14,12 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@ms-cloudpack/common-types": "^0.24.16",
17
+ "@ms-cloudpack/common-types": "^0.24.17",
18
18
  "@ms-cloudpack/environment": "^0.1.1",
19
19
  "@ms-cloudpack/json-utilities": "^0.1.10",
20
- "@ms-cloudpack/package-utilities": "^12.3.4",
20
+ "@ms-cloudpack/package-utilities": "^12.3.5",
21
21
  "@ms-cloudpack/path-string-parsing": "^1.2.7",
22
- "@ms-cloudpack/path-utilities": "^3.1.1",
22
+ "@ms-cloudpack/path-utilities": "^3.1.2",
23
23
  "semver": "^7.6.0"
24
24
  },
25
25
  "devDependencies": {