@lage-run/config 0.1.3 → 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,55 @@
2
2
  "name": "@lage-run/config",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 14 Apr 2023 04:37:34 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",
21
+ "tag": "@lage-run/config_v0.1.4",
22
+ "version": "0.1.4",
23
+ "comments": {
24
+ "patch": [
25
+ {
26
+ "author": "elcraig@microsoft.com",
27
+ "package": "@lage-run/config",
28
+ "commit": "a2e112e8aafee26380684efca4db994a9c5e3801",
29
+ "comment": "Update repository and homepage"
30
+ },
31
+ {
32
+ "author": "beachball",
33
+ "package": "@lage-run/config",
34
+ "comment": "Bump @lage-run/logger to v1.3.0",
35
+ "commit": "a2e112e8aafee26380684efca4db994a9c5e3801"
36
+ },
37
+ {
38
+ "author": "beachball",
39
+ "package": "@lage-run/config",
40
+ "comment": "Bump @lage-run/scheduler-types to v0.3.8",
41
+ "commit": "a2e112e8aafee26380684efca4db994a9c5e3801"
42
+ },
43
+ {
44
+ "author": "beachball",
45
+ "package": "@lage-run/config",
46
+ "comment": "Bump @lage-run/target-graph to v0.8.4",
47
+ "commit": "a2e112e8aafee26380684efca4db994a9c5e3801"
48
+ }
49
+ ]
50
+ }
51
+ },
52
+ {
53
+ "date": "Fri, 14 Apr 2023 04:37:54 GMT",
6
54
  "tag": "@lage-run/config_v0.1.3",
7
55
  "version": "0.1.3",
8
56
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,31 @@
1
1
  # Change Log - @lage-run/config
2
2
 
3
- This log was last generated on Fri, 14 Apr 2023 04:37:34 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
+
15
+ ## 0.1.4
16
+
17
+ Tue, 25 Apr 2023 02:51:19 GMT
18
+
19
+ ### Patches
20
+
21
+ - Update repository and homepage (elcraig@microsoft.com)
22
+ - Bump @lage-run/logger to v1.3.0
23
+ - Bump @lage-run/scheduler-types to v0.3.8
24
+ - Bump @lage-run/target-graph to v0.8.4
25
+
7
26
  ## 0.1.3
8
27
 
9
- Fri, 14 Apr 2023 04:37:34 GMT
28
+ Fri, 14 Apr 2023 04:37:54 GMT
10
29
 
11
30
  ### Patches
12
31
 
@@ -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,10 +1,12 @@
1
1
  {
2
2
  "name": "@lage-run/config",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "Config management for Lage",
5
5
  "repository": {
6
+ "type": "git",
6
7
  "url": "https://github.com/microsoft/lage"
7
8
  },
9
+ "homepage": "https://microsoft.github.io/lage/",
8
10
  "bin": {
9
11
  "lage": "./bin/lage"
10
12
  },
@@ -19,9 +21,9 @@
19
21
  },
20
22
  "dependencies": {
21
23
  "backfill-config": "^6.3.1",
22
- "@lage-run/logger": "^1.2.2",
23
- "@lage-run/scheduler-types": "^0.3.7",
24
- "@lage-run/target-graph": "^0.8.3",
24
+ "@lage-run/logger": "^1.3.0",
25
+ "@lage-run/scheduler-types": "^0.3.8",
26
+ "@lage-run/target-graph": "^0.8.4",
25
27
  "workspace-tools": "^0.34.0",
26
28
  "cosmiconfig": "^7.0.0"
27
29
  },