Conversation
The minimumFrontendPackageAgeDays parameter defaulted to 1 and was always passed as a command line argument, which takes precedence over every configuration source of npm, pnpm and bun. A project that configures min-release-age in .npmrc got the Vaadin default instead, so `mvn vaadin:build-frontend` and a manually run `npm install` disagreed on which package versions are allowed. The parameter is now unset by default. When nothing is configured on the Vaadin side, the package manager is asked what it resolves for its own minimum release age setting (`config get` for npm and pnpm, bunfig.toml for bun) and no argument is passed when it already has one. The one day default applies only when neither is configured.
The parameter type changed from int to Integer, which the javadoc build flags as a reference that cannot be resolved.
Reading the minimum release age used `config get <key>` while the registry lookup already ran `config ls --json`, which resolves the same configuration and contains every key. Both now share getResolvedConfiguration, so there is a single way to ask npm or pnpm what it resolves for a directory, and no string parsing of the tool output is needed to tell a configured value from an unset one.
resolveMinimumFrontendPackageAgeDays returned 0 both for a check that is explicitly disabled and for one the package manager already handles itself, and the caller repeated the same check to know whether to ask npm for its version at all. Resolution now returns the install argument to add, or nothing, and the remaining day count method only formats a positive number of days for the package manager in use.
Detecting a minimum release age configured for bun meant parsing bunfig.toml by hand, as bun has no command for printing its resolved configuration (oven-sh/bun#7140). That parser only recognized a subset of what the TOML format allows, so it could just as well miss a configured value as pick up something that is not one. Only npm and pnpm, which can both report their resolved configuration, are now asked. For bun the Vaadin default applies as before, and the documentation says so.
There was a problem hiding this comment.
Does not work on pnpm:
% npx pnpm config ls --json
{
"error": {
"code": "ERR_PNPM_CONFIG_UNKNOWN_SUBCOMMAND",
"message": "This subcommand is not known"
}
}
% npx pnpm config
[ERR_PNPM_CONFIG_NO_SUBCOMMAND] Please specify the subcommand
Usage: pnpm config set <key> <value>
pnpm config get <key>
pnpm config get --json <key>
pnpm config delete <key>
pnpm config list
Manage the pnpm configuration files.
Commands:
delete Remove the config key from the config file
get Print the config value for the provided key
list Show all the config settings
set Set the config key to the value provided
Options:
-g, --global Sets the configuration in the global config file
--json Show all types of values in JSON format (not just objects and arrays)
--location <project|global> When set to "project", the pnpm-workspace.yaml file will be used if it exists. If only .npmrc exists, it will be used. If neither exists, a pnpm-workspace.yaml file
will be created.
Visit https://pnpm.io/11.x/cli/config for documentation about this command.
and in the config file, the key is minimumReleaseAge
pnpm has no `config ls --json` subcommand, so reading the resolved configuration that way always failed and the minimum release age configured for pnpm was silently overridden by the Vaadin default. The value is now read one key at a time with `config get <key>`, which both npm and pnpm support and which prints the same shape on every version, unlike `pnpm config list` (INI in pnpm 10, JSON in pnpm 11). pnpm names the setting `minimumReleaseAge`, not `minimum-release-age`, so the key it is asked for is now the one pnpm knows. Reading the npm registries keeps using `npm config ls --json`, as the whole listing is needed there. Also renames getPackageManagerMinimumReleaseAge to getPackageManagerConfiguredMinimumReleaseAge to make it clear that it returns the package manager's own configuration option.
The old-npm path, where the counterpart of the --before fallback is read instead of min-release-age, had no coverage at all. The bun test relied on a mock that reports nothing for any key, so it passed even if bun were asked for its configuration; it now stubs a value and asserts that it is neither read nor used. Drops the pnpm default-value test, which only combined the argument formatting and the default fallback that are each already covered.
|
pnpm has no Verified against the real tools — pnpm 10.34 with Test coverage in 795a6e1: the |
Reading a single key at a time was a workaround for pnpm not knowing 'config ls'; the subcommand it does not know is the 'ls' alias, not the listing itself. Both pnpm 10 and 11 print the resolved configuration for 'config list --json', so the whole listing is read in one call again and the value is picked from it. pnpm 11 reports the setting camel-cased as minimumReleaseAge while pnpm 10 reports it kebab-cased, so getConfiguredSetting now takes the keys to look for in order of preference.
npm lists some of its settings as arrays, which JsonNode.asString does not accept, and the guard against that lived only in the registry lookup. Reading a setting now skips anything that is not a scalar, the same way the registry lookup skips anything that is not a string. Also covers a tool answering in a format other than JSON, which is ignored rather than failing the build, and corrects the subcommand the registry lookup documents.
The two argument tests for npm asserted exactly what the resolution tests assert while going through the same code, so only the pnpm and bun ones are left, where the day count is converted to minutes and seconds and a wrong conversion would otherwise pass unnoticed. The two ways of failing to read a configuration are one test now, as both only establish that the value is ignored rather than failing.
The merged test asked for a key the fixture cannot yield in any reading, so it no longer established that only JSON is accepted. It now asks for the key the output would produce if it were read as key=value pairs, and says which of the two ways of failing to read a configuration broke.
|



Problem
The
minimumFrontendPackageAgeDaysparameter defaulted to1and was always passed as a command line argument to the package manager. A command line argument takes precedence over every configuration source of npm, pnpm and bun, so a project that had configuredmin-release-agein its.npmrc(orminimumReleaseAgeinpnpm-workspace.yaml) silently got the Vaadin default instead —mvn vaadin:build-frontendand a manually runnpm installdisagreed on which package versions were allowed to be installed.What changed
The parameter is now unset by default (
Integer/nullrather thanint/1):0still disables the check.TaskRunNpmInstall.DEFAULT_MINIMUM_FRONTEND_PACKAGE_AGE_DAYS) apply.Reading the package manager configuration
The resolved configuration is read from the tool itself with
config list --json, so it accounts for every configuration source and precedence rule the tool applies (command line, environment variables, project/user/global/builtin.npmrc, and for pnpmpnpm-workspace.yaml). The subcommand has to be spelledlist— pnpm does not know thelsalias npm accepts, which is what made an earlier attempt at this fail on pnpm.The npm registry lookup already ran the same command, so both now share
FrontendTools.getResolvedConfigurationand there is a single way to ask npm or pnpm what it resolves for a directory. Details handled along the way:minimumReleaseAgewhile pnpm 10 reports it kebab-cased, sogetConfiguredSettingtakes the keys to look for in order of preference.omit,noproxy) as arrays, whichJsonNode.asStringdoes not accept. The guard against that previously lived only in the registry lookup; reading a setting now skips anything that is not a scalar, andnull(which npm uses for keys it knows but that are not configured) counts as unset.--min-release-ageis unsupported and the--before=<date>fallback is used, thebeforesetting is read as the configuration counterpart.bunfig.tomlby hand, as bun has no command for printing its resolved configuration (oven-sh/bun#7140). That hand-written parser recognized only a subset of what TOML allows, so it could just as easily miss a configured value as pick up something that was not one. It has been removed — for bun the Vaadin default applies as before, and the documentation says so.Refactoring
resolveMinimumFrontendPackageAgeArgumentnow returns the install argument to add, or nothing. Previously the day-count resolution returned0both for a check that is explicitly disabled and for one the package manager already handles itself, and the caller had to repeat the same check to know whether it needed to ask npm for its version at all. The remaining argument-formatting method only converts a positive number of days into the flag for the package manager in use.Tests
beforecounterpart is read instead ofmin-release-age), which had no coverage at all.Also restores the
flow-clientlockfile that a local build had rewritten.API Changes
com.vaadin.flow.server.frontend.Options
com.vaadin.flow.plugin.base.PluginAdapterBuild
com.vaadin.flow.plugin.maven.BuildFrontendMojo
com.vaadin.flow.plugin.maven.BuildDevBundleMojo