Files
vercel/packages/remix/test/unit.resolve-semver-min-max.test.ts
Nathan Rajlich d1b0dbe3a7 [remix] Install @vercel/remix-run-dev at build-time instead of using symlink (#9784)
Instead of including the fork `@remix-run/dev` package as a regular dependency of `@vercel/remix-builder`, install it at build-time by modifying the project's `package.json` file. The reasons for this are:

* Avoids deprecation warnings from a few packages that currently exist on the `@remix-run/dev` package when installing Vercel CLI (those warnings already show up in the build logs anyways, so nothing new there).
* Allows us to install a version as close as possible to the version specified in the user's `package.json` (similar to how we do when auto-injecting the `@vercel/remix` package). This will be especially important once Remix v2 is released, which will have breaking changes compared to v1.

**Note:** `@vercel/remix-run-dev` is still a _dev_ dependency, so that we can use TypeScript types from it, as well as, at runtime, we use the version in the Builder's `package.json` to determine the maximum versions of `@vercel/remix-run-dev` and/or `@vercel/remix` which can safely be installed.

Fixes #10027.
Fixes #10222.
2023-07-28 20:49:32 +00:00

21 lines
951 B
TypeScript
Vendored

import { resolveSemverMinMax } from '../src/utils';
describe('resolveSemverMinMax()', () => {
it.each([
{ min: '1.0.0', max: '1.15.0', version: '0.9.0', expected: '1.0.0' },
{ min: '1.0.0', max: '1.15.0', version: '1.0.0', expected: '1.0.0' },
{ min: '1.0.0', max: '1.15.0', version: '1.1.0', expected: '1.1.0' },
{ min: '1.0.0', max: '1.15.0', version: '1.10.0', expected: '1.10.0' },
{ min: '1.0.0', max: '1.15.0', version: '1.15.0', expected: '1.15.0' },
{ min: '1.0.0', max: '1.15.0', version: '1.16.0', expected: '1.15.0' },
{ min: '1.0.0', max: '1.15.0', version: '^1.12.0', expected: '^1.12.0' },
{ min: '1.0.0', max: '1.15.0', version: '0.x.x', expected: '1.0.0' },
])(
'Should return "$expected" for version "$version" (min=$min, max=$max)',
({ min, max, version, expected }) => {
const actual = resolveSemverMinMax(min, max, version);
expect(actual).toEqual(expected);
}
);
});