Skip to content

Commit

Permalink
refactor: group projects in different subdirectories (#5659)
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Nov 19, 2022
1 parent d81599b commit 4ca53b0
Show file tree
Hide file tree
Showing 1,835 changed files with 5,802 additions and 12,650 deletions.
1 change: 1 addition & 0 deletions .eslintignore
@@ -1 +1,2 @@
fixtures
__fixtures__
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -43,8 +43,8 @@ jobs:
run: npm add --global npm@7
- name: pnpm install
run: pnpm install
- name: Audit
run: pnpm audit
# - name: Audit
# run: pnpm audit
- name: Cache TypeScript and Jest
uses: actions/cache@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .meta-updater/package.json
Expand Up @@ -7,8 +7,8 @@
"compile": "tsc --build"
},
"dependencies": {
"@pnpm/lockfile-file": "workspace:*",
"@pnpm/types": "workspace:*",
"@pnpm/lockfile-file": "6.0.2",
"@pnpm/types": "8.9.0",
"@types/normalize-path": "^3.0.0",
"is-subdir": "^1.2.0",
"load-json-file": "^6.2.0",
Expand Down
17 changes: 6 additions & 11 deletions .meta-updater/src/index.ts
Expand Up @@ -13,10 +13,11 @@ const NEXT_TAG = 'next-7'
const CLI_PKG_NAME = 'pnpm'

export default async (workspaceDir: string) => {
const pnpmManifest = loadJsonFile.sync(path.join(workspaceDir, 'packages/pnpm/package.json'))
const pnpmManifest = loadJsonFile.sync(path.join(workspaceDir, 'pnpm/package.json'))
const pnpmVersion = pnpmManifest!['version'] // eslint-disable-line
const pnpmMajorKeyword = `pnpm${pnpmVersion.split('.')[0]}`
const pkgsDir = path.join(workspaceDir, 'packages')
const privatePkgsDir = path.join(workspaceDir, 'privatePackages')
const utilsDir = path.join(workspaceDir, 'utils')
const lockfile = await readWantedLockfile(workspaceDir, { ignoreIncompatible: false })
if (lockfile == null) {
throw new Error('no lockfile found')
Expand All @@ -30,21 +31,15 @@ export default async (workspaceDir: string) => {
manifest.scripts!['release'] = `pnpm --filter=@pnpm/exe publish --tag=${NEXT_TAG} --access=public && pnpm publish --filter=!pnpm --filter=!@pnpm/exe --access=public && pnpm publish --filter=pnpm --tag=${NEXT_TAG} --access=public`
return manifest
}
if (!isSubdir(pkgsDir, dir)) {
if (manifest.name) {
manifest.devDependencies = {
...manifest.devDependencies,
[manifest.name]: `workspace:*`,
}
}
return manifest
}
if (manifest.name && manifest.name !== CLI_PKG_NAME) {
manifest.devDependencies = {
...manifest.devDependencies,
[manifest.name]: `workspace:*`,
}
} else if (manifest.name === CLI_PKG_NAME && manifest.devDependencies) {
delete manifest.devDependencies[manifest.name]
}
if (manifest.private || isSubdir(privatePkgsDir, dir) || isSubdir(utilsDir, dir)) return manifest
manifest.keywords = [
pnpmMajorKeyword,
...(manifest.keywords ?? []).filter((keyword) => !/^pnpm[0-9]+$/.test(keyword)),
Expand Down
9 changes: 1 addition & 8 deletions .meta-updater/tsconfig.json
Expand Up @@ -9,12 +9,5 @@
"src/**/*.ts",
"../typings/**/*.d.ts"
],
"references": [
{
"path": "../packages/lockfile-file"
},
{
"path": "../packages/types"
}
]
"references": []
}
2 changes: 1 addition & 1 deletion .npmrc
Expand Up @@ -2,7 +2,7 @@
git-checks = false

hoist-pattern[] = jest-runner
link-workspace-packages = true
link-workspace-packages = false
shared-workspace-lockfile = true
publish-branch = main
pnpmfile = .pnpmfile.cjs
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -18,7 +18,7 @@
## Setting Up the Environment

1. Run `pnpm install` in the root of the repository to install all dependencies.
1. Run `cd packages/pnpm/dev && pnpm link -g` to make pnpm from the repository available in the command line via the `pd` command.
1. Run `cd pnpm/dev && pnpm link -g` to make pnpm from the repository available in the command line via the `pd` command.
1. Return to the root of the repository and run `pnpm run compile` to create an initial build of pnpm from the source in the repository.
1. Now you can change any source code file and run `pd [command] [flags]` to run `pnpm` directly from the source code by compiling all the files without typechecking in memory.
1. Alternatively, for recompiling all the projects with typechecking after your changes, again run `pnpm run compile` in the root of the repository. To run a task that will recompile the projects on change, run `pnpm run watch`.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions __fixtures__/has-major-outdated-deps/.gitignore
@@ -0,0 +1,2 @@
!**/node_modules/**/*
!/node_modules/
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions __fixtures__/has-not-outdated-deps/.gitignore
@@ -0,0 +1,2 @@
!**/node_modules/**/*
!/node_modules/
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,2 @@
!**/node_modules/**/*
!/node_modules/
2 changes: 2 additions & 0 deletions __fixtures__/has-outdated-deps/.gitignore
@@ -0,0 +1,2 @@
!**/node_modules/**/*
!/node_modules/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions __fixtures__/package.yaml
@@ -0,0 +1,5 @@
scripts:
prepareFixtures: >
node ../pnpm/dist/pnpm.cjs install -rf --frozen-lockfile --no-shared-workspace-lockfile --no-link-workspace-packages &&
node ../pnpm/dist/pnpm.cjs install -rf -C fixtureWithLinks --frozen-lockfile --link-workspace-packages --no-shared-workspace-lockfile &&
cd ./fixture-with-external-shrinkwrap/pkg && node ../../../pnpm/dist/pnpm.cjs install -f --frozen-lockfile
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/cli-meta/package.json → cli/cli-meta/package.json
Expand Up @@ -17,7 +17,7 @@
"prepublishOnly": "pnpm run compile",
"compile": "tsc --build && pnpm run lint --fix"
},
"repository": "https://github.com/pnpm/pnpm/blob/main/packages/cli-meta",
"repository": "https://github.com/pnpm/pnpm/blob/main/cli/cli-meta",
"keywords": [
"pnpm7",
"pnpm"
Expand All @@ -26,7 +26,7 @@
"bugs": {
"url": "https://github.com/pnpm/pnpm/issues"
},
"homepage": "https://github.com/pnpm/pnpm/blob/main/packages/cli-meta#readme",
"homepage": "https://github.com/pnpm/pnpm/blob/main/cli/cli-meta#readme",
"devDependencies": {
"@pnpm/cli-meta": "workspace:*"
},
Expand Down
File renamed without changes.
Expand Up @@ -10,7 +10,7 @@
],
"references": [
{
"path": "../types"
"path": "../../packages/types"
}
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -17,7 +17,7 @@
"compile": "tsc --build && pnpm run lint --fix",
"test": "pnpm run compile"
},
"repository": "https://github.com/pnpm/pnpm/blob/main/packages/cli-utils",
"repository": "https://github.com/pnpm/pnpm/blob/main/cli/cli-utils",
"keywords": [
"pnpm7",
"pnpm"
Expand All @@ -26,7 +26,7 @@
"bugs": {
"url": "https://github.com/pnpm/pnpm/issues"
},
"homepage": "https://github.com/pnpm/pnpm/blob/main/packages/cli-utils#readme",
"homepage": "https://github.com/pnpm/pnpm/blob/main/cli/cli-utils#readme",
"devDependencies": {
"@pnpm/cli-utils": "workspace:*",
"@types/ramda": "0.28.15"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions packages/cli-utils/tsconfig.json → cli/cli-utils/tsconfig.json
Expand Up @@ -10,28 +10,28 @@
],
"references": [
{
"path": "../cli-meta"
"path": "../../config/config"
},
{
"path": "../config"
"path": "../../config/package-is-installable"
},
{
"path": "../default-reporter"
"path": "../../packages/error"
},
{
"path": "../error"
"path": "../../packages/types"
},
{
"path": "../manifest-utils"
"path": "../../pkg-manifest/manifest-utils"
},
{
"path": "../package-is-installable"
"path": "../../pkg-manifest/read-project-manifest"
},
{
"path": "../read-project-manifest"
"path": "../cli-meta"
},
{
"path": "../types"
"path": "../default-reporter"
}
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/command/package.json → cli/command/package.json
Expand Up @@ -17,7 +17,7 @@
"prepublishOnly": "pnpm run compile",
"compile": "tsc --build && pnpm run lint --fix"
},
"repository": "https://github.com/pnpm/pnpm/blob/main/packages/command",
"repository": "https://github.com/pnpm/pnpm/blob/main/cli/command",
"keywords": [
"pnpm7",
"pnpm"
Expand All @@ -26,7 +26,7 @@
"bugs": {
"url": "https://github.com/pnpm/pnpm/issues"
},
"homepage": "https://github.com/pnpm/pnpm/blob/main/packages/command#readme",
"homepage": "https://github.com/pnpm/pnpm/blob/main/cli/command#readme",
"funding": "https://opencollective.com/pnpm",
"devDependencies": {
"@pnpm/command": "workspace:*"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -17,7 +17,7 @@
"prepublishOnly": "pnpm run compile",
"compile": "tsc --build && pnpm run lint --fix"
},
"repository": "https://github.com/pnpm/pnpm/blob/main/packages/common-cli-options-help",
"repository": "https://github.com/pnpm/pnpm/blob/main/cli/common-cli-options-help",
"keywords": [
"pnpm7",
"pnpm"
Expand All @@ -26,7 +26,7 @@
"bugs": {
"url": "https://github.com/pnpm/pnpm/issues"
},
"homepage": "https://github.com/pnpm/pnpm/blob/main/packages/common-cli-options-help#readme",
"homepage": "https://github.com/pnpm/pnpm/blob/main/cli/common-cli-options-help#readme",
"funding": "https://opencollective.com/pnpm",
"devDependencies": {
"@pnpm/common-cli-options-help": "workspace:*"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -17,7 +17,7 @@
"prepublishOnly": "pnpm run compile",
"compile": "tsc --build && pnpm run lint --fix"
},
"repository": "https://github.com/pnpm/pnpm/blob/main/packages/default-reporter",
"repository": "https://github.com/pnpm/pnpm/blob/main/cli/default-reporter",
"keywords": [
"pnpm7",
"pnpm-reporter"
Expand Down Expand Up @@ -61,7 +61,7 @@
"load-json-file": "^6.2.0",
"normalize-newline": "3.0.0"
},
"homepage": "https://github.com/pnpm/pnpm/blob/main/packages/default-reporter#readme",
"homepage": "https://github.com/pnpm/pnpm/blob/main/cli/default-reporter#readme",
"funding": "https://opencollective.com/pnpm",
"exports": {
".": "./lib/index.js"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -10,19 +10,19 @@
],
"references": [
{
"path": "../core-loggers"
"path": "../../config/config"
},
{
"path": "../directory-fetcher"
"path": "../../packages/core-loggers"
},
{
"path": "../read-package-json"
"path": "../../packages/error"
},
{
"path": "../store-controller-types"
"path": "../../packages/render-peer-issues"
},
{
"path": "../types"
"path": "../../packages/types"
}
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -19,7 +19,7 @@
"start": "tsc --watch",
"compile": "tsc --build && pnpm run lint --fix"
},
"repository": "https://github.com/pnpm/pnpm/blob/main/packages/parse-cli-args",
"repository": "https://github.com/pnpm/pnpm/blob/main/cli/parse-cli-args",
"keywords": [
"pnpm7",
"pnpm"
Expand All @@ -28,7 +28,7 @@
"bugs": {
"url": "https://github.com/pnpm/pnpm/issues"
},
"homepage": "https://github.com/pnpm/pnpm/blob/main/packages/parse-cli-args#readme",
"homepage": "https://github.com/pnpm/pnpm/blob/main/cli/parse-cli-args#readme",
"devDependencies": {
"@pnpm/parse-cli-args": "workspace:*",
"tempy": "^1.0.1"
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -10,10 +10,10 @@
],
"references": [
{
"path": "../read-project-manifest"
"path": "../../packages/error"
},
{
"path": "../types"
"path": "../../workspace/find-workspace-dir"
}
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/config/package.json → config/config/package.json
Expand Up @@ -17,7 +17,7 @@
"start": "tsc --watch",
"compile": "tsc --build && pnpm run lint --fix"
},
"repository": "https://github.com/pnpm/pnpm/blob/main/packages/config",
"repository": "https://github.com/pnpm/pnpm/blob/main/config/config",
"keywords": [
"pnpm7",
"pnpm",
Expand All @@ -30,7 +30,7 @@
"bugs": {
"url": "https://github.com/pnpm/pnpm/issues"
},
"homepage": "https://github.com/pnpm/pnpm/blob/main/packages/config#readme",
"homepage": "https://github.com/pnpm/pnpm/blob/main/config/config#readme",
"dependencies": {
"@pnpm/config.env-replace": "1.0.0",
"@pnpm/constants": "workspace:*",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 9 additions & 9 deletions packages/config/tsconfig.json → config/config/tsconfig.json
Expand Up @@ -10,31 +10,31 @@
],
"references": [
{
"path": "../../privatePackages/prepare"
"path": "../../hooks/pnpmfile"
},
{
"path": "../../privatePackages/test-fixtures"
"path": "../../packages/constants"
},
{
"path": "../constants"
"path": "../../packages/error"
},
{
"path": "../error"
"path": "../../packages/git-utils"
},
{
"path": "../git-utils"
"path": "../../packages/types"
},
{
"path": "../matcher"
"path": "../../pkg-manifest/read-project-manifest"
},
{
"path": "../pnpmfile"
"path": "../../privatePackages/prepare"
},
{
"path": "../read-project-manifest"
"path": "../../privatePackages/test-fixtures"
},
{
"path": "../types"
"path": "../matcher"
}
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/matcher/package.json → config/matcher/package.json
Expand Up @@ -18,7 +18,7 @@
"prepublishOnly": "pnpm run compile",
"compile": "tsc --build && pnpm run lint --fix"
},
"repository": "https://github.com/pnpm/pnpm/blob/main/packages/matcher",
"repository": "https://github.com/pnpm/pnpm/blob/main/config/matcher",
"keywords": [
"pnpm7",
"pnpm",
Expand All @@ -30,7 +30,7 @@
"bugs": {
"url": "https://github.com/pnpm/pnpm/issues"
},
"homepage": "https://github.com/pnpm/pnpm/blob/main/packages/matcher#readme",
"homepage": "https://github.com/pnpm/pnpm/blob/main/config/matcher#readme",
"dependencies": {
"escape-string-regexp": "^4.0.0"
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 4ca53b0

Please sign in to comment.