create-powerapps-project 0.15.3 → 0.16.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.
- package/CHANGELOG.json +61 -1
- package/CHANGELOG.md +37 -5
- package/lib/logger.js +22 -12
- package/lib/{createDataverseProject.js → packages/create-powerapps-project/src/createDataverseProject.js} +83 -24
- package/lib/{getEnvInfo.js → packages/create-powerapps-project/src/getEnvInfo.js} +0 -0
- package/lib/{index.js → packages/create-powerapps-project/src/index.js} +0 -0
- package/lib/{nuget.js → packages/create-powerapps-project/src/nuget.js} +3 -0
- package/lib/{packageManager.js → packages/create-powerapps-project/src/packageManager.js} +17 -0
- package/lib/{plop.js → packages/create-powerapps-project/src/plop.js} +8 -5
- package/lib/{plopfile.js → packages/create-powerapps-project/src/plopfile.js} +47 -0
- package/package.json +5 -5
- package/plop-templates/pcf/App.tsx +20 -0
- package/plop-templates/pcf/index.ts +66 -0
- package/lib/createDataverseProject.d.ts +0 -12
- package/lib/getEnvInfo.d.ts +0 -11
- package/lib/index.d.ts +0 -2
- package/lib/logger.d.ts +0 -5
- package/lib/nuget.d.ts +0 -2
- package/lib/packageManager.d.ts +0 -2
- package/lib/plop.d.ts +0 -4
- package/lib/plopfile.d.ts +0 -2
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,67 @@
|
|
|
2
2
|
"name": "create-powerapps-project",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Mon, 07 Feb 2022 22:01:59 GMT",
|
|
6
|
+
"tag": "create-powerapps-project_v0.16.0",
|
|
7
|
+
"version": "0.16.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "derek.finlinson@journeyteam.com",
|
|
12
|
+
"package": "create-powerapps-project",
|
|
13
|
+
"commit": "55d633b2c3064bbdce48c5d314d8e7572a015882",
|
|
14
|
+
"comment": "Add support for PCF projects"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Mon, 17 Jan 2022 15:43:56 GMT",
|
|
21
|
+
"tag": "create-powerapps-project_v0.15.6",
|
|
22
|
+
"version": "0.15.6",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"author": "derek.finlinson@journeyteam.com",
|
|
27
|
+
"package": "create-powerapps-project",
|
|
28
|
+
"commit": "d275c2308928ec40259d257ed132c91b3d1a87fb",
|
|
29
|
+
"comment": "Rework logger"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"date": "Sun, 16 Jan 2022 23:22:22 GMT",
|
|
36
|
+
"tag": "create-powerapps-project_v0.15.5",
|
|
37
|
+
"version": "0.15.5",
|
|
38
|
+
"comments": {
|
|
39
|
+
"patch": [
|
|
40
|
+
{
|
|
41
|
+
"author": "derek.finlinson@journeyteam.com",
|
|
42
|
+
"package": "create-powerapps-project",
|
|
43
|
+
"commit": "928a436f3d6627765a329ee4cb31d83cab714b1d",
|
|
44
|
+
"comment": "Switch symbols"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"date": "Sun, 16 Jan 2022 22:57:19 GMT",
|
|
51
|
+
"tag": "create-powerapps-project_v0.15.4",
|
|
52
|
+
"version": "0.15.4",
|
|
53
|
+
"comments": {
|
|
54
|
+
"patch": [
|
|
55
|
+
{
|
|
56
|
+
"author": "derek.finlinson@journeyteam.com",
|
|
57
|
+
"package": "create-powerapps-project",
|
|
58
|
+
"commit": "acf6ca4763a9d98fa7683fe517deb872f12f4c42",
|
|
59
|
+
"comment": "Fix logging for real"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"date": "Sun, 16 Jan 2022 22:41:55 GMT",
|
|
6
66
|
"tag": "create-powerapps-project_v0.15.3",
|
|
7
67
|
"version": "0.15.3",
|
|
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
|
|
3
|
+
This log was last generated on Mon, 07 Feb 2022 22:01:59 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 0.
|
|
7
|
+
## 0.16.0
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Mon, 07 Feb 2022 22:01:59 GMT
|
|
10
10
|
|
|
11
|
-
###
|
|
11
|
+
### Minor changes
|
|
12
12
|
|
|
13
|
-
-
|
|
13
|
+
- Add support for PCF projects (derek.finlinson@journeyteam.com)
|
|
14
14
|
|
|
15
|
+
## 0.15.6
|
|
16
|
+
|
|
17
|
+
Mon, 17 Jan 2022 15:43:56 GMT
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- Rework logger (derek.finlinson@journeyteam.com)
|
|
22
|
+
|
|
23
|
+
## 0.15.5
|
|
24
|
+
|
|
25
|
+
Sun, 16 Jan 2022 23:22:22 GMT
|
|
26
|
+
|
|
27
|
+
### Patches
|
|
28
|
+
|
|
29
|
+
- Switch symbols (derek.finlinson@journeyteam.com)
|
|
30
|
+
|
|
31
|
+
## 0.15.4
|
|
32
|
+
|
|
33
|
+
Sun, 16 Jan 2022 22:57:19 GMT
|
|
34
|
+
|
|
35
|
+
### Patches
|
|
36
|
+
|
|
37
|
+
- Fix logging for real (derek.finlinson@journeyteam.com)
|
|
38
|
+
|
|
39
|
+
## 0.15.3
|
|
40
|
+
|
|
41
|
+
Sun, 16 Jan 2022 22:41:55 GMT
|
|
42
|
+
|
|
43
|
+
### Patches
|
|
44
|
+
|
|
45
|
+
- Fix logging (derek.finlinson@journeyteam.com)
|
|
46
|
+
|
|
15
47
|
## 0.15.2
|
|
16
48
|
|
|
17
49
|
Sun, 16 Jan 2022 22:28:32 GMT
|
package/lib/logger.js
CHANGED
|
@@ -3,24 +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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
console[method](timestamp, 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('‼')
|
|
15
14
|
};
|
|
16
15
|
exports.logger = {
|
|
17
16
|
info(...args) {
|
|
18
|
-
|
|
17
|
+
if (!isTest) {
|
|
18
|
+
console.info(exports.icons.info, ...args);
|
|
19
|
+
}
|
|
19
20
|
},
|
|
20
21
|
warn(...args) {
|
|
21
|
-
|
|
22
|
+
if (!isTest) {
|
|
23
|
+
console.warn(exports.icons.warn, ...args);
|
|
24
|
+
}
|
|
22
25
|
},
|
|
23
26
|
error(...args) {
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
if (!isTest) {
|
|
28
|
+
console.error(exports.icons.error, ...args);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
done(...args) {
|
|
32
|
+
if (!isTest) {
|
|
33
|
+
console.info(exports.icons.info, ...args);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
26
36
|
};
|
|
@@ -29,12 +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 logger_1 = require("
|
|
32
|
+
const logger_1 = require("../../../logger");
|
|
33
33
|
exports.default = async (type) => {
|
|
34
34
|
await (0, getEnvInfo_1.initialize)();
|
|
35
35
|
const name = path_1.default.basename(process.cwd());
|
|
36
|
-
if (!type || (type !== 'webresource' && type !== 'assembly')) {
|
|
37
|
-
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';
|
|
38
38
|
const invalidMessage = invalid ? `${type} is not a valid project type.` : '';
|
|
39
39
|
const { promptType } = await (0, prompts_1.default)({
|
|
40
40
|
type: 'select',
|
|
@@ -42,7 +42,8 @@ exports.default = async (type) => {
|
|
|
42
42
|
message: `${invalidMessage} Select dataverse project to create?`,
|
|
43
43
|
choices: [
|
|
44
44
|
{ title: 'web resource', value: 'webresource' },
|
|
45
|
-
{ title: 'plugin or workflow activity', value: 'assembly' }
|
|
45
|
+
{ title: 'plugin or workflow activity', value: 'assembly' },
|
|
46
|
+
{ title: 'powerapps component framework control', value: 'pcf' }
|
|
46
47
|
]
|
|
47
48
|
});
|
|
48
49
|
type = promptType;
|
|
@@ -58,7 +59,9 @@ exports.default = async (type) => {
|
|
|
58
59
|
logger_1.logger.info(`run powerapps-project-${type} code generator`);
|
|
59
60
|
await (0, plop_1.runGenerator)(generator, config);
|
|
60
61
|
logger_1.logger.info('initialize project');
|
|
61
|
-
|
|
62
|
+
if (type !== 'pcf' || config.react) {
|
|
63
|
+
pkg.install(process.cwd(), type);
|
|
64
|
+
}
|
|
62
65
|
if (type === 'assembly') {
|
|
63
66
|
logger_1.logger.info('add nuget packages');
|
|
64
67
|
(0, nuget_1.install)(config.name, config.sdkVersion, config.xrmVersion);
|
|
@@ -67,6 +70,35 @@ exports.default = async (type) => {
|
|
|
67
70
|
};
|
|
68
71
|
const getAnswers = async (type) => {
|
|
69
72
|
let questions = [];
|
|
73
|
+
if (type === 'pcf') {
|
|
74
|
+
questions = [
|
|
75
|
+
{
|
|
76
|
+
type: 'select',
|
|
77
|
+
name: 'template',
|
|
78
|
+
message: 'template',
|
|
79
|
+
choices: [
|
|
80
|
+
{ title: 'field', value: 'field' },
|
|
81
|
+
{ title: 'dataset', value: 'dataset' }
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: 'text',
|
|
86
|
+
name: 'namespace',
|
|
87
|
+
message: 'namespace'
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
type: 'text',
|
|
91
|
+
name: 'name',
|
|
92
|
+
message: 'name'
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: 'confirm',
|
|
96
|
+
name: 'react',
|
|
97
|
+
message: 'install react?'
|
|
98
|
+
}
|
|
99
|
+
];
|
|
100
|
+
return questions;
|
|
101
|
+
}
|
|
70
102
|
if (type === 'webresource') {
|
|
71
103
|
questions.push({
|
|
72
104
|
type: 'text',
|
|
@@ -127,27 +159,54 @@ const getAnswers = async (type) => {
|
|
|
127
159
|
return questions;
|
|
128
160
|
};
|
|
129
161
|
const done = (type) => {
|
|
130
|
-
|
|
131
|
-
|
|
162
|
+
if (process.env.JEST_WORKER_ID !== undefined) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
let message;
|
|
166
|
+
if (type === 'pcf') {
|
|
167
|
+
message = `
|
|
168
|
+
|
|
169
|
+
${logger_1.icons.done} ${type} project created!
|
|
170
|
+
|
|
171
|
+
keep your build tools up-to-date by updating these two devDependencies:
|
|
172
|
+
${logger_1.icons.info} powerapps-project-${type}
|
|
132
173
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
174
|
+
build your project in watch mode with this command:
|
|
175
|
+
${logger_1.icons.info} npm start watch
|
|
176
|
+
build your project in production mode with this command:
|
|
177
|
+
${logger_1.icons.info} npm run build
|
|
136
178
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
${pkg.getYarn() ? 'yarn' : 'npm run'} start
|
|
140
|
-
build your project in production mode with this command:
|
|
141
|
-
${pkg.getYarn() ? 'yarn' : 'npm run'} build
|
|
142
|
-
generate table definition files with this command:
|
|
143
|
-
${pkg.getYarn() ? 'yarn' : 'npm run'} generate` :
|
|
144
|
-
`build your project with this command:
|
|
145
|
-
dotnet build
|
|
146
|
-
deploy your project with this command:
|
|
147
|
-
${pkg.getYarn() ? 'yarn' : 'npm run'} deploy`}
|
|
179
|
+
run code generator with this command:
|
|
180
|
+
${logger_1.icons.info} npm run gen
|
|
148
181
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
message = `
|
|
186
|
+
|
|
187
|
+
${logger_1.icons.done} ${type} project created!
|
|
188
|
+
|
|
189
|
+
keep your build tools up-to-date by updating these two devDependencies:
|
|
190
|
+
${logger_1.icons.info} dataverse-utils
|
|
191
|
+
${logger_1.icons.info} powerapps-project-${type}
|
|
192
|
+
|
|
193
|
+
${type === 'webresource' ?
|
|
194
|
+
`build your project in watch mode with this command:
|
|
195
|
+
${logger_1.icons.info} ${pkg.getYarn() ? 'yarn' : 'npm run'} start
|
|
196
|
+
build your project in production mode with this command:
|
|
197
|
+
${logger_1.icons.info} ${pkg.getYarn() ? 'yarn' : 'npm run'} build
|
|
198
|
+
generate table definition files with this command:
|
|
199
|
+
${logger_1.icons.info} ${pkg.getYarn() ? 'yarn' : 'npm run'} generate` :
|
|
200
|
+
`build your project with this command:
|
|
201
|
+
dotnet build
|
|
202
|
+
deploy your project with this command:
|
|
203
|
+
${logger_1.icons.info} ${pkg.getYarn() ? 'yarn' : 'npm run'} deploy`}
|
|
204
|
+
|
|
205
|
+
run code generator with this command:
|
|
206
|
+
${logger_1.icons.info} ${pkg.getYarn() ? 'yarn' : 'npm run'} gen
|
|
207
|
+
|
|
208
|
+
`;
|
|
209
|
+
}
|
|
210
|
+
console.info(message);
|
|
152
211
|
};
|
|
153
212
|
exports.done = done;
|
|
File without changes
|
|
File without changes
|
|
@@ -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}`,
|
|
@@ -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 logger_1 = require("
|
|
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
|
-
|
|
13
|
-
|
|
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,7 +21,7 @@ exports.getGenerator = getGenerator;
|
|
|
18
21
|
const runGenerator = async (generator, args) => {
|
|
19
22
|
const results = await generator.runActions(args, {
|
|
20
23
|
onComment: (comment) => {
|
|
21
|
-
logger_1.logger.
|
|
24
|
+
logger_1.logger.done(comment);
|
|
22
25
|
}
|
|
23
26
|
});
|
|
24
27
|
if (results.failures && results.failures.length > 0) {
|
|
@@ -27,7 +30,7 @@ const runGenerator = async (generator, args) => {
|
|
|
27
30
|
// do something after the actions have run
|
|
28
31
|
for (const change of results.changes) {
|
|
29
32
|
if (change.path) {
|
|
30
|
-
logger_1.logger.
|
|
33
|
+
logger_1.logger.done(change.path);
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
};
|
|
@@ -5,6 +5,7 @@ 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"));
|
|
8
9
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
9
10
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
10
11
|
exports.default = (plop) => {
|
|
@@ -13,6 +14,26 @@ exports.default = (plop) => {
|
|
|
13
14
|
(0, child_process_1.spawnSync)(path_1.default.resolve(__dirname, '../', 'bin', 'sn.exe'), ['-q', '-k', keyPath], { stdio: 'inherit' });
|
|
14
15
|
return 'signed assembly';
|
|
15
16
|
});
|
|
17
|
+
plop.setActionType('runPcf', (answers) => {
|
|
18
|
+
const args = ['pcf', 'init', '-ns', answers.namespace, '-n', answers.name, '-t', answers.template];
|
|
19
|
+
/// Setting framework to React currently unsupported by PCF CLI
|
|
20
|
+
// if (answers.react) {
|
|
21
|
+
// args.push('-fw', 'react');
|
|
22
|
+
// }
|
|
23
|
+
if (process.env.JEST_WORKER_ID !== undefined) {
|
|
24
|
+
args.push('-npm', 'false');
|
|
25
|
+
}
|
|
26
|
+
(0, child_process_1.spawnSync)('pac', args, { stdio: 'inherit' });
|
|
27
|
+
return 'pcf project created';
|
|
28
|
+
});
|
|
29
|
+
plop.setActionType('addGenScript', () => {
|
|
30
|
+
const packagePath = path_1.default.resolve(process.cwd(), 'package.json');
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
32
|
+
const packageJson = require(packagePath);
|
|
33
|
+
packageJson.scripts.gen = 'plop';
|
|
34
|
+
fs_1.default.writeFileSync(packagePath, JSON.stringify(packageJson, null, 4), 'utf8');
|
|
35
|
+
return 'added plop script to package.json';
|
|
36
|
+
});
|
|
16
37
|
plop.setGenerator('webresource', {
|
|
17
38
|
actions: [
|
|
18
39
|
{
|
|
@@ -24,6 +45,32 @@ exports.default = (plop) => {
|
|
|
24
45
|
}
|
|
25
46
|
]
|
|
26
47
|
});
|
|
48
|
+
plop.setGenerator('pcf', {
|
|
49
|
+
actions: [
|
|
50
|
+
{
|
|
51
|
+
type: 'runPcf'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: 'addMany',
|
|
55
|
+
templateFiles: [
|
|
56
|
+
'../plop-templates/pcf/App.tsx',
|
|
57
|
+
'../plop-templates/pcf/index.ts'
|
|
58
|
+
],
|
|
59
|
+
base: '../plop-templates/pcf',
|
|
60
|
+
destination: `${process.cwd()}/{{ name }}`,
|
|
61
|
+
force: true,
|
|
62
|
+
skip: (answers) => {
|
|
63
|
+
return !answers.react;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'addGenScript',
|
|
68
|
+
skip: (answers) => {
|
|
69
|
+
return !answers.react;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
});
|
|
27
74
|
plop.setGenerator('assembly', {
|
|
28
75
|
actions: [
|
|
29
76
|
{
|
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.
|
|
4
|
+
"version": "0.16.0",
|
|
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
|
-
"
|
|
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;
|
package/lib/getEnvInfo.d.ts
DELETED
package/lib/index.d.ts
DELETED
package/lib/logger.d.ts
DELETED
package/lib/nuget.d.ts
DELETED
package/lib/packageManager.d.ts
DELETED
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