create-powerapps-project 0.18.0 → 0.20.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.
@@ -36,15 +36,15 @@ function getPackages(type) {
36
36
  if (type === 'pcf') {
37
37
  return {
38
38
  dependencies: [
39
- 'react',
40
- 'react-dom',
39
+ 'react@17.0.2',
40
+ 'react-dom@17.0.2',
41
41
  '@fluentui/react',
42
42
  '@fluentui/font-icons-mdl2'
43
43
  ],
44
44
  devDependencies: [
45
45
  //`powerapps-project-${type}`,
46
- '@types/react',
47
- '@types/react-dom',
46
+ '@types/react@17.0.39',
47
+ '@types/react-dom@17.0.11',
48
48
  '@types/xrm',
49
49
  '-D'
50
50
  ]
package/lib/plopfile.js CHANGED
@@ -90,9 +90,9 @@ exports.default = (plop) => {
90
90
  nuget.install(answers.name, answers.sdkVersion, xrmVersion);
91
91
  return 'installed nuget packages';
92
92
  });
93
- plop.setActionType('npmInstall', (_answers, config) => {
94
- if (config?.projectType) {
95
- pkg.install(process.cwd(), config.projectType);
93
+ plop.setActionType('npmInstall', (answers) => {
94
+ if (answers.projectType) {
95
+ pkg.install(process.cwd(), answers.projectType);
96
96
  }
97
97
  return 'installed npm packages';
98
98
  });
@@ -178,7 +178,9 @@ exports.default = (plop) => {
178
178
  },
179
179
  {
180
180
  type: 'npmInstall',
181
- projectType: 'assembly'
181
+ data: {
182
+ projectType: 'assembly'
183
+ }
182
184
  }
183
185
  ]
184
186
  });
@@ -224,7 +226,10 @@ exports.default = (plop) => {
224
226
  destination: `${process.cwd()}/{{ name }}`,
225
227
  force: true,
226
228
  skip: (answers) => {
227
- return !answers.react;
229
+ if (!answers.react) {
230
+ return 'react not included';
231
+ }
232
+ return;
228
233
  }
229
234
  },
230
235
  {
@@ -233,20 +238,22 @@ exports.default = (plop) => {
233
238
  path: path_1.default.resolve(process.cwd(), 'tsconfig.json'),
234
239
  force: true,
235
240
  skip: (answers) => {
236
- return !answers.react;
237
- }
238
- },
239
- {
240
- type: 'addGenScript',
241
- skip: (answers) => {
242
- return !answers.react;
241
+ if (!answers.react) {
242
+ return 'react not included';
243
+ }
244
+ return;
243
245
  }
244
246
  },
245
247
  {
246
248
  type: 'npmInstall',
247
- projectType: 'pcf',
249
+ data: {
250
+ projectType: 'pcf'
251
+ },
248
252
  skip: (answers) => {
249
- return !answers.react;
253
+ if (!answers.react) {
254
+ return 'react not included';
255
+ }
256
+ return;
250
257
  }
251
258
  }
252
259
  ]
@@ -274,13 +281,6 @@ exports.default = (plop) => {
274
281
  base: '../plop-templates/webresource',
275
282
  destination: process.cwd(),
276
283
  force: true
277
- },
278
- {
279
- type: 'npmInstall',
280
- projectType: 'webresource',
281
- skip: (answers) => {
282
- return !answers.react;
283
- }
284
284
  }
285
285
  ]
286
286
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-powerapps-project",
3
3
  "description": "💧 plop generator for Dataverse development",
4
- "version": "0.18.0",
4
+ "version": "0.20.0",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
7
7
  "main": "lib/index.js",
@@ -1,6 +1,6 @@
1
1
  import { IInputs, IOutputs } from "./generated/ManifestTypes";
2
2
  import React from 'react';
3
- import { createRoot, Root } from 'react-dom/client';
3
+ import ReactDOM from 'react-dom';
4
4
  import { initializeIcons } from '@fluentui/font-icons-mdl2';
5
5
 
6
6
  import { App, AppProps } from './App';
@@ -33,7 +33,6 @@ export class {{name}} implements ComponentFramework.StandardControl<IInputs, IOu
33
33
  this.container = container;
34
34
  this.context = context;
35
35
  this.isTestHarness = document.getElementById('control-dimensions') !== null;
36
- this.root = createRoot(this.container);
37
36
  }
38
37
 
39
38
 
@@ -46,8 +45,9 @@ export class {{name}} implements ComponentFramework.StandardControl<IInputs, IOu
46
45
  isTestHarness: this.isTestHarness
47
46
  };
48
47
 
49
- this.root.render(
50
- React.createElement(App, this.props)
48
+ ReactDOM.render(
49
+ React.createElement(App, this.props),
50
+ this.container
51
51
  );
52
52
  }
53
53
 
@@ -64,7 +64,7 @@ export class {{name}} implements ComponentFramework.StandardControl<IInputs, IOu
64
64
  * i.e. cancelling any pending remote calls, removing listeners, etc.
65
65
  */
66
66
  public destroy(): void {
67
- this.root.unmount();
67
+ ReactDOM.unmountComponentAtNode(this.container);
68
68
  }
69
69
 
70
70
  }