Replies: 6 comments 16 replies
-
The version catalog portion of this feature feels different than the inheritance portions. I wonder if we should define them differently and reserve the "environments" terminology specifically as an inheritance mechanism. Here's my take:
Since inheritance can be surprising, I think it makes sense to draw a line between the features that do this implicitly. Configuring Version CatalogHere's what the version catalog would look like: {
"name": "@comp/foo",
"pnpm": {
"catalog": "@comp/[email protected]"
},
"dependencies": {
"react": "catalog:",
"react-dom": "catalog:"
},
"devDependencies": {
"eslint": "catalog",
"jest": "catalog:"
}
} Configuring Environment InheritanceHere's what environment inheritance would look like: {
"name": "@comp/foo",
"pnpm": {
"environment": "@comp/[email protected]"
}
} In-memory this would become the following. Note that {
"name": "@comp/foo",
"pnpm": {
"environment": "@comp/[email protected]"
},
"author": "Example Team <[email protected]>",
"dependencies": {
"react": "16",
"eslint": "4",
"react-dom": "17",
"jest": "22"
},
"peerDependencies": {
"react-dom": "17",
"react": "16"
}
} Configuring both...?I do see a use case for configuring both. Users may want to share a version catalog across the entire company, but scope common fields to the specific product team within a company. {
"name": "@team/env",
"author": "Team Within @comp <[email protected]>",
"license": "BSD-3-Clause"
} {
"name": "@comp/foo",
"pnpm": {
"environment": "@team/[email protected]",
"version-catalog": "@comp/[email protected]"
},
"dependencies": {
"react": "version-catalog:",
"react-dom": "version-catalog:"
}
} But I don't think we should split the config specifically for this purpose. My concern was more around implicit/explicit inheritance. AlternativeFrom pnpm/rfcs#1 (comment), the other alternative would be to configure this on the environment package itself. For example On the environment package itself: {
"name": "@comp/utils",
"version": "1.0.0",
"alwaysIncludedDevDeps": ["jest", "typescript"],
"dependencies": {
"jest": "17",
"typescript": "4",
"ramda": "15"
} |
Beta Was this translation helpful? Give feedback.
-
QuestionWhen a package specifies a version from an environment package, should the original specifier be used, or its resolution? For example, suppose the following environment package: {
"name": "@comp/react-env",
"version": "1.0.0",
"dependencies": {
"react": "^16.0.0",
"react-dom": "^16.0.0",
}
} Gets installed as ( # pnpm-lock.yaml
packages:
/@comp/[email protected]:
dependencies:
react: 16.14.0
react-dom: 16.14.0 And the following package references that: {
"name": "@comp/app",
"pnpm": {
"env": "@comp/[email protected]"
},
"dependencies": {
"react": "pnpm-env:",
"react-dom": "pnpm-env:"
}
} Should the I also noticed that most of the examples given so far only specify the major version number. #2713 (comment). Was that intentional? {
"name": "@comp/react-env",
"version": "1.0.0",
"dependencies": {
"react": "16",
"eslint": "4",
"react-dom": "17",
"jest": "22"
},
"peerDependencies": {
"react-dom": "17",
"react": "16"
}
} My ThoughtsI could see reasons for approaches, but I think using the same resolution as |
Beta Was this translation helpful? Give feedback.
-
QuestionWhat should pnpm do if an environment package is referenced, but the consuming package uses Suppose {
"name": "@comp/react-env",
"version": "1.0.0",
"dependencies": {
"react": "16",
"react-dom": "16",
}
} But the consuming package incorrectly uses this in {
"name": "@comp/app",
"pnpm": {
"env": "@comp/[email protected]"
},
"peerDependencies": {
"react": "pnpm-env:",
"react-dom": "pnpm-env:"
}
} My ThoughtsWe probably need to throw an error in this case and push environment package authors towards: {
"name": "@comp/react-env",
"version": "1.0.0",
"dependencies": {
"react": "16",
"react-dom": "16",
},
"peerDependencies": {
"react": "16",
"react-dom": "16",
}
} But I could see this getting messy as environment packages end up duplicating the same list across |
Beta Was this translation helpful? Give feedback.
-
QuestionShould auto-install inheritance be specified on the environment package or the consuming package? Approach 1: {
"name": "@comp/utils",
"version": "1.0.0",
"alwaysIncludedDevDeps": ["jest", "typescript"],
"dependencies": {
"jest": "17",
"typescript": "4",
"ramda": "15"
} Approach 2: {
"name": "@comp/app",
"pnpm": {
"env": {
"name": "@comp/[email protected]",
"autoInstallAsDevDeps": true
}
}
} I have the same question for regular metadata fields such as My ThoughtsI see how approach 1 is easier, but it could be a surprise for developers that are only looking at the consuming app's |
Beta Was this translation helpful? Give feedback.
-
Been a bit busy with work. Getting the RFC together will be my top priority this weekend. |
Beta Was this translation helpful? Give feedback.
-
Hey folks! Thanks for following along. I think we can close this discussion since it served the initial purpose of answering many of my initial questions. See progress in pnpm/rfcs#3. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Edit: Draft RFC in discussion here pnpm/rfcs#3
Background
Starting a brainstorming discussion for details of an upcoming "environments" feature. (Final name to be determined.) This was first proposed by @zkochan here: #2713 (comment)
This was previously discussed in:
This discussion will be short-lived and close when there's enough concrete ideas for a new RFC. https://github.com/pnpm/rfcs
Concept
Environment packages will allow other packages to reference them for different purposes. A
@comp/react-env
environment package may be defined as:Other packages would be able to reference them through
pnpm.environment
:The rough goals this feature should accomplish are:
package.json
fields such asengines
,license
,authors
,scripts
,pnpm.overrides
between packages.dependencies
,devDependencies
, etc.Beta Was this translation helpful? Give feedback.
All reactions