Releases: hso-nn/d365-cli
Tab and Section names may have spaces
Tab and Section names may have spaces. The control method generation now removes the spaces to generate valid method names.
Generate Entity --skipForms
CLI Command generate Entity supports flag --skipForms. This will skip generating form folders and files and the Entity.formContext.ts.
Generate Model support
The generate Model command was deprecated for a short time, but now introduced again to only generate a model file for a specific entity. This can be handy when models refer to other models.
Form generation
- Entity generation will now generate a sub folder for every form
- EnvironmentVariable generation
Breaking changes
You need to update your project: hso-d365 update
After updating your project will be backward-compatible, but we recommend to update by following steps:
- Regenerate all your entities
- Move content from Entity/Entity.ts and Entity/Entity.form.ts to correct form subfolder equivalents
- Remove Entity/Entity.ts and Entity/Entity.form.ts files
- Remove Entity entry in webpack.config.ts
- Turn off unused forms in Entity/build.json, which will prevent them being deployed
- Deploy your code
- In your forms replace Entity.ts by new form equivalent
- In your solution deprecate/remove Entity.ts files
setFormCustomizable
SetFormCustomizable moved from project tools folder to cli
Generate Entity checks entityLogicalName
Feature: When generating an Entity, the cli will check for valid entityLogicalName
Bugfix: Resx was invoked on every command
Translation extraction
Extracting translations into resx files failed when using double quotes:
console.log(Translations.translate("test"));
Please update the project:
npm install -g @hso/d365-cli@latest
hso-d365 update
Bugfixes
Move xml2js from devDependencies to dependencies
Update command will remove TranslationI18n.ts and i18next-scanner.config.js files
CopyWebpackPlugin uses noErrorOnMissing
Linting fix in src/WebApi/Service.ts
Attributes generation for names and methods
In short the 4.x version will prevent typo's in project code by generating attribute enum and methods. Below more explanation.
Generation
Attribute names and getters generated
In current projects code like below may have three possible problems:
- A typo in attribute name 'industrycoode' will not result in a build failure
- Wrong atrribute type (OptionSetAttribute) will not result in a build failure
- A name change on D365 side will not result in a build failure
const formContext = executionContext.getFormContext();
const industryAttribute: Xrm.Attributes.OptionSetAttribute = formContext.getAttribute('industrycode');
const industryControl = formContext.getControl('industrycode');
Version 4.x will solve those three problems
First for creating or updating an Entity use the generate command:
hso-d365 generate Entity Account
This will generate methods like getIndustryCodeAttribute and enum AccountAttributeNames.
Then have code like below
const formContext = executionContext.getFormContext();
const industryAttribute = AccountForm.getIndustryCodeAttribute(formContext);
const industryControl = formContext.getControl(AccountAttributeNames.IndustryCode);
Breaking changes
Entity.enum.ts using SchemaName instead of LogicalName
For more readable code the Entity.enum.ts uses SchemaName instead of LogicalName.
IndustryCode.EatingandDrinkingPlaces is more readable as Industrycode.eatinganddrinkingplaces.
This may break the build, but can be fixed easy.
Entity.form.ts extend Entity.formContext.ts
After running the update command:
hso-d365 update
Entity.form.ts files will extend EntityFormContext. That will break the build and has to be fixed by running:
hso-d365 generate Entity ...
hso-d365 generate Model deprecated
The CLI command 'hso-d365 generate Model ...' is deprecated. The command 'hso-d365 generate Entity ...' became an 'upsert'.
Node 15 support
Node has been giving a warning for peer dependencies for a long time. Node 15 will fail on npm packages having peer dependencies, which are not installed. For this we had to remove and replace some packages, which are archived or not maintained at the moment. This makes the cli up-to-date and future proof.
Breaking changes
I18next
I18next is not supported anymore. Translations will be in the Dynamics CE recommended way: resx files.
If you need to migrate on this point, please follow migration steps below and run following command:
hso-d365 extractTranslations
For more info: extractTranslations
dlf-core package.json
This was too HSO specific code and logic. After update the programmer should check the package.json diff and reinstall dlf-core.
Fixes
Coverage fixed
Code coverage needed a node 15 compatible plugin and it was broken when cli introduced webpack 5.
Migration steps
- Update to version 2.4.2 and update
npm install -g @hso/d365-cli@2.4.2
hso-d365 update
- Update to version >2.4.2
npm install -g @hso/d365-cli@latest
hso-d365 update