Skip to content

Commit

Permalink
Merge branch 'release/1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
nsteenbeek committed Feb 27, 2020
2 parents 05b1218 + d1a961d commit b266164
Show file tree
Hide file tree
Showing 29 changed files with 511 additions and 247 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 HSO Innovation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion bin/main.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bin/root/deploy/deploy.js

This file was deleted.

4 changes: 3 additions & 1 deletion bin/root/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"scripts": {
"build": "npm run clean && webpack",
"build:prod": "npm run clean && cross-env NODE_ENV=production webpack --bail --progress",
"deploy": "node deploy/deploy.js",
"deploy": "node tools/deploy.js",
"setFormCustomizable:true": "node tools/setFormCustomizable.js --customizable true",
"setFormCustomizable:false": "node tools/setFormCustomizable.js --customizable false",
"clean": "IF exist dist (rmdir /s /q dist)",
"watch": "webpack --watch",
"start": "webpack-dev-server",
Expand Down
11 changes: 11 additions & 0 deletions bin/root/src/util/FormUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,15 @@ export class FormUtil {
}
});
}

static setVisible(executionContext: Xrm.Events.EventContext, visible: boolean, attributeNames: string[]): void {
const formContext = executionContext.getFormContext();

attributeNames.forEach((fieldname: string) => {
const formControl: Xrm.Controls.StandardControl = formContext.getControl(fieldname);
if (formControl) {
formControl.setVisible(visible);
}
});
}
}
File renamed without changes.
1 change: 1 addition & 0 deletions bin/root/tools/deploy.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bin/root/tools/setFormCustomizable.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hso/d365-cli",
"version": "1.2.1",
"version": "1.3.0",
"author": "HSO Innovation <[email protected]> (http://www.hso.com)",
"description": "HSO D365 Command Line Interface",
"repository": {
Expand Down
28 changes: 22 additions & 6 deletions src/Update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class Update {

private static async update(): Promise<void> {
console.log(`Updating D365 Project...`);
Update.moveDeploy();
const variables = await Variables.get();
Update.updateProjectRootFolder();
Update.updateDeploy(variables);
Expand Down Expand Up @@ -77,14 +78,29 @@ export class Update {
shell.rm('-R', './src/tsx');
}

private static moveDeploy(): void {
console.log(`Moving deploy folder...`);
if (shell.test('-f', 'deploy/deploy.js')) {
shell.cp('-R','deploy', 'tools');
if (shell.which('git')) {
shell.exec('git rm deploy/deploy.js');
shell.exec('git rm deploy/crm.json');
shell.exec('git add tools/deploy.js');
shell.exec('git add tools/crm.json');
}
}
}

private static updateDeploy(variables: AllVariables): void {
console.log(`Updating deploy...`);
shell.cp('-R', `${__dirname}/root/deploy/deploy.js`, './deploy');
const checkClientSecret = shell.grep(`clientSecret`, './deploy/crm.json'),
console.log(`Updating deploy folder...`);
shell.cp('-R', `${__dirname}/root/tools/deploy.js`, './tools');
shell.cp('-R', `${__dirname}/root/tools/setFormCustomizable.js`, './tools');
shell.exec('git add tools/setFormCustomizable.js');
const checkClientSecret = shell.grep(`clientSecret`, './tools/crm.json'),
{publisher, solution, environment} = variables;
if (checkClientSecret.stdout !== '\n') {
shell.cp('-R', `${__dirname}/root/deploy/crm.json`, './deploy');
const crmJsonFile = shell.ls('./deploy/crm.json')[0];
shell.cp('-R', `${__dirname}/root/tools/crm.json`, './tools');
const crmJsonFile = shell.ls('./tools/crm.json')[0];
shell.sed('-i', new RegExp('<%= publisher %>', 'ig'), publisher, crmJsonFile);
shell.sed('-i', new RegExp('<%= solution %>', 'ig'), solution, crmJsonFile);
shell.sed('-i', new RegExp('<%= environment %>', 'ig'), environment, crmJsonFile);
Expand Down Expand Up @@ -145,7 +161,7 @@ export class Update {
const origRecord = await Xrm.WebApi.retrieveRecord(EntityService.logicalName, id);
return Model.parseCreateModel(EntityService.logicalName, origRecord);
}
public static async validateRecord(entityModel: EntityModel): Promise<ModelValidation> {
return Model.validateRecord(EntityService.logicalName, entityModel);
}`;
Expand Down
2 changes: 1 addition & 1 deletion src/Variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class Variables {
return new Promise((resolve): void => {
let environment = '', solution = '';
const lineReader = require('readline').createInterface({
input: require('fs').createReadStream(`deploy/crm.json`)
input: require('fs').createReadStream(`tools/crm.json`)
});
lineReader.on('line', (line: string) => {
if (line.includes('"solution_name":')) {
Expand Down
13 changes: 12 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Update} from './update';
import {Generator} from './Generator';

program
.version('1.2.1') // .version(require('../package').version)
.version('1.3.0') // .version(require('../package').version)
.usage('<command> [options]');

program
Expand Down Expand Up @@ -87,6 +87,17 @@ program
Update.showUpdateHelp();
});

program
.command('setFormCustomizable <customizable>')
.alias('f')
.description('Sets the Solution forms iscustomizable/canbedeleted true/false')
.action((customizable?: boolean) => {
shell.exec(`npm run setFormCustomizable:${customizable ? 'true' : 'false'}`);
})
.on('--help', () => {
console.log(`Sets the Solution forms iscustomizable/canbedeleted true/false`);
});

program
.arguments('<command>')
.action(() => {
Expand Down
229 changes: 0 additions & 229 deletions src/root/deploy/App.ts

This file was deleted.

Loading

0 comments on commit b266164

Please sign in to comment.