Open rajsite opened 2 years ago
As part of closing this issue we should include CONTRIBUTING docs that explain whatever layout philosophy we land on.
Related tasks for repo layout:
exports
for the import
condition. Maybe the script would allow imports correctly then?import {ButtonModule} from '@ni/nimble-angular/button';
then dead code elimination can work as expected.As part of this work we should control our exports. This helps two issues, one is the Angular warning about deep entry points:
- Generating browser application bundles (phase: setup)...Warning: Entry point '@ni/nimble-angular' contains deep imports into 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/button/types', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/button', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/checkbox', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/drawer/types', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/drawer', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/listbox-option', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/menu', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/menu-item', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/number-field', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/select', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/tab', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/tab-panel', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/tabs', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/tabs-toolbar', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/text-field/types', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/text-field', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/theme-provider/types', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/theme-provider', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/tree-item', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/tree-view/types', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/tree-view', 'C:/dev/github/nimble/node_modules/@ni/nimble-components/dist/esm/testing/async-helpers'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
The other is we can prevent implementation details from being exposed externally, like stuff in src/patterns styles.
As part of adding secondary entrypoints to the nimble-angular library we should export the ButtonAppearance from each component. See https://github.com/ni/nimble/pull/344/files#r803863208
Some initial research:
As part of this work we should control our exports. This helps two issues, one is the Angular warning about deep entry points:
The other is we can prevent implementation details from being exposed externally, like stuff in src/patterns styles.
In addition, we should evaluate our exported .d.ts files to make sure internal libraries are not exposed and move @types
to devDependencies where possible. See https://github.com/ni/nimble/pull/831/files#r1029565900
Related issue suggesting we should use package exports as described above. That is technically independent of re-organizing the repo so not closing as a duplicate. It's essentially a subtask of this issue https://github.com/ni/nimble/issues/694
As part of a repo re-org we should move the design-tokens to a top-level export so applications that only need the tokens can adopt them independently of the theme-provider or of importing elements. Example the microstrategy theme customization and the nimble landing page which just need the tokens and no components.
As part of adding secondary entrypoints to nimble-angular we should expose testing
entrypoints as we have done in nimble-components.
I created an AzDO tech debt feature to help us prioritize this large body of work against other non-tech debt work. Feature 2677713: [Tech Debt] Nimble entry point refactor
Next step is to create an HLD that describes the overall plan. It should cover the issues raised in the comments and description above.
Currently nimble-components and nimble-angular organize each component into a separate directory with separate import strategies.
Edit August 2023:
The current recommendation would be as follows (these are not coupled, we could do the smaller nimble-components work first):
dist/esm
from import paths so for instance a button import changes fromimport '@ni/nimble-components/dist/esm/button';
toimport '@ni/nimble-components/button';
dist/esm
. This could help avoid bugs like we fixed in #2290@ni/nimble-angular/button
Known issues this change will resolve: