Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is mean file:workspaces in package dependencies?

I try use npm 7 workspaces

"workspaces": {
    "packages": [
      "packages/apps/*",
      "packages/components",
    ],

and after install I see in my package.json

  "dependencies": {
    "@project/components": "file:workspaces/components",

Is it correct ? And what is mean file: ?

like image 272
zloctb Avatar asked Oct 13 '21 10:10

zloctb


People also ask

What is dependencies in package?

A dependency is another package that your package needs in order to work. Dependencies are specified in your pubspec. You list only immediate dependencies—the software that your package uses directly.

What is the point of yarn workspaces?

Yarn Workspaces is a feature that allows users to install dependencies from multiple package. json files in subfolders of a single root package. json file, all in one go. Yarn can also create symlinks between Workspaces that depend on each other, and will ensure the consistency and correctness of all directories.

What is dependencies in npm package?

"dependencies" : Packages required by your application in production. "devDependencies" : Packages that are only needed for local development and testing.

How do I add dependencies to a package?

To add a package dependency to your Xcode project, select File > Swift Packages > Add Package Dependency and enter its repository URL.

How do I add/remove/update dependencies of my workspace?

It's possible to directly add/remove/update dependencies of your workspaces using the workspace config. For example, assuming the following structure: .

What is a workspace in Linux?

A workspace is a directory tree on your filesystem that contains the source files for the software you want to build. Each workspace has a text file named WORKSPACE which may be empty, or may contain references to external dependencies required to build the outputs.

What is the source code structure of a workspace?

Bazel builds software from source code organized in a directory tree called a workspace. Source files in the workspace are organized in a nested hierarchy of packages, where each package is a directory that contains a set of related source files and one BUILD file.

How do I use require workspace-a from a file located in workspace-B?

Requiring workspace-a from a file located in workspace-b will now use the exact code currently located inside your project rather than what is published on npm, and the cross-env package has been correctly deduped and put at the root of your project to be used by both workspace-a and workspace-b.


Video Answer


1 Answers

Workspaces is a generic term that refers to the set of features in the npm CLI that provides support to managing multiple packages from your local files system from within a singular top-level, root package.

For more details

Defining workspaces

Workspaces are usually defined via the workspaces property of the package.json file, e.g:

{
  "name": "my-workspaces-powered-project",
  "workspaces": [
    "workspace-a"
  ]
}

Given the above package.json example living at a current working directory . that contains a folder named workspace-a that itself contains a package.json inside it, defining a Node.js package, e.g:

.
+-- package.json
`-- workspace-a
   `-- package.json
like image 70
Asif vora Avatar answered Oct 21 '22 20:10

Asif vora