@goldstack/utils-package-config 0.4.0 → 0.4.1

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.
@@ -1,17 +1,17 @@
1
- import type { Deployment } from '@goldstack/infra';
2
- import type { Package } from '@goldstack/utils-package';
3
- interface PackageConfigConstructorParams {
4
- packageSchema?: any;
5
- goldstackJson?: Package;
6
- packagePath?: string;
7
- }
8
- export declare class PackageConfig<PackageType extends Package, DeploymentType extends Deployment> {
9
- packageSchema: any;
10
- goldstackJson: PackageType;
11
- constructor(params: PackageConfigConstructorParams);
12
- getPackageSchema(): any;
13
- getConfig(): PackageType;
14
- getDeployment(deploymentName: string): DeploymentType;
15
- }
16
- export {};
1
+ import type { Deployment } from '@goldstack/infra';
2
+ import type { Package } from '@goldstack/utils-package';
3
+ interface PackageConfigConstructorParams {
4
+ packageSchema?: any;
5
+ goldstackJson?: Package;
6
+ packagePath?: string;
7
+ }
8
+ export declare class PackageConfig<PackageType extends Package, DeploymentType extends Deployment> {
9
+ packageSchema: any;
10
+ goldstackJson: PackageType;
11
+ constructor(params: PackageConfigConstructorParams);
12
+ getPackageSchema(): any;
13
+ getConfig(): PackageType;
14
+ getDeployment(deploymentName: string): DeploymentType;
15
+ }
16
+ export {};
17
17
  //# sourceMappingURL=utilsPackageConfig.d.ts.map
@@ -1,40 +1,40 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PackageConfig = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const utils_config_1 = require("@goldstack/utils-config");
9
- const utils_package_1 = require("@goldstack/utils-package");
10
- const utils_sh_1 = require("@goldstack/utils-sh");
11
- class PackageConfig {
12
- constructor(params) {
13
- if (!params.packageSchema &&
14
- !fs_1.default.existsSync('schemas/package.schema.json')) {
15
- throw new Error('Package schema cannot be found in schemas/package.schema.json');
16
- }
17
- this.packageSchema =
18
- params.packageSchema ||
19
- JSON.parse((0, utils_sh_1.read)(params.packagePath + 'schemas/package.schema.json'));
20
- this.goldstackJson = (0, utils_config_1.validateConfig)(params.goldstackJson || (0, utils_package_1.readPackageConfig)(params.packagePath), this.getPackageSchema(), {
21
- errorMessage: 'Cannot load configuration for package.',
22
- });
23
- }
24
- getPackageSchema() {
25
- return this.packageSchema;
26
- }
27
- getConfig() {
28
- return this.goldstackJson;
29
- }
30
- getDeployment(deploymentName) {
31
- const name = deploymentName;
32
- const deployment = this.goldstackJson.deployments.find((deployment) => deployment.name === name);
33
- if (!deployment) {
34
- throw new Error(`Cannot find configuration for deployment '${name}''`);
35
- }
36
- return deployment;
37
- }
38
- }
39
- exports.PackageConfig = PackageConfig;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PackageConfig = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const utils_config_1 = require("@goldstack/utils-config");
9
+ const utils_package_1 = require("@goldstack/utils-package");
10
+ const utils_sh_1 = require("@goldstack/utils-sh");
11
+ class PackageConfig {
12
+ constructor(params) {
13
+ if (!params.packageSchema &&
14
+ !fs_1.default.existsSync('schemas/package.schema.json')) {
15
+ throw new Error('Package schema cannot be found in schemas/package.schema.json');
16
+ }
17
+ this.packageSchema =
18
+ params.packageSchema ||
19
+ JSON.parse((0, utils_sh_1.read)(params.packagePath + 'schemas/package.schema.json'));
20
+ this.goldstackJson = (0, utils_config_1.validateConfig)(params.goldstackJson || (0, utils_package_1.readPackageConfig)(params.packagePath), this.getPackageSchema(), {
21
+ errorMessage: 'Cannot load configuration for package.',
22
+ });
23
+ }
24
+ getPackageSchema() {
25
+ return this.packageSchema;
26
+ }
27
+ getConfig() {
28
+ return this.goldstackJson;
29
+ }
30
+ getDeployment(deploymentName) {
31
+ const name = deploymentName;
32
+ const deployment = this.goldstackJson.deployments.find((deployment) => deployment.name === name);
33
+ if (!deployment) {
34
+ throw new Error(`Cannot find configuration for deployment '${name}''`);
35
+ }
36
+ return deployment;
37
+ }
38
+ }
39
+ exports.PackageConfig = PackageConfig;
40
40
  //# sourceMappingURL=utilsPackageConfig.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goldstack/utils-package-config",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Utilities for working with Goldstack package schemas.",
5
5
  "keywords": [
6
6
  "goldstack",
@@ -37,13 +37,13 @@
37
37
  "version:apply:force": "yarn version $@ && yarn version apply"
38
38
  },
39
39
  "dependencies": {
40
- "@goldstack/infra": "0.4.0",
41
- "@goldstack/utils-config": "0.4.0",
42
- "@goldstack/utils-package": "0.4.0",
43
- "@goldstack/utils-sh": "0.5.0"
40
+ "@goldstack/infra": "0.4.1",
41
+ "@goldstack/utils-config": "0.4.1",
42
+ "@goldstack/utils-package": "0.4.1",
43
+ "@goldstack/utils-sh": "0.5.1"
44
44
  },
45
45
  "devDependencies": {
46
- "@goldstack/utils-git": "0.2.0",
46
+ "@goldstack/utils-git": "0.2.1",
47
47
  "@types/jest": "^28.1.8",
48
48
  "@types/node": "^18.7.13",
49
49
  "jest": "^28.1.0",