From bc55a5481a26132ef481e1450007c88547fbcf56 Mon Sep 17 00:00:00 2001 From: Mirko Kruschke Date: Sun, 4 Apr 2021 01:37:20 +0200 Subject: [PATCH] feat: support pnpm workspaces --- .github/workflows/node.js.yml | 51 +++++++++---------- .npmignore | 1 + README.md | 5 +- package.json | 14 ++++- scripts/prepareTests.sh | 2 +- src/update-ts-references.js | 30 ++++++++++- .../lerna/lerna.json | 0 .../lerna/package.json | 0 .../lerna/shared/workspace-c/package.json | 0 .../lerna/shared/workspace-c/tsconfig.json | 0 .../lerna/shared/workspace-d/package.json | 0 .../lerna/shared/workspace-d/tsconfig.json | 0 .../lerna/tsconfig.json | 0 .../lerna/utils/foos/foo-a/package.json | 0 .../lerna/utils/foos/foo-a/tsconfig.json | 0 .../lerna/utils/foos/foo-b/package.json | 0 .../lerna/utils/foos/foo-b/tsconfig.json | 0 .../lerna/workspace-a/package.json | 0 .../lerna/workspace-a/tsconfig.json | 0 .../lerna/workspace-b/package.json | 0 .../lerna/workspace-b/tsconfig.json | 0 test-scenarios/pnpm/package.json | 8 +++ test-scenarios/pnpm/pnpm-workspace.yaml | 8 +++ .../pnpm}/shared/workspace-c/package.json | 0 .../pnpm}/shared/workspace-c/tsconfig.json | 0 .../pnpm}/shared/workspace-d/package.json | 0 .../pnpm}/shared/workspace-d/tsconfig.json | 0 .../pnpm}/tsconfig.json | 0 .../pnpm}/utils/foos/foo-a/package.json | 0 .../pnpm}/utils/foos/foo-a/tsconfig.json | 0 .../pnpm}/utils/foos/foo-b/package.json | 0 .../pnpm}/utils/foos/foo-b/tsconfig.json | 0 .../pnpm/utils/foos/tests/test-a/package.json | 4 ++ .../utils/foos/tests/test-a}/tsconfig.json | 0 .../pnpm}/workspace-a/package.json | 0 .../pnpm/workspace-a}/tsconfig.json | 0 .../pnpm}/workspace-b/package.json | 0 .../pnpm/workspace-b}/tsconfig.json | 0 .../yarn-ws-check-no-changes/package.json | 0 .../shared/workspace-c/package.json | 0 .../shared/workspace-c/tsconfig.json | 0 .../shared/workspace-d/package.json | 0 .../shared/workspace-d/tsconfig.json | 0 .../yarn-ws-check-no-changes/tsconfig.json | 0 .../utils/foos/foo-a/package.json | 0 .../utils/foos/foo-a/tsconfig.json | 0 .../utils/foos/foo-b/package.json | 0 .../utils/foos/foo-b/tsconfig.json | 0 .../workspace-a/package.json | 0 .../workspace-a/tsconfig.json | 0 .../workspace-b/package.json | 0 .../workspace-b/tsconfig.json | 0 .../yarn-ws-check-no-changes/yarn.lock | 0 .../yarn-ws-check/package.json | 0 .../shared/workspace-c/package.json | 0 .../shared/workspace-c}/tsconfig.json | 0 .../shared/workspace-d/package.json | 0 .../shared/workspace-d}/tsconfig.json | 0 .../yarn-ws-check/tsconfig.json | 0 .../utils/foos/foo-a/package.json | 0 .../utils/foos/foo-a}/tsconfig.json | 0 .../utils/foos/foo-b/package.json | 0 .../utils/foos/foo-b}/tsconfig.json | 0 .../yarn-ws-check}/workspace-a/package.json | 0 .../yarn-ws-check/workspace-a}/tsconfig.json | 0 .../yarn-ws-check}/workspace-b/package.json | 0 .../yarn-ws-check/workspace-b}/tsconfig.json | 0 .../yarn-ws-nohoist/package.json | 0 .../shared/workspace-c/package.json | 0 .../shared/workspace-c}/tsconfig.json | 0 .../shared/workspace-d/package.json | 0 .../shared/workspace-d}/tsconfig.json | 0 .../yarn-ws-nohoist}/tsconfig.json | 0 .../utils/foos/foo-a/package.json | 0 .../utils/foos/foo-a}/tsconfig.json | 0 .../utils/foos/foo-b/package.json | 0 .../utils/foos/foo-b}/tsconfig.json | 0 .../yarn-ws-nohoist}/workspace-a/package.json | 0 .../workspace-a}/tsconfig.json | 0 .../yarn-ws-nohoist}/workspace-b/package.json | 0 .../yarn-ws-nohoist/workspace-b/tsconfig.json | 6 +++ .../yarn-ws/package.json | 0 .../yarn-ws/shared/workspace-c/package.json | 10 ++++ .../yarn-ws/shared/workspace-c/tsconfig.json | 6 +++ .../yarn-ws/shared/workspace-d/package.json | 7 +++ .../yarn-ws/shared/workspace-d/tsconfig.json | 6 +++ test-scenarios/yarn-ws/tsconfig.json | 8 +++ .../yarn-ws/utils/foos/foo-a/package.json | 7 +++ .../yarn-ws/utils/foos/foo-a/tsconfig.json | 6 +++ .../yarn-ws/utils/foos/foo-b/package.json | 4 ++ .../yarn-ws/utils/foos/foo-b/tsconfig.json | 6 +++ .../yarn-ws/workspace-a/package.json | 10 ++++ .../yarn-ws/workspace-a/tsconfig.json | 6 +++ .../yarn-ws/workspace-b/package.json | 10 ++++ .../yarn-ws/workspace-b/tsconfig.json | 6 +++ tests/update-ts-references.test.js | 13 +++++ yarn.lock | 12 +++++ 97 files changed, 214 insertions(+), 32 deletions(-) rename {tests/scenarios => test-scenarios}/lerna/lerna.json (100%) rename {tests/scenarios => test-scenarios}/lerna/package.json (100%) rename {tests/scenarios => test-scenarios}/lerna/shared/workspace-c/package.json (100%) rename {tests/scenarios => test-scenarios}/lerna/shared/workspace-c/tsconfig.json (100%) rename {tests/scenarios => test-scenarios}/lerna/shared/workspace-d/package.json (100%) rename {tests/scenarios => test-scenarios}/lerna/shared/workspace-d/tsconfig.json (100%) rename {tests/scenarios => test-scenarios}/lerna/tsconfig.json (100%) rename {tests/scenarios => test-scenarios}/lerna/utils/foos/foo-a/package.json (100%) rename {tests/scenarios => test-scenarios}/lerna/utils/foos/foo-a/tsconfig.json (100%) rename {tests/scenarios => test-scenarios}/lerna/utils/foos/foo-b/package.json (100%) rename {tests/scenarios => test-scenarios}/lerna/utils/foos/foo-b/tsconfig.json (100%) rename {tests/scenarios => test-scenarios}/lerna/workspace-a/package.json (100%) rename {tests/scenarios => test-scenarios}/lerna/workspace-a/tsconfig.json (100%) rename {tests/scenarios => test-scenarios}/lerna/workspace-b/package.json (100%) rename {tests/scenarios => test-scenarios}/lerna/workspace-b/tsconfig.json (100%) create mode 100644 test-scenarios/pnpm/package.json create mode 100644 test-scenarios/pnpm/pnpm-workspace.yaml rename {tests/scenarios/yarn-ws-check-no-changes => test-scenarios/pnpm}/shared/workspace-c/package.json (100%) rename {tests/scenarios/yarn-ws-check => test-scenarios/pnpm}/shared/workspace-c/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-check-no-changes => test-scenarios/pnpm}/shared/workspace-d/package.json (100%) rename {tests/scenarios/yarn-ws-check => test-scenarios/pnpm}/shared/workspace-d/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-nohoist => test-scenarios/pnpm}/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-check-no-changes => test-scenarios/pnpm}/utils/foos/foo-a/package.json (100%) rename {tests/scenarios/yarn-ws-check => test-scenarios/pnpm}/utils/foos/foo-a/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-check-no-changes => test-scenarios/pnpm}/utils/foos/foo-b/package.json (100%) rename {tests/scenarios/yarn-ws-check => test-scenarios/pnpm}/utils/foos/foo-b/tsconfig.json (100%) create mode 100644 test-scenarios/pnpm/utils/foos/tests/test-a/package.json rename {tests/scenarios/yarn-ws-check/workspace-a => test-scenarios/pnpm/utils/foos/tests/test-a}/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-check-no-changes => test-scenarios/pnpm}/workspace-a/package.json (100%) rename {tests/scenarios/yarn-ws-check/workspace-b => test-scenarios/pnpm/workspace-a}/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-check-no-changes => test-scenarios/pnpm}/workspace-b/package.json (100%) rename {tests/scenarios/yarn-ws-nohoist/shared/workspace-c => test-scenarios/pnpm/workspace-b}/tsconfig.json (100%) rename {tests/scenarios => test-scenarios}/yarn-ws-check-no-changes/package.json (100%) rename {tests/scenarios/yarn-ws-check => test-scenarios/yarn-ws-check-no-changes}/shared/workspace-c/package.json (100%) rename {tests/scenarios => test-scenarios}/yarn-ws-check-no-changes/shared/workspace-c/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-check => test-scenarios/yarn-ws-check-no-changes}/shared/workspace-d/package.json (100%) rename {tests/scenarios => test-scenarios}/yarn-ws-check-no-changes/shared/workspace-d/tsconfig.json (100%) rename {tests/scenarios => test-scenarios}/yarn-ws-check-no-changes/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-check => test-scenarios/yarn-ws-check-no-changes}/utils/foos/foo-a/package.json (100%) rename {tests/scenarios => test-scenarios}/yarn-ws-check-no-changes/utils/foos/foo-a/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-check => test-scenarios/yarn-ws-check-no-changes}/utils/foos/foo-b/package.json (100%) rename {tests/scenarios => test-scenarios}/yarn-ws-check-no-changes/utils/foos/foo-b/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-check => test-scenarios/yarn-ws-check-no-changes}/workspace-a/package.json (100%) rename {tests/scenarios => test-scenarios}/yarn-ws-check-no-changes/workspace-a/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-check => test-scenarios/yarn-ws-check-no-changes}/workspace-b/package.json (100%) rename {tests/scenarios => test-scenarios}/yarn-ws-check-no-changes/workspace-b/tsconfig.json (100%) rename {tests/scenarios => test-scenarios}/yarn-ws-check-no-changes/yarn.lock (100%) rename {tests/scenarios => test-scenarios}/yarn-ws-check/package.json (100%) rename {tests/scenarios/yarn-ws-nohoist => test-scenarios/yarn-ws-check}/shared/workspace-c/package.json (100%) rename {tests/scenarios/yarn-ws-nohoist/shared/workspace-d => test-scenarios/yarn-ws-check/shared/workspace-c}/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-nohoist => test-scenarios/yarn-ws-check}/shared/workspace-d/package.json (100%) rename {tests/scenarios/yarn-ws-nohoist/utils/foos/foo-a => test-scenarios/yarn-ws-check/shared/workspace-d}/tsconfig.json (100%) rename {tests/scenarios => test-scenarios}/yarn-ws-check/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-nohoist => test-scenarios/yarn-ws-check}/utils/foos/foo-a/package.json (100%) rename {tests/scenarios/yarn-ws-nohoist/utils/foos/foo-b => test-scenarios/yarn-ws-check/utils/foos/foo-a}/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-nohoist => test-scenarios/yarn-ws-check}/utils/foos/foo-b/package.json (100%) rename {tests/scenarios/yarn-ws-nohoist/workspace-a => test-scenarios/yarn-ws-check/utils/foos/foo-b}/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-nohoist => test-scenarios/yarn-ws-check}/workspace-a/package.json (100%) rename {tests/scenarios/yarn-ws-nohoist/workspace-b => test-scenarios/yarn-ws-check/workspace-a}/tsconfig.json (100%) rename {tests/scenarios/yarn-ws-nohoist => test-scenarios/yarn-ws-check}/workspace-b/package.json (100%) rename {tests/scenarios/yarn-ws/shared/workspace-c => test-scenarios/yarn-ws-check/workspace-b}/tsconfig.json (100%) rename {tests/scenarios => test-scenarios}/yarn-ws-nohoist/package.json (100%) rename {tests/scenarios/yarn-ws => test-scenarios/yarn-ws-nohoist}/shared/workspace-c/package.json (100%) rename {tests/scenarios/yarn-ws/shared/workspace-d => test-scenarios/yarn-ws-nohoist/shared/workspace-c}/tsconfig.json (100%) rename {tests/scenarios/yarn-ws => test-scenarios/yarn-ws-nohoist}/shared/workspace-d/package.json (100%) rename {tests/scenarios/yarn-ws/utils/foos/foo-a => test-scenarios/yarn-ws-nohoist/shared/workspace-d}/tsconfig.json (100%) rename {tests/scenarios/yarn-ws => test-scenarios/yarn-ws-nohoist}/tsconfig.json (100%) rename {tests/scenarios/yarn-ws => test-scenarios/yarn-ws-nohoist}/utils/foos/foo-a/package.json (100%) rename {tests/scenarios/yarn-ws/utils/foos/foo-b => test-scenarios/yarn-ws-nohoist/utils/foos/foo-a}/tsconfig.json (100%) rename {tests/scenarios/yarn-ws => test-scenarios/yarn-ws-nohoist}/utils/foos/foo-b/package.json (100%) rename {tests/scenarios/yarn-ws/workspace-a => test-scenarios/yarn-ws-nohoist/utils/foos/foo-b}/tsconfig.json (100%) rename {tests/scenarios/yarn-ws => test-scenarios/yarn-ws-nohoist}/workspace-a/package.json (100%) rename {tests/scenarios/yarn-ws/workspace-b => test-scenarios/yarn-ws-nohoist/workspace-a}/tsconfig.json (100%) rename {tests/scenarios/yarn-ws => test-scenarios/yarn-ws-nohoist}/workspace-b/package.json (100%) create mode 100644 test-scenarios/yarn-ws-nohoist/workspace-b/tsconfig.json rename {tests/scenarios => test-scenarios}/yarn-ws/package.json (100%) create mode 100644 test-scenarios/yarn-ws/shared/workspace-c/package.json create mode 100644 test-scenarios/yarn-ws/shared/workspace-c/tsconfig.json create mode 100644 test-scenarios/yarn-ws/shared/workspace-d/package.json create mode 100644 test-scenarios/yarn-ws/shared/workspace-d/tsconfig.json create mode 100644 test-scenarios/yarn-ws/tsconfig.json create mode 100644 test-scenarios/yarn-ws/utils/foos/foo-a/package.json create mode 100644 test-scenarios/yarn-ws/utils/foos/foo-a/tsconfig.json create mode 100644 test-scenarios/yarn-ws/utils/foos/foo-b/package.json create mode 100644 test-scenarios/yarn-ws/utils/foos/foo-b/tsconfig.json create mode 100644 test-scenarios/yarn-ws/workspace-a/package.json create mode 100644 test-scenarios/yarn-ws/workspace-a/tsconfig.json create mode 100644 test-scenarios/yarn-ws/workspace-b/package.json create mode 100644 test-scenarios/yarn-ws/workspace-b/tsconfig.json diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index d45afb9..9d2691b 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -5,13 +5,12 @@ name: Node.js CI on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: build: - runs-on: ubuntu-latest strategy: @@ -19,26 +18,26 @@ jobs: node-version: [10.x, 12.x, 14.x] steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: yarn - - run: yarn test - - windows: - runs-on: windows-latest - - strategy: - matrix: - node-version: [14.x] - - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} with windows - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: yarn - - run: yarn test \ No newline at end of file + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: yarn + - run: yarn test + + # windows: + # runs-on: windows-latest + + # strategy: + # matrix: + # node-version: [14.x] + + # steps: + # - uses: actions/checkout@v2 + # - name: Use Node.js ${{ matrix.node-version }} with windows + # uses: actions/setup-node@v1 + # with: + # node-version: ${{ matrix.node-version }} + # - run: yarn + # - run: yarn test diff --git a/.npmignore b/.npmignore index 44ee35f..beafd82 100644 --- a/.npmignore +++ b/.npmignore @@ -2,3 +2,4 @@ tests scripts node_modules test-run +test-scenarios \ No newline at end of file diff --git a/README.md b/README.md index 2a01014..3bcc8fd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # update-ts-references -If your repository is a multi package repository (via [lerna.js](https://lerna.js.org/) or [yarn workspaces](https://classic.yarnpkg.com/en/docs/workspaces/)) in combination with [project references](https://www.typescriptlang.org/docs/handbook/project-references.html) from TypeScript, this tool will be very helpful by reading dependencies out of the _package.json_ and applying them to the _tsconfig.json_ as references. +If your repository is a multi package repository (via [lerna.js](https://lerna.js.org/), [yarn workspaces](https://classic.yarnpkg.com/en/docs/workspaces/)) or [pnpm workspaces](https://pnpm.js.org/workspaces) in combination with [project references](https://www.typescriptlang.org/docs/handbook/project-references.html) from TypeScript, this tool will be very helpful by reading dependencies out of the _package.json_ and applying them to the _tsconfig.json_ as references. There's a blog post that's a good introduction to it [Optimizing multi-package apps with TypeScript Project References](https://ebaytech.berlin/optimizing-multi-package-apps-with-typescript-project-references-d5c57a3b4440). @@ -38,6 +38,9 @@ or you add it as dev dependency and include it in the `postinstall` script in th ## FAQ +> Why is my pnpm workspace alias not working? +_update-ts-references_ is currently not supporting [Referencing workspace packages through aliases](https://pnpm.js.org/workspaces#referencing-workspace-packages-through-aliases) yet. See issue #13 + > Where are the comments from my tsconfig? _update-ts-references_ is **not** able to preserve comments in tsconfig files when it is updating the references. If you need comments for the case like, explaining why compiler options are set, please move this part including comments into a second file and use the `extends` functionallity (see [here](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#tsconfig-bases)). diff --git a/package.json b/package.json index 07be23b..41a2251 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "update-ts-references", - "version": "2.0.0", + "version": "2.1.0", "bin": "src/index.js", "scripts": { "lint": "eslint src tests", @@ -15,6 +15,8 @@ "dependencies": { "@formatjs/cli": "^2.3.1", "glob": "^7.1.6", + "js-yaml": "^4.0.0", + "minimatch": "^3.0.4", "minimist": "^1.2.5", "mkdirp": "^1.0.4", "readline-sync": "^1.4.10" @@ -38,6 +40,7 @@ "tool", "util", "yarn", + "pnpm", "workspaces", "lerna", "monorepo", @@ -50,5 +53,12 @@ "bugs": { "url": "https://github.com/eBayClassifiedsGroup/update-ts-references/issues" }, - "homepage": "https://github.com/eBayClassifiedsGroup/update-ts-references" + "homepage": "https://github.com/eBayClassifiedsGroup/update-ts-references", + "jest": { + "verbose": true, + "modulePathIgnorePatterns": [ + "/test-scenarios/", + "/test-run/" + ] + } } diff --git a/scripts/prepareTests.sh b/scripts/prepareTests.sh index bab1b09..092f2cc 100755 --- a/scripts/prepareTests.sh +++ b/scripts/prepareTests.sh @@ -1,5 +1,5 @@ #!/bin/bash yarn link rm -rf test-run -cp -R tests/scenarios test-run +cp -R test-scenarios test-run find test-run -maxdepth 1 -type d \( ! -name 'test-run' \) -exec bash -c "cd {} && yarn && yarn link update-ts-references " \; \ No newline at end of file diff --git a/src/update-ts-references.js b/src/update-ts-references.js index 3a391ef..5fcb63f 100644 --- a/src/update-ts-references.js +++ b/src/update-ts-references.js @@ -2,6 +2,8 @@ const glob = require('glob'); const path = require('path'); const fs = require('fs'); const ts = require('typescript'); +const yaml = require('js-yaml'); +const minimatch = require('minimatch'); const readlineSync = require('readline-sync'); const assert = require('assert').strict; @@ -17,8 +19,19 @@ const defaultOptions = { }; const getAllPackageJsons = async (workspaces) => { + const ignoreGlobs = []; + const workspaceGlobs = []; + + workspaces.forEach((workspaceGlob) => { + if (workspaceGlob.startsWith('!')) { + ignoreGlobs.push(workspaceGlob); + } else { + workspaceGlobs.push(workspaceGlob); + } + }); + return Promise.all( - workspaces.map( + workspaceGlobs.map( (workspace) => new Promise((resolve, reject) => { glob(`${workspace}/${PACKAGE_JSON}`, (error, files) => { @@ -39,7 +52,13 @@ const getAllPackageJsons = async (workspaces) => { ) ) .then((allPackages) => - allPackages.filter((packageName) => !packageName.includes('node_modules')) + allPackages.filter( + (packageName) => + ignoreGlobs.reduce((prev, actualPattern) => { + if (!prev) return prev; + return minimatch(packageName, actualPattern); + }, true) && !packageName.includes('node_modules') + ) ); }; @@ -174,6 +193,13 @@ const execute = async ({ cwd, verbose, discardComments, check }) => { workspaces = lernaJson.packages; } + if (!workspaces && fs.existsSync(path.join(cwd, 'pnpm-workspace.yaml'))) { + const pnpmConfig = yaml.load( + fs.readFileSync(path.join(cwd, 'pnpm-workspace.yaml')) + ); + workspaces = pnpmConfig.packages; + } + if (!workspaces) { throw new Error( 'could not detect yarn workspaces or lerna in this repository' diff --git a/tests/scenarios/lerna/lerna.json b/test-scenarios/lerna/lerna.json similarity index 100% rename from tests/scenarios/lerna/lerna.json rename to test-scenarios/lerna/lerna.json diff --git a/tests/scenarios/lerna/package.json b/test-scenarios/lerna/package.json similarity index 100% rename from tests/scenarios/lerna/package.json rename to test-scenarios/lerna/package.json diff --git a/tests/scenarios/lerna/shared/workspace-c/package.json b/test-scenarios/lerna/shared/workspace-c/package.json similarity index 100% rename from tests/scenarios/lerna/shared/workspace-c/package.json rename to test-scenarios/lerna/shared/workspace-c/package.json diff --git a/tests/scenarios/lerna/shared/workspace-c/tsconfig.json b/test-scenarios/lerna/shared/workspace-c/tsconfig.json similarity index 100% rename from tests/scenarios/lerna/shared/workspace-c/tsconfig.json rename to test-scenarios/lerna/shared/workspace-c/tsconfig.json diff --git a/tests/scenarios/lerna/shared/workspace-d/package.json b/test-scenarios/lerna/shared/workspace-d/package.json similarity index 100% rename from tests/scenarios/lerna/shared/workspace-d/package.json rename to test-scenarios/lerna/shared/workspace-d/package.json diff --git a/tests/scenarios/lerna/shared/workspace-d/tsconfig.json b/test-scenarios/lerna/shared/workspace-d/tsconfig.json similarity index 100% rename from tests/scenarios/lerna/shared/workspace-d/tsconfig.json rename to test-scenarios/lerna/shared/workspace-d/tsconfig.json diff --git a/tests/scenarios/lerna/tsconfig.json b/test-scenarios/lerna/tsconfig.json similarity index 100% rename from tests/scenarios/lerna/tsconfig.json rename to test-scenarios/lerna/tsconfig.json diff --git a/tests/scenarios/lerna/utils/foos/foo-a/package.json b/test-scenarios/lerna/utils/foos/foo-a/package.json similarity index 100% rename from tests/scenarios/lerna/utils/foos/foo-a/package.json rename to test-scenarios/lerna/utils/foos/foo-a/package.json diff --git a/tests/scenarios/lerna/utils/foos/foo-a/tsconfig.json b/test-scenarios/lerna/utils/foos/foo-a/tsconfig.json similarity index 100% rename from tests/scenarios/lerna/utils/foos/foo-a/tsconfig.json rename to test-scenarios/lerna/utils/foos/foo-a/tsconfig.json diff --git a/tests/scenarios/lerna/utils/foos/foo-b/package.json b/test-scenarios/lerna/utils/foos/foo-b/package.json similarity index 100% rename from tests/scenarios/lerna/utils/foos/foo-b/package.json rename to test-scenarios/lerna/utils/foos/foo-b/package.json diff --git a/tests/scenarios/lerna/utils/foos/foo-b/tsconfig.json b/test-scenarios/lerna/utils/foos/foo-b/tsconfig.json similarity index 100% rename from tests/scenarios/lerna/utils/foos/foo-b/tsconfig.json rename to test-scenarios/lerna/utils/foos/foo-b/tsconfig.json diff --git a/tests/scenarios/lerna/workspace-a/package.json b/test-scenarios/lerna/workspace-a/package.json similarity index 100% rename from tests/scenarios/lerna/workspace-a/package.json rename to test-scenarios/lerna/workspace-a/package.json diff --git a/tests/scenarios/lerna/workspace-a/tsconfig.json b/test-scenarios/lerna/workspace-a/tsconfig.json similarity index 100% rename from tests/scenarios/lerna/workspace-a/tsconfig.json rename to test-scenarios/lerna/workspace-a/tsconfig.json diff --git a/tests/scenarios/lerna/workspace-b/package.json b/test-scenarios/lerna/workspace-b/package.json similarity index 100% rename from tests/scenarios/lerna/workspace-b/package.json rename to test-scenarios/lerna/workspace-b/package.json diff --git a/tests/scenarios/lerna/workspace-b/tsconfig.json b/test-scenarios/lerna/workspace-b/tsconfig.json similarity index 100% rename from tests/scenarios/lerna/workspace-b/tsconfig.json rename to test-scenarios/lerna/workspace-b/tsconfig.json diff --git a/test-scenarios/pnpm/package.json b/test-scenarios/pnpm/package.json new file mode 100644 index 0000000..08cfa55 --- /dev/null +++ b/test-scenarios/pnpm/package.json @@ -0,0 +1,8 @@ +{ + "name": "pnpm-workspace", + "version": "0.0.1", + "private": true, + "devDependencies": { + "typescript": "latest" + } +} diff --git a/test-scenarios/pnpm/pnpm-workspace.yaml b/test-scenarios/pnpm/pnpm-workspace.yaml new file mode 100644 index 0000000..24cf306 --- /dev/null +++ b/test-scenarios/pnpm/pnpm-workspace.yaml @@ -0,0 +1,8 @@ +packages: + # all packages in subdirs of packages/ and components/ + - 'workspace-a' + - 'workspace-b' + - 'shared/*' + - 'utils/**/' + # exclude packages that are inside test directories + - '!**/tests/**' diff --git a/tests/scenarios/yarn-ws-check-no-changes/shared/workspace-c/package.json b/test-scenarios/pnpm/shared/workspace-c/package.json similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/shared/workspace-c/package.json rename to test-scenarios/pnpm/shared/workspace-c/package.json diff --git a/tests/scenarios/yarn-ws-check/shared/workspace-c/tsconfig.json b/test-scenarios/pnpm/shared/workspace-c/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-check/shared/workspace-c/tsconfig.json rename to test-scenarios/pnpm/shared/workspace-c/tsconfig.json diff --git a/tests/scenarios/yarn-ws-check-no-changes/shared/workspace-d/package.json b/test-scenarios/pnpm/shared/workspace-d/package.json similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/shared/workspace-d/package.json rename to test-scenarios/pnpm/shared/workspace-d/package.json diff --git a/tests/scenarios/yarn-ws-check/shared/workspace-d/tsconfig.json b/test-scenarios/pnpm/shared/workspace-d/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-check/shared/workspace-d/tsconfig.json rename to test-scenarios/pnpm/shared/workspace-d/tsconfig.json diff --git a/tests/scenarios/yarn-ws-nohoist/tsconfig.json b/test-scenarios/pnpm/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-nohoist/tsconfig.json rename to test-scenarios/pnpm/tsconfig.json diff --git a/tests/scenarios/yarn-ws-check-no-changes/utils/foos/foo-a/package.json b/test-scenarios/pnpm/utils/foos/foo-a/package.json similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/utils/foos/foo-a/package.json rename to test-scenarios/pnpm/utils/foos/foo-a/package.json diff --git a/tests/scenarios/yarn-ws-check/utils/foos/foo-a/tsconfig.json b/test-scenarios/pnpm/utils/foos/foo-a/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-check/utils/foos/foo-a/tsconfig.json rename to test-scenarios/pnpm/utils/foos/foo-a/tsconfig.json diff --git a/tests/scenarios/yarn-ws-check-no-changes/utils/foos/foo-b/package.json b/test-scenarios/pnpm/utils/foos/foo-b/package.json similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/utils/foos/foo-b/package.json rename to test-scenarios/pnpm/utils/foos/foo-b/package.json diff --git a/tests/scenarios/yarn-ws-check/utils/foos/foo-b/tsconfig.json b/test-scenarios/pnpm/utils/foos/foo-b/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-check/utils/foos/foo-b/tsconfig.json rename to test-scenarios/pnpm/utils/foos/foo-b/tsconfig.json diff --git a/test-scenarios/pnpm/utils/foos/tests/test-a/package.json b/test-scenarios/pnpm/utils/foos/tests/test-a/package.json new file mode 100644 index 0000000..ea4b7c6 --- /dev/null +++ b/test-scenarios/pnpm/utils/foos/tests/test-a/package.json @@ -0,0 +1,4 @@ +{ + "name": "test-a", + "version": "1.0.0" +} diff --git a/tests/scenarios/yarn-ws-check/workspace-a/tsconfig.json b/test-scenarios/pnpm/utils/foos/tests/test-a/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-check/workspace-a/tsconfig.json rename to test-scenarios/pnpm/utils/foos/tests/test-a/tsconfig.json diff --git a/tests/scenarios/yarn-ws-check-no-changes/workspace-a/package.json b/test-scenarios/pnpm/workspace-a/package.json similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/workspace-a/package.json rename to test-scenarios/pnpm/workspace-a/package.json diff --git a/tests/scenarios/yarn-ws-check/workspace-b/tsconfig.json b/test-scenarios/pnpm/workspace-a/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-check/workspace-b/tsconfig.json rename to test-scenarios/pnpm/workspace-a/tsconfig.json diff --git a/tests/scenarios/yarn-ws-check-no-changes/workspace-b/package.json b/test-scenarios/pnpm/workspace-b/package.json similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/workspace-b/package.json rename to test-scenarios/pnpm/workspace-b/package.json diff --git a/tests/scenarios/yarn-ws-nohoist/shared/workspace-c/tsconfig.json b/test-scenarios/pnpm/workspace-b/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-nohoist/shared/workspace-c/tsconfig.json rename to test-scenarios/pnpm/workspace-b/tsconfig.json diff --git a/tests/scenarios/yarn-ws-check-no-changes/package.json b/test-scenarios/yarn-ws-check-no-changes/package.json similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/package.json rename to test-scenarios/yarn-ws-check-no-changes/package.json diff --git a/tests/scenarios/yarn-ws-check/shared/workspace-c/package.json b/test-scenarios/yarn-ws-check-no-changes/shared/workspace-c/package.json similarity index 100% rename from tests/scenarios/yarn-ws-check/shared/workspace-c/package.json rename to test-scenarios/yarn-ws-check-no-changes/shared/workspace-c/package.json diff --git a/tests/scenarios/yarn-ws-check-no-changes/shared/workspace-c/tsconfig.json b/test-scenarios/yarn-ws-check-no-changes/shared/workspace-c/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/shared/workspace-c/tsconfig.json rename to test-scenarios/yarn-ws-check-no-changes/shared/workspace-c/tsconfig.json diff --git a/tests/scenarios/yarn-ws-check/shared/workspace-d/package.json b/test-scenarios/yarn-ws-check-no-changes/shared/workspace-d/package.json similarity index 100% rename from tests/scenarios/yarn-ws-check/shared/workspace-d/package.json rename to test-scenarios/yarn-ws-check-no-changes/shared/workspace-d/package.json diff --git a/tests/scenarios/yarn-ws-check-no-changes/shared/workspace-d/tsconfig.json b/test-scenarios/yarn-ws-check-no-changes/shared/workspace-d/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/shared/workspace-d/tsconfig.json rename to test-scenarios/yarn-ws-check-no-changes/shared/workspace-d/tsconfig.json diff --git a/tests/scenarios/yarn-ws-check-no-changes/tsconfig.json b/test-scenarios/yarn-ws-check-no-changes/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/tsconfig.json rename to test-scenarios/yarn-ws-check-no-changes/tsconfig.json diff --git a/tests/scenarios/yarn-ws-check/utils/foos/foo-a/package.json b/test-scenarios/yarn-ws-check-no-changes/utils/foos/foo-a/package.json similarity index 100% rename from tests/scenarios/yarn-ws-check/utils/foos/foo-a/package.json rename to test-scenarios/yarn-ws-check-no-changes/utils/foos/foo-a/package.json diff --git a/tests/scenarios/yarn-ws-check-no-changes/utils/foos/foo-a/tsconfig.json b/test-scenarios/yarn-ws-check-no-changes/utils/foos/foo-a/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/utils/foos/foo-a/tsconfig.json rename to test-scenarios/yarn-ws-check-no-changes/utils/foos/foo-a/tsconfig.json diff --git a/tests/scenarios/yarn-ws-check/utils/foos/foo-b/package.json b/test-scenarios/yarn-ws-check-no-changes/utils/foos/foo-b/package.json similarity index 100% rename from tests/scenarios/yarn-ws-check/utils/foos/foo-b/package.json rename to test-scenarios/yarn-ws-check-no-changes/utils/foos/foo-b/package.json diff --git a/tests/scenarios/yarn-ws-check-no-changes/utils/foos/foo-b/tsconfig.json b/test-scenarios/yarn-ws-check-no-changes/utils/foos/foo-b/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/utils/foos/foo-b/tsconfig.json rename to test-scenarios/yarn-ws-check-no-changes/utils/foos/foo-b/tsconfig.json diff --git a/tests/scenarios/yarn-ws-check/workspace-a/package.json b/test-scenarios/yarn-ws-check-no-changes/workspace-a/package.json similarity index 100% rename from tests/scenarios/yarn-ws-check/workspace-a/package.json rename to test-scenarios/yarn-ws-check-no-changes/workspace-a/package.json diff --git a/tests/scenarios/yarn-ws-check-no-changes/workspace-a/tsconfig.json b/test-scenarios/yarn-ws-check-no-changes/workspace-a/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/workspace-a/tsconfig.json rename to test-scenarios/yarn-ws-check-no-changes/workspace-a/tsconfig.json diff --git a/tests/scenarios/yarn-ws-check/workspace-b/package.json b/test-scenarios/yarn-ws-check-no-changes/workspace-b/package.json similarity index 100% rename from tests/scenarios/yarn-ws-check/workspace-b/package.json rename to test-scenarios/yarn-ws-check-no-changes/workspace-b/package.json diff --git a/tests/scenarios/yarn-ws-check-no-changes/workspace-b/tsconfig.json b/test-scenarios/yarn-ws-check-no-changes/workspace-b/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/workspace-b/tsconfig.json rename to test-scenarios/yarn-ws-check-no-changes/workspace-b/tsconfig.json diff --git a/tests/scenarios/yarn-ws-check-no-changes/yarn.lock b/test-scenarios/yarn-ws-check-no-changes/yarn.lock similarity index 100% rename from tests/scenarios/yarn-ws-check-no-changes/yarn.lock rename to test-scenarios/yarn-ws-check-no-changes/yarn.lock diff --git a/tests/scenarios/yarn-ws-check/package.json b/test-scenarios/yarn-ws-check/package.json similarity index 100% rename from tests/scenarios/yarn-ws-check/package.json rename to test-scenarios/yarn-ws-check/package.json diff --git a/tests/scenarios/yarn-ws-nohoist/shared/workspace-c/package.json b/test-scenarios/yarn-ws-check/shared/workspace-c/package.json similarity index 100% rename from tests/scenarios/yarn-ws-nohoist/shared/workspace-c/package.json rename to test-scenarios/yarn-ws-check/shared/workspace-c/package.json diff --git a/tests/scenarios/yarn-ws-nohoist/shared/workspace-d/tsconfig.json b/test-scenarios/yarn-ws-check/shared/workspace-c/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-nohoist/shared/workspace-d/tsconfig.json rename to test-scenarios/yarn-ws-check/shared/workspace-c/tsconfig.json diff --git a/tests/scenarios/yarn-ws-nohoist/shared/workspace-d/package.json b/test-scenarios/yarn-ws-check/shared/workspace-d/package.json similarity index 100% rename from tests/scenarios/yarn-ws-nohoist/shared/workspace-d/package.json rename to test-scenarios/yarn-ws-check/shared/workspace-d/package.json diff --git a/tests/scenarios/yarn-ws-nohoist/utils/foos/foo-a/tsconfig.json b/test-scenarios/yarn-ws-check/shared/workspace-d/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-nohoist/utils/foos/foo-a/tsconfig.json rename to test-scenarios/yarn-ws-check/shared/workspace-d/tsconfig.json diff --git a/tests/scenarios/yarn-ws-check/tsconfig.json b/test-scenarios/yarn-ws-check/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-check/tsconfig.json rename to test-scenarios/yarn-ws-check/tsconfig.json diff --git a/tests/scenarios/yarn-ws-nohoist/utils/foos/foo-a/package.json b/test-scenarios/yarn-ws-check/utils/foos/foo-a/package.json similarity index 100% rename from tests/scenarios/yarn-ws-nohoist/utils/foos/foo-a/package.json rename to test-scenarios/yarn-ws-check/utils/foos/foo-a/package.json diff --git a/tests/scenarios/yarn-ws-nohoist/utils/foos/foo-b/tsconfig.json b/test-scenarios/yarn-ws-check/utils/foos/foo-a/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-nohoist/utils/foos/foo-b/tsconfig.json rename to test-scenarios/yarn-ws-check/utils/foos/foo-a/tsconfig.json diff --git a/tests/scenarios/yarn-ws-nohoist/utils/foos/foo-b/package.json b/test-scenarios/yarn-ws-check/utils/foos/foo-b/package.json similarity index 100% rename from tests/scenarios/yarn-ws-nohoist/utils/foos/foo-b/package.json rename to test-scenarios/yarn-ws-check/utils/foos/foo-b/package.json diff --git a/tests/scenarios/yarn-ws-nohoist/workspace-a/tsconfig.json b/test-scenarios/yarn-ws-check/utils/foos/foo-b/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-nohoist/workspace-a/tsconfig.json rename to test-scenarios/yarn-ws-check/utils/foos/foo-b/tsconfig.json diff --git a/tests/scenarios/yarn-ws-nohoist/workspace-a/package.json b/test-scenarios/yarn-ws-check/workspace-a/package.json similarity index 100% rename from tests/scenarios/yarn-ws-nohoist/workspace-a/package.json rename to test-scenarios/yarn-ws-check/workspace-a/package.json diff --git a/tests/scenarios/yarn-ws-nohoist/workspace-b/tsconfig.json b/test-scenarios/yarn-ws-check/workspace-a/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws-nohoist/workspace-b/tsconfig.json rename to test-scenarios/yarn-ws-check/workspace-a/tsconfig.json diff --git a/tests/scenarios/yarn-ws-nohoist/workspace-b/package.json b/test-scenarios/yarn-ws-check/workspace-b/package.json similarity index 100% rename from tests/scenarios/yarn-ws-nohoist/workspace-b/package.json rename to test-scenarios/yarn-ws-check/workspace-b/package.json diff --git a/tests/scenarios/yarn-ws/shared/workspace-c/tsconfig.json b/test-scenarios/yarn-ws-check/workspace-b/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws/shared/workspace-c/tsconfig.json rename to test-scenarios/yarn-ws-check/workspace-b/tsconfig.json diff --git a/tests/scenarios/yarn-ws-nohoist/package.json b/test-scenarios/yarn-ws-nohoist/package.json similarity index 100% rename from tests/scenarios/yarn-ws-nohoist/package.json rename to test-scenarios/yarn-ws-nohoist/package.json diff --git a/tests/scenarios/yarn-ws/shared/workspace-c/package.json b/test-scenarios/yarn-ws-nohoist/shared/workspace-c/package.json similarity index 100% rename from tests/scenarios/yarn-ws/shared/workspace-c/package.json rename to test-scenarios/yarn-ws-nohoist/shared/workspace-c/package.json diff --git a/tests/scenarios/yarn-ws/shared/workspace-d/tsconfig.json b/test-scenarios/yarn-ws-nohoist/shared/workspace-c/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws/shared/workspace-d/tsconfig.json rename to test-scenarios/yarn-ws-nohoist/shared/workspace-c/tsconfig.json diff --git a/tests/scenarios/yarn-ws/shared/workspace-d/package.json b/test-scenarios/yarn-ws-nohoist/shared/workspace-d/package.json similarity index 100% rename from tests/scenarios/yarn-ws/shared/workspace-d/package.json rename to test-scenarios/yarn-ws-nohoist/shared/workspace-d/package.json diff --git a/tests/scenarios/yarn-ws/utils/foos/foo-a/tsconfig.json b/test-scenarios/yarn-ws-nohoist/shared/workspace-d/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws/utils/foos/foo-a/tsconfig.json rename to test-scenarios/yarn-ws-nohoist/shared/workspace-d/tsconfig.json diff --git a/tests/scenarios/yarn-ws/tsconfig.json b/test-scenarios/yarn-ws-nohoist/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws/tsconfig.json rename to test-scenarios/yarn-ws-nohoist/tsconfig.json diff --git a/tests/scenarios/yarn-ws/utils/foos/foo-a/package.json b/test-scenarios/yarn-ws-nohoist/utils/foos/foo-a/package.json similarity index 100% rename from tests/scenarios/yarn-ws/utils/foos/foo-a/package.json rename to test-scenarios/yarn-ws-nohoist/utils/foos/foo-a/package.json diff --git a/tests/scenarios/yarn-ws/utils/foos/foo-b/tsconfig.json b/test-scenarios/yarn-ws-nohoist/utils/foos/foo-a/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws/utils/foos/foo-b/tsconfig.json rename to test-scenarios/yarn-ws-nohoist/utils/foos/foo-a/tsconfig.json diff --git a/tests/scenarios/yarn-ws/utils/foos/foo-b/package.json b/test-scenarios/yarn-ws-nohoist/utils/foos/foo-b/package.json similarity index 100% rename from tests/scenarios/yarn-ws/utils/foos/foo-b/package.json rename to test-scenarios/yarn-ws-nohoist/utils/foos/foo-b/package.json diff --git a/tests/scenarios/yarn-ws/workspace-a/tsconfig.json b/test-scenarios/yarn-ws-nohoist/utils/foos/foo-b/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws/workspace-a/tsconfig.json rename to test-scenarios/yarn-ws-nohoist/utils/foos/foo-b/tsconfig.json diff --git a/tests/scenarios/yarn-ws/workspace-a/package.json b/test-scenarios/yarn-ws-nohoist/workspace-a/package.json similarity index 100% rename from tests/scenarios/yarn-ws/workspace-a/package.json rename to test-scenarios/yarn-ws-nohoist/workspace-a/package.json diff --git a/tests/scenarios/yarn-ws/workspace-b/tsconfig.json b/test-scenarios/yarn-ws-nohoist/workspace-a/tsconfig.json similarity index 100% rename from tests/scenarios/yarn-ws/workspace-b/tsconfig.json rename to test-scenarios/yarn-ws-nohoist/workspace-a/tsconfig.json diff --git a/tests/scenarios/yarn-ws/workspace-b/package.json b/test-scenarios/yarn-ws-nohoist/workspace-b/package.json similarity index 100% rename from tests/scenarios/yarn-ws/workspace-b/package.json rename to test-scenarios/yarn-ws-nohoist/workspace-b/package.json diff --git a/test-scenarios/yarn-ws-nohoist/workspace-b/tsconfig.json b/test-scenarios/yarn-ws-nohoist/workspace-b/tsconfig.json new file mode 100644 index 0000000..1dd8e13 --- /dev/null +++ b/test-scenarios/yarn-ws-nohoist/workspace-b/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "outDir": "dist", + "rootDir": "src" + } +} diff --git a/tests/scenarios/yarn-ws/package.json b/test-scenarios/yarn-ws/package.json similarity index 100% rename from tests/scenarios/yarn-ws/package.json rename to test-scenarios/yarn-ws/package.json diff --git a/test-scenarios/yarn-ws/shared/workspace-c/package.json b/test-scenarios/yarn-ws/shared/workspace-c/package.json new file mode 100644 index 0000000..a401b15 --- /dev/null +++ b/test-scenarios/yarn-ws/shared/workspace-c/package.json @@ -0,0 +1,10 @@ +{ + "name": "workspace-c", + "version": "1.0.0", + "dependencies": { + "cross-env": "5.0.5" + }, + "peerDependencies": { + "foo-a": "1.0.0" + } +} diff --git a/test-scenarios/yarn-ws/shared/workspace-c/tsconfig.json b/test-scenarios/yarn-ws/shared/workspace-c/tsconfig.json new file mode 100644 index 0000000..1dd8e13 --- /dev/null +++ b/test-scenarios/yarn-ws/shared/workspace-c/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "outDir": "dist", + "rootDir": "src" + } +} diff --git a/test-scenarios/yarn-ws/shared/workspace-d/package.json b/test-scenarios/yarn-ws/shared/workspace-d/package.json new file mode 100644 index 0000000..e5a993c --- /dev/null +++ b/test-scenarios/yarn-ws/shared/workspace-d/package.json @@ -0,0 +1,7 @@ +{ + "name": "workspace-d", + "version": "1.0.0", + "dependencies": { + "workspace-c": "1.0.0" + } +} diff --git a/test-scenarios/yarn-ws/shared/workspace-d/tsconfig.json b/test-scenarios/yarn-ws/shared/workspace-d/tsconfig.json new file mode 100644 index 0000000..1dd8e13 --- /dev/null +++ b/test-scenarios/yarn-ws/shared/workspace-d/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "outDir": "dist", + "rootDir": "src" + } +} diff --git a/test-scenarios/yarn-ws/tsconfig.json b/test-scenarios/yarn-ws/tsconfig.json new file mode 100644 index 0000000..23b6225 --- /dev/null +++ b/test-scenarios/yarn-ws/tsconfig.json @@ -0,0 +1,8 @@ +{ + "files": [], + "compilerOptions": { + /* Basic Options */ + // "allowJs": true, + "composite": true + } +} diff --git a/test-scenarios/yarn-ws/utils/foos/foo-a/package.json b/test-scenarios/yarn-ws/utils/foos/foo-a/package.json new file mode 100644 index 0000000..699ec9c --- /dev/null +++ b/test-scenarios/yarn-ws/utils/foos/foo-a/package.json @@ -0,0 +1,7 @@ +{ + "name": "foo-a", + "version": "1.0.0", + "dependencies": { + "foo-b": "1.0.0" + } +} diff --git a/test-scenarios/yarn-ws/utils/foos/foo-a/tsconfig.json b/test-scenarios/yarn-ws/utils/foos/foo-a/tsconfig.json new file mode 100644 index 0000000..1dd8e13 --- /dev/null +++ b/test-scenarios/yarn-ws/utils/foos/foo-a/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "outDir": "dist", + "rootDir": "src" + } +} diff --git a/test-scenarios/yarn-ws/utils/foos/foo-b/package.json b/test-scenarios/yarn-ws/utils/foos/foo-b/package.json new file mode 100644 index 0000000..2c997b8 --- /dev/null +++ b/test-scenarios/yarn-ws/utils/foos/foo-b/package.json @@ -0,0 +1,4 @@ +{ + "name": "foo-b", + "version": "1.0.0" +} diff --git a/test-scenarios/yarn-ws/utils/foos/foo-b/tsconfig.json b/test-scenarios/yarn-ws/utils/foos/foo-b/tsconfig.json new file mode 100644 index 0000000..1dd8e13 --- /dev/null +++ b/test-scenarios/yarn-ws/utils/foos/foo-b/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "outDir": "dist", + "rootDir": "src" + } +} diff --git a/test-scenarios/yarn-ws/workspace-a/package.json b/test-scenarios/yarn-ws/workspace-a/package.json new file mode 100644 index 0000000..f35aa29 --- /dev/null +++ b/test-scenarios/yarn-ws/workspace-a/package.json @@ -0,0 +1,10 @@ +{ + "name": "workspace-a", + "version": "1.0.0", + "dependencies": { + "workspace-b": "1.0.0" + }, + "devDependencies": { + "foo-a": "1.0.0" + } +} diff --git a/test-scenarios/yarn-ws/workspace-a/tsconfig.json b/test-scenarios/yarn-ws/workspace-a/tsconfig.json new file mode 100644 index 0000000..1dd8e13 --- /dev/null +++ b/test-scenarios/yarn-ws/workspace-a/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "outDir": "dist", + "rootDir": "src" + } +} diff --git a/test-scenarios/yarn-ws/workspace-b/package.json b/test-scenarios/yarn-ws/workspace-b/package.json new file mode 100644 index 0000000..552cf0e --- /dev/null +++ b/test-scenarios/yarn-ws/workspace-b/package.json @@ -0,0 +1,10 @@ +{ + "name": "workspace-b", + "version": "1.0.0", + "dependencies": { + "cross-env": "5.0.5" + }, + "devDependencies": { + "foo-b": "1.0.0" + } +} diff --git a/test-scenarios/yarn-ws/workspace-b/tsconfig.json b/test-scenarios/yarn-ws/workspace-b/tsconfig.json new file mode 100644 index 0000000..1dd8e13 --- /dev/null +++ b/test-scenarios/yarn-ws/workspace-b/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "outDir": "dist", + "rootDir": "src" + } +} diff --git a/tests/update-ts-references.test.js b/tests/update-ts-references.test.js index bfc4d47..36f8b11 100644 --- a/tests/update-ts-references.test.js +++ b/tests/update-ts-references.test.js @@ -6,6 +6,7 @@ const rootFolderYarnNohoist = path.join( process.cwd(), 'test-run/yarn-ws-nohoist' ); +const rootFolderPnpm = path.join(process.cwd(), 'test-run/pnpm'); const rootFolderYarnCheck = path.join(process.cwd(), 'test-run/yarn-ws-check'); const rootFolderYarnCheckNoChanges = path.join( process.cwd(), @@ -164,6 +165,18 @@ test('Support yarn workspaces with noHoist', async () => { }); }); +test('Support pnpm workspaces', async () => { + await setup(rootFolderPnpm); + + tsconfigs.forEach((tsconfig) => { + const [configPath, config] = tsconfig; + + expect( + require(path.join(rootFolderPnpm, configPath, 'tsconfig.json')) + ).toEqual(config); + }); +}); + test('Detect changes with the --check option', async () => { let errorCode = 0; try { diff --git a/yarn.lock b/yarn.lock index 632ddd4..75837d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -789,6 +789,11 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" @@ -2644,6 +2649,13 @@ js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" +js-yaml@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz#f426bc0ff4b4051926cd588c71113183409a121f" + integrity sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q== + dependencies: + argparse "^2.0.1" + jsbn@~0.1.0: version "0.1.1" resolved "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"