Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integrities to deps graph #9574

Open
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

zkochan
Copy link
Member

@zkochan zkochan commented Feb 24, 2025

Proposed Changes

@zkochan zkochan marked this pull request as ready for review March 4, 2025 15:40
@zkochan
Copy link
Member Author

zkochan commented Mar 11, 2025

the install function also return depsRequiringBuild. We need this information also when skipping install by creating the lockfile from the graph. So, maybe we should specify in the graph which dependencies require a build.

private _getComponentIdByPkgNameMap(): Map<string, ComponentID> {
if (!this.allWorkspaceComps) throw new Error('please make sure to populate this.allWorkspaceComps before');
const componentIdByPkgName = new Map<string, ComponentID>();
for (let i = 0; i < this.components.length; i++) {
Copy link
Member

Choose a reason for hiding this comment

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

why not using this.components.forEach?

for (const depType of ['dependencies', 'devDependencies', 'optionalDependencies', 'specifiers', 'dependenciesMeta']) {
for (const workspacePkgName of opts.componentIdByPkgName.keys()) {
if (workspacePkgName !== opts.pkgName) {
delete lockfile.importers[importerId]?.[depType]?.[workspacePkgName]
Copy link
Member

Choose a reason for hiding this comment

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

@zkochan , do you have the prettier running on commit hook? I'm wondering why it didn't add the semicolon at the end of this line

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure, isn't it configured automatically?

Copy link
Member

Choose a reason for hiding this comment

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

it should. maybe next commit, look for something running before you get the response. if it's not working, I guess full-setup should fix it.

const pkgsToResolve: Array<{ name: string; version: string; pkgId: string }> = [];
const pkgsInTheWorkspaces = new Set(Object.values(manifests).map(({ name }) => name));
for (const [pkgId, pkg] of Object.entries(lockfile.packages)) {
if (pkg.resolution == null || 'type' in pkg.resolution && pkg.resolution.type === 'directory') {
Copy link
Member

Choose a reason for hiding this comment

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

you can probably replace 'type' in pkg.resolution && pkg.resolution.type === 'directory' with pkg.resolution?.type === 'directory'

Copy link
Member Author

Choose a reason for hiding this comment

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

I can't because it is a union type and not every type has the type field.

image

helper.command.setConfig('registry', npmCiRegistry.getRegistryUrl());

helper.fixtures.populateComponents(2);
helper.extensions.workspaceJsonc.addKeyValToDependencyResolver('rootComponents', true);
Copy link
Member

Choose a reason for hiding this comment

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

isn't this one comes already by default? the rootComponents true?

helper.command.export();
helper.command.sign(
[`${helper.scopes.remote}/[email protected]`],
'--log',
Copy link
Member

Choose a reason for hiding this comment

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

do you need the --log here?

helper.scopeHelper.reInitLocalScope();
helper.scopeHelper.addRemoteScope();
helper.command.import(`${helper.scopes.remote}/comp1@latest`);
expect(fs.readFileSync(path.join(helper.scopes.localPath, 'pnpm-lock.yaml'), 'utf8')).to.have.string(
Copy link
Member

@davidfirst davidfirst Mar 11, 2025

Choose a reason for hiding this comment

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

you can replace fs.readFileSync(path.join(helper.scopes.localPath, 'pnpm-lock.yaml'), 'utf8') by helper.fs.readFile('pnpm-lock.yaml')

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