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

Whether you can add a secondary entry depends on the dependency list #1337

Open
jiayisheji opened this issue Jul 11, 2019 · 3 comments
Open

Comments

@jiayisheji
Copy link

jiayisheji commented Jul 11, 2019

Type of Issue

[ ] Bug Report
[x] Feature Request

Description

You automatically extract the secondary entry dependency, which I found to be invalid.

package.transform.ts

entryPoints.forEach(entryPoint => {
        const deps = entryPoint.filter(isEntryPoint).map(ep => ep.url);
       console.log(deps)   => []   // Always returns an empty array
        depthBuilder.add(entryPoint.url, deps);
});

image

The result is an alphabetical packing of folders

I wondered if I could manually add a dependency list configuration

     let initialValue = [];
      // WARNING in secondary entry points lib peerDependencies configuration Circular dependency detected
      entryPoints.forEach(entryPoint => {
        let peerDependencies = [];
        const secondaryData = entryPoint.data.entryPoint.secondaryData;
        if (secondaryData) {
          peerDependencies = secondaryData.peerDependencies.map(ngUrl);
        }
        initialValue = [...initialValue, entryPoint.url, ...peerDependencies];
        depthBuilder.add(entryPoint.url, peerDependencies);
      });
      initialValue = [...new Set(initialValue)];
      // The array index is the depth.
      const groups = depthBuilder.build();
      const groupsValue = array_1.flatten(groups);
      // If the initial value and the processed value
      if (initialValue.length !== groupsValue.length) {
        const untreatedValue = initialValue
          .filter(value => !groupsValue.includes(value))
          .map(ngPath);
        throw Error(
          `WARNING in secondary entry points lib peerDependencies configuration Circular dependency detected. \n Error folder: \n${untreatedValue.join(
            "\n"
          )}`
        );
      }

alert/package.json

{
  "ngPackage": {
    "lib": {
      "entryFile": "index.ts",
      "umdModuleIds": {
        "simple-ui/core": "simple-ui-core"
      },
      "peerDependencies": ["core"]
    }
  }
}

my tree

lib
├─alert
├─autocomplete
├─button
├─card
├─checkbox
├─core
├─data-grid
├─date-picker
├─dialog
├─divider
├─echarts
├─form-field
├─icon
├─input
├─menu
├─multiple-picker
├─option
├─paginator
├─popover
├─progressbar
├─radio
├─role-permission
├─select
├─spinner
├─src
│ └─lib
├─switch
├─toast
├─tooltip
├─transfer
└─tree

image

image

build ok

@alan-agius4
Copy link
Member

Can you please provide a reproduction of the problem?

Thanks

@jiayisheji
Copy link
Author

My problem is that if I press auto to get the dependency, there will be a packaging error. I want to manually set the dependency to fix this error.

Do you need me to provide the demo?

@alan-agius4
Copy link
Member

I am sorry, but I am unable to understand the problem. Also please provide which version of ng-packagr you are using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants