Equivalencias de herramientas:
Yeoman y Gulp
npm install -g yo gulp
npm install -g --production windows-build-tools
npm install -g @microsoft/generator-sharepoint
Para probar que todo ha ido bien lanzaremos los siguientes comandos:
mkdir myFirstSolution
cd
myFirstSolutionyo @microsoft/sharepoint
Finalmente le debe de aparecer la siguiente ventana:
npm install -g typescript
- _layouts/workbench.aspx
El certificado de desarrollador SOLO tiene que instalarse una vez en el entorno de desarrollo, por lo que puede omitir este paso si ya lo ejecutó en su entorno.
gulp trust-dev-certThe following pop-up should appear:
Herramientas opcionales
- Fiddler
- Complemento Postman para Chrome
- Cmder para Windows
- Oh My Zsh para Mac
- Herramientas de controles de origen de Git
Getting the version number
To find the version of your SPFx Yeoman generator, follow these steps:
- Launch a Node.js command prompt command or whatever terminal you use
- Type the following command:
npm ls -g --depth=0 @microsoft/generator-sharepoint
- Wait…
- The response should look a little like this:
The command isn’t specific to the SPFx Yeoman generator. It can be used for any NPM package. Here is what it really does:
npm
indicates a Node Package Manager command.ls
means to list packages-g
means that you want to list the global packages. If you don’t use-g
, you’ll only list the packages installed in the current solution (assuming that you’re currently in a folder that contains a solution)--depth=0
means that you only want the top-level modules. In other words, you don’t want to list all modules that includes the package you’re looking for.@microsoft/generator-sharepoint
is the actual package you want to list. You can actually put whatever package you want here. For example,npm ls -g --depth=0 yo
would tell you what version of the Yeoman generator is globally installed, andnpm ls --depth=0 office-ui-fabric-react
would tell you what version of Office UI Fabric React is currently installed in your current solution.
How to check if Yeoman has an update for you
As Stefan Bauer pointed out, if you don’t want to know which version of the SPFx Yeoman generator you have installed, but you want to see if there is an update, you can follow these steps:
- Launch a Node.js command prompt command or whatever terminal you use
- Type the following command:
yo
- Yeoman will greet you. If you have an update available, Yeoman should tell you right away (see how my Office generator has an update in the screen shot below)
- Select Update your generators
- Yeoman will prompt you to select the generators you want to upgrade. Use the spacebar to toggle which generators you want to update, then press Enter
- Yeoman will do its thing, then will tell you I’ve just updated your generators. Remember, you can update a specific generator with npm by running
npm install -g generator-______
. Good to know Yeoman, good to know.
Conclusion
This article shows you how you can use a standard NPM command to query what version of the SPFx Yeoman generator is installed on a workstation.
You can use the same command for any NPM package, but in my particular case, I just wanted to remember how to diagnose the version of the SPFx Yeoman generator.
There may be an easier/faster way to do this. If you know a different way, please share with the rest of the class.
Comments
Post a Comment