-
Notifications
You must be signed in to change notification settings - Fork 148
Support multiple minor versions in parallel #723
Support multiple minor versions in parallel #723
Conversation
4e29cdd
to
60edd1a
Compare
cc @orta @acoates-ms |
@@ -39,7 +39,7 @@ export default async function generatePackages(dt: FS, allPackages: AllPackages, | |||
if (tgz) { | |||
await writeTgz(pkg.outputDirectory, `${pkg.outputDirectory}.tgz`); | |||
} | |||
log(` * ${pkg.libraryName}`); | |||
log(` * ${pkg.desc}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds the version of the package that’s being generated, rather than simply repeating the package name multiple times.
@@ -282,22 +282,22 @@ async function runCommand(log: LoggerWithErrors, cwd: string | undefined, cmd: s | |||
|
|||
/** Returns all immediate subdirectories of the root directory that have changed. */ | |||
export function gitChanges(diffs: GitDiff[]): PackageId[] { | |||
const changedPackages = new Map<string, Set<DependencyVersion>>(); | |||
const changedPackages = new Map<string, Map<string, DependencyVersion>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that DependencyVersion
is no longer a single primitive, but rather an object, I had to replace the usage of Set
…
|
||
for (const diff of diffs) { | ||
const dep = getDependencyFromFile(diff.file); | ||
if (dep) { | ||
const versions = changedPackages.get(dep.name); | ||
if (!versions) { | ||
changedPackages.set(dep.name, new Set([dep.majorVersion])); | ||
changedPackages.set(dep.name, new Map([[formatDependencyVersion(dep.version), dep.version]])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…so now it’s keyed by a string representation of the version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
When I've tried to run master on my laptop I'm getting issues, can you check the diff for the results of npm run parse
on this PR vs master to validate that the additional finer grain server checking hasn't accidentally changed the parsed representation overall?
That said, looks good to me
"make-server-run": "node -r source-map-support/register bin/make-server-run.js", | ||
"make-production-server-run": "node -r source-map-support/register bin/make-server-run.js --remote", | ||
"test-tsNext": "node -r source-map-support/register bin/tester/test.js --all --tsNext", | ||
"code-owners": "node -r source-map-support/register bin/code-owners.js", | ||
"push-production": "npm run build && git checkout production && git merge master && npm run build && git add bin && git commit -m \"Update bin\" && git push -u origin production" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work
c040652
to
284824c
Compare
@orta Rebased against |
@acoates-ms Unsure in how far you were planning on using your DT branch, but I had to make one small extra change DefinitelyTyped/DefinitelyTyped@5f1995c |
@alloy, The only other thing to check was that any changes to master since I made the change get copied into all the directories. -- Other than that, I was hoping to revive the PR once this one lands. (You are more than welcome to do that yourself though) |
@acoates-ms Cool, I’ll pick that up once this lands 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall the code looks good. There's a lot there but it's well-tested.
I'm on vacation early next week so I'll test the change manually then. In the meantime, I had some minor wording suggestions and one small question.
src/lib/definition-parser.test.ts
Outdated
|
||
expect(() => { | ||
getTypingInfo("jquery", dt.pkgFS("jquery")); | ||
}).toThrow("The latest version is 3.3, but a directory v3 exists."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would read better as
"The latest version of ${packageName} is 3.3, so the subdirectory 'v3' is not allowed since it applies to 3.*, which is not older than 3.3."
(Not sure about how to get across the idea of 3.* -- there might be a clearer way.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with:
The latest version is 3.3, so the subdirectory 'v3' is not allowed; since it applies to any 3.* version, up to and including 3.3.
What do you think?
oldMajorVersion: number | undefined, | ||
): TypingsDataRaw { | ||
directoryVersion: TypingVersion | undefined, | ||
): Omit<TypingsDataRaw, "libraryVersionDirectoryName"> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to omit libraryVersionDirectoryName here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libraryVersionDirectoryName
is not determined in this function. I could have passed the value in, only to include it in the object and return it, but that felt like bolting it on. I can go either way, if you have a strong preference.
Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Alright, addressed feedback 👍 |
@sandersn Could I get another review? |
@alloy I'm about to quit for the day so I'm going to publish in the morning, around 9 AM PST (-8 GMT). |
This is published and running on CI. I'll keep an eye out to see how it goes. |
Ace 🙌 Thanks! |
Looks like the fallout of this change thus far is:
|
Regarding DefinitelyTyped/DefinitelyTyped#40923
Supersedes #717
Summary
Some packages, such as react-native, have been and will be < v1 for a while. Especially in the < v1 case, according to semver any
v0.x
version can break API compatibility. As such, it would be great if we could maintain minor versions in parallel, just like we already can with major versions.After getting my bearings in the repo, I ended up adjusting the version directory validation to allow for minor versions and record that directory name in the
definitions.json
file so it can be used when generating packages.Example run
Test plan
I’ve tried to add tests around code I’ve changed as much as possible and I’ve performed local runs of the steps that can be ran locally (as shown above). However, I do think this requires a handheld run by somebody that knows this project more intimately to ensure all the steps after generating packages work as expected.