@ms-cloudpack/config 0.7.4 → 0.7.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/lib/config.d.ts CHANGED
@@ -6,7 +6,7 @@ export declare const generatedConfigFileName = "cloudpack.generated.json";
6
6
  * @param cwd - base path of the config file
7
7
  * @returns the path of the config file
8
8
  */
9
- export declare function getConfigPath(cwd?: string): {
9
+ export declare function getConfigPath(cwd: string): {
10
10
  configPath: string;
11
11
  overridesPath: string;
12
12
  };
@@ -15,17 +15,17 @@ export declare function getConfigPath(cwd?: string): {
15
15
  * @param cwd - base path of the config file
16
16
  * @returns cloudpack config object or empty object if no config file exists.
17
17
  */
18
- export declare function readConfigSync(cwd?: string): CloudpackConfig;
18
+ export declare function readConfigSync(cwd: string): CloudpackConfig;
19
19
  /**
20
20
  * Reads the config file asynchronously
21
21
  * @param cwd - base path of the config file
22
22
  * @returns cloudpack config object or empty object if no config file exists.
23
23
  */
24
- export declare function readConfig(cwd?: string): Promise<CloudpackConfig>;
24
+ export declare function readConfig(cwd: string): Promise<CloudpackConfig>;
25
25
  /**
26
26
  * Writes generated config. This is used for `init` to provide package overrides needed.
27
27
  * @param config - updated config object to be written
28
28
  * @param cwd - base path of the config file
29
29
  */
30
- export declare function writeGeneratedConfig(config: GeneratedConfig, cwd?: string): Promise<void>;
30
+ export declare function writeGeneratedConfig(config: GeneratedConfig, cwd: string): Promise<void>;
31
31
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE,eAAO,MAAM,cAAc,0BAA0B,CAAC;AACtD,eAAO,MAAM,uBAAuB,6BAA6B,CAAC;AAElE;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,CAAC,EAAE,MAAM;;;EAMzC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,CAAC,EAAE,MAAM,mBAS1C;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAOvE;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,MAAM,iBAiB/E"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE,eAAO,MAAM,cAAc,0BAA0B,CAAC;AACtD,eAAO,MAAM,uBAAuB,6BAA6B,CAAC;AAElE;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM;;;EAKxC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,mBASzC;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAOtE;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,iBAiB9E"}
package/lib/config.js CHANGED
@@ -7,10 +7,9 @@ export const generatedConfigFileName = 'cloudpack.generated.json';
7
7
  * @returns the path of the config file
8
8
  */
9
9
  export function getConfigPath(cwd) {
10
- const basePath = cwd || process.cwd();
11
10
  return {
12
- configPath: path.join(basePath, configFileName),
13
- overridesPath: path.join(basePath, generatedConfigFileName),
11
+ configPath: path.join(cwd, configFileName),
12
+ overridesPath: path.join(cwd, generatedConfigFileName),
14
13
  };
15
14
  }
16
15
  /**
package/lib/config.js.map CHANGED
@@ -1 +1 @@
1
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H,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAAuB,EAAE,GAAY;IAC9E,MAAM,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAE7C,oFAAoF;IACpF,MAAM,eAAe,GACnB,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACrC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE;YACrB,OAAO,CAAC,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;SACjE;QAED,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,IAAI,EAAE,CAAC;IAEX,OAAO,SAAS,CAAC,aAAa,EAAE;QAC9B,GAAG,MAAM;QACT,gBAAgB,EAAE,eAAe;KAClC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import path from 'path';\nimport type { GeneratedConfig } from './types/GeneratedConfig.js';\nimport type { CloudpackConfig } from './types/CloudpackConfig.js';\nimport { readJson, readJsonSync, writeJson } from '@ms-cloudpack/json-utilities';\n\nexport const configFileName = 'cloudpack.config.json';\nexport const generatedConfigFileName = 'cloudpack.generated.json';\n\n/**\n * @param cwd - base path of the config file\n * @returns the path of the config file\n */\nexport function getConfigPath(cwd?: string) {\n const basePath = cwd || process.cwd();\n return {\n configPath: path.join(basePath, configFileName),\n overridesPath: path.join(basePath, generatedConfigFileName),\n };\n}\n\n/**\n * Reads the config file synchronously\n * @param cwd - base path of the config file\n * @returns cloudpack config object or empty object if no config file exists.\n */\nexport function readConfigSync(cwd?: string) {\n const { configPath, overridesPath } = getConfigPath(cwd);\n\n return {\n // eslint-disable-next-line no-restricted-syntax\n ...(readJsonSync(configPath) || {}),\n // eslint-disable-next-line no-restricted-syntax\n ...(readJsonSync(overridesPath) || {}),\n } as CloudpackConfig;\n}\n\n/**\n * Reads the config file asynchronously\n * @param cwd - base path of the config file\n * @returns cloudpack config object or empty object if no config file exists.\n */\nexport async function readConfig(cwd?: string): Promise<CloudpackConfig> {\n const { configPath, overridesPath } = getConfigPath(cwd);\n\n return {\n ...((await readJson(configPath)) || {}),\n ...((await readJson(overridesPath)) || {}),\n } as CloudpackConfig;\n}\n\n/**\n * Writes generated config. This is used for `init` to provide package overrides needed.\n * @param config - updated config object to be written\n * @param cwd - base path of the config file\n */\nexport async function writeGeneratedConfig(config: GeneratedConfig, cwd?: string) {\n const { overridesPath } = getConfigPath(cwd);\n\n // Ensure package overrides are sorted based on package name and versionRequirement.\n const sortedOverrides =\n config.packageOverrides?.sort((a, b) => {\n if (a.name === b.name) {\n return a.versionRequirement.localeCompare(b.versionRequirement);\n }\n\n return a.name.localeCompare(b.name);\n }) || [];\n\n return writeJson(overridesPath, {\n ...config,\n packageOverrides: sortedOverrides,\n });\n}\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEjF,MAAM,CAAC,MAAM,cAAc,GAAG,uBAAuB,CAAC;AACtD,MAAM,CAAC,MAAM,uBAAuB,GAAG,0BAA0B,CAAC;AAElE;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO;QACL,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC;QAC1C,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAuB,CAAC;KACvD,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAEzD,OAAO;QACL,gDAAgD;QAChD,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACnC,gDAAgD;QAChD,GAAG,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;KACpB,CAAC;AACvB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW;IAC1C,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAEzD,OAAO;QACL,GAAG,CAAC,CAAC,MAAM,QAAQ,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;QACvC,GAAG,CAAC,CAAC,MAAM,QAAQ,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,CAAC;KACxB,CAAC;AACvB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAAuB,EAAE,GAAW;IAC7E,MAAM,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAE7C,oFAAoF;IACpF,MAAM,eAAe,GACnB,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACrC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE;YACrB,OAAO,CAAC,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;SACjE;QAED,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,IAAI,EAAE,CAAC;IAEX,OAAO,SAAS,CAAC,aAAa,EAAE;QAC9B,GAAG,MAAM;QACT,gBAAgB,EAAE,eAAe;KAClC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import path from 'path';\nimport type { GeneratedConfig } from './types/GeneratedConfig.js';\nimport type { CloudpackConfig } from './types/CloudpackConfig.js';\nimport { readJson, readJsonSync, writeJson } from '@ms-cloudpack/json-utilities';\n\nexport const configFileName = 'cloudpack.config.json';\nexport const generatedConfigFileName = 'cloudpack.generated.json';\n\n/**\n * @param cwd - base path of the config file\n * @returns the path of the config file\n */\nexport function getConfigPath(cwd: string) {\n return {\n configPath: path.join(cwd, configFileName),\n overridesPath: path.join(cwd, generatedConfigFileName),\n };\n}\n\n/**\n * Reads the config file synchronously\n * @param cwd - base path of the config file\n * @returns cloudpack config object or empty object if no config file exists.\n */\nexport function readConfigSync(cwd: string) {\n const { configPath, overridesPath } = getConfigPath(cwd);\n\n return {\n // eslint-disable-next-line no-restricted-syntax\n ...(readJsonSync(configPath) || {}),\n // eslint-disable-next-line no-restricted-syntax\n ...(readJsonSync(overridesPath) || {}),\n } as CloudpackConfig;\n}\n\n/**\n * Reads the config file asynchronously\n * @param cwd - base path of the config file\n * @returns cloudpack config object or empty object if no config file exists.\n */\nexport async function readConfig(cwd: string): Promise<CloudpackConfig> {\n const { configPath, overridesPath } = getConfigPath(cwd);\n\n return {\n ...((await readJson(configPath)) || {}),\n ...((await readJson(overridesPath)) || {}),\n } as CloudpackConfig;\n}\n\n/**\n * Writes generated config. This is used for `init` to provide package overrides needed.\n * @param config - updated config object to be written\n * @param cwd - base path of the config file\n */\nexport async function writeGeneratedConfig(config: GeneratedConfig, cwd: string) {\n const { overridesPath } = getConfigPath(cwd);\n\n // Ensure package overrides are sorted based on package name and versionRequirement.\n const sortedOverrides =\n config.packageOverrides?.sort((a, b) => {\n if (a.name === b.name) {\n return a.versionRequirement.localeCompare(b.versionRequirement);\n }\n\n return a.name.localeCompare(b.name);\n }) || [];\n\n return writeJson(overridesPath, {\n ...config,\n packageOverrides: sortedOverrides,\n });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/config",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "Configuration handling for cloudpack.",
5
5
  "license": "MIT",
6
6
  "type": "module",