@lage-run/config 0.1.4 → 0.2.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.json CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "@lage-run/config",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 25 Apr 2023 02:50:56 GMT",
5
+ "date": "Wed, 26 Apr 2023 04:56:07 GMT",
6
+ "tag": "@lage-run/config_v0.2.0",
7
+ "version": "0.2.0",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "author": "elcraig@microsoft.com",
12
+ "package": "@lage-run/config",
13
+ "commit": "56910ce2ef67d9d3dc99b7a75df007820e9444c8",
14
+ "comment": "Add readConfigFile API to read the file without defaults"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Tue, 25 Apr 2023 02:51:19 GMT",
6
21
  "tag": "@lage-run/config_v0.1.4",
7
22
  "version": "0.1.4",
8
23
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Change Log - @lage-run/config
2
2
 
3
- This log was last generated on Tue, 25 Apr 2023 02:50:56 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 26 Apr 2023 04:56:07 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.2.0
8
+
9
+ Wed, 26 Apr 2023 04:56:07 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Add readConfigFile API to read the file without defaults (elcraig@microsoft.com)
14
+
7
15
  ## 0.1.4
8
16
 
9
- Tue, 25 Apr 2023 02:50:56 GMT
17
+ Tue, 25 Apr 2023 02:51:19 GMT
10
18
 
11
19
  ### Patches
12
20
 
@@ -1,2 +1,5 @@
1
1
  import type { ConfigOptions } from "./types/ConfigOptions.js";
2
+ /**
3
+ * Get the lage config with defaults.
4
+ */
2
5
  export declare function getConfig(cwd: string): Promise<ConfigOptions>;
package/lib/getConfig.js CHANGED
@@ -7,24 +7,14 @@ Object.defineProperty(exports, "getConfig", {
7
7
  get: ()=>getConfig
8
8
  });
9
9
  const _os = /*#__PURE__*/ _interopRequireDefault(require("os"));
10
- const _cosmiconfig = require("cosmiconfig");
11
- const _workspaceTools = require("workspace-tools");
10
+ const _readConfigFileJs = require("./readConfigFile.js");
12
11
  function _interopRequireDefault(obj) {
13
12
  return obj && obj.__esModule ? obj : {
14
13
  default: obj
15
14
  };
16
15
  }
17
16
  async function getConfig(cwd) {
18
- // Verify presence of git
19
- const root = (0, _workspaceTools.getWorkspaceRoot)(cwd);
20
- if (!root) {
21
- throw new Error("This must be called inside a codebase that is part of a JavaScript workspace.");
22
- }
23
- // Search for lage.config.js file
24
- const ConfigModuleName = "lage";
25
- const configExplorer = await (0, _cosmiconfig.cosmiconfig)(ConfigModuleName);
26
- const results = await configExplorer.search(root ?? cwd);
27
- const config = results?.config;
17
+ const config = await (0, _readConfigFileJs.readConfigFile)(cwd) || {};
28
18
  return {
29
19
  cacheOptions: config?.cacheOptions ?? {},
30
20
  ignore: config?.ignore ?? [],
package/lib/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { getConfig } from "./getConfig.js";
2
2
  export { getConcurrency } from "./getConcurrency.js";
3
3
  export { getMaxWorkersPerTask, getMaxWorkersPerTaskFromOptions } from "./getMaxWorkersPerTask.js";
4
+ export { readConfigFile } from "./readConfigFile.js";
4
5
  export type { PipelineDefinition } from "./types/PipelineDefinition.js";
5
6
  export type { ConfigOptions } from "./types/ConfigOptions.js";
6
7
  export type { CacheOptions } from "./types/CacheOptions.js";
package/lib/index.js CHANGED
@@ -12,8 +12,10 @@ _export(exports, {
12
12
  getConfig: ()=>_getConfigJs.getConfig,
13
13
  getConcurrency: ()=>_getConcurrencyJs.getConcurrency,
14
14
  getMaxWorkersPerTask: ()=>_getMaxWorkersPerTaskJs.getMaxWorkersPerTask,
15
- getMaxWorkersPerTaskFromOptions: ()=>_getMaxWorkersPerTaskJs.getMaxWorkersPerTaskFromOptions
15
+ getMaxWorkersPerTaskFromOptions: ()=>_getMaxWorkersPerTaskJs.getMaxWorkersPerTaskFromOptions,
16
+ readConfigFile: ()=>_readConfigFileJs.readConfigFile
16
17
  });
17
18
  const _getConfigJs = require("./getConfig.js");
18
19
  const _getConcurrencyJs = require("./getConcurrency.js");
19
20
  const _getMaxWorkersPerTaskJs = require("./getMaxWorkersPerTask.js");
21
+ const _readConfigFileJs = require("./readConfigFile.js");
@@ -0,0 +1,5 @@
1
+ import type { ConfigOptions } from "./types/ConfigOptions.js";
2
+ /**
3
+ * Read the lage config file if it exists, without filling in defaults.
4
+ */
5
+ export declare function readConfigFile(cwd: string): Promise<ConfigOptions | undefined>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "readConfigFile", {
6
+ enumerable: true,
7
+ get: ()=>readConfigFile
8
+ });
9
+ const _cosmiconfig = require("cosmiconfig");
10
+ const _workspaceTools = require("workspace-tools");
11
+ const ConfigModuleName = "lage";
12
+ async function readConfigFile(cwd) {
13
+ // Verify presence of git
14
+ const root = (0, _workspaceTools.getWorkspaceRoot)(cwd);
15
+ if (!root) {
16
+ throw new Error("This must be called inside a codebase that is part of a JavaScript workspace.");
17
+ }
18
+ // Search for lage.config.js file
19
+ const configExplorer = await (0, _cosmiconfig.cosmiconfig)(ConfigModuleName);
20
+ const results = await configExplorer.search(root ?? cwd);
21
+ return results?.config || undefined;
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/config",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "Config management for Lage",
5
5
  "repository": {
6
6
  "type": "git",