create-powerapps-project 0.15.6 → 0.16.3

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": "Mon, 17 Jan 2022 15:43:47 GMT",
5
+ "date": "Wed, 09 Feb 2022 16:18:47 GMT",
6
+ "tag": "create-powerapps-project_v0.16.3",
7
+ "version": "0.16.3",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "derek.finlinson@journeyteam.com",
12
+ "package": "create-powerapps-project",
13
+ "commit": "cdab4698564ece9f40c5a45327a38270a6d1c16d",
14
+ "comment": "Catch errors on commands"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Tue, 08 Feb 2022 18:47:13 GMT",
21
+ "tag": "create-powerapps-project_v0.16.2",
22
+ "version": "0.16.2",
23
+ "comments": {
24
+ "patch": [
25
+ {
26
+ "author": "derek.finlinson@journeyteam.com",
27
+ "package": "create-powerapps-project",
28
+ "commit": "70380beb0078b8c1ab669bf5f3e4eacbbcd99ba7",
29
+ "comment": "Update symbols"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Tue, 08 Feb 2022 18:13:53 GMT",
36
+ "tag": "create-powerapps-project_v0.16.1",
37
+ "version": "0.16.1",
38
+ "comments": {
39
+ "patch": [
40
+ {
41
+ "author": "derek.finlinson@journeyteam.com",
42
+ "package": "create-powerapps-project",
43
+ "commit": "cfa9121f50ea731b9ef639154153b01dc81fff85",
44
+ "comment": "Fix logger and file paths"
45
+ }
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ "date": "Mon, 07 Feb 2022 22:02:33 GMT",
51
+ "tag": "create-powerapps-project_v0.16.0",
52
+ "version": "0.16.0",
53
+ "comments": {
54
+ "minor": [
55
+ {
56
+ "author": "derek.finlinson@journeyteam.com",
57
+ "package": "create-powerapps-project",
58
+ "commit": "55d633b2c3064bbdce48c5d314d8e7572a015882",
59
+ "comment": "Add support for PCF projects"
60
+ }
61
+ ]
62
+ }
63
+ },
64
+ {
65
+ "date": "Mon, 17 Jan 2022 15:43:56 GMT",
6
66
  "tag": "create-powerapps-project_v0.15.6",
7
67
  "version": "0.15.6",
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 Mon, 17 Jan 2022 15:43:47 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 09 Feb 2022 16:18:47 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.15.6
7
+ ## 0.16.3
8
8
 
9
- Mon, 17 Jan 2022 15:43:47 GMT
9
+ Wed, 09 Feb 2022 16:18:47 GMT
10
10
 
11
11
  ### Patches
12
12
 
13
- - Rework logger (derek.finlinson@journeyteam.com)
13
+ - Catch errors on commands (derek.finlinson@journeyteam.com)
14
14
 
15
+ ## 0.16.2
16
+
17
+ Tue, 08 Feb 2022 18:47:13 GMT
18
+
19
+ ### Patches
20
+
21
+ - Update symbols (derek.finlinson@journeyteam.com)
22
+
23
+ ## 0.16.1
24
+
25
+ Tue, 08 Feb 2022 18:13:53 GMT
26
+
27
+ ### Patches
28
+
29
+ - Fix logger and file paths (derek.finlinson@journeyteam.com)
30
+
31
+ ## 0.16.0
32
+
33
+ Mon, 07 Feb 2022 22:02:33 GMT
34
+
35
+ ### Minor changes
36
+
37
+ - Add support for PCF projects (derek.finlinson@journeyteam.com)
38
+
39
+ ## 0.15.6
40
+
41
+ Mon, 17 Jan 2022 15:43:56 GMT
42
+
43
+ ### Patches
44
+
45
+ - Rework logger (derek.finlinson@journeyteam.com)
46
+
15
47
  ## 0.15.5
16
48
 
17
49
  Sun, 16 Jan 2022 23:22:22 GMT
@@ -29,13 +29,12 @@ const path_1 = __importDefault(require("path"));
29
29
  const plop_1 = require("./plop");
30
30
  const pkg = __importStar(require("./packageManager"));
31
31
  const getEnvInfo_1 = require("./getEnvInfo");
32
- const kleur_1 = __importDefault(require("kleur"));
33
- const tick = '√', pointer = '>';
32
+ const logger_1 = require("./logger");
34
33
  exports.default = async (type) => {
35
34
  await (0, getEnvInfo_1.initialize)();
36
35
  const name = path_1.default.basename(process.cwd());
37
- if (!type || (type !== 'webresource' && type !== 'assembly')) {
38
- const invalid = type !== undefined && type !== 'webresource' && type !== 'assembly';
36
+ if (!type || (type !== 'webresource' && type !== 'assembly' && type !== 'pcf')) {
37
+ const invalid = type !== undefined && type !== 'webresource' && type !== 'assembly' && type !== 'pcf';
39
38
  const invalidMessage = invalid ? `${type} is not a valid project type.` : '';
40
39
  const { promptType } = await (0, prompts_1.default)({
41
40
  type: 'select',
@@ -43,7 +42,8 @@ exports.default = async (type) => {
43
42
  message: `${invalidMessage} Select dataverse project to create?`,
44
43
  choices: [
45
44
  { title: 'web resource', value: 'webresource' },
46
- { title: 'plugin or workflow activity', value: 'assembly' }
45
+ { title: 'plugin or workflow activity', value: 'assembly' },
46
+ { title: 'powerapps component framework control', value: 'pcf' }
47
47
  ]
48
48
  });
49
49
  type = promptType;
@@ -54,20 +54,59 @@ exports.default = async (type) => {
54
54
  const xrmVersions = await (0, nuget_1.getNugetPackageVersions)('JourneyTeam.Xrm');
55
55
  config.xrmVersion = xrmVersions.shift();
56
56
  }
57
- console.info(kleur_1.default.green(`${kleur_1.default.green(tick)} 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
- console.info(`${kleur_1.default.green(tick)} run powerapps-project-${type} code generator`);
60
- await (0, plop_1.runGenerator)(generator, config);
61
- console.info(`${kleur_1.default.green(tick)} initialize project`);
62
- pkg.install(process.cwd(), type);
61
+ logger_1.logger.info(`run powerapps-project-${type} code generator`);
62
+ try {
63
+ await (0, plop_1.runGenerator)(generator, config);
64
+ }
65
+ catch (ex) {
66
+ logger_1.logger.error(ex.message);
67
+ return;
68
+ }
69
+ logger_1.logger.info('initialize project');
70
+ if (type !== 'pcf' || config.react) {
71
+ pkg.install(process.cwd(), type);
72
+ }
63
73
  if (type === 'assembly') {
64
- console.info(`${kleur_1.default.green(tick)} add nuget packages`);
74
+ logger_1.logger.info('add nuget packages');
65
75
  (0, nuget_1.install)(config.name, config.sdkVersion, config.xrmVersion);
66
76
  }
67
77
  (0, exports.done)(type);
68
78
  };
69
79
  const getAnswers = async (type) => {
70
80
  let questions = [];
81
+ if (type === 'pcf') {
82
+ questions = [
83
+ {
84
+ type: 'select',
85
+ name: 'template',
86
+ message: 'template',
87
+ choices: [
88
+ { title: 'field', value: 'field' },
89
+ { title: 'dataset', value: 'dataset' }
90
+ ]
91
+ },
92
+ {
93
+ type: 'text',
94
+ name: 'namespace',
95
+ message: 'namespace'
96
+ },
97
+ {
98
+ type: 'text',
99
+ name: 'name',
100
+ message: 'name'
101
+ },
102
+ {
103
+ type: 'confirm',
104
+ name: 'react',
105
+ message: 'install react?'
106
+ }
107
+ ];
108
+ return questions;
109
+ }
71
110
  if (type === 'webresource') {
72
111
  questions.push({
73
112
  type: 'text',
@@ -128,30 +167,54 @@ const getAnswers = async (type) => {
128
167
  return questions;
129
168
  };
130
169
  const done = (type) => {
131
- const message = `
170
+ if (process.env.JEST_WORKER_ID !== undefined) {
171
+ return;
172
+ }
173
+ let message;
174
+ if (type === 'pcf') {
175
+ message = `
132
176
 
133
- ${kleur_1.default.green(tick)} ${type} project created!
177
+ ${logger_1.icons.done} ${type} project created!
134
178
 
135
179
  keep your build tools up-to-date by updating these two devDependencies:
136
- ${kleur_1.default.cyan(pointer)} dataverse-utils
137
- ${kleur_1.default.cyan(pointer)} powerapps-project-${type}
180
+ ${logger_1.icons.info} powerapps-project-${type}
181
+
182
+ build your project in watch mode with this command:
183
+ ${logger_1.icons.info} npm start watch
184
+ build your project in production mode with this command:
185
+ ${logger_1.icons.info} npm run build
186
+
187
+ run code generator with this command:
188
+ ${logger_1.icons.info} npm run gen
189
+
190
+ `;
191
+ }
192
+ else {
193
+ message = `
194
+
195
+ ${logger_1.icons.done} ${type} project created!
196
+
197
+ keep your build tools up-to-date by updating these two devDependencies:
198
+ ${logger_1.icons.info} dataverse-utils
199
+ ${logger_1.icons.info} powerapps-project-${type}
138
200
 
139
201
  ${type === 'webresource' ?
140
- `build your project in watch mode with this command:
141
- ${kleur_1.default.cyan(pointer)} ${pkg.getYarn() ? 'yarn' : 'npm run'} start
202
+ `build your project in watch mode with this command:
203
+ ${logger_1.icons.info} ${pkg.getYarn() ? 'yarn' : 'npm run'} start
142
204
  build your project in production mode with this command:
143
- ${kleur_1.default.cyan(pointer)} ${pkg.getYarn() ? 'yarn' : 'npm run'} build
205
+ ${logger_1.icons.info} ${pkg.getYarn() ? 'yarn' : 'npm run'} build
144
206
  generate table definition files with this command:
145
- ${kleur_1.default.cyan(pointer)} ${pkg.getYarn() ? 'yarn' : 'npm run'} generate` :
146
- `build your project with this command:
207
+ ${logger_1.icons.info} ${pkg.getYarn() ? 'yarn' : 'npm run'} generate` :
208
+ `build your project with this command:
147
209
  dotnet build
148
210
  deploy your project with this command:
149
- ${kleur_1.default.cyan(pointer)} ${pkg.getYarn() ? 'yarn' : 'npm run'} deploy`}
211
+ ${logger_1.icons.info} ${pkg.getYarn() ? 'yarn' : 'npm run'} deploy`}
150
212
 
151
213
  run code generator with this command:
152
- ${kleur_1.default.cyan(pointer)} ${pkg.getYarn() ? 'yarn' : 'npm run'} gen
214
+ ${logger_1.icons.info} ${pkg.getYarn() ? 'yarn' : 'npm run'} gen
153
215
 
154
216
  `;
217
+ }
155
218
  console.info(message);
156
219
  };
157
220
  exports.done = done;
package/lib/index.js CHANGED
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const commander_1 = require("commander");
8
- const kleur_1 = __importDefault(require("kleur"));
9
8
  const createDataverseProject_1 = __importDefault(require("./createDataverseProject"));
10
9
  // eslint-disable-next-line @typescript-eslint/no-var-requires
11
10
  const packageJson = require('../package');
@@ -13,7 +12,7 @@ const program = new commander_1.Command(packageJson.name);
13
12
  program
14
13
  .version(packageJson.version)
15
14
  .description('Create new Dataverse project')
16
- .usage(kleur_1.default.green('[type]'))
15
+ .usage('[type]')
17
16
  .argument('[type]', 'Type of project to generate')
18
17
  .action(type => {
19
18
  (0, createDataverseProject_1.default)(type);
package/lib/logger.js CHANGED
@@ -3,20 +3,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.logger = void 0;
6
+ exports.logger = exports.icons = void 0;
7
7
  const kleur_1 = __importDefault(require("kleur"));
8
- const tick = '√', cross = '×';
9
- const log = (method, symbol, ...args) => {
10
- console[method](symbol, ...args);
8
+ const isTest = process.env.JEST_WORKER_ID !== undefined;
9
+ exports.icons = {
10
+ done: kleur_1.default.green('◉'),
11
+ info: kleur_1.default.cyan('◎'),
12
+ error: kleur_1.default.red('⨂'),
13
+ warn: kleur_1.default.yellow('⨁')
11
14
  };
12
15
  exports.logger = {
13
16
  info(...args) {
14
- log('info', kleur_1.default.green(tick), ...args);
17
+ if (!isTest) {
18
+ console.info(exports.icons.info, ...args);
19
+ }
15
20
  },
16
21
  warn(...args) {
17
- log('warn', kleur_1.default.yellow(cross), ...args);
22
+ if (!isTest) {
23
+ console.warn(exports.icons.warn, ...args);
24
+ }
18
25
  },
19
26
  error(...args) {
20
- log('error', kleur_1.default.red(cross), ...args);
21
- }
27
+ if (!isTest) {
28
+ console.error(exports.icons.error, ...args);
29
+ }
30
+ },
31
+ done(...args) {
32
+ if (!isTest) {
33
+ console.info(exports.icons.done, ...args);
34
+ }
35
+ },
22
36
  };
package/lib/nuget.js CHANGED
@@ -47,6 +47,9 @@ const install = (project, sdkVersion, xrmVersion) => {
47
47
  cwd: process.cwd(),
48
48
  stdio: 'inherit'
49
49
  });
50
+ if (process.env.JEST_WORKER_ID !== undefined) {
51
+ return;
52
+ }
50
53
  (0, child_process_1.spawnSync)('dotnet', ['restore'], {
51
54
  cwd: process.cwd(),
52
55
  stdio: 'inherit'
@@ -15,6 +15,9 @@ const getNpm = () => {
15
15
  };
16
16
  const install = (cwd, type) => {
17
17
  const packages = getPackages(type);
18
+ if (process.env.JEST_WORKER_ID !== undefined) {
19
+ return;
20
+ }
18
21
  if ((0, exports.getYarn)()) {
19
22
  (0, child_process_1.spawnSync)((0, exports.getYarn)(), ['add', ...packages.devDependencies], { stdio: 'inherit', cwd });
20
23
  if (packages.dependencies) {
@@ -30,6 +33,20 @@ const install = (cwd, type) => {
30
33
  };
31
34
  exports.install = install;
32
35
  function getPackages(type) {
36
+ if (type === 'pcf') {
37
+ return {
38
+ dependencies: [
39
+ 'react',
40
+ 'react-dom',
41
+ '@fluentui/react'
42
+ ],
43
+ devDependencies: [
44
+ `powerapps-project-${type}`,
45
+ '@types/react',
46
+ '@types/react-dom'
47
+ ]
48
+ };
49
+ }
33
50
  const packages = {
34
51
  devDependencies: [
35
52
  `powerapps-project-${type}`,
package/lib/plop.js CHANGED
@@ -6,11 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.runGenerator = exports.getGenerator = void 0;
7
7
  const node_plop_1 = __importDefault(require("node-plop"));
8
8
  const path_1 = __importDefault(require("path"));
9
- const tick = '√';
9
+ const logger_1 = require("./logger");
10
10
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
11
  const getGenerator = async (type, name) => {
12
- const plopFile = path_1.default.resolve(__dirname, 'plopfile.js');
13
- const plop = await (0, node_plop_1.default)(plopFile, { destBasePath: name, force: false });
12
+ let plopFile = path_1.default.resolve(__dirname, 'plopfile.js');
13
+ if (process.env.JEST_WORKER_ID !== undefined) {
14
+ plopFile = path_1.default.resolve(__dirname, 'plopfile.ts');
15
+ }
16
+ const plop = (0, node_plop_1.default)(plopFile, { destBasePath: name, force: false });
14
17
  const generator = plop.getGenerator(type);
15
18
  return generator;
16
19
  };
@@ -18,16 +21,16 @@ exports.getGenerator = getGenerator;
18
21
  const runGenerator = async (generator, args) => {
19
22
  const results = await generator.runActions(args, {
20
23
  onComment: (comment) => {
21
- console.log(`${tick} ${comment}`);
24
+ logger_1.logger.info(comment);
22
25
  }
23
26
  });
24
27
  if (results.failures && results.failures.length > 0) {
25
- throw new Error('Error: ' + results.failures[0].error);
28
+ throw new Error(results.failures[0].error);
26
29
  }
27
30
  // do something after the actions have run
28
31
  for (const change of results.changes) {
29
32
  if (change.path) {
30
- console.log(`${tick} ${change.path}`);
33
+ logger_1.logger.done(change.path);
31
34
  }
32
35
  }
33
36
  };
package/lib/plopfile.js CHANGED
@@ -5,13 +5,56 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const path_1 = __importDefault(require("path"));
7
7
  const child_process_1 = require("child_process");
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const didSucceed = (code) => `${code}` === '0';
8
10
  /* eslint-disable @typescript-eslint/no-explicit-any */
9
11
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
10
12
  exports.default = (plop) => {
11
13
  plop.setActionType('signAssembly', (answers) => {
12
14
  const keyPath = path_1.default.resolve(process.cwd(), `${answers.name}.snk`);
13
- (0, child_process_1.spawnSync)(path_1.default.resolve(__dirname, '../', 'bin', 'sn.exe'), ['-q', '-k', keyPath], { stdio: 'inherit' });
14
- 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
+ });
29
+ });
30
+ plop.setActionType('runPcf', (answers) => {
31
+ const args = ['pcf', 'init', '-ns', answers.namespace, '-n', answers.name, '-t', answers.template];
32
+ /// Setting framework to React currently unsupported by PCF CLI
33
+ // if (answers.react) {
34
+ // args.push('-fw', 'react');
35
+ // }
36
+ if (process.env.JEST_WORKER_ID !== undefined) {
37
+ args.push('-npm', 'false');
38
+ }
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
+ });
50
+ });
51
+ plop.setActionType('addGenScript', async () => {
52
+ const packagePath = path_1.default.resolve(process.cwd(), 'package.json');
53
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
54
+ const packageJson = require(packagePath);
55
+ packageJson.scripts.gen = 'plop';
56
+ await fs_1.default.promises.writeFile(packagePath, JSON.stringify(packageJson, null, 4), 'utf8');
57
+ return 'added plop script to package.json';
15
58
  });
16
59
  plop.setGenerator('webresource', {
17
60
  actions: [
@@ -24,6 +67,32 @@ exports.default = (plop) => {
24
67
  }
25
68
  ]
26
69
  });
70
+ plop.setGenerator('pcf', {
71
+ actions: [
72
+ {
73
+ type: 'runPcf'
74
+ },
75
+ {
76
+ type: 'addMany',
77
+ templateFiles: [
78
+ '../plop-templates/pcf/App.tsx',
79
+ '../plop-templates/pcf/index.ts'
80
+ ],
81
+ base: '../plop-templates/pcf',
82
+ destination: `${process.cwd()}/{{ name }}`,
83
+ force: true,
84
+ skip: (answers) => {
85
+ return !answers.react;
86
+ }
87
+ },
88
+ {
89
+ type: 'addGenScript',
90
+ skip: (answers) => {
91
+ return !answers.react;
92
+ }
93
+ }
94
+ ]
95
+ });
27
96
  plop.setGenerator('assembly', {
28
97
  actions: [
29
98
  {
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.15.6",
4
+ "version": "0.16.3",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
7
7
  "bin": {
@@ -19,14 +19,14 @@
19
19
  "scripts": {
20
20
  "build": "tsc -p .",
21
21
  "lint": "eslint",
22
- "prebuild": "rimraf lib"
22
+ "clean": "rimraf lib"
23
23
  },
24
24
  "dependencies": {
25
+ "commander": "^8.3.0",
25
26
  "envinfo": "^7.8.1",
27
+ "kleur": "^4.1.4",
26
28
  "node-plop": "^0.26.3",
27
- "prompts": "^2.4.2",
28
- "commander": "^8.3.0",
29
- "kleur": "^4.1.4"
29
+ "prompts": "^2.4.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/envinfo": "^7.8.1",
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { ThemeProvider } from '@fluentui/react/lib/utilities/ThemeProvider/ThemeProvider';
3
+
4
+ export interface AppProps {
5
+ isTestHarness: boolean;
6
+ }
7
+
8
+ export const App = React.memo((props: AppProps) => {
9
+ const {
10
+ isTestHarness
11
+ } = props;
12
+
13
+ return (
14
+ <ThemeProvider dir='ltr'>
15
+ </ThemeProvider>
16
+ );
17
+ });
18
+
19
+ App.displayName = 'App';
20
+
@@ -0,0 +1,66 @@
1
+ import { IInputs, IOutputs } from "./generated/ManifestTypes";
2
+ import React from 'react';
3
+ import ReactDOM from 'react-dom';
4
+ import { initializeIcons } from '@fluentui/font-icons-mdl2';
5
+
6
+ import { App } from './App';
7
+
8
+ export class ReportDashboard implements ComponentFramework.StandardControl<IInputs, IOutputs> {
9
+ container: HTMLDivElement;
10
+ context: ComponentFramework.Context<IInputs>;
11
+ isTestHarness: boolean;
12
+
13
+ /**
14
+ * Empty constructor.
15
+ */
16
+ constructor() {
17
+
18
+ }
19
+
20
+ /**
21
+ * Used to initialize the control instance. Controls can kick off remote server calls and other initialization actions here.
22
+ * Data-set values are not initialized here, use updateView.
23
+ * @param context The entire property bag available to control via Context Object; It contains values as set up by the customizer mapped to property names defined in the manifest, as well as utility functions.
24
+ * @param notifyOutputChanged A callback method to alert the framework that the control has new outputs ready to be retrieved asynchronously.
25
+ * @param state A piece of data that persists in one session for a single user. Can be set at any point in a controls life cycle by calling 'setControlState' in the Mode interface.
26
+ * @param container If a control is marked control-type='standard', it will receive an empty div element within which it can render its content.
27
+ */
28
+ public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container: HTMLDivElement): void {
29
+ initializeIcons(undefined, { disableWarnings: true });
30
+
31
+ this.container = container;
32
+ this.context = context;
33
+ this.isTestHarness = document.getElementById('control-dimensions') !== null;
34
+ }
35
+
36
+
37
+ /**
38
+ * Called when any value in the property bag has changed. This includes field values, data-sets, global values such as container height and width, offline status, control metadata values such as label, visible, etc.
39
+ * @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
+ public updateView(context: ComponentFramework.Context<IInputs>): void {
42
+ ReactDOM.render(
43
+ React.createElement(App, {
44
+ isTestHarness: this.isTestHarness
45
+ }),
46
+ this.container
47
+ );
48
+ }
49
+
50
+ /**
51
+ * It is called by the framework prior to a control receiving new data.
52
+ * @returns an object based on nomenclature defined in manifest, expecting object[s] for property marked as “bound” or “output”
53
+ */
54
+ public getOutputs(): IOutputs {
55
+ return {};
56
+ }
57
+
58
+ /**
59
+ * Called when the control is to be removed from the DOM tree. Controls should use this call for cleanup.
60
+ * i.e. cancelling any pending remote calls, removing listeners, etc.
61
+ */
62
+ public destroy(): void {
63
+ // Add code to cleanup control if necessary
64
+ }
65
+
66
+ }
@@ -1,12 +0,0 @@
1
- export interface Config {
2
- name: string;
3
- isolation: number;
4
- tenant: string;
5
- solution: string;
6
- server: string;
7
- xrmVersion?: string;
8
- sdkVersion?: string;
9
- }
10
- declare const _default: (type: string) => Promise<void>;
11
- export default _default;
12
- export declare const done: (type: string) => void;
@@ -1,11 +0,0 @@
1
- export interface EnvInfoCache {
2
- Binaries: {
3
- Yarn: any;
4
- npm: any;
5
- };
6
- npmGlobalPackages: {
7
- pnpm: any;
8
- };
9
- }
10
- export declare const getEnvInfo: () => EnvInfoCache;
11
- export declare const initialize: () => Promise<any>;
package/lib/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/lib/logger.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export declare const logger: {
2
- info(...args: any[]): void;
3
- warn(...args: any[]): void;
4
- error(...args: any[]): void;
5
- };
package/lib/nuget.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const getNugetPackageVersions: (name: string) => Promise<string[]>;
2
- export declare const install: (project: string, sdkVersion?: string | undefined, xrmVersion?: string | undefined) => void;
@@ -1,2 +0,0 @@
1
- export declare const getYarn: () => any;
2
- export declare const install: (cwd: string, type: string) => void;
package/lib/plop.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { PlopGenerator } from 'node-plop';
2
- import { Config } from './createDataverseProject';
3
- export declare const getGenerator: (type: string, name: string) => Promise<PlopGenerator>;
4
- export declare const runGenerator: (generator: PlopGenerator, args: Config) => Promise<void>;
package/lib/plopfile.d.ts DELETED
@@ -1,2 +0,0 @@
1
- declare const _default: (plop: any) => void;
2
- export default _default;