cli-microsoft365 icon indicating copy to clipboard operation
cli-microsoft365 copied to clipboard

Update docs when building a new command

Open milanholemans opened this issue 1 year ago • 6 comments

Today I was building a new command and noticed that CLI didn't recognize my new command locally. I quickly thought of something we adjusted a few weeks ago. Currently, we discover new commands only while running a new build. While we know this, this might not be that obvious for new contributors. Therefore I suggest we add to our docs an admonition that says people should run npm run build one time when they are working on a new command.

milanholemans avatar Feb 10 '24 15:02 milanholemans

Good call. Let's add this clarity 👍 It's also good to first clear before running build like npm run clean; npm run build

Adam-it avatar Feb 11 '24 08:02 Adam-it

Just to clarify: you mean the command was there but CLI wouldn't load its help?

Since we're writing in TypeScript, you need to build to transpile the code to JavaScript, so the need to build is obvious. But I suspect there's more to your observation so would like to clarify it before we proceed with defining a suitable a solution.

waldekmastykarz avatar Feb 11 '24 09:02 waldekmastykarz

Just to clarify: you mean the command was there but CLI wouldn't load its help?

Since we're writing in TypeScript, you need to build to transpile the code to JavaScript, so the need to build is obvious. But I suspect there's more to your observation so would like to clarify it before we proceed with defining a suitable a solution.

While developing I usually use npm run watch. However when you create a new command, you are unable to test it locally because CLI says this command doesn't exist. Only after doing an npm run build, CLI updates its command list and knows it's there. This is because of https://github.com/pnp/cli-microsoft365/pull/5608

milanholemans avatar Feb 11 '24 10:02 milanholemans

While developing I usually use npm run watch. However when you create a new command, you are unable to test it locally because CLI says this command doesn't exist.

Understood. I suggest that we revisit the watch command and see if there's a different way to orchestrate it so that you get everything you get from build + watch. It doesn't make sense for watch to be incomplete.

#5608 is not the only culprit. We had the same issue for a long time, previously linked to Power Platform app templates. Now they're gone, the reason has changed, but the problem remains.

waldekmastykarz avatar Feb 11 '24 13:02 waldekmastykarz

Can I work on it?

SmitaNachan avatar Apr 06 '24 07:04 SmitaNachan

All yours @SmitaNachan!

Jwaegebaert avatar Apr 16 '24 06:04 Jwaegebaert