Skip to content

Generate dependency manifest for apps#1285

Merged
LukeSheard merged 21 commits intomainfrom
feature/dependency-manifest-strawman
Jan 18, 2022
Merged

Generate dependency manifest for apps#1285
LukeSheard merged 21 commits intomainfrom
feature/dependency-manifest-strawman

Conversation

@cristiano-belloni
Copy link
Contributor

@cristiano-belloni cristiano-belloni commented Jan 13, 2022

  • Extract dependency ranges for a package, using ts-morph. This implementation is independent from the build process, and could technically easily offer dependency extraction as a separate command, if needed.
  • Write extracted dependencies to dependencies and bundledDependencies and copy package.json to dist

This implementation assumes no nested workspaces (Yarn classic), so the dependencies can only be in the package's package.json or in the root one.

@changeset-bot
Copy link

changeset-bot bot commented Jan 13, 2022

🦋 Changeset detected

Latest commit: 1f11fec

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
modular-scripts Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

const manifest = getDependenciesFromSource(
targetLocation,
).reduce<DependencyManifest>((manifest, depName) => {
const depVersion =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be cleaner by creating the dependencies by overwriting from the targetLocation into the root dependencies. This would create a "workspace" set of dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LukeSheard not sure I understand. Does this mean initialise the reducer with the target dependencies, then add the root dependencies as we iterate through them?

const depVersion =
targetPackageJsonDependencies[depName] ??
rootPackageJsonDependencies[depName];
if (depVersion) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should throw an error if you're importing something which is not listed as a dependency. ESlint should also pick it up, but people do weird things...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@cristiano-belloni cristiano-belloni changed the title Feature/dependency manifest strawman Dependency manifest for apps Jan 14, 2022
@cristiano-belloni cristiano-belloni changed the title Dependency manifest for apps Generate dependency manifest for apps Jan 14, 2022
@coveralls
Copy link
Collaborator

coveralls commented Jan 14, 2022

Coverage Status

Coverage decreased (-0.4%) to 28.14% when pulling 1f11fec on feature/dependency-manifest-strawman into ad574a7 on main.

version: targetPackageJson.version,
license: targetPackageJson.license,
modular: targetPackageJson.modular,
module: targetPackageJson.module,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be undefined, but probably best to remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@LukeSheard LukeSheard merged commit 9582380 into main Jan 18, 2022
@LukeSheard LukeSheard deleted the feature/dependency-manifest-strawman branch January 18, 2022 20:00
@github-actions github-actions bot mentioned this pull request Jan 18, 2022
This was referenced Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants