Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New command: Create PowerApps component framework project structure #952

Closed
YannickRe opened this issue Apr 28, 2019 · 15 comments
Closed

New command: Create PowerApps component framework project structure #952

YannickRe opened this issue Apr 28, 2019 · 15 comments

Comments

@YannickRe
Copy link
Contributor

YannickRe commented Apr 28, 2019

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.

@waldekmastykarz
Copy link
Member

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

@ghurlman
Copy link

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

@waldekmastykarz
Copy link
Member

waldekmastykarz commented Apr 28, 2019

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

@ghurlman
Copy link

@waldekmastykarz, saw your post, thanks! I’ll make sure the PCF CLI team sees it if you don’t get a timely response.

@waldekmastykarz
Copy link
Member

Thank you! Appreciate your help! 👏

@YannickRe
Copy link
Contributor Author

@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?

@waldekmastykarz
Copy link
Member

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.

@YannickRe
Copy link
Contributor Author

Thank you! I’m 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 😉

@YannickRe
Copy link
Contributor Author

@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.

@waldekmastykarz
Copy link
Member

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.

@waldekmastykarz waldekmastykarz self-assigned this Aug 22, 2019
@waldekmastykarz
Copy link
Member

The current setup looks solid. Nicely done 👍

@waldekmastykarz waldekmastykarz removed their assignment Aug 24, 2019
@YannickRe
Copy link
Contributor Author

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 upgrade solves 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 :)

@waldekmastykarz
Copy link
Member

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.

@YannickRe
Copy link
Contributor Author

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.

@waldekmastykarz
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants