From d051ca51800edc1923b7d3e9cf64da8af450950a Mon Sep 17 00:00:00 2001 From: Arun George Date: Tue, 19 Apr 2022 21:26:08 -0400 Subject: [PATCH] 0.4.4; remove pnpm options that were never applied --- README.md | 53 +++++++++++++++++---------------------- cli/index.js | 7 +++--- cli/package.json | 9 +++++-- cli/template/package.json | 4 +-- package.json | 4 +-- pnpm-lock.yaml | 3 +++ 6 files changed, 38 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index bad4006..2dda187 100644 --- a/README.md +++ b/README.md @@ -10,19 +10,35 @@ Setup a `CoSpace` to link multiple (mono)repos together! ## Getting started -1. Install `cospace`, then run `npx cospace init` +### Initialize -1. Clone all the repos you want to link together under the `repos` directory. You can use [sparse checkouts](https://github.blog/2020-01-17-bring-your-monorepo-down-to-size-with-sparse-checkout/) to only clone the directories you need. +```bash +npx cospace@latest init my-cospace +``` + +### Link your (mono)repos + +```bash +cd my-cospace +``` + +1. Clone all the repos you want to link together under the `repos` sub directory. + +1. Update the `pnpm-workspace.yaml` file with all the packages you want to add to your `CoSpace`. By default all packages under the `repos` sub directory will be added to your `CoSpace`; you will probably want to be more specific and build/link only what you need. + +1. Update the `cospace.code-workspace` file with all the repos you want to add to your [vscode multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces). -1. Update the [pnpm-workspace.yaml](pnpm-workspace.yaml) file with all the packages you want to add to your CoSpace. +1. Run `pnpm exec cospace override` to automatically update the `pnpm.overrides` section of the `CoSpace`'s `package.json`, to link all the dependencies together with the copy found in the workspace. This will ignore [semver](https://semver.org/) and always use the local package version from the workspace, very useful for when you have pre-release versions of packages in your workspace. -1. Update the [cospace.code-workspace](cospace.code-workspace) file with all the repos you want to add to your VsCode multi root workspace. +1. Run `pnpm install` to install all dependecies in your workspace and link all the packages you've added to your `CoSpace`. -1. (Optional) Run `pnpm setOverrides` to automatically update the `pnpm.overrides` section of the CoSpace's [package.json](package.json), to use the local package version from the workspace, disregarding semver. Useful for when you have pre-release versions of packages in your workspace. +1. Run `pnpm build` to build all the packages you've added to your `CoSpace` using your monorepo task runner. By default we use [lage](https://microsoft.github.io/lage/), but [turborepo](https://turborepo.org/docs) should work as well. -1. Run `pnpm install` to install all the packages you've added to your CoSpace. +For more information visit the docs site. -1. Run `pnpm build` to build all the packages you've added to your CoSpace using your monorepo task runner. I'm using [lage](https://microsoft.github.io/lage/), but [turborepo](https://turborepo.org/docs) should theoretically work. +## example usage + +- itwin-cospace, an example of a `CoSpace` to help develop with the iTwin Platform. ## Notes @@ -44,26 +60,3 @@ git checkout {branchName} git sparse-checkout init --cone git sparse-checkout set [...allSubDirs] ``` - -### pnpm - -#### [link-workspace-packages](https://pnpm.io/workspaces#link-workspace-packages) - -- "If you need local packages to also be linked to subdependencies, you can use the `deep` setting" - - ```json - "pnpm": { - "link-workspace-packages": "deep" - } - ``` - -#### [prefer-workspace-packages](https://pnpm.io/workspaces#prefer-workspace-packages) - -- pros: don't have to explicitly list all packages in the `pnpm.overrides` section. -- cons: if you're linking a repo with HEAD pointing to pre-release packages, those won't be used/linked due to semver 😕 - - ```json - "pnpm": { - "prefer-workspace-packages": true - } - ``` diff --git a/cli/index.js b/cli/index.js index 9cfc608..c57c93c 100644 --- a/cli/index.js +++ b/cli/index.js @@ -1,7 +1,7 @@ #!/usr/bin/env node import { fileURLToPath } from "url"; -import * as path from "path"; +import path from "path"; import fs from "fs-extra"; import meow from "meow"; import { execSync } from "child_process"; @@ -10,7 +10,7 @@ const Commands = { INIT: "init", OVERRIDE: "override", PURGE: "purge", -} +}; const help = ` Usage: @@ -113,11 +113,10 @@ const overridePnpm = async () => { if (added.length) { console.log( `\nYou added the following packages to your CoSpace:\n- ${added.join( - "\n- " + "\n+ " )}` ); } - }; const purge = async () => { diff --git a/cli/package.json b/cli/package.json index b5cd929..d95aa01 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,8 +1,9 @@ { "name": "cospace", - "version": "0.4.3", + "version": "0.4.4", "description": "Setup a `CoSpace` to link multiple (mono)repos together!", "author": "https://github.com/aruniverse", + "homepage": "https://aruniverse.github.io/cospace/", "license": "MIT", "repository": { "type": "git", @@ -20,7 +21,11 @@ "cospace", "monorepo", "pnpm", - "workspaces" + "workspace", + "workspaces", + "link", + "symlinks", + "dependencies" ], "dependencies": { "fs-extra": "^10.0.0", diff --git a/cli/template/package.json b/cli/template/package.json index ad2aa2f..c3aac79 100644 --- a/cli/template/package.json +++ b/cli/template/package.json @@ -14,8 +14,6 @@ "lage": "^1.5.1" }, "pnpm": { - "overrides": {}, - "prefer-workspace-packages": true, - "link-workspace-packages": "deep" + "overrides": {} } } diff --git a/package.json b/package.json index e1c461c..c79d7cd 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,6 @@ "pnpm": { "overrides": { "cospace": "workspace:*" - }, - "prefer-workspace-packages": true, - "link-workspace-packages": "deep" + } } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bc2813d..9006391 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,5 +1,8 @@ lockfileVersion: 5.3 +overrides: + cospace: workspace:* + importers: .: