Cli-microsoft365: New command: Create PowerApps component framework project structure

Created on 28 Apr 2019  路  15Comments  路  Source: pnp/cli-microsoft365

Creates new PowerApps component framework project

pa pcf init --namespace <namespace> --name <name> --template <template>

  • namespace: string value, with some limitations (need to decompile PAC)
  • name: string value, with some limitations (need to decompile PAC)
  • template: enum value, only __field__ and __dataset__ are currently possible

Equivalent to the PowerApps CLI command.

new feature work in progress

All 15 comments

Nice! I've updated the description a little, but other than that, ready to go! 馃挭

Have you left feedback on the PowerApps forum for PCF for this issue (https://aka.ms/PCFForum) before shoehorning it into an office tool?

Thanks for the pointer @ghurlman. I haven't posted an issue there yet. I have now.

@waldekmastykarz, saw your post, thanks! I鈥檒l make sure the PCF CLI team sees it if you don鈥檛 get a timely response.

Thank you! Appreciate your help! 馃憦

@waldekmastykarz I finally gave this a shot, while familiarizing myself with the code structure. Current implementation can be found at https://github.com/YannickRe/office365-cli/tree/pa-pcf-init
It doesn't have the necessary tests yet, it seems I need to study up on this... Also, the .md documentation isn't done.

Before I go any further with this, do you mind checking this and give pointers?
Specifically around:

  • the filesystem structure
  • the template files that need to be included
  • the changes to existing files
  • in the code, if I'm duplicating code blocks that already have some implementation somewhere in the CLI code base?

Would you rather I submit this as a work in progress PR?

I'll have a look at it asap. Thanks! It will be a good first step to be able to create a project using the same templates as the original PCF tooling. In the end we should strive to create projects that can also be built on any platform, which will require reverse-engineering the build process and adjusting the templates.

Thank you! I鈥檓 aiming to make the tooling and all the commands work cross platform, and I hope I can convince some MS people to make minor changes in their NPM packages so they work cross platform 馃槈

@waldekmastykarz Sorry to push, but did you have a chance to look into this? I'd like your input before trying to get code coverage/starting other commands.

Sorry, I was away and didn't have time to look into it. Thanks for the reminder though. I'll have a look at it shortly.

The current setup looks solid. Nicely done 馃憤

Thank you! I made some changes according to your comments, but I squashed my commits, unintentionally removing them :(

  • I cannot inherit directly from Command, because it force the authentication. spfx project upgradesolves this by overriding action() in the command, but for the multiple PowerApps commands that is not ideal.
  • I switched my guid code to use uuid.

I'll get there, time to figure out how to reach the necessary test coverage :)

Suppressing auth for all pa commands would also not work if in the future we'd like to offer commands for managing apps deployed to the tenant, which would require auth, like we do in Flow commands.

I moved away from PaCommand for now, I'll solve the problem when we get to it with the new commands.

For testing the filesystem, can I use mock-fs? I need to test if the resulting file and dir structure matches the source structure. Also, I need to test if the files contain the correct data. Not sure how to approach it atm to be honest.

We have some mocking for the file system in the SPFx command, you can have a look at that. With regards to testing, it should be enough for us to test that the Node.js copy method is called with the right arguments. We should be able to assume that it works correctly so we don't need to test if the file is actually copied, that's Node's responsibility.

Was this page helpful?
0 / 5 - 0 ratings