create-powerapps-project 0.24.0 → 0.24.2

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/README.md CHANGED
@@ -23,11 +23,12 @@ Project generator for Dataverse development
23
23
  * Workflow activity base class
24
24
  * No ILMerge needed
25
25
  * Deploy workflow assemblies and types
26
+ * PCF project scaffolding
26
27
 
27
28
  # Create project
28
29
 
29
30
  ```sh
30
- npm init powerapps-project
31
+ npx create-powerapps-project
31
32
  ```
32
33
 
33
34
  # Add files to project
package/lib/plopfile.js CHANGED
@@ -136,103 +136,105 @@ exports.default = (plop) => {
136
136
  packageQuestion,
137
137
  ...sharedQuestions,
138
138
  ],
139
- actions: [
140
- async (answers) => {
141
- const xrmVersions = await (0, nuget_1.getNugetPackageVersions)('JourneyTeam.Xrm');
142
- answers.xrmVersion = xrmVersions.shift();
143
- return `retrieved latest JourneyTeam.Xrm version ${answers.xrmVersion}`;
144
- },
145
- {
146
- type: 'add',
147
- templateFile: '../plop-templates/assembly/assembly.csproj.hbs',
148
- path: path_1.default.resolve(process.cwd(), '{{name}}.csproj'),
149
- skip: (answers) => {
150
- if (answers.pluginPackage) {
151
- return 'generating plugin package';
152
- }
153
- else {
154
- return;
155
- }
156
- }
157
- },
158
- {
159
- type: 'add',
160
- templateFile: '../plop-templates/assembly/package.csproj.hbs',
161
- path: path_1.default.resolve(process.cwd(), '{{name}}.csproj'),
162
- skip: (answers) => {
163
- if (!answers.pluginPackage) {
164
- return 'generating regular assembly';
165
- }
166
- else {
167
- return;
139
+ actions: (data) => {
140
+ return [
141
+ async (answers) => {
142
+ const xrmVersions = await (0, nuget_1.getNugetPackageVersions)('JourneyTeam.Xrm');
143
+ answers.xrmVersion = xrmVersions.shift();
144
+ return `retrieved latest JourneyTeam.Xrm version ${answers.xrmVersion}`;
145
+ },
146
+ {
147
+ type: 'add',
148
+ templateFile: '../plop-templates/assembly/assembly.csproj.hbs',
149
+ path: path_1.default.resolve(process.cwd(), '{{name}}.csproj'),
150
+ skip: (answers) => {
151
+ if (answers.pluginPackage) {
152
+ return 'generating plugin package';
153
+ }
154
+ else {
155
+ return;
156
+ }
168
157
  }
169
- }
170
- },
171
- {
172
- type: 'add',
173
- templateFile: '../plop-templates/assembly/dataverse.config.json.hbs',
174
- path: path_1.default.resolve(process.cwd(), 'dataverse.config.json'),
175
- skip: (answers) => {
176
- if (answers.pluginPackage) {
177
- return 'generating plugin package';
158
+ },
159
+ {
160
+ type: 'add',
161
+ templateFile: '../plop-templates/assembly/package.csproj.hbs',
162
+ path: path_1.default.resolve(process.cwd(), '{{name}}.csproj'),
163
+ skip: (answers) => {
164
+ if (!answers.pluginPackage) {
165
+ return 'generating regular assembly';
166
+ }
167
+ else {
168
+ return;
169
+ }
178
170
  }
179
- else {
180
- return;
171
+ },
172
+ {
173
+ type: 'add',
174
+ templateFile: '../plop-templates/assembly/dataverse.config.json.hbs',
175
+ path: path_1.default.resolve(process.cwd(), 'dataverse.config.json'),
176
+ skip: (answers) => {
177
+ if (answers.pluginPackage) {
178
+ return 'generating plugin package';
179
+ }
180
+ else {
181
+ return;
182
+ }
181
183
  }
182
- }
183
- },
184
- {
185
- type: 'add',
186
- templateFile: '../plop-templates/assembly/dataverse.package.config.json.hbs',
187
- path: path_1.default.resolve(process.cwd(), 'dataverse.config.json'),
188
- skip: (answers) => {
189
- if (!answers.pluginPackage) {
190
- return 'generating regular assembly';
184
+ },
185
+ {
186
+ type: 'add',
187
+ templateFile: '../plop-templates/assembly/dataverse.package.config.json.hbs',
188
+ path: path_1.default.resolve(process.cwd(), 'dataverse.config.json'),
189
+ skip: (answers) => {
190
+ if (!answers.pluginPackage) {
191
+ return 'generating regular assembly';
192
+ }
193
+ else {
194
+ return;
195
+ }
191
196
  }
192
- else {
193
- return;
197
+ },
198
+ {
199
+ type: 'addMany',
200
+ templateFiles: [
201
+ '../plop-templates/assembly/package.json.hbs',
202
+ '../plop-templates/assembly/plopfile.js',
203
+ '../plop-templates/assembly/.gitignore',
204
+ '../plop-templates/assembly/Entities/EarlyBoundGenerator.xml',
205
+ '../plop-templates/assembly/.vscode/tasks.json.hbs',
206
+ '../plop-templates/assembly/.editorconfig'
207
+ ],
208
+ base: '../plop-templates/assembly',
209
+ destination: process.cwd(),
210
+ force: true
211
+ },
212
+ {
213
+ type: 'addScript',
214
+ data: {
215
+ scriptKey: 'preinstall',
216
+ scriptValue: `npx only-allow ${data.package}`
194
217
  }
195
- }
196
- },
197
- {
198
- type: 'addMany',
199
- templateFiles: [
200
- '../plop-templates/assembly/package.json.hbs',
201
- '../plop-templates/assembly/plopfile.js',
202
- '../plop-templates/assembly/.gitignore',
203
- '../plop-templates/assembly/Entities/EarlyBoundGenerator.xml',
204
- '../plop-templates/assembly/.vscode/tasks.json.hbs',
205
- '../plop-templates/assembly/.editorconfig'
206
- ],
207
- base: '../plop-templates/assembly',
208
- destination: process.cwd(),
209
- force: true
210
- },
211
- {
212
- type: 'addScript',
213
- data: {
214
- scriptKey: 'preinstall',
215
- scriptValue: 'npx only-allow {{ package }}'
216
- }
217
- },
218
- {
219
- type: 'signAssembly'
220
- },
221
- {
222
- type: 'nugetRestore'
223
- },
224
- {
225
- type: 'npmInstall',
226
- data: {
227
- packages: {
228
- devDependencies: [
229
- 'powerapps-project-assembly',
230
- 'dataverse-utils'
231
- ]
218
+ },
219
+ {
220
+ type: 'signAssembly'
221
+ },
222
+ {
223
+ type: 'nugetRestore'
224
+ },
225
+ {
226
+ type: 'npmInstall',
227
+ data: {
228
+ packages: {
229
+ devDependencies: [
230
+ 'powerapps-project-assembly',
231
+ 'dataverse-utils'
232
+ ]
233
+ }
232
234
  }
233
235
  }
234
- }
235
- ]
236
+ ];
237
+ }
236
238
  });
237
239
  plop.setGenerator('pcf', {
238
240
  description: 'generate dataverse pcf project',
@@ -263,76 +265,78 @@ exports.default = (plop) => {
263
265
  },
264
266
  packageQuestion
265
267
  ],
266
- actions: [
267
- {
268
- type: 'runPcf'
269
- },
270
- {
271
- type: 'add',
272
- templateFile: '../plop-templates/pcf/tsconfig.json',
273
- path: path_1.default.resolve(process.cwd(), 'tsconfig.json'),
274
- force: true
275
- },
276
- {
277
- type: 'addMany',
278
- templateFiles: [
279
- '../plop-templates/pcf/App.tsx.hbs',
280
- '../plop-templates/pcf/AppContext.ts'
281
- ],
282
- base: '../plop-templates/pcf',
283
- destination: `${process.cwd()}/{{ name }}`,
284
- skip: (answers) => {
285
- if (!answers.react) {
286
- return 'react not included';
268
+ actions: (data) => {
269
+ return [
270
+ {
271
+ type: 'runPcf'
272
+ },
273
+ {
274
+ type: 'add',
275
+ templateFile: '../plop-templates/pcf/tsconfig.json',
276
+ path: path_1.default.resolve(process.cwd(), 'tsconfig.json'),
277
+ force: true
278
+ },
279
+ {
280
+ type: 'addMany',
281
+ templateFiles: [
282
+ '../plop-templates/pcf/App.tsx.hbs',
283
+ '../plop-templates/pcf/AppContext.ts'
284
+ ],
285
+ base: '../plop-templates/pcf',
286
+ destination: `${process.cwd()}/{{name}}`,
287
+ skip: (answers) => {
288
+ if (!answers.react) {
289
+ return 'react not included';
290
+ }
291
+ return;
287
292
  }
288
- return;
289
- }
290
- },
291
- {
292
- type: 'modify',
293
- path: `${process.cwd()}/{{ name }}/index.ts`,
294
- pattern: 'import { HelloWorld, IHelloWorldProps } from "./HelloWorld";',
295
- template: `import { App, IAppProps } from './App';`
296
- },
297
- {
298
- type: 'modify',
299
- path: `${process.cwd()}/{{ name }}/index.ts`,
300
- pattern: 'HelloWorld, props',
301
- template: 'App, props'
302
- },
303
- {
304
- type: 'modify',
305
- path: `${process.cwd()}/{{ name }}/index.ts`,
306
- pattern: `const props: IHelloWorldProps = { name: 'Hello, World!' };`,
307
- template: `const props: IAppProps = { context: context };`
308
- },
309
- {
310
- type: 'addScript',
311
- data: {
312
- scriptKey: 'build:prod',
313
- scriptValue: 'pcf-scripts build --buildMode production'
314
- }
315
- },
316
- {
317
- type: 'addScript',
318
- data: {
319
- scriptKey: 'preinstall',
320
- scriptValue: 'npx only-allow {{ package }}'
321
- }
322
- },
323
- async (answers) => {
324
- await fs_1.default.promises.rm(path_1.default.resolve(process.cwd(), answers.name, 'HelloWorld.tsx'));
325
- return 'removed HelloWorld component';
326
- },
327
- {
328
- type: 'npmInstall',
329
- skip: (answers) => {
330
- if (answers.package === 'npm') {
331
- return 'npm packages already installed';
293
+ },
294
+ {
295
+ type: 'modify',
296
+ path: `${process.cwd()}/{{name}}/index.ts`,
297
+ pattern: 'import { HelloWorld, IHelloWorldProps } from "./HelloWorld";',
298
+ template: `import { App, IAppProps } from './App';`
299
+ },
300
+ {
301
+ type: 'modify',
302
+ path: `${process.cwd()}/{{name}}/index.ts`,
303
+ pattern: 'HelloWorld, props',
304
+ template: 'App, props'
305
+ },
306
+ {
307
+ type: 'modify',
308
+ path: `${process.cwd()}/{{name}}/index.ts`,
309
+ pattern: `const props: IHelloWorldProps = { name: 'Hello, World!' };`,
310
+ template: `const props: IAppProps = { context: context };`
311
+ },
312
+ {
313
+ type: 'addScript',
314
+ data: {
315
+ scriptKey: 'build:prod',
316
+ scriptValue: 'pcf-scripts build --buildMode production'
317
+ }
318
+ },
319
+ {
320
+ type: 'addScript',
321
+ data: {
322
+ scriptKey: 'preinstall',
323
+ scriptValue: `npx only-allow ${data.package}`
324
+ }
325
+ },
326
+ async (answers) => {
327
+ await fs_1.default.promises.rm(path_1.default.resolve(process.cwd(), answers.name, 'HelloWorld.tsx'));
328
+ return 'removed HelloWorld component';
329
+ },
330
+ {
331
+ type: 'npmInstall',
332
+ skip: (answers) => {
333
+ if (answers.package === 'npm') {
334
+ return 'npm packages already installed';
335
+ }
332
336
  }
333
337
  }
334
- }
335
- ]
338
+ ];
339
+ }
336
340
  });
337
341
  plop.setGenerator('webresource', {
338
342
  description: 'generate dataverse web resource project',
@@ -351,58 +355,60 @@ exports.default = (plop) => {
351
355
  packageQuestion,
352
356
  ...sharedQuestions
353
357
  ],
354
- actions: [
355
- {
356
- type: 'addMany',
357
- templateFiles: ['../plop-templates/webresource/*', '../plop-templates/webresource/.*'],
358
- base: '../plop-templates/webresource',
359
- destination: process.cwd(),
360
- force: true
361
- },
362
- {
363
- type: 'addScript',
364
- data: {
365
- scriptKey: 'preinstall',
366
- scriptValue: 'npx only-allow {{ package }}'
367
- }
368
- },
369
- {
370
- type: 'npmInstall',
371
- data: {
372
- packages: {
373
- devDependencies: [
374
- 'powerapps-project-webresource',
375
- 'dataverse-utils',
376
- '@types/xrm',
377
- 'typescript',
378
- 'eslint',
379
- '@typescript-eslint/eslint-plugin',
380
- '@typescript-eslint/parser',
381
- 'webpack-event-plugin',
382
- 'clean-webpack-plugin',
383
- 'source-map-loader',
384
- 'babel-loader',
385
- 'ts-loader',
386
- '@babel/core',
387
- '@babel/preset-env',
388
- '@babel/preset-typescript',
389
- 'xrm-mock',
390
- 'webpack',
391
- 'webpack-cli',
392
- 'cross-spawn',
393
- 'ts-node',
394
- '@microsoft/eslint-plugin-power-apps',
395
- '-D'
396
- ],
397
- dependencies: [
398
- 'core-js',
399
- 'regenerator-runtime',
400
- 'powerapps-common',
401
- 'dataverse-webapi'
402
- ]
358
+ actions: (data) => {
359
+ return [
360
+ {
361
+ type: 'addMany',
362
+ templateFiles: ['../plop-templates/webresource/*', '../plop-templates/webresource/.*'],
363
+ base: '../plop-templates/webresource',
364
+ destination: process.cwd(),
365
+ force: true
366
+ },
367
+ {
368
+ type: 'addScript',
369
+ data: {
370
+ scriptKey: 'preinstall',
371
+ scriptValue: `npx only-allow ${data.package}`
372
+ }
373
+ },
374
+ {
375
+ type: 'npmInstall',
376
+ data: {
377
+ packages: {
378
+ devDependencies: [
379
+ 'powerapps-project-webresource',
380
+ 'dataverse-utils',
381
+ '@types/xrm',
382
+ 'typescript',
383
+ 'eslint',
384
+ '@typescript-eslint/eslint-plugin',
385
+ '@typescript-eslint/parser',
386
+ 'webpack-event-plugin',
387
+ 'clean-webpack-plugin',
388
+ 'source-map-loader',
389
+ 'babel-loader',
390
+ 'ts-loader',
391
+ '@babel/core',
392
+ '@babel/preset-env',
393
+ '@babel/preset-typescript',
394
+ 'xrm-mock',
395
+ 'webpack',
396
+ 'webpack-cli',
397
+ 'cross-spawn',
398
+ 'ts-node',
399
+ '@microsoft/eslint-plugin-power-apps',
400
+ '-D'
401
+ ],
402
+ dependencies: [
403
+ 'core-js',
404
+ 'regenerator-runtime',
405
+ 'powerapps-common',
406
+ 'dataverse-webapi'
407
+ ]
408
+ }
403
409
  }
404
410
  }
405
- }
406
- ]
411
+ ];
412
+ }
407
413
  });
408
414
  };
package/license CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Derek Finlinson
3
+ Copyright (c) 2022 Derek Finlinson
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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.24.0",
4
+ "version": "0.24.2",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
7
7
  "bin": {
@@ -8,7 +8,7 @@ export interface IAppProps {
8
8
 
9
9
  export const App = React.memo((props: IAppProps) => {
10
10
  const {
11
- context,
11
+ context
12
12
  } = props;
13
13
 
14
14
  return (