create-powerapps-project 0.16.2 → 0.16.6

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.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,67 @@
2
2
  "name": "create-powerapps-project",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 08 Feb 2022 18:47:00 GMT",
5
+ "date": "Wed, 16 Feb 2022 00:36:07 GMT",
6
+ "tag": "create-powerapps-project_v0.16.6",
7
+ "version": "0.16.6",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "derek.finlinson@journeyteam.com",
12
+ "package": "create-powerapps-project",
13
+ "commit": "96abb993cc017edf436a612281ef7a5d3346023b",
14
+ "comment": "Re-add sn.exe; React PCF updates"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Mon, 14 Feb 2022 23:29:54 GMT",
21
+ "tag": "create-powerapps-project_v0.16.5",
22
+ "version": "0.16.5",
23
+ "comments": {
24
+ "patch": [
25
+ {
26
+ "author": "derek.finlinson@journeyteam.com",
27
+ "package": "create-powerapps-project",
28
+ "commit": "361a315823b5558a96c191850c2fcf8863653e5b",
29
+ "comment": "Set class name from prompts"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Fri, 11 Feb 2022 16:59:23 GMT",
36
+ "tag": "create-powerapps-project_v0.16.4",
37
+ "version": "0.16.4",
38
+ "comments": {
39
+ "patch": [
40
+ {
41
+ "author": "derek.finlinson@journeyteam.com",
42
+ "package": "create-powerapps-project",
43
+ "commit": "19a5d1442fef02d2f260e59d2779d6f85df51630",
44
+ "comment": "Comment out pcf plop for now"
45
+ }
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ "date": "Wed, 09 Feb 2022 16:19:05 GMT",
51
+ "tag": "create-powerapps-project_v0.16.3",
52
+ "version": "0.16.3",
53
+ "comments": {
54
+ "patch": [
55
+ {
56
+ "author": "derek.finlinson@journeyteam.com",
57
+ "package": "create-powerapps-project",
58
+ "commit": "cdab4698564ece9f40c5a45327a38270a6d1c16d",
59
+ "comment": "Catch errors on commands"
60
+ }
61
+ ]
62
+ }
63
+ },
64
+ {
65
+ "date": "Tue, 08 Feb 2022 18:47:13 GMT",
6
66
  "tag": "create-powerapps-project_v0.16.2",
7
67
  "version": "0.16.2",
8
68
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,17 +1,49 @@
1
1
  # Change Log - create-powerapps-project
2
2
 
3
- This log was last generated on Tue, 08 Feb 2022 18:47:00 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 16 Feb 2022 00:36:07 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.16.2
7
+ ## 0.16.6
8
8
 
9
- Tue, 08 Feb 2022 18:47:00 GMT
9
+ Wed, 16 Feb 2022 00:36:07 GMT
10
10
 
11
11
  ### Patches
12
12
 
13
- - Update symbols (derek.finlinson@journeyteam.com)
13
+ - Re-add sn.exe; React PCF updates (derek.finlinson@journeyteam.com)
14
14
 
15
+ ## 0.16.5
16
+
17
+ Mon, 14 Feb 2022 23:29:54 GMT
18
+
19
+ ### Patches
20
+
21
+ - Set class name from prompts (derek.finlinson@journeyteam.com)
22
+
23
+ ## 0.16.4
24
+
25
+ Fri, 11 Feb 2022 16:59:23 GMT
26
+
27
+ ### Patches
28
+
29
+ - Comment out pcf plop for now (derek.finlinson@journeyteam.com)
30
+
31
+ ## 0.16.3
32
+
33
+ Wed, 09 Feb 2022 16:19:05 GMT
34
+
35
+ ### Patches
36
+
37
+ - Catch errors on commands (derek.finlinson@journeyteam.com)
38
+
39
+ ## 0.16.2
40
+
41
+ Tue, 08 Feb 2022 18:47:13 GMT
42
+
43
+ ### Patches
44
+
45
+ - Update symbols (derek.finlinson@journeyteam.com)
46
+
15
47
  ## 0.16.1
16
48
 
17
49
  Tue, 08 Feb 2022 18:13:53 GMT
package/bin/sn.exe ADDED
Binary file
@@ -0,0 +1,6 @@
1
+ <?xml version ="1.0"?>
2
+ <configuration>
3
+ <startup useLegacyV2RuntimeActivationPolicy="true">
4
+ <requiredRuntime safemode="true" imageVersion="v4.0.30319" version="v4.0.30319"/>
5
+ </startup>
6
+ </configuration>
@@ -54,10 +54,18 @@ exports.default = async (type) => {
54
54
  const xrmVersions = await (0, nuget_1.getNugetPackageVersions)('JourneyTeam.Xrm');
55
55
  config.xrmVersion = xrmVersions.shift();
56
56
  }
57
- logger_1.logger.info('get plop generator');
57
+ else if (type === 'webresource') {
58
+ config.name = name;
59
+ }
58
60
  const generator = await (0, plop_1.getGenerator)(type, name);
59
61
  logger_1.logger.info(`run powerapps-project-${type} code generator`);
60
- await (0, plop_1.runGenerator)(generator, config);
62
+ try {
63
+ await (0, plop_1.runGenerator)(generator, config);
64
+ }
65
+ catch (ex) {
66
+ logger_1.logger.error(ex.message);
67
+ return;
68
+ }
61
69
  logger_1.logger.info('initialize project');
62
70
  if (type !== 'pcf' || config.react) {
63
71
  pkg.install(process.cwd(), type);
package/lib/logger.js CHANGED
@@ -30,7 +30,7 @@ exports.logger = {
30
30
  },
31
31
  done(...args) {
32
32
  if (!isTest) {
33
- console.info(exports.icons.info, ...args);
33
+ console.info(exports.icons.done, ...args);
34
34
  }
35
35
  },
36
36
  };
@@ -38,12 +38,14 @@ function getPackages(type) {
38
38
  dependencies: [
39
39
  'react',
40
40
  'react-dom',
41
- '@fluentui/react'
41
+ '@fluentui/react',
42
+ '@fluentui/font-icons-mdl2'
42
43
  ],
43
44
  devDependencies: [
44
- `powerapps-project-${type}`,
45
+ //`powerapps-project-${type}`,
45
46
  '@types/react',
46
- '@types/react-dom'
47
+ '@types/react-dom',
48
+ '@types/xrm'
47
49
  ]
48
50
  };
49
51
  }
package/lib/plop.js CHANGED
@@ -21,11 +21,11 @@ exports.getGenerator = getGenerator;
21
21
  const runGenerator = async (generator, args) => {
22
22
  const results = await generator.runActions(args, {
23
23
  onComment: (comment) => {
24
- logger_1.logger.done(comment);
24
+ logger_1.logger.info(comment);
25
25
  }
26
26
  });
27
27
  if (results.failures && results.failures.length > 0) {
28
- throw new Error('Error: ' + results.failures[0].error);
28
+ throw new Error(results.failures[0].error);
29
29
  }
30
30
  // do something after the actions have run
31
31
  for (const change of results.changes) {
package/lib/plopfile.js CHANGED
@@ -6,13 +6,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const path_1 = __importDefault(require("path"));
7
7
  const child_process_1 = require("child_process");
8
8
  const fs_1 = __importDefault(require("fs"));
9
+ const didSucceed = (code) => `${code}` === '0';
9
10
  /* eslint-disable @typescript-eslint/no-explicit-any */
10
11
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
11
12
  exports.default = (plop) => {
12
13
  plop.setActionType('signAssembly', (answers) => {
13
14
  const keyPath = path_1.default.resolve(process.cwd(), `${answers.name}.snk`);
14
- (0, child_process_1.spawnSync)(path_1.default.resolve(__dirname, '../', 'bin', 'sn.exe'), ['-q', '-k', keyPath], { stdio: 'inherit' });
15
- return 'signed assembly';
15
+ return new Promise((resolve, reject) => {
16
+ if (process.env.JEST_WORKER_ID !== undefined) {
17
+ resolve('Testing so no need to sign');
18
+ }
19
+ const sign = (0, child_process_1.spawn)(path_1.default.resolve(__dirname, '../', 'bin', 'sn.exe'), ['-q', '-k', keyPath], { stdio: 'inherit' });
20
+ sign.on('close', (code) => {
21
+ if (didSucceed(code)) {
22
+ resolve('signed assembly');
23
+ }
24
+ else {
25
+ reject('Failed to sign assembly');
26
+ }
27
+ });
28
+ });
16
29
  });
17
30
  plop.setActionType('runPcf', (answers) => {
18
31
  const args = ['pcf', 'init', '-ns', answers.namespace, '-n', answers.name, '-t', answers.template];
@@ -23,15 +36,24 @@ exports.default = (plop) => {
23
36
  if (process.env.JEST_WORKER_ID !== undefined) {
24
37
  args.push('-npm', 'false');
25
38
  }
26
- (0, child_process_1.spawnSync)('pac', args, { stdio: 'inherit' });
27
- return 'pcf project created';
39
+ return new Promise((resolve, reject) => {
40
+ const pac = (0, child_process_1.spawn)('pac', args, { stdio: 'inherit' });
41
+ pac.on('close', (code) => {
42
+ if (didSucceed(code)) {
43
+ resolve('pcf project created');
44
+ }
45
+ else {
46
+ reject('Ensure the Power Platform CLI is installed. Command must be run from within VS Code if using the Power Platform Extension');
47
+ }
48
+ });
49
+ });
28
50
  });
29
- plop.setActionType('addGenScript', () => {
51
+ plop.setActionType('addGenScript', async () => {
30
52
  const packagePath = path_1.default.resolve(process.cwd(), 'package.json');
31
53
  // eslint-disable-next-line @typescript-eslint/no-var-requires
32
54
  const packageJson = require(packagePath);
33
55
  packageJson.scripts.gen = 'plop';
34
- fs_1.default.writeFileSync(packagePath, JSON.stringify(packageJson, null, 4), 'utf8');
56
+ await fs_1.default.promises.writeFile(packagePath, JSON.stringify(packageJson, null, 4), 'utf8');
35
57
  return 'added plop script to package.json';
36
58
  });
37
59
  plop.setGenerator('webresource', {
@@ -54,7 +76,7 @@ exports.default = (plop) => {
54
76
  type: 'addMany',
55
77
  templateFiles: [
56
78
  '../plop-templates/pcf/App.tsx',
57
- '../plop-templates/pcf/index.ts'
79
+ '../plop-templates/pcf/index.ts.hbs'
58
80
  ],
59
81
  base: '../plop-templates/pcf',
60
82
  destination: `${process.cwd()}/{{ name }}`,
@@ -63,11 +85,26 @@ exports.default = (plop) => {
63
85
  return !answers.react;
64
86
  }
65
87
  },
88
+ {
89
+ type: 'add',
90
+ templateFile: '../plop-templates/pcf/tsconfig.json',
91
+ path: path_1.default.resolve(process.cwd(), 'tsconfig.json'),
92
+ force: true,
93
+ skip: (answers) => {
94
+ return !answers.react;
95
+ }
96
+ },
66
97
  {
67
98
  type: 'addGenScript',
68
99
  skip: (answers) => {
69
100
  return !answers.react;
70
101
  }
102
+ },
103
+ {
104
+ type: 'updateTsConfig',
105
+ skip: (answers) => {
106
+ return !answers.react;
107
+ }
71
108
  }
72
109
  ]
73
110
  });
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.16.2",
4
+ "version": "0.16.6",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
7
7
  "bin": {
@@ -3,12 +3,13 @@ import React from 'react';
3
3
  import ReactDOM from 'react-dom';
4
4
  import { initializeIcons } from '@fluentui/font-icons-mdl2';
5
5
 
6
- import { App } from './App';
6
+ import { App, AppProps } from './App';
7
7
 
8
- export class ReportDashboard implements ComponentFramework.StandardControl<IInputs, IOutputs> {
8
+ export class {{name}} implements ComponentFramework.StandardControl<IInputs, IOutputs> {
9
9
  container: HTMLDivElement;
10
10
  context: ComponentFramework.Context<IInputs>;
11
11
  isTestHarness: boolean;
12
+ props: AppProps;
12
13
 
13
14
  /**
14
15
  * Empty constructor.
@@ -39,10 +40,12 @@ export class ReportDashboard implements ComponentFramework.StandardControl<IInpu
39
40
  * @param context The entire property bag available to control via Context Object; It contains values as set up by the customizer mapped to names defined in the manifest, as well as utility functions
40
41
  */
41
42
  public updateView(context: ComponentFramework.Context<IInputs>): void {
43
+ this.props = {
44
+ isTestHarness: this.isTestHarness
45
+ };
46
+
42
47
  ReactDOM.render(
43
- React.createElement(App, {
44
- isTestHarness: this.isTestHarness
45
- }),
48
+ React.createElement(App, AppProps),
46
49
  this.container
47
50
  );
48
51
  }
@@ -60,7 +63,7 @@ export class ReportDashboard implements ComponentFramework.StandardControl<IInpu
60
63
  * i.e. cancelling any pending remote calls, removing listeners, etc.
61
64
  */
62
65
  public destroy(): void {
63
- // Add code to cleanup control if necessary
66
+ ReactDOM.unmountComponentAtNode(this.container);
64
67
  }
65
68
 
66
69
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./node_modules/pcf-scripts/tsconfig_base.json",
3
+ "compilerOptions": {
4
+ "target": "ES6",
5
+ "esModuleInterop": true
6
+ }
7
+ }