Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

Commit 672902b

Browse files
author
azlam-abdulsalam
committed
fix(schema): do not fail when new tags are observed in sfdx-project.json
fixes #1329, sfpowerscripts earlier used to error out when new additional attributes are encountered in sfdx-project.json. This option was later disabled, when the schema was allowed tfor additional enhancements in sfdc li . This fchange request rather enahnces it to display warning for itemms that are not supported by sfpowerscripts but don not error out fixes #1329
1 parent 502ab96 commit 672902b

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

packages/sfpowerscripts-cli/resources/schemas/sfdx-project.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"branch": ["package"]
3737
},
3838
"required": ["path"],
39-
"additionalProperties": true,
39+
"additionalProperties": false,
4040
"properties": {
4141
"ancestorId": {
4242
"$ref": "#/definitions/packageDirectory.ancestorId"

packages/sfpowerscripts-cli/src/ProjectValidation.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Ajv from 'ajv';
33
import path = require('path');
44
import * as fs from 'fs-extra';
55
import { PackageType } from '@dxatscale/sfpowerscripts.core/lib/package/SfpPackage';
6+
import SFPLogger, { LoggerLevel } from '@dxatscale/sfp-logger';
67

78
export default class ProjectValidation {
89
private readonly projectConfig;
@@ -30,7 +31,9 @@ export default class ProjectValidation {
3031
)}`;
3132
});
3233

33-
throw new Error(errorMsg);
34+
35+
SFPLogger.log(`The following attributes are not recognized by sfpowerscripts, You might need to remove them`,LoggerLevel.WARN)
36+
SFPLogger.log(errorMsg, LoggerLevel.WARN);
3437
}
3538
}
3639

packages/sfpowerscripts-cli/src/SfpowerscriptsCommand.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,7 @@ export default abstract class SfpowerscriptsCommand extends SfdxCommand {
7272

7373
this.validateFlags();
7474

75-
if (this.statics.requiresProject) {
76-
let projectValidation = new ProjectValidation();
77-
projectValidation.validateSFDXProjectJSON();
78-
projectValidation.validatePackageNames();
79-
}
75+
8076

8177
//Clear temp directory before every run
8278
rimraf.sync('.sfpowerscripts');
@@ -104,6 +100,12 @@ export default abstract class SfpowerscriptsCommand extends SfdxCommand {
104100
);
105101
}
106102

103+
if (this.statics.requiresProject) {
104+
let projectValidation = new ProjectValidation();
105+
projectValidation.validateSFDXProjectJSON();
106+
projectValidation.validatePackageNames();
107+
}
108+
107109

108110
// Execute command run code
109111
return await this.execute();

0 commit comments

Comments
 (0)