create-powerapps-project 2.3.0 → 2.3.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.
@@ -58,7 +58,7 @@ export default (plop) => {
58
58
  plop.setActionType('runPcf', async (answers) => {
59
59
  const args = ['pcf', 'init', '-ns', answers.namespace, '-n', answers.name, '-t', answers.template, '-npm', 'false'];
60
60
  // Set framework to React if selected
61
- if (answers.react && answers.fluentVersion === 8) {
61
+ if (answers.react) {
62
62
  args.push('-fw', 'react');
63
63
  }
64
64
  console.log('running pac pcf command with args');
package/lib/plopfile.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import path from 'node:path';
2
+ import fs from 'node:fs';
2
3
  import { getNugetPackageVersions } from './nuget.js';
3
4
  /* eslint-disable @typescript-eslint/no-explicit-any */
4
5
  export default async (plop) => {
@@ -327,23 +328,16 @@ export default async (plop) => {
327
328
  },
328
329
  {
329
330
  type: 'append',
330
- path: `${process.cwd()}/{{name}}.pcfproj`,
331
- pattern: "</PowerAppsTargetsPath>",
332
- template: `<PcfEnableAutoNpmInstall Condition=" '$(PcfEnableAutoNpmInstall)' == '' ">false</PcfEnableAutoNpmInstall>`,
333
- separator: '\n'
334
- },
335
- {
336
- type: 'append',
337
- path: `${process.cwd()}/{{name}}.pcfproj`,
338
- pattern: "</PowerAppsTargetsPath>",
339
- template: `<PcfAlwaysNpmInstall Condition=" '$(PcfAlwaysNpmInstall)' == '' ">false</PcfAlwaysNpmInstall>`,
331
+ path: `${process.cwd()}/${path.basename(process.cwd())}.pcfproj`,
332
+ pattern: '</PowerAppsTargetsPath>',
333
+ template: `\t\t<PcfEnableAutoNpmInstall Condition=" '$(PcfEnableAutoNpmInstall)' == '' ">false</PcfEnableAutoNpmInstall>\r\n\t\t<PcfAlwaysNpmInstall Condition=" '$(PcfAlwaysNpmInstall)' == '' ">false</PcfAlwaysNpmInstall>`,
340
334
  separator: '\n'
341
335
  },
342
336
  {
343
337
  type: 'append',
344
338
  path: `${process.cwd()}/eslint.config.mjs`,
345
- pattern: "reactPlugin.configs.flat.recommended,",
346
- template: "reactHooks.configs.flat.recommended,",
339
+ pattern: 'reactPlugin.configs.flat.recommended,',
340
+ template: '\treactHooksPlugin.configs.flat.recommended,',
347
341
  separator: '\n'
348
342
  },
349
343
  {
@@ -355,9 +349,9 @@ export default async (plop) => {
355
349
  },
356
350
  {
357
351
  type: 'append',
358
- path: `${process.cwd()}/{{name}}.pcfproj`,
359
- pattern: "</OutputPath>",
360
- template: `<PcfBuildMode>development</PcfBuildMode>`,
352
+ path: `${process.cwd()}/${path.basename(process.cwd())}.pcfproj`,
353
+ pattern: '</OutputPath>',
354
+ template: `\t\t<PcfBuildMode>development</PcfBuildMode>`,
361
355
  separator: '\n'
362
356
  },
363
357
  {
@@ -372,6 +366,13 @@ export default async (plop) => {
372
366
  pattern: `const props: IHelloWorldProps = { name: 'Power Apps' };`,
373
367
  template: ''
374
368
  },
369
+ async (answers) => {
370
+ if (answers.react) {
371
+ await fs.promises.rm(path.resolve(process.cwd(), answers.name, 'HelloWorld.tsx'));
372
+ return 'removed default HelloWorld component';
373
+ }
374
+ return 'react not included';
375
+ },
375
376
  {
376
377
  type: 'addScript',
377
378
  data: {
@@ -414,11 +415,7 @@ export default async (plop) => {
414
415
  type: 'npmInstall',
415
416
  data: {
416
417
  packages: {
417
- devDependencies: [
418
- 'powerapps-project-pcf',
419
- 'eslint-plugin-react-hooks',
420
- '@types/xrm'
421
- ],
418
+ devDependencies: ['powerapps-project-pcf', 'eslint-plugin-react-hooks', '@types/xrm'],
422
419
  dependencies: ['@fluentui/react-icons']
423
420
  }
424
421
  },
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": "2.3.0",
4
+ "version": "2.3.2",
5
5
  "license": "MIT",
6
6
  "exports": "./lib/index.js",
7
7
  "engines": {
@@ -4,7 +4,7 @@ import { AppContext } from './contexts/AppContext';
4
4
 
5
5
  export const App = ({ context }: { context: ComponentFramework.Context<IInputs>; }) => {
6
6
  return (
7
- <AppContext.Provider value={{{ context }}}>
7
+ <AppContext.Provider value=\{{ context }}>
8
8
  </AppContext.Provider>
9
9
  );
10
10
  };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { IInputs } from '../generated/ManifestTypes';
3
3
 
4
- interface IAppContext {
4
+ export interface IAppContext {
5
5
  context: ComponentFramework.Context<IInputs>;
6
6
  }
7
7