├── .gitattributes ├── src ├── index.ts ├── workspaces │ ├── types.ts │ ├── mapLocations.ts │ ├── mapLocations.test.ts │ ├── nameFromLocation.ts │ ├── listDependencies.ts │ ├── unnecessaryDependencies.ts │ ├── nameFromLocation.test.ts │ ├── unnecessaryDependencies.test.ts │ └── listDependencies.test.ts ├── utils.ts ├── cli.ts ├── pkg │ ├── removeAllDependencies.ts │ ├── removeAllDependencies.test.ts │ ├── removeKeys.ts │ └── removeKeys.test.ts ├── fs │ ├── clone.test.ts │ └── clone.ts ├── utils.test.ts ├── yarn.ts ├── yarn.test.ts ├── workspaces.ts └── install.ts ├── .eslintignore ├── .github ├── yarn.png ├── renovate.json └── workflows │ └── ci.yml ├── e2e ├── empty │ ├── package.json │ ├── packages │ │ └── dummy │ │ │ └── package.json │ ├── yarn.lock │ └── __tests__ │ │ ├── yarn-install.out │ │ └── index.ts ├── foo-focus │ ├── packages │ │ ├── c1 │ │ │ └── package.json │ │ ├── b │ │ │ └── package.json │ │ ├── c2 │ │ │ └── package.json │ │ ├── d │ │ │ └── package.json │ │ ├── c21 │ │ │ └── package.json │ │ ├── c │ │ │ └── package.json │ │ ├── a │ │ │ └── package.json │ │ └── foo │ │ │ └── package.json │ ├── __tests__ │ │ ├── yarn-install.out │ │ └── index.ts │ ├── package.json │ └── yarn.lock └── jest.config.js ├── bin └── yarn-workspace-focus-install.js ├── .gitignore ├── tsconfig.build.json ├── .editorconfig ├── .eslintrc.yml ├── .releaserc.yml ├── CONTRIBUTING.md ├── jest.config.js ├── tsconfig.json ├── babel.config.js ├── package.json ├── README.md ├── LICENSE └── CHANGELOG.md /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | // 2 | 3 | export * from "./install"; 4 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /bin 2 | /lib 3 | coverage 4 | node_modules 5 | -------------------------------------------------------------------------------- /.github/yarn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SocialGouv/yarn-workspace-focus-install/HEAD/.github/yarn.png -------------------------------------------------------------------------------- /e2e/empty/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "workspaces": [ 4 | "packages/*" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /bin/yarn-workspace-focus-install.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | "use strict"; 3 | 4 | require("../lib/cli.js"); 5 | -------------------------------------------------------------------------------- /e2e/foo-focus/packages/c1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "c1", 3 | "version": "0.0.0", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /e2e/empty/packages/dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dummy", 3 | "version": "0.0.0", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /e2e/empty/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/workspaces/types.ts: -------------------------------------------------------------------------------- 1 | export interface Workspace { 2 | location: string; 3 | workspaceDependencies: string[]; 4 | } 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .eslintcache 2 | /components 3 | /environments 4 | /lib 5 | /tsconfig.build.tsbuildinfo 6 | /types 7 | /utils 8 | coverage 9 | node_modules 10 | -------------------------------------------------------------------------------- /e2e/empty/__tests__/yarn-install.out: -------------------------------------------------------------------------------- 1 | 2 | [1/4] Resolving packages... 3 | [2/4] Fetching packages... 4 | [3/4] Linking dependencies... 5 | [4/4] Building fresh packages... 6 | -------------------------------------------------------------------------------- /e2e/foo-focus/packages/b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "b", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "slash": "latest" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/foo-focus/packages/c2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "c2", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "c21": "0.0.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/foo-focus/packages/d/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "d", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "semver": "0.0.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/foo-focus/__tests__/yarn-install.out: -------------------------------------------------------------------------------- 1 | 2 | [1/4] Resolving packages... 3 | [2/4] Fetching packages... 4 | [3/4] Linking dependencies... 5 | [4/4] Building fresh packages... 6 | -------------------------------------------------------------------------------- /e2e/foo-focus/packages/c21/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "c21", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "signal-exit": "latest" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/foo-focus/packages/c/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "c", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "c1": "0.0.0", 7 | "c2": "0.0.0" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /e2e/foo-focus/packages/a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": {}, 6 | "devDependencies": { 7 | "through": "latest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /e2e/foo-focus/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "dependencies": { 4 | "base64-js": "latest" 5 | }, 6 | "devDependencies": { 7 | "type": "latest" 8 | }, 9 | "workspaces": [ 10 | "packages/*" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /src/utils.ts: -------------------------------------------------------------------------------- 1 | export function uniqueUnion(...iterables: Iterable[]): Set { 2 | const set = new Set(); 3 | for (const iterable of iterables) { 4 | for (const item of iterable) { 5 | set.add(item); 6 | } 7 | } 8 | 9 | return set; 10 | } 11 | -------------------------------------------------------------------------------- /src/workspaces/mapLocations.ts: -------------------------------------------------------------------------------- 1 | import type { Workspace } from "./types"; 2 | 3 | export function mapLocations( 4 | workspaces: Record, 5 | fn: (location: string) => T 6 | ): T[] { 7 | return Object.entries(workspaces).map(([, { location }]) => fn(location)); 8 | } 9 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig", 3 | "compilerOptions": { 4 | "declaration": true, 5 | "noEmit": false, 6 | "outDir": "lib", 7 | "rootDir": "src", 8 | "sourceMap": true 9 | }, 10 | "include": ["src"], 11 | "exclude": ["**/*.test.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /src/cli.ts: -------------------------------------------------------------------------------- 1 | import parser from "yargs-parser"; 2 | 3 | import { focusInstall } from "./install"; 4 | 5 | const { cwd, dryRun, production, _: yarnArgs } = parser(process.argv.slice(2)); 6 | 7 | focusInstall({ cwd, dryRun, production, yarnArgs }).catch((e) => { 8 | console.error(e); 9 | process.exit(1); 10 | }); 11 | -------------------------------------------------------------------------------- /e2e/foo-focus/packages/foo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "a": "0.0.0", 7 | "b": "0.0.0", 8 | "c": "0.0.0", 9 | "remove-trailing-separator": "latest" 10 | }, 11 | "devDependencies": { 12 | "replace-ext": "latest" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "github>SocialGouv/renovate-config", 5 | ":automergeAll" 6 | ], 7 | "packageRules": [ 8 | { 9 | "paths": ["e2e"], 10 | "ignoreDeps": ["a", "b", "c", "c1", "c2", "c21"] 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /src/pkg/removeAllDependencies.ts: -------------------------------------------------------------------------------- 1 | import Debug from "debug"; 2 | 3 | import { removeKeys } from "./removeKeys"; 4 | 5 | const debug = Debug("yarn-workspace-focus-install:pkg:removeAllDependencies"); 6 | export async function removeAllDependencies(rootDir: string): Promise { 7 | debug({ rootDir }); 8 | return removeKeys(rootDir, ["dependencies", "devDependencies"]); 9 | } 10 | -------------------------------------------------------------------------------- /e2e/jest.config.js: -------------------------------------------------------------------------------- 1 | const { defaults } = require("jest-config"); 2 | 3 | const ignorePatterns = ["/src"]; 4 | 5 | module.exports = { 6 | rootDir: "../", 7 | setupFilesAfterEnv: [], 8 | testEnvironment: "node", 9 | testPathIgnorePatterns: [ 10 | ...defaults.testPathIgnorePatterns, 11 | ...ignorePatterns, 12 | ], 13 | watchPathIgnorePatterns: ignorePatterns, 14 | }; 15 | -------------------------------------------------------------------------------- /.eslintrc.yml: -------------------------------------------------------------------------------- 1 | root: true 2 | overrides: 3 | - files: "*.js" 4 | extends: 5 | - "@socialgouv/eslint-config-recommended" 6 | - files: "*.ts" 7 | extends: 8 | - "@socialgouv/eslint-config-typescript" 9 | rules: 10 | "@typescript-eslint/no-invalid-void-type": off 11 | "import/named": off 12 | "import/default": off 13 | "import/no-named-as-default": off 14 | -------------------------------------------------------------------------------- /src/fs/clone.test.ts: -------------------------------------------------------------------------------- 1 | import { copy } from "fs-extra"; 2 | import { join } from "path"; 3 | 4 | import { cloneFolders } from "./clone"; 5 | 6 | jest.mock("fs-extra"); 7 | 8 | test.concurrent("clone the qux", async () => { 9 | const cloneFromFooToBar = cloneFolders("foo", "bar"); 10 | await cloneFromFooToBar("qux"); 11 | expect(copy).toHaveBeenCalledWith(join("foo/qux"), join("bar/qux")); 12 | }); 13 | -------------------------------------------------------------------------------- /.releaserc.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - "@semantic-release/commit-analyzer" 3 | - "@semantic-release/release-notes-generator" 4 | - "@semantic-release/npm" 5 | - "@semantic-release/changelog" 6 | - - "@semantic-release/git" 7 | - assets: 8 | - CHANGELOG.md 9 | - package.json 10 | message: "chore(release): version ${nextRelease.version}\n\n${nextRelease.notes}" 11 | - "@semantic-release/github" 12 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | > Thanks for being willing to contribute ! 4 | 5 | ## TL;DR 6 | 7 | ```sh 8 | # Install 9 | $ yarn 10 | 11 | # Build 12 | $ yarn build 13 | # Watch the build 14 | $ yarn build --watch 15 | 16 | # Lint 17 | $ yarn lint 18 | 19 | # Type check 20 | $ yarn typecheck --watch 21 | 22 | # Test 23 | $ yarn test 24 | # Watch the test 25 | $ yarn test --watch 26 | 27 | # Build 28 | $ yarn e2e 29 | # Watch the e2e 30 | $ yarn e2e --watch 31 | ``` 32 | -------------------------------------------------------------------------------- /src/pkg/removeAllDependencies.test.ts: -------------------------------------------------------------------------------- 1 | import { removeAllDependencies } from "./removeAllDependencies"; 2 | import { removeKeys } from "./removeKeys"; 3 | 4 | jest.mock("./removeKeys"); 5 | 6 | test.concurrent( 7 | "calls remove keys with dependencies and devDependencies", 8 | async () => { 9 | await removeAllDependencies("foo/bar"); 10 | 11 | expect(removeKeys).toHaveBeenCalledWith("foo/bar", [ 12 | "dependencies", 13 | "devDependencies", 14 | ]); 15 | } 16 | ); 17 | -------------------------------------------------------------------------------- /src/fs/clone.ts: -------------------------------------------------------------------------------- 1 | import Debug from "debug"; 2 | import { copy } from "fs-extra"; 3 | import { join } from "path"; 4 | 5 | export const debug = Debug("yarn-workspace-focus-install:fs:clone"); 6 | 7 | export function cloneFolders(sourceDir: string, destDir: string) { 8 | return async function (location: string): Promise { 9 | const source = join(sourceDir, location); 10 | const destination = join(destDir, location); 11 | debug("copy from '%s' to '%s", source, destination); 12 | return copy(source, destination); 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /src/workspaces/mapLocations.test.ts: -------------------------------------------------------------------------------- 1 | import { mapLocations } from "./mapLocations"; 2 | 3 | test("should map nothing", () => { 4 | expect(mapLocations({}, (location) => location)).toStrictEqual([]); 5 | }); 6 | 7 | test("should map location in workspace", () => { 8 | expect( 9 | mapLocations( 10 | { 11 | bar: { 12 | location: "root/bar", 13 | workspaceDependencies: [], 14 | }, 15 | foo: { 16 | location: "root/foo", 17 | workspaceDependencies: [], 18 | }, 19 | }, 20 | (location) => location 21 | ) 22 | ).toStrictEqual(["root/bar", "root/foo"]); 23 | }); 24 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | const { defaults } = require("jest-config"); 2 | 3 | const ignorePatterns = [ 4 | "/components", 5 | "/coverage", 6 | "/e2e", 7 | "/environments", 8 | "/types", 9 | ]; 10 | 11 | module.exports = { 12 | collectCoverageFrom: ["src/**/*.ts"], 13 | moduleDirectories: ["src", ...defaults.moduleDirectories], 14 | moduleNameMapper: { 15 | "^@socialgouv/kosko-charts(.*)$": "/src$1", 16 | }, 17 | testEnvironment: "node", 18 | testPathIgnorePatterns: [ 19 | ...defaults.testPathIgnorePatterns, 20 | ...ignorePatterns, 21 | ], 22 | watchPathIgnorePatterns: ignorePatterns, 23 | }; 24 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowSyntheticDefaultImports": true, 4 | "baseUrl": ".", 5 | "esModuleInterop": true, 6 | "importHelpers": true, 7 | "module": "commonjs", 8 | "moduleResolution": "node", 9 | "noEmit": true, 10 | "noEmitHelpers": true, 11 | "noEmitOnError": true, 12 | "noFallthroughCasesInSwitch": true, 13 | "noImplicitReturns": true, 14 | "preserveConstEnums": true, 15 | "resolveJsonModule": true, 16 | "skipLibCheck": true, 17 | "strict": true, 18 | "strictNullChecks": true, 19 | "target": "ES2019", 20 | "types": ["jest", "node"] 21 | }, 22 | "exclude": ["bin", "lib"] 23 | } 24 | -------------------------------------------------------------------------------- /src/pkg/removeKeys.ts: -------------------------------------------------------------------------------- 1 | import Debug from "debug"; 2 | import { outputJson, readJson } from "fs-extra"; 3 | import { join } from "path"; 4 | 5 | const debug = Debug("yarn-workspace-focus-install:pkg:removeKeys"); 6 | export async function removeKeys(cwd: string, keys: string[]): Promise { 7 | const packageFile = join(cwd, "package.json"); 8 | debug({ cwd, keys, packageFile }); 9 | 10 | const pkg: Record = await readJson(packageFile); 11 | 12 | const json = keys.reduce((memo, key) => { 13 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 14 | const { [key]: _value, ...rest } = memo; 15 | return rest; 16 | }, pkg); 17 | 18 | await outputJson(packageFile, json); 19 | } 20 | -------------------------------------------------------------------------------- /src/workspaces/nameFromLocation.ts: -------------------------------------------------------------------------------- 1 | import assert from "assert"; 2 | import Debug from "debug"; 3 | import slash from "slash"; 4 | 5 | import type { Workspace } from "./types"; 6 | 7 | const debug = Debug("yarn-workspace-focus-install:workspace:nameFromLocation"); 8 | 9 | export function nameFromLocation( 10 | workspaces: Record, 11 | focusLocation: string 12 | ): string { 13 | debug({ focusLocation, workspaces }); 14 | const unixFocusLocation = slash(focusLocation); 15 | const [name] = 16 | Object.entries(workspaces).find( 17 | ([, { location }]) => location === unixFocusLocation 18 | ) ?? []; 19 | assert(name, `${unixFocusLocation} is not in the workspace tree`); 20 | return name; 21 | } 22 | -------------------------------------------------------------------------------- /src/utils.test.ts: -------------------------------------------------------------------------------- 1 | import { uniqueUnion } from "./utils"; 2 | 3 | test("returns empty set", () => { 4 | expect(uniqueUnion([])).toEqual(new Set()); 5 | }); 6 | 7 | test("returns a b c set", () => { 8 | expect(uniqueUnion(["a", "b", "c"])).toEqual(new Set(["a", "b", "c"])); 9 | }); 10 | 11 | test("returns unique a b c set", () => { 12 | expect(uniqueUnion(["a", "a", "b", "b", "b", "c"])).toEqual( 13 | new Set(["a", "b", "c"]) 14 | ); 15 | }); 16 | 17 | test("returns unique a b c d e f set from multiple args", () => { 18 | expect( 19 | uniqueUnion( 20 | ["a", "a", "b"], 21 | new Set(["b", "b", "c"]), 22 | ["a", "c", "d"], 23 | new Set(["b", "e", "f"]) 24 | ) 25 | ).toEqual(new Set(["a", "b", "c", "d", "e", "f"])); 26 | }); 27 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | test: { 4 | presets: [ 5 | [ 6 | "@babel/preset-env", 7 | { 8 | modules: "commonjs", 9 | targets: { node: "current" }, 10 | }, 11 | ], 12 | ], 13 | }, 14 | }, 15 | plugins: [ 16 | ["@babel/plugin-syntax-nullish-coalescing-operator"], 17 | [ 18 | "babel-plugin-module-resolver", 19 | { 20 | extensions: [".ts"], 21 | root: [require("./tsconfig.json").compilerOptions.baseUrl], 22 | }, 23 | ], 24 | ], 25 | presets: [ 26 | ["@babel/preset-env", { modules: false, targets: { node: "current" } }], 27 | [ 28 | "@babel/preset-typescript", 29 | { 30 | onlyRemoveTypeImports: true, 31 | }, 32 | ], 33 | ], 34 | }; 35 | -------------------------------------------------------------------------------- /src/pkg/removeKeys.test.ts: -------------------------------------------------------------------------------- 1 | import { outputJson, readJSON } from "fs-extra"; 2 | import { join } from "path"; 3 | 4 | import { removeKeys } from "./removeKeys"; 5 | 6 | jest.mock("fs-extra"); 7 | test.concurrent( 8 | "should remove uncool keys from package.json file", 9 | async () => { 10 | (readJSON as jest.Mock).mockResolvedValueOnce({ 11 | cool: "cool", 12 | looser: "looser", 13 | uncool: "uncool", 14 | winner: "winner", 15 | }); 16 | (outputJson as jest.Mock).mockResolvedValueOnce({}); 17 | const file = join("foo/bar/package.json"); 18 | 19 | await removeKeys("foo/bar", ["uncool", "looser"]); 20 | 21 | expect(readJSON).toHaveBeenCalledWith(file); 22 | expect(outputJson).toHaveBeenCalledWith(file, { 23 | cool: "cool", 24 | winner: "winner", 25 | }); 26 | } 27 | ); 28 | -------------------------------------------------------------------------------- /src/workspaces/listDependencies.ts: -------------------------------------------------------------------------------- 1 | import Debug from "debug"; 2 | 3 | import { uniqueUnion } from "../utils"; 4 | import type { Workspace } from "./types"; 5 | 6 | const debug = Debug("yarn-workspace-focus-install:workspace:listDependencies"); 7 | 8 | export function listDependencies( 9 | workspaces: Record, 10 | name: string, 11 | dependencies = new Set() 12 | ): Set { 13 | debug({ 14 | dependencies, 15 | name, 16 | workspaces, 17 | }); 18 | const { workspaceDependencies } = workspaces[name]; 19 | if (!workspaceDependencies.length) { 20 | return dependencies; 21 | } 22 | const deps = uniqueUnion(dependencies, workspaceDependencies); 23 | return uniqueUnion( 24 | ...workspaceDependencies.map((workspace) => { 25 | return listDependencies(workspaces, workspace, deps); 26 | }) 27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /src/workspaces/unnecessaryDependencies.ts: -------------------------------------------------------------------------------- 1 | import { ok } from "assert"; 2 | import Debug from "debug"; 3 | 4 | import { listDependencies } from "./listDependencies"; 5 | import type { Workspace } from "./types"; 6 | 7 | const debug = Debug( 8 | "yarn-workspace-focus-install:workspaces:unnecessaryDependencies" 9 | ); 10 | 11 | export function unnecessaryDependencies( 12 | workspaces: Record, 13 | workspaceName: string 14 | ): Record { 15 | debug({ 16 | workspaceName, 17 | workspaces, 18 | }); 19 | 20 | ok(workspaces[workspaceName], `${workspaceName} workspace not found`); 21 | 22 | const internalDeps = listDependencies(workspaces, workspaceName); 23 | return Object.entries(workspaces) 24 | .filter(([packageName]) => workspaceName !== packageName) 25 | .filter(([packageName]) => !internalDeps.has(packageName)) 26 | .reduce((memo, [key, value]) => ({ ...memo, [key]: value }), {}); 27 | } 28 | -------------------------------------------------------------------------------- /src/yarn.ts: -------------------------------------------------------------------------------- 1 | import Debug from "debug"; 2 | import type { ExecaReturnValue, Options } from "execa"; 3 | import execa from "execa"; 4 | 5 | import type { Workspace } from "./workspaces/types"; 6 | 7 | const debug = Debug("yarn-workspace-focus-install:yarn"); 8 | 9 | export async function yarnInstall( 10 | cwd: string, 11 | options: Options = {}, 12 | yarnArgs: string[] = ["--prefer-offline"] 13 | ): Promise { 14 | debug("yarn", [...yarnArgs], { 15 | cwd: cwd, 16 | stdio: "inherit", 17 | ...options, 18 | }); 19 | return execa("yarn", ["--frozen-lockfile", ...yarnArgs], { 20 | cwd: cwd, 21 | stdio: "inherit", 22 | ...options, 23 | }); 24 | } 25 | 26 | export async function getWorkspaces(): Promise> { 27 | const { stdout } = await execa("yarn", [ 28 | "--silent", 29 | "workspaces", 30 | "--json", 31 | "info", 32 | ]); 33 | const { data }: { data: string } = JSON.parse(stdout); 34 | return JSON.parse(data) as Record; 35 | } 36 | -------------------------------------------------------------------------------- /src/yarn.test.ts: -------------------------------------------------------------------------------- 1 | beforeEach(() => { 2 | jest.resetModules(); 3 | }); 4 | 5 | test("should call system yarn command", async () => { 6 | const execa = jest.fn(); 7 | jest.doMock("execa", () => ({ 8 | // eslint-disable-next-line @typescript-eslint/naming-convention 9 | __esModule: true, 10 | default: execa, 11 | })); 12 | const { yarnInstall } = await import("./yarn"); 13 | 14 | const cwd = "/my/app"; 15 | 16 | await yarnInstall(cwd); 17 | 18 | expect(execa).toHaveBeenCalledWith( 19 | "yarn", 20 | ["--frozen-lockfile", "--prefer-offline"], 21 | { cwd, stdio: "inherit" } 22 | ); 23 | }); 24 | 25 | test("should call yarn command with --cache-folder /dev/shm/yarn", async () => { 26 | const execa = jest.fn(); 27 | jest.doMock("execa", () => ({ 28 | // eslint-disable-next-line @typescript-eslint/naming-convention 29 | __esModule: true, 30 | default: execa, 31 | })); 32 | const { yarnInstall } = await import("./yarn"); 33 | 34 | const cwd = "/my/app"; 35 | 36 | await yarnInstall(cwd, {}, ["--cache-folder", "/dev/shm/yarn"]); 37 | 38 | expect(execa).toHaveBeenCalledWith( 39 | "yarn", 40 | ["--frozen-lockfile", "--cache-folder", "/dev/shm/yarn"], 41 | { cwd, stdio: "inherit" } 42 | ); 43 | }); 44 | -------------------------------------------------------------------------------- /e2e/empty/__tests__/index.ts: -------------------------------------------------------------------------------- 1 | import { node } from "execa"; 2 | import { copy, pathExists, readFileSync, remove } from "fs-extra"; 3 | import { join } from "path"; 4 | import { directory } from "tempy"; 5 | 6 | import { bin } from "../../../package.json"; 7 | 8 | const BIN = join(__dirname, "..", "..", "..", bin); 9 | const cwd = directory(); 10 | const yarnInstallLog = readFileSync(join(__dirname, "yarn-install.out")) 11 | .toString("utf-8") 12 | .trim(); 13 | afterAll(async () => { 14 | await remove(cwd); 15 | }); 16 | test("should do nothing", async () => { 17 | await copy(join(__dirname, ".."), cwd); 18 | const { stdout, stderr } = await node(BIN, { 19 | cwd: join(cwd, "packages", "dummy"), 20 | env: { 21 | /* eslint-disable @typescript-eslint/naming-convention */ 22 | FORCE_COLOR: "0", 23 | }, 24 | }); 25 | 26 | expect({ stderr, stdout }).toStrictEqual({ 27 | stderr: "", 28 | stdout: yarnInstallLog, 29 | }); 30 | 31 | expect(await pathExists(join(cwd, "packages"))).toBeTruthy(); 32 | expect(await pathExists(join(cwd, "packages", "dummy"))).toBeTruthy(); 33 | 34 | expect(await pathExists(join(cwd, "node_modules"))).toBeTruthy(); 35 | expect(await pathExists(join(cwd, "node_modules", "dummy"))).toBeTruthy(); 36 | 37 | expect(await pathExists(join(cwd, "package.json"))).toBeTruthy(); 38 | expect(await pathExists(join(cwd, "yarn.lock"))).toBeTruthy(); 39 | }); 40 | -------------------------------------------------------------------------------- /src/workspaces/nameFromLocation.test.ts: -------------------------------------------------------------------------------- 1 | import { AssertionError } from "assert"; 2 | 3 | import { nameFromLocation } from "./nameFromLocation"; 4 | 5 | test("returns the mathing workspace name location", () => { 6 | const workspaces = { 7 | bar: { 8 | location: "root/bar", 9 | workspaceDependencies: [], 10 | }, 11 | foo: { 12 | location: "root/foo", 13 | workspaceDependencies: [], 14 | }, 15 | }; 16 | expect(nameFromLocation(workspaces, "root/foo")).toBe("foo"); 17 | }); 18 | 19 | test("throw if no math", () => { 20 | expect(() => nameFromLocation({}, "root/foo")).toThrow(); 21 | }); 22 | 23 | test("throw package not found from location", () => { 24 | expect(() => nameFromLocation({}, "foo")).toThrowError( 25 | new AssertionError({ message: "foo is not in the workspace tree" }) 26 | ); 27 | }); 28 | 29 | test("get focus package name from location", () => { 30 | expect( 31 | nameFromLocation( 32 | { 33 | foo: { 34 | location: "packages/foo", 35 | workspaceDependencies: [], 36 | }, 37 | }, 38 | "packages/foo" 39 | ) 40 | ).toBe("foo"); 41 | }); 42 | 43 | test("get focus package name from location (windows like)", () => { 44 | expect( 45 | nameFromLocation( 46 | { 47 | foo: { 48 | location: "packages/foo", 49 | workspaceDependencies: [], 50 | }, 51 | }, 52 | "packages\\foo" 53 | ) 54 | ).toBe("foo"); 55 | }); 56 | -------------------------------------------------------------------------------- /src/workspaces/unnecessaryDependencies.test.ts: -------------------------------------------------------------------------------- 1 | import { AssertionError } from "assert"; 2 | 3 | import { unnecessaryDependencies } from "./unnecessaryDependencies"; 4 | 5 | test("shouldn't remove self dependencies", () => { 6 | expect( 7 | unnecessaryDependencies( 8 | { 9 | foo: { 10 | location: "packages/foo", 11 | workspaceDependencies: [], 12 | }, 13 | }, 14 | "foo" 15 | ) 16 | ).toStrictEqual({}); 17 | }); 18 | 19 | test("fail with bar not found", () => { 20 | expect(() => 21 | unnecessaryDependencies( 22 | { 23 | foo: { 24 | location: "packages/foo", 25 | workspaceDependencies: [], 26 | }, 27 | }, 28 | "bar" 29 | ) 30 | ).toThrowError(new AssertionError({ message: "bar workspace not found" })); 31 | }); 32 | 33 | test("removes unnecessary workspaces", () => { 34 | expect( 35 | unnecessaryDependencies( 36 | { 37 | bar: { 38 | location: "packages/bar", 39 | workspaceDependencies: [], 40 | }, 41 | foo: { 42 | location: "packages/foo", 43 | workspaceDependencies: ["bar"], 44 | }, 45 | lol: { 46 | location: "packages/lol", 47 | workspaceDependencies: [], 48 | }, 49 | }, 50 | "foo" 51 | ) 52 | ).toStrictEqual({ 53 | lol: { 54 | location: "packages/lol", 55 | workspaceDependencies: [], 56 | }, 57 | }); 58 | }); 59 | -------------------------------------------------------------------------------- /src/workspaces.ts: -------------------------------------------------------------------------------- 1 | import Debug from "debug"; 2 | import { move, pathExistsSync, remove } from "fs-extra"; 3 | import { join } from "path"; 4 | 5 | import type { Workspace } from "./workspaces/types"; 6 | 7 | export const debug = Debug("yarn-workspace-focus-install:workspace"); 8 | export async function removeAllNodeModules( 9 | rootDir: string, 10 | workspaces: Record 11 | ): Promise { 12 | debug("removeAllNodeModules", { 13 | rootDir, 14 | workspaces, 15 | }); 16 | return Promise.all([ 17 | remove(join(rootDir, "node_modules")), 18 | ...Object.entries(workspaces).map(async ([, { location }]) => { 19 | debug("remove ", join(rootDir, location, "node_modules")); 20 | return remove(join(rootDir, location, "node_modules")); 21 | }), 22 | ]); 23 | } 24 | 25 | export async function transferAllNodeModules( 26 | tmp: string, 27 | rootDir: string, 28 | workspaces: Record 29 | ): Promise { 30 | debug("transferAllNodeModules", { 31 | rootDir, 32 | tmp, 33 | workspaces, 34 | }); 35 | const moveFromTmpToRootDir = async (location: string) => { 36 | const source = join(tmp, location); 37 | const destination = join(rootDir, location); 38 | debug("move from '%s' to '%s", source, destination); 39 | return move(source, destination); 40 | }; 41 | return Promise.all([ 42 | moveFromTmpToRootDir("node_modules"), 43 | ...Object.entries(workspaces) 44 | .filter(([, { location }]) => 45 | pathExistsSync(join(tmp, location, "node_modules")) 46 | ) 47 | .map(async ([, { location }]) => 48 | moveFromTmpToRootDir(join(location, "node_modules")) 49 | ), 50 | ]); 51 | } 52 | -------------------------------------------------------------------------------- /src/workspaces/listDependencies.test.ts: -------------------------------------------------------------------------------- 1 | import { listDependencies } from "./listDependencies"; 2 | 3 | test("list bar dependency", () => { 4 | expect( 5 | listDependencies( 6 | { 7 | bar: { 8 | location: "root/bar", 9 | workspaceDependencies: [], 10 | }, 11 | foo: { 12 | location: "root/foo", 13 | workspaceDependencies: ["bar"], 14 | }, 15 | }, 16 | "foo" 17 | ) 18 | ).toEqual(new Set(["bar"])); 19 | }); 20 | 21 | test("list no dependencies", () => { 22 | expect( 23 | listDependencies( 24 | { 25 | bar: { 26 | location: "root/bar", 27 | workspaceDependencies: [], 28 | }, 29 | foo: { 30 | location: "root/foo", 31 | workspaceDependencies: [], 32 | }, 33 | }, 34 | "foo" 35 | ) 36 | ).toEqual(new Set()); 37 | }); 38 | 39 | test("list many dependencies", () => { 40 | expect( 41 | listDependencies( 42 | { 43 | bar: { 44 | location: "root/bar", 45 | workspaceDependencies: ["qux", "quz"], 46 | }, 47 | foo: { 48 | location: "root/foo", 49 | workspaceDependencies: ["bar"], 50 | }, 51 | lol: { 52 | location: "root/lol", 53 | workspaceDependencies: ["lol"], 54 | }, 55 | lul: { 56 | location: "root/lul", 57 | workspaceDependencies: [], 58 | }, 59 | qoo: { 60 | location: "root/qoo", 61 | workspaceDependencies: [], 62 | }, 63 | qux: { 64 | location: "root/qux", 65 | workspaceDependencies: ["qoo"], 66 | }, 67 | quz: { 68 | location: "root/quz", 69 | workspaceDependencies: ["qoo"], 70 | }, 71 | }, 72 | "foo" 73 | ) 74 | ).toEqual(new Set(["bar", "qoo", "qux", "quz"])); 75 | }); 76 | -------------------------------------------------------------------------------- /e2e/foo-focus/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | base64-js@latest: 6 | version "1.3.1" 7 | resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" 8 | integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== 9 | 10 | remove-trailing-separator@latest: 11 | version "1.1.0" 12 | resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" 13 | integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= 14 | 15 | replace-ext@latest: 16 | version "2.0.0" 17 | resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-2.0.0.tgz#9471c213d22e1bcc26717cd6e50881d88f812b06" 18 | integrity sha512-UszKE5KVK6JvyD92nzMn9cDapSk6w/CaFZ96CnmDMUqH9oowfxF/ZjRITD25H4DnOQClLA4/j7jLGXXLVKxAug== 19 | 20 | semver@0.0.0: 21 | version "7.3.2" 22 | resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" 23 | integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== 24 | 25 | signal-exit@latest: 26 | version "3.0.3" 27 | resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" 28 | integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== 29 | 30 | slash@latest: 31 | version "3.0.0" 32 | resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" 33 | integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== 34 | 35 | through@latest: 36 | version "2.3.8" 37 | resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" 38 | integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= 39 | 40 | type@latest: 41 | version "2.0.0" 42 | resolved "https://registry.yarnpkg.com/type/-/type-2.0.0.tgz#5f16ff6ef2eb44f260494dae271033b29c09a9c3" 43 | integrity sha512-KBt58xCHry4Cejnc2ISQAF7QY+ORngsWfxezO68+12hKV6lQY8P/psIkcbjeHWn7MqcgciWJyCCevFMJdIXpow== 44 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@socialgouv/yarn-workspace-focus-install", 3 | "description": "Install one and only workspace", 4 | "version": "1.1.38", 5 | "author": "Fabrique numérique des Ministères Sociaux (https://incubateur.social.gouv.fr)", 6 | "bugs": "https://github.com/SocialGouv/yarn-workspace-focus-install/issues", 7 | "dependencies": { 8 | "debug": "^4.3.3", 9 | "execa": "^5.1.1", 10 | "find-yarn-workspace-root": "^2.0.0", 11 | "fs-extra": "^10.0.0", 12 | "slash": "^3.0.0", 13 | "tempy": "^1.0.1", 14 | "tslib": "^2.3.1", 15 | "yargs-parser": "^21.0.0" 16 | }, 17 | "bin": "./bin/yarn-workspace-focus-install.js", 18 | "devDependencies": { 19 | "@babel/core": "^7.16.5", 20 | "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", 21 | "@babel/preset-env": "^7.16.5", 22 | "@babel/preset-typescript": "^7.16.5", 23 | "@kosko/env": "^3.0.0", 24 | "@socialgouv/eslint-config-recommended": "^1.100.0", 25 | "@socialgouv/eslint-config-typescript": "^1.100.0", 26 | "@types/debug": "^4.1.7", 27 | "@types/fs-extra": "^9.0.13", 28 | "@types/jest": "^27.0.3", 29 | "@types/node": "^16.11.14", 30 | "babel-plugin-module-resolver": "^4.1.0", 31 | "eslint": "^7.32.0", 32 | "eslint-import-resolver-typescript": "^2.5.0", 33 | "husky": "^7.0.4", 34 | "jest": "^27.4.5", 35 | "lint-staged": "^12.1.2", 36 | "prettier": "^2.5.1", 37 | "typescript": "^4.5.4" 38 | }, 39 | "files": [ 40 | "bin", 41 | "lib" 42 | ], 43 | "homepage": "https://github.com/SocialGouv/yarn-workspace-focus-install#readme", 44 | "husky": { 45 | "hooks": { 46 | "pre-commit": "lint-staged", 47 | "pre-push": " yarn lint && yarn typecheck && yarn test && yarn build && yarn e2e" 48 | } 49 | }, 50 | "keywords": [], 51 | "license": "Apache-2.0", 52 | "lint-staged": { 53 | "*.{j,t}s": [ 54 | "eslint --fix", 55 | "jest --bail --findRelatedTests" 56 | ] 57 | }, 58 | "publishConfig": { 59 | "access": "public" 60 | }, 61 | "repository": "https://github.com/SocialGouv/yarn-workspace-focus-install.git", 62 | "scripts": { 63 | "build": "tsc -p tsconfig.build.json", 64 | "e2e": "jest -c ./e2e/jest.config.js", 65 | "lint": "eslint .", 66 | "precommit": "lint-staged", 67 | "start": "node --enable-source-maps ./lib/cli.js", 68 | "test": "jest", 69 | "typecheck": "tsc" 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

Yarn Workspace Focus Install

4 |

Install one and only workspace

5 |

6 | 7 |

8 | Github Master CI Status 9 | License: Apache-2.0 10 | Npm version 11 | codecov 12 |

13 | 14 |
15 |
16 |
17 |
18 | 19 | ## Problem 20 | 21 | In a yarn v1 monorepo one does not simply install one workspace. 22 | 23 |
24 |
25 |
26 |
27 | 28 | ## Solution 29 | 30 | ```sh 31 | $ npx @socialgouv/yarn-workspace-focus-install # in packages/foo 32 | # or 33 | $ npx @socialgouv/yarn-workspace-focus-install --cwd packages/foo 34 | ``` 35 | 36 |
37 |
38 |
39 |
40 | 41 | ## Installation 42 | 43 | ```sh 44 | $ yarn add -D @socialgouv/yarn-workspace-focus-install 45 | $ npx yarn-workspace-focus-install --cwd packages/foo 46 | ``` 47 | 48 |
49 |
50 |
51 |
52 | 53 | ## Usage 54 | 55 | ```sh 56 | $ yarn add -D @socialgouv/yarn-workspace-focus-install 57 | # Focus install packages/foo 58 | $ npx @socialgouv/yarn-workspace-focus-install --cwd packages/foo 59 | # Focus install packages/foo without its devDependencies 60 | $ npx @socialgouv/yarn-workspace-focus-install --cwd packages/foo --production 61 | # Fake focus install packages/foo 62 | $ npx @socialgouv/yarn-workspace-focus-install --cwd packages/foo --dry-run 63 | # Focus install packages/foo pass `--cache-folder /dev/shm/yarn` to yarn 64 | $ npx @socialgouv/yarn-workspace-focus-install --cwd packages/foo -- --cache-folder /dev/shm/yarn 65 | ``` 66 | 67 |
68 |
69 |
70 |
71 | 72 | ## Inspiration 73 | 74 | - Workspaces : https://classic.yarnpkg.com/en/docs/workspaces/ 75 | - `yarn workspaces focus` : https://yarnpkg.com/cli/workspaces/focus 76 | 77 |
78 |
79 |
80 |
81 | 82 | ## [License Apache-2.0](./LICENSE) 83 | -------------------------------------------------------------------------------- /src/install.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-use-before-define */ 2 | // 3 | 4 | import assert from "assert"; 5 | import Debug from "debug"; 6 | import findWorkspaceRoot from "find-yarn-workspace-root"; 7 | import { remove } from "fs-extra"; 8 | import { join, normalize, relative } from "path"; 9 | import slash from "slash"; 10 | import { directory } from "tempy"; 11 | 12 | import { cloneFolders } from "./fs/clone"; 13 | import { removeAllDependencies } from "./pkg/removeAllDependencies"; 14 | import { removeKeys } from "./pkg/removeKeys"; 15 | import { removeAllNodeModules, transferAllNodeModules } from "./workspaces"; 16 | import { mapLocations } from "./workspaces/mapLocations"; 17 | import { nameFromLocation } from "./workspaces/nameFromLocation"; 18 | import type { Workspace } from "./workspaces/types"; 19 | import { unnecessaryDependencies } from "./workspaces/unnecessaryDependencies"; 20 | import { getWorkspaces, yarnInstall } from "./yarn"; 21 | 22 | export const debug = Debug("yarn-workspace-focus-install:install"); 23 | 24 | export async function focusInstall({ 25 | cwd = process.cwd(), 26 | production = false, 27 | dryRun = false, 28 | yarnArgs = [], 29 | }: { 30 | cwd?: string; 31 | production?: boolean; 32 | dryRun?: boolean; 33 | yarnArgs?: string[]; 34 | }): Promise { 35 | debug({ cwd, dryRun, production, yarnArgs }); 36 | 37 | // Guard 38 | assert(cwd, "cwd should be defined"); 39 | const workspaceRoot = findWorkspaceRoot(cwd); 40 | assert(workspaceRoot, "Should be in a workspace"); 41 | assert(cwd !== workspaceRoot, "cwd should not be the workspace root"); 42 | 43 | const workspaces = await getWorkspaces(); 44 | 45 | const pkgLocation = slash(normalize(relative(workspaceRoot, cwd))); 46 | const focusPkgName = nameFromLocation(workspaces, pkgLocation); 47 | debug({ focusPkgName, pkgLocation }); 48 | 49 | const tmp = await initializeTmpClone(workspaceRoot, workspaces); 50 | 51 | await Promise.all( 52 | mapLocations( 53 | unnecessaryDependencies(workspaces, focusPkgName), 54 | async (location) => removeAllDependencies(join(tmp, location)) 55 | ) 56 | ); 57 | 58 | await Promise.all([ 59 | ...mapLocations(workspaces, async (location) => { 60 | if (location === pkgLocation) { 61 | if (!production) return; 62 | // remove focus workspace devDependencies too 63 | } 64 | await removeKeys(join(tmp, location), ["devDependencies"]); 65 | }), 66 | removeAllDependencies(tmp), 67 | ]); 68 | 69 | await yarnInstall(tmp, {}, yarnArgs); 70 | 71 | if (dryRun) { 72 | console.info("[dryRun mode] Focus installation done in " + tmp); 73 | return Promise.resolve(); 74 | } 75 | 76 | await removeAllNodeModules(workspaceRoot, workspaces); 77 | await transferAllNodeModules(tmp, workspaceRoot, workspaces); 78 | 79 | await remove(tmp); 80 | } 81 | 82 | async function initializeTmpClone( 83 | source: string, 84 | workspaces: Record 85 | ) { 86 | const tmp = directory(); 87 | debug({ source, tmp, workspaces }); 88 | 89 | const cp = cloneFolders(source, tmp); 90 | 91 | debug("copy package.json and yarn.lock from '%s' to '%s", source, tmp); 92 | await Promise.all([cp("package.json"), cp("yarn.lock")]); 93 | 94 | await Promise.all( 95 | mapLocations(workspaces, async (location) => cp(`${location}/package.json`)) 96 | ); 97 | 98 | return tmp; 99 | } 100 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | on: 3 | - push 4 | - pull_request 5 | 6 | jobs: 7 | build: 8 | strategy: 9 | # Don't fast-fail on tag and master 10 | fail-fast: ${{ github.event_name == 'pull_request' || (github.ref != 11 | 'refs/heads/master' && !startsWith(github.ref, 'refs/tags/')) }} 12 | matrix: 13 | config: 14 | - os: ubuntu-latest 15 | node-version: lts/* 16 | kind: test 17 | - os: macOS-latest 18 | node-version: lts/* 19 | kind: test 20 | - os: windows-latest 21 | node-version: lts/* 22 | kind: test 23 | # 24 | - os: macOS-latest 25 | node-version: 16.x 26 | kind: test 27 | - os: windows-latest 28 | node-version: 16.x 29 | kind: test 30 | # 31 | - os: ubuntu-latest 32 | node-version: 16.x 33 | kind: release 34 | 35 | name: ${{ matrix.config.kind }} on ${{ matrix.config.node-version }} (${{ matrix.config.os }}) 36 | runs-on: ${{ matrix.config.os }} 37 | 38 | steps: 39 | - uses: actions/checkout@v3 40 | 41 | - name: Set up Node.js ${{ matrix.config.node-version }} 42 | uses: actions/setup-node@v3 43 | with: 44 | node-version: ${{ matrix.config.node-version }} 45 | cache: yarn 46 | 47 | - name: Installing 48 | run: yarn --frozen-lockfile --perfer-offline 49 | 50 | - name: Lint 51 | run: yarn lint 52 | 53 | - name: Unit tests 54 | if: matrix.config.kind == 'test' 55 | run: yarn test 56 | 57 | - name: Unit tests and coverage 58 | if: matrix.config.kind == 'release' 59 | run: yarn test --coverage --coverageReporters=lcov --coverageReporters=text-summary 60 | 61 | - name: Send test coverage to codecov 62 | if: matrix.config.kind == 'release' 63 | continue-on-error: true 64 | uses: codecov/codecov-action@v2 65 | 66 | - name: Build 67 | run: yarn build 68 | 69 | - name: Archive lib components 70 | if: matrix.config.kind == 'release' 71 | uses: actions/upload-artifact@v3 72 | with: 73 | name: lib 74 | path: lib/ 75 | 76 | - name: Functional tests 77 | run: yarn e2e 78 | 79 | release: 80 | needs: 81 | - build 82 | if: github.event_name == 'push' 83 | runs-on: ubuntu-latest 84 | steps: 85 | - name: Set up Node 86 | uses: actions/setup-node@v2-beta 87 | with: 88 | node-version: 14.x 89 | 90 | - uses: actions/checkout@v3 91 | 92 | - name: Download lib form build job 93 | uses: actions/download-artifact@v3 94 | with: 95 | name: lib 96 | path: lib 97 | 98 | - name: Semantic Release 99 | uses: cycjimmy/semantic-release-action@v2 100 | with: 101 | extra_plugins: | 102 | @semantic-release/changelog 103 | @semantic-release/exec 104 | @semantic-release/git 105 | env: 106 | GIT_AUTHOR_EMAIL: ${{ secrets.SOCIALGROOVYBOT_EMAIL }} 107 | GIT_AUTHOR_NAME: ${{ secrets.SOCIALGROOVYBOT_NAME }} 108 | GIT_COMMITTER_EMAIL: ${{ secrets.SOCIALGROOVYBOT_EMAIL }} 109 | GIT_COMMITTER_NAME: ${{ secrets.SOCIALGROOVYBOT_NAME }} 110 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 111 | NPM_TOKEN: ${{ secrets.SOCIALGROOVYBOT_NPM_TOKEN }} 112 | -------------------------------------------------------------------------------- /e2e/foo-focus/__tests__/index.ts: -------------------------------------------------------------------------------- 1 | import { node } from "execa"; 2 | import { copy, pathExists, readFileSync, remove } from "fs-extra"; 3 | import { join } from "path"; 4 | import { directory } from "tempy"; 5 | 6 | import { bin } from "../../../package.json"; 7 | 8 | const BIN = join(__dirname, "..", "..", "..", bin); 9 | const cwd = directory(); 10 | const yarnInstallLog = readFileSync(join(__dirname, "yarn-install.out")) 11 | .toString("utf-8") 12 | .trim(); 13 | afterAll(async () => { 14 | await remove(cwd); 15 | }); 16 | test("should focus install foo package", async () => { 17 | await copy(join(__dirname, ".."), cwd); 18 | const { stdout, stderr } = await node(BIN, { 19 | cwd: join(cwd, "packages", "foo"), 20 | env: { 21 | // DEBUG: "*", 22 | /* eslint-disable @typescript-eslint/naming-convention */ 23 | FORCE_COLOR: "0", 24 | }, 25 | }); 26 | 27 | expect({ stderr, stdout }).toStrictEqual({ 28 | stderr: "", 29 | stdout: yarnInstallLog, 30 | }); 31 | expect(await pathExists(join(cwd, "packages"))).toBeTruthy(); 32 | expect(await pathExists(join(cwd, "packages", "a"))).toBeTruthy(); 33 | expect(await pathExists(join(cwd, "packages", "b"))).toBeTruthy(); 34 | expect(await pathExists(join(cwd, "packages", "c"))).toBeTruthy(); 35 | expect(await pathExists(join(cwd, "packages", "c1"))).toBeTruthy(); 36 | expect(await pathExists(join(cwd, "packages", "c2"))).toBeTruthy(); 37 | expect(await pathExists(join(cwd, "packages", "c21"))).toBeTruthy(); 38 | expect(await pathExists(join(cwd, "packages", "d"))).toBeTruthy(); 39 | expect(await pathExists(join(cwd, "packages", "foo"))).toBeTruthy(); 40 | 41 | expect(await pathExists(join(cwd, "node_modules"))).toBeTruthy(); 42 | // package dependencies should be installed 43 | expect( 44 | await pathExists(join(cwd, "node_modules", "remove-trailing-separator")) 45 | ).toBeTruthy(); 46 | // package dev dependencies should be installed 47 | expect( 48 | await pathExists(join(cwd, "node_modules", "replace-ext")) 49 | ).toBeTruthy(); 50 | 51 | expect(await pathExists(join(cwd, "node_modules", "a"))).toBeTruthy(); 52 | // Sub package dev dependencies should not be installed 53 | expect(await pathExists(join(cwd, "node_modules", "through"))).toBeFalsy(); 54 | 55 | expect(await pathExists(join(cwd, "node_modules", "b"))).toBeTruthy(); 56 | // Sub package dependencies should be installed 57 | expect(await pathExists(join(cwd, "node_modules", "slash"))).toBeTruthy(); 58 | 59 | expect(await pathExists(join(cwd, "node_modules", "c"))).toBeTruthy(); 60 | expect(await pathExists(join(cwd, "node_modules", "c1"))).toBeTruthy(); 61 | expect(await pathExists(join(cwd, "node_modules", "c2"))).toBeTruthy(); 62 | expect(await pathExists(join(cwd, "node_modules", "c21"))).toBeTruthy(); 63 | // Deep sub package dependencies should be installed 64 | expect( 65 | await pathExists(join(cwd, "node_modules", "signal-exit")) 66 | ).toBeTruthy(); 67 | 68 | expect(await pathExists(join(cwd, "node_modules", "d"))).toBeTruthy(); 69 | // Other package dependencies should not be installed 70 | expect(await pathExists(join(cwd, "node_modules", "semver"))).toBeFalsy(); 71 | 72 | expect(await pathExists(join(cwd, "node_modules", "foo"))).toBeTruthy(); 73 | 74 | expect(await pathExists(join(cwd, "package.json"))).toBeTruthy(); 75 | expect(await pathExists(join(cwd, "yarn.lock"))).toBeTruthy(); 76 | // Workspace dependencies should not be installed 77 | expect(await pathExists(join(cwd, "node_modules", "base64-js"))).toBeFalsy(); 78 | // Workspace dev dependencies should not be installed 79 | expect(await pathExists(join(cwd, "node_modules", "type"))).toBeFalsy(); 80 | }, 10_000); 81 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [1.1.38](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.37...v1.1.38) (2021-11-27) 2 | 3 | 4 | ### Bug Fixes 5 | 6 | * **deps:** update dependency debug to ^4.3.3 ([#488](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/488)) ([89f59b8](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/89f59b807ee800db15acf5752938ad775d15f6c6)) 7 | 8 | ## [1.1.37](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.36...v1.1.37) (2021-11-16) 9 | 10 | 11 | ### Bug Fixes 12 | 13 | * **deps:** update dependency yargs-parser to v21 ([#474](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/474)) ([c412b9a](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/c412b9a306457bab8174cc9fe7e7a4a4112877d9)) 14 | 15 | ## [1.1.36](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.35...v1.1.36) (2021-08-27) 16 | 17 | 18 | ### Bug Fixes 19 | 20 | * **deps:** update dependency tslib to ^2.3.1 ([#392](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/392)) ([09f7cae](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/09f7cae4b8aaa43a7c4450890d7e7b849c823697)) 21 | 22 | ## [1.1.35](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.34...v1.1.35) (2021-08-27) 23 | 24 | 25 | ### Bug Fixes 26 | 27 | * **deps:** update dependency slash to v4 ([#319](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/319)) ([d974d0b](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/d974d0bacca41a545bf592a346ffd93a840f0f64)) 28 | 29 | 30 | ### Reverts 31 | 32 | * **deps:** update dependency slash to v4 ([#399](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/399)) ([1fc3119](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/1fc31194bef67381d52d0569928b90157303676a)) 33 | 34 | ## [1.1.34](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.33...v1.1.34) (2021-07-04) 35 | 36 | 37 | ### Bug Fixes 38 | 39 | * **deps:** update dependency debug to ^4.3.2 ([#365](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/365)) ([3ed6429](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/3ed6429ed83999f374af87b8c01bfc193bc657e7)) 40 | 41 | ## [1.1.33](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.32...v1.1.33) (2021-06-21) 42 | 43 | 44 | ### Bug Fixes 45 | 46 | * **deps:** update dependency yargs-parser to ^20.2.9 ([#355](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/355)) ([dddb0d3](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/dddb0d321d03c64ea8bf82fbfaa76889105e6c71)) 47 | 48 | ## [1.1.32](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.31...v1.1.32) (2021-06-12) 49 | 50 | 51 | ### Bug Fixes 52 | 53 | * **deps:** update dependency tslib to ^2.3.0 ([#350](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/350)) ([78ba9db](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/78ba9dbeaf073cedb01f16c6910d6f861c23cfae)) 54 | 55 | 56 | ### Reverts 57 | 58 | * **renovate:** force enable the 🤖 on this repo ([a2799d8](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/a2799d85e30672695eedd3122cd5d8d73526f99e)) 59 | 60 | ## [1.1.31](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.30...v1.1.31) (2021-06-04) 61 | 62 | 63 | ### Bug Fixes 64 | 65 | * **deps:** update dependency execa to ^5.1.1 ([#345](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/345)) ([9fe215f](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/9fe215fde85ef5fb2c7168ced25318c2ed679776)) 66 | 67 | ## [1.1.30](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.29...v1.1.30) (2021-06-02) 68 | 69 | 70 | ### Bug Fixes 71 | 72 | * **deps:** update dependency execa to ^5.1.0 ([#343](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/343)) ([246db6a](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/246db6a27ed6183ddee144063259cb4b5ce35847)) 73 | 74 | ## [1.1.29](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.28...v1.1.29) (2021-05-30) 75 | 76 | 77 | ### Bug Fixes 78 | 79 | * **deps:** update dependency execa to ^5.0.1 ([#340](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/340)) ([ab77976](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/ab7797635802e0654c19fa3911b961dd6bde5574)) 80 | 81 | 82 | ### Reverts 83 | 84 | * **github:** test on node 14 minimum ([8acf4c5](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/8acf4c520b95dd25b656f8e23db7001aa3b13cc2)) 85 | 86 | ## [1.1.28](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.27...v1.1.28) (2021-05-20) 87 | 88 | 89 | ### Bug Fixes 90 | 91 | * **deps:** update dependency fs-extra to v10 ([#330](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/330)) ([a9c21ca](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/a9c21ca8ca1c5dc143b7251c5e5af5707fa0ac0f)) 92 | 93 | ## [1.1.27](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.26...v1.1.27) (2021-04-05) 94 | 95 | 96 | ### Bug Fixes 97 | 98 | * **deps:** update dependency tslib to ^2.2.0 ([#311](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/311)) ([faa7e9a](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/faa7e9a6a43b17e284db660448015518478e4947)) 99 | 100 | ## [1.1.26](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.25...v1.1.26) (2021-03-17) 101 | 102 | 103 | ### Bug Fixes 104 | 105 | * **deps:** update dependency tempy to ^1.0.1 ([#292](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/292)) ([cbab196](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/cbab196ee0af158b12c6a57a06ffc7d1b51ab09a)) 106 | 107 | ## [1.1.25](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.24...v1.1.25) (2021-03-10) 108 | 109 | 110 | ### Bug Fixes 111 | 112 | * **deps:** update dependency yargs-parser to ^20.2.7 ([#285](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/285)) ([cef9745](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/cef974519a8928a7da53e7abea4715b989a7ecc7)) 113 | 114 | ## [1.1.24](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.23...v1.1.24) (2021-02-22) 115 | 116 | 117 | ### Bug Fixes 118 | 119 | * **deps:** update dependency yargs-parser to ^20.2.6 ([#260](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/260)) ([b51c6c2](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/b51c6c299aaaab94f3a742ea356ca38887bbaa04)) 120 | 121 | ## [1.1.23](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.22...v1.1.23) (2021-02-13) 122 | 123 | 124 | ### Bug Fixes 125 | 126 | * **deps:** update dependency yargs-parser to ^20.2.5 ([#250](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/250)) ([daa9155](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/daa9155b4cc8ec289a9f3e4da75b3c6f22fe63e1)) 127 | 128 | ## [1.1.22](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.21...v1.1.22) (2021-01-22) 129 | 130 | 131 | ### Bug Fixes 132 | 133 | * **deps:** update dependency execa to v5 ([#232](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/232)) ([0f2792d](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/0f2792d3cf86e27cfc1b5031ea7196beaf633820)) 134 | 135 | ## [1.1.21](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.20...v1.1.21) (2021-01-19) 136 | 137 | 138 | ### Bug Fixes 139 | 140 | * **deps:** update dependency fs-extra to ^9.1.0 ([#228](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/228)) ([6866edf](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/6866edf5dabd94f5869b76ac6396b4f45a184ade)) 141 | 142 | ## [1.1.20](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.19...v1.1.20) (2021-01-06) 143 | 144 | 145 | ### Bug Fixes 146 | 147 | * **deps:** update dependency tslib to ^2.1.0 ([#222](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/222)) ([435aea8](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/435aea84b8a5cc08479e6f9230c1da2c7848d6b8)) 148 | 149 | ## [1.1.19](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.18...v1.1.19) (2020-11-19) 150 | 151 | 152 | ### Bug Fixes 153 | 154 | * **deps:** update dependency debug to ^4.3.1 ([#187](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/187)) ([e889941](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/e88994148a1c8ebf22c5fe931b25b7be44ba3a77)) 155 | 156 | ## [1.1.18](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.17...v1.1.18) (2020-11-19) 157 | 158 | 159 | ### Bug Fixes 160 | 161 | * **deps:** update dependency debug to ^4.3.0 ([#186](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/186)) ([444cb27](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/444cb27c78506f2db3669fee93c22a09e7e5c598)) 162 | 163 | ## [1.1.17](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.16...v1.1.17) (2020-11-13) 164 | 165 | 166 | ### Bug Fixes 167 | 168 | * **deps:** update dependency yargs-parser to ^20.2.4 ([#184](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/184)) ([f5cbf29](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/f5cbf29ee6300202c20487fea7c5dae3440a8844)) 169 | 170 | ## [1.1.16](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.15...v1.1.16) (2020-10-30) 171 | 172 | 173 | ### Bug Fixes 174 | 175 | * **deps:** update dependency yargs-parser to ^20.2.3 ([#154](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/154)) ([1b4c3c7](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/1b4c3c7842bc8856a8b14e00c105d81ce2c1e0e4)) 176 | 177 | ## [1.1.15](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.14...v1.1.15) (2020-10-28) 178 | 179 | 180 | ### Bug Fixes 181 | 182 | * **deps:** update dependency execa to ^4.1.0 ([#174](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/174)) ([9f1b8dc](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/9f1b8dcd91c8a02529a707588a01e9429f54be55)) 183 | 184 | ## [1.1.14](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.13...v1.1.14) (2020-10-15) 185 | 186 | 187 | ### Bug Fixes 188 | 189 | * **deps:** update dependency yargs-parser to ^20.2.2 ([#151](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/151)) ([e383db2](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/e383db27648635aacee5bcb7c5e5fda95908e7a9)) 190 | 191 | ## [1.1.13](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.12...v1.1.13) (2020-10-12) 192 | 193 | 194 | ### Bug Fixes 195 | 196 | * **deps:** update dependency tempy to v1 ([#149](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/149)) ([c550982](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/c55098251d1f4bf32d1de65aaa46fbe650048203)) 197 | 198 | ## [1.1.12](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.11...v1.1.12) (2020-10-11) 199 | 200 | 201 | ### Bug Fixes 202 | 203 | * **deps:** update dependency tslib to ^2.0.3 ([#146](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/146)) ([2149fb0](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/2149fb084c325f686a69f6fe073333ada77492f1)) 204 | 205 | ## [1.1.11](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.10...v1.1.11) (2020-10-06) 206 | 207 | 208 | ### Bug Fixes 209 | 210 | * **deps:** update dependency tslib to ^2.0.2 ([#140](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/140)) ([2ef3deb](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/2ef3deb111f6a532f00509971ff104e61c9f2377)) 211 | 212 | ## [1.1.10](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.9...v1.1.10) (2020-10-01) 213 | 214 | 215 | ### Bug Fixes 216 | 217 | * **deps:** update dependency yargs-parser to ^20.2.1 ([#133](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/133)) ([e1eab89](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/e1eab89e41fccb2802e09c90c7ceed46bd8364aa)) 218 | 219 | ## [1.1.9](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.8...v1.1.9) (2020-09-26) 220 | 221 | 222 | ### Bug Fixes 223 | 224 | * **deps:** update dependency tempy to ^0.7.1 ([#127](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/127)) ([d702c95](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/d702c95446b85721b1f5fba66c76c4c6240484e3)) 225 | 226 | ## [1.1.8](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.7...v1.1.8) (2020-09-21) 227 | 228 | 229 | ### Bug Fixes 230 | 231 | * **deps:** update dependency yargs-parser to ^20.2.0 ([#124](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/124)) ([7fff3dc](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/7fff3dc759682c05cd9c71c008c9747b529008a0)) 232 | 233 | ## [1.1.7](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.6...v1.1.7) (2020-09-20) 234 | 235 | 236 | ### Bug Fixes 237 | 238 | * **deps:** update dependency yargs-parser to ^20.1.0 ([#123](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/123)) ([61c2ea2](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/61c2ea2a4dc624a3d345ed90bd9f06014381393c)) 239 | 240 | ## [1.1.6](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.5...v1.1.6) (2020-09-19) 241 | 242 | 243 | ### Bug Fixes 244 | 245 | * **deps:** update dependency debug to ^4.2.0 ([#122](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/122)) ([f16e08a](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/f16e08a54995e3ccd8131e7c46088b932e9e9546)) 246 | 247 | ## [1.1.5](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.4...v1.1.5) (2020-09-17) 248 | 249 | 250 | ### Bug Fixes 251 | 252 | * **deps:** update dependency yargs-parser to v20 ([#107](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/107)) ([c0b59a9](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/c0b59a9ff40137485a82340a85583716875e3ae5)) 253 | 254 | ## [1.1.4](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.3...v1.1.4) (2020-09-15) 255 | 256 | 257 | ### Bug Fixes 258 | 259 | * **deps:** update dependency tempy to ^0.7.0 ([#112](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/112)) ([11c1156](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/11c1156b87bd3a7d4e913feb3fc9774c6dd0eb32)) 260 | 261 | ## [1.1.3](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.2...v1.1.3) (2020-09-03) 262 | 263 | 264 | ### Bug Fixes 265 | 266 | * **deps:** update dependency yargs-parser to v19 ([#70](https://github.com/SocialGouv/yarn-workspace-focus-install/issues/70)) ([6268f11](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/6268f1133054fd48218888e79f61e4513125f4a3)) 267 | 268 | ## [1.1.2](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.1...v1.1.2) (2020-08-06) 269 | 270 | 271 | ### Bug Fixes 272 | 273 | * **deps:** update dependency tslib to ^2.0.1 ([f7e50d6](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/f7e50d63d628aa76189c44efae8c77bc33e3ba95)) 274 | 275 | ## [1.1.1](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.1.0...v1.1.1) (2020-07-20) 276 | 277 | 278 | ### Bug Fixes 279 | 280 | * **deps:** update dependency tempy to ^0.6.0 ([3483efc](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/3483efced3955c589ac64198502c76ede8c1da7a)) 281 | 282 | # [1.1.0](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.0.4...v1.1.0) (2020-07-08) 283 | 284 | 285 | ### Bug Fixes 286 | 287 | * ensure to no change the lock ([5713f1f](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/5713f1fff1699bae6be6dd59539d609d558ffac5)) 288 | 289 | 290 | ### Features 291 | 292 | * pass yarn args after -- ([02bc3e3](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/02bc3e34e4a883c8587f4c3d5f7c95ddf0c16bfe)) 293 | 294 | ## [1.0.4](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.0.3...v1.0.4) (2020-07-07) 295 | 296 | 297 | ### Bug Fixes 298 | 299 | * **deps:** update dependency execa to ^4.0.3 ([2f844e3](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/2f844e379ed36c671202467c473886364692211d)) 300 | 301 | ## [1.0.3](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.0.2...v1.0.3) (2020-06-15) 302 | 303 | 304 | ### Bug Fixes 305 | 306 | * remove all workspace dependencies too ([3c8f7fc](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/3c8f7fc81c58785cfd5c775afdf1765d3f1fce95)) 307 | 308 | ## [1.0.2](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.0.1...v1.0.2) (2020-06-15) 309 | 310 | 311 | ### Bug Fixes 312 | 313 | * **cli:** ensure to exit with 1 on error ([d57aedb](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/d57aedb7773c9933e987ad65507e8e4572c1bd7a)) 314 | * do not remove focus dependencies ([45ddfaa](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/45ddfaa36d46308bc87dda62188a3f5c32098f26)) 315 | * do not remove focus dependencies ([3376a91](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/3376a9194695f07fdcca8bd876bc4a82f60a54f3)) 316 | 317 | ## [1.0.1](https://github.com/SocialGouv/yarn-workspace-focus-install/compare/v1.0.0...v1.0.1) (2020-06-15) 318 | 319 | 320 | ### Bug Fixes 321 | 322 | * add missing tslib dependency ([1d41de1](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/1d41de12a1b3068b23f1356145eada0bd3ff5147)) 323 | 324 | # 1.0.0 (2020-06-15) 325 | 326 | 327 | ### Bug Fixes 328 | 329 | * **workspace:** allow windows like location ([df0153e](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/df0153ee8f990746c21525302da37fcf96591e32)) 330 | * add dummy bin ([1d95da6](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/1d95da614a5596382c3f66d0cdfaa1b4ceeadc44)) 331 | * add dummy sources ([82cbc38](https://github.com/SocialGouv/yarn-workspace-focus-install/commit/82cbc384814ba566b14589ba24b41f8e42802742)) 332 | --------------------------------------------------------------------------------