yarn workspace version number setting problem - yarn-workspaces

For example, there are 2 packages A, B in the workspace, when yarn workspace A add B, the version number in package.json of package A is ·"A":"workspace:^", how to change it to "file:../A" or "^1.0.0"?

Related

yarn symlinks wrong package in .bin of workspace in monorepo

I have two workspaces in my mono repo workspace-a and workspace-b. One depends on jest version 26 the other on 29. When I do yarn install it will install jest-26 in the root node_modules and the other one in node_modules of workspace-b.
It will then symlink the jest script in workspace-b/.bin/jest to the older jest version in the root node_modules.
So when I run yarn workspace workspace-b jest it will invoke jest-26 even though the dependency is states as 29 and it actually installed the correct version in the corresponding node_modules directory.
To me this behavior seems odd.
I could fix it and manually link it to the right version but I wonder if I did anything wrong in the setup or if this is the default behavior.
Here is a small repository to reproduce the behavior:
https://github.com/timbicker/yarn-workspace-bug/tree/main

Is there a way to install dependencies for just one package in a yarn2 monorepo?

to do a yarn immutable install for all packages it yarn 2 recommends yarn workspaces focus --production --all, is there a way to do this for just one workspace? reason being I would like to not have all dependencies for everything installed into docker containers for different applications.
Yes,
yarn workspaces focus --production (without --all flag)
installs production dependencies just for the workspace in current working directory. You can also specify the name of the workspace as an argument, e.g.:
yarn workspaces focus --production frontend

node_modules removal on Jenkins build

We have an Angular 6 project which contains approximately 660 MB of packages in the node_modules folder. Since the project's inception, upon building the project we would remove the entire node_modules folder and then perform an npm install to re-download and install all of the packages found in package.json.
However, the build times have increased to 15 - 20 minutes. If we comment out the command to remove that folder the build time is between 3 - 4 minutes. What are we gaining to always have a brand new download of the defined packages?

Xcode install target library dependency on executable Run

I have a target executable A.
A links against a target dynamic library B in the same project.
I would like that each time in Xcode, i run A (⌘R), i will get B installed into it's INSTALL_PATH on device/simulator.
I Tried to add to A post build events, a RunScript to copy B manually, and also tried to use "Copy Build Phase" on A target but it all failed. Nothing which i have tried seems to get B installed on it's target install directory.

How do I install a Dart package globally?

Does Pub Package Manager provide a way to install packages globally?
I have been a node.js developer for a while and I was wondering if there was a pub equivalent of npm install -g <package_name>
If there is a way to install packages globally, is there a way to register binary scripts which can be installed to be invoked like shell commands.
dependencies
All pub packages are installed globally (a unique subdirectory below ~/.pub-cache/ for Mac/Linux AppData\Roaming\Pub\Cache in Windows, for each package version) and is then only linked to your project you add the dependency in pubspec.yaml.
Actually ~/pub-cache is only global for a user not global as for the entire system. I don't know npm well but I think npm install -g installs it global to the system. There is nothing similar in Dart but you don't install a package in Dart anyway. When you use a Pub package in the same version in different packages it is saved only once on the drive.
global package executables
Packages containing executable scripts can be globally (per user) activated using pub global activate .... If you add the ~/.pub-cache/bin/ directory to your path you can run these executable Dart scripts just by their name (like tuneup for the tuneup package) or with pub global run packagename:scriptName (like pub global run tuneup:tuneup) If script and package name are the same you can omit the :scriptName part.
local package executables
You can also run scripts from dependencies of your current project with pub run packageName:scriptName (like pub run test for running unit tests)

Resources