diff --git a/.circleci/config.yml b/.circleci/config.yml index c207f2a68133..f02bc52220a8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -662,10 +662,21 @@ jobs: # tracked changes) — without it, a duplicate user-agent line lands on master every # release and, being last in the file, overrides bit-repo-local for local installs too. # the flag lives in .git/index, so it survives persist_to_workspace into later jobs. + # + # storeDir moves the store — and with it the global virtual store at //links, + # which every node_modules entry symlinks into — under the persist_to_workspace root, so the + # later jobs that only attach the workspace get resolvable symlinks. pnpm's default store + # lives in ~/.local/share/pnpm, outside that root. it has to go in pnpm-workspace.yaml: + # .npmrc only carries npm-compatible settings, and store-dir there is silently ignored by + # the config reader bit installs through (see scopes/dependencies/pnpm/read-config.ts). + # the repo has no committed pnpm-workspace.yaml; info/exclude keeps this CI-only one from + # being picked up by anything that stages untracked files. command: > cd bit && echo "user-agent=bit-repo-circleci" >> .npmrc && git update-index --skip-worktree .npmrc && + echo "storeDir: /home/circleci/bit/.pnpm-store" > pnpm-workspace.yaml && + echo "pnpm-workspace.yaml" >> .git/info/exclude && bbit install # `bbit install` compiles as part of the install, but that pass can fall back to the # default TypeScript compiler for components whose env is still being imported - notably @@ -679,11 +690,24 @@ jobs: # - run: cd bit && ls -l node_modules/@babel # - run: cd bit && ls -l node_modules/@babel/cli/bin # - run: cd bit && ls -l node_modules/.bin + - run: + # a persist path that matches nothing is not an error, so without this check a store that + # landed outside the workspace root only shows up much later, as a MODULE_NOT_FOUND on a + # dangling node_modules symlink in whichever job runs first. + name: verify the global virtual store sits inside the persisted workspace + command: | + set -e + ls -d /home/circleci/bit/.pnpm-store/*/links + ls -l bit/node_modules/oxlint + test -e bit/node_modules/oxlint/bin/oxlint - persist_to_workspace: root: . paths: - bit - - .pnpm-store + # only the global virtual store, not the content-addressable files/ it hardlinks from: + # the consumers of this workspace read node_modules, they never fetch packages, and + # carrying files/ too would duplicate every package in the archive. + - .pnpm-store/*/links - store_artifacts: path: ~/Library/Caches/Bit/logs - store_artifacts: diff --git a/mocha-multi-reporters-config.json b/mocha-multi-reporters-config.json index 4501ddb97115..e524b539c00f 100644 --- a/mocha-multi-reporters-config.json +++ b/mocha-multi-reporters-config.json @@ -1,5 +1,5 @@ { - "reporterEnabled": "spec, mocha-junit-reporter", + "reporterEnabled": "spec, ./node_modules/mocha-junit-reporter", "mochaJunitReporterReporterOptions": { "mochaFile": "${MOCHA_FILE}", "outputs": "true" diff --git a/package.json b/package.json index 5b4a1e27fe47..3a049af45c67 100644 --- a/package.json +++ b/package.json @@ -31,14 +31,14 @@ "lint-full": "./scripts/validate-import-named-aspects.sh && ./scripts/validate-no-ramda.sh && node scripts/validate-pkg-exist-in-pkg-json.js && npm run lint", "format": "prettier \"{e2e,scopes,components}/**/*.{ts,js,jsx,css,scss,tsx,md,mdx}\" --write", "prettier:check": "prettier --list-different \"{e2e,scopes,components}/**/*.{ts,js,jsx,css,scss,tsx,md,mdx}\"", - "mocha-circleci": "cross-env NODE_OPTIONS='--no-warnings --max-old-space-size=5000' registry-mock prepare && mocha --require ./babel-register --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors --exit", + "mocha-circleci": "cross-env NODE_OPTIONS='--no-warnings --max-old-space-size=5000' registry-mock prepare && mocha --require ./babel-register --reporter ./node_modules/mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors --exit", "e2e-test": "registry-mock prepare && cross-env NODE_OPTIONS=--no-warnings mocha --require ./babel-register './e2e/**/*.e2e*.ts'", "e2e-test:debug": "npm run e2e-test --debug", - "e2e-test-circle": "cross-env NODE_OPTIONS='--no-warnings --max-old-space-size=5000' mocha --require ./babel-register --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors --exit './e2e/**/*.e2e*.ts'", + "e2e-test-circle": "cross-env NODE_OPTIONS='--no-warnings --max-old-space-size=5000' mocha --require ./babel-register --reporter ./node_modules/mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors --exit './e2e/**/*.e2e*.ts'", "performance-test": "mocha --require ./babel-register ./e2e/performance/*.performance*.ts", "performance-test:debug": "npm run performance-test --debug", - "performance-test-circle": "mocha --require ./babel-register --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors ./e2e/performance/*.performance*.ts", - "bit-hub-test-circle": "mocha --require ./babel-register --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors ./e2e/bit-hub/*.ts", + "performance-test-circle": "mocha --require ./babel-register --reporter ./node_modules/mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors ./e2e/performance/*.performance*.ts", + "bit-hub-test-circle": "mocha --require ./babel-register --reporter ./node_modules/mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors ./e2e/bit-hub/*.ts", "clean-node-modules": "find . -type d -name node_modules -prune -exec rm -rf '{}' +", "setup": "bit install && bit compile", "full-setup": "rm -rf node_modules/.bin/bit && bit install && husky && bit compile", diff --git a/workspace.jsonc b/workspace.jsonc index af7d6ab5a9ec..db55391f7978 100644 --- a/workspace.jsonc +++ b/workspace.jsonc @@ -11,6 +11,7 @@ "resolveEnvsFromRoots": true }, "teambit.dependencies/dependency-resolver": { + "enableGlobalVirtualStore": true, "allowScripts": { "@apollo/protobufjs": true, "@parcel/watcher": true,