Yarn script fails to execute when building in Visual Studio Team Services - build

I managed to setup Yarn in Angular app and when I run: yarn install
it successfully installs all the packages which makes the app run with no issues.
Inside package.json I have written some scripts to help me out run the specific task (I want node_modules folder to be inside wwwroot).
"scripts": {
"install-dev": "yarn install --modules-folder ./wwwroot/node_modules",
"install-ci": "install --modules-folder ./wwwroot/node_modules",
}
When I have to install packages locally I use yarn run install-dev, which works perfectly.
However, when I need to build the project using Visual Studio Team Services, using Yarn Build and Release Tasks by Geek Learning I pass in run install-ci inside VS Team Services Arguments which fails with the following error:
VS Console.png
What I find weird is that it says Version: 1.1.1001, but under it writes yarn run v0.27.5. It seems like that version v0.27.5 does not support --modules-folder (and anyway why is it running the wrong version?).
Here is how Yarn task is configured in Visual Studio Team Services - VS Yarn task configuration.png.
I am making sure that I am in the correct branch (bower-to-yarn) as well as pointing to the Project Directory - src/MyApp where I have package.json file. Also, it says that the task should run with Version: 1.*.
Any help would be very useful. Thank you!
The reason why I have "install-ci" without yarn is because inside vsts console yarn gets loaded and does not need to be specified again. The same applies to Arguments field inside Visual Studio Team Services run install-ci.

Related

How to build a Windows Qt/MSBuild C++ application inside a Jenkins docker container

First of all, I'm completely new in CI.
I am trying to set up a Jenkins to build several C++ projects I am hosting on my own Gitea instance.
The applications I want to add to my Jenkins build pipeline are mostly Qt or MSBuild projects.
I have installed the MSBuild plugin for Jenkins, however I couldn't find a Qt plugin.
Since the Jenkins docker container runs inside a Linux environment and runs on Linux itself too, I couldn't find out how to make Jenkins build MSBuild (.sln) or qt (.pro) projects.
How do I have to configure Jenkins to make it build MSBuild or Qt repositories?
Do I have to create makefile or CMakeLists files?
My goal is to have automated release builds inside my repositories built using my Jenkins docker container running on my Linux machine.
I really couldn't find a useful tutorial or explanation on this.
Thanks a lot in advance.

How to make a NodeJS package build C++/WebAssembly upon install?

How do you structure a NodeJS package, containing wrapped C++ code that's compiled into web assembly, so that when you run npm install <package name>, the compilation step happens?
I have a package mypackage configured so that when I run npm run build in its project directory, C++ code is compiled into web assembly, and this is then bundled with other Javascript for the package.
I'm now trying to use this package from another project, and if I run npm install --save mypackage, it installs the package's Javascript, but doesn't run it's build process, so none of the web assembly is created, resulting in a broken package.
How you do it
In the scriptis section in package.json file, you can add a postinstall script, while will be run each time after a package is installed. You can find more about npm scripts here https://docs.npmjs.com/misc/scripts
inside pacakge.json
...
"scripts": {
...
"postinstall": "npm run build"
}
Should you do it
The only valid reason to make build process happen at the target (consumer) system is if the build is dependent on the operating system or architecture of the target system, or is dependent on some configuration/properties of the target system. If the build is not related then it should be made at publishing time, this way it will be done once for all consumers, saving bandwidth, and time. usually also you save space because the bundled package is less than the source.
If you decide to package the built artifact (your bundled package) then its a good idea to use the prepublish script
"scripts": {
...
// this will make sure that you are always publishing the most updated built artifact, instead of having to manually run build each time you want to publish
"prepublish": "npm run build"
}
Another good idea, is to also exclude the source files from the published package using .npmignore, to actually save space.

Local Docker run fails (An assembly specified in the manifest was not found)

I am trying to test my local Docker build before I deploy to AWS. My app has dependencies to AWSSDK.Core via NuGet and I am using the following Docker file:
FROM microsoft/dotnet:2.2.0-aspnetcore-runtime AS runtime
WORKDIR /My.App
COPY bin/Release/netcoreapp2.2 .
ENV ASPNETCORE_URLS http://+:5000
EXPOSE 5000
ENTRYPOINT ["dotnet", "My.App.dll"]
To build my file
docker build -t myapp .
However, when I try to run it with
docker run -it --rm --name my_app myapp
I get the error
Error:
An assembly specified in the application dependencies manifest (My.App.deps.json) was not found:
package: 'AWSSDK.Core', version: '3.3.106.17'
path: 'lib/netstandard2.0/AWSSDK.Core.dll'
As far as I can tell, I should be adding a RUN command to install the AWSSDK in my Docker image but I cannot find it. So, my question would be: Am I doing something wrong? If not, is there some kind of reference as to the locations of packages to use in Docker?
After digging around some, I found a few possible answers. First I found this blog post which exemplifies how to use docker with .NET with a very simple project. The solution to my problem was to use the dotnet package command, which gathers all the dependencies and puts them in a single directory.
However, after digging some more, I found Microsoft's Container Tools in Visual Studio which, by pressing the right mouse button on the project, offers to add Docker Support which is more elaborate than the first solution.

npm start in dev mode within django project fail using django-tailwind package

im trying to use the below package to use tailwind css within my django project im using a windows 10 machine
package used to integrate tailwind-css in django
tailwind-css uses npm modules to install and start of which the install worked although the start failed giving me the below error (all steps in the package Readme were followed upto 7 where the error occured)
im trying to figure out whether its an issue nodejs has with windows or not. any help will be appreciated
here's the fix since we are using windows we have to change the qoutes we use so within ./theme/static_src/package.json change "start": "watch 'npm run build-postcss' ./src"
to
"start": "watch \"npm run build-postcss\" ./src"

Can't run 'ng' from VSTS agent

I'm trying to run unit tests against our AngularCLI project using our hosted VSTS build agents however it keeps running into trouble when it tries to run 'ng test'.
To resolve this I have tried to make the agent use the ng tool directly by providing the path to the tool. This hasn't worked as it looks like it's trying to run 'ng test' where the tool is rather than in the specified current working directory:
I've also tried to add it as an environment variable in Windows (we're using Windows Server 2012 to host the VSTS agent) and setting the tool in the VSTS agent as just ng however it doesn't appear to be finding the ng tool:
How can I get the VSTS agent to make use of the ng tool to run tests? We have got #angular/cli installed on the server hosting the agent.
The thing is that you won't get angular cli installed on VSTS globally as its build server is not supporting that. But the good thing you not even need cli globally installed on your agent.
All you need is npm run ng build -- prod - this way it will always run the local version. Also this way you won't need to take care of updating your global package at all.
Use npm run ng test to run tests, npm run ng e2e to run protractor. If you need to pass any more params to any of these just use --
As mentioned by #Kuncevic, to use the Angular CLI without installing it globally, you will need to use the npm run command.
To run an Angular build using Azure Devops:
Add an npm task to install dependencies (choose install for the command)
Add another npm task, but choose custom for the command. Then add your command and arguments:
run ng -- build --output-path=dist --configuration=prod
Note how npm is not a part of the command and arguments since this will be provided by the task. Also note how -- separates the command to be run and the arguments to be passed to the command.