Skip to content

Commit fd1a623

Browse files
committed
Merge remote-tracking branch 'origin/feat-color-palette' into feat-color-palette
2 parents 467bfef + ce63673 commit fd1a623

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

packages/components/scripts/post-build/angular.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,14 @@ const setControlValueAccessorReplacements = (
109109
* In Angular, you have to use a directive for this...
110110
* This is a workaround to replace it in the file.
111111
* @param replacements
112+
* @param outputFolder {string}
112113
* @param componentName {string}
113114
* @param upperComponentName {string}
114115
* @param directives {{name:string, ngContentName?:string}[]}
115116
*/
116117
const setDirectiveReplacements = (
117118
replacements,
119+
outputFolder,
118120
componentName,
119121
upperComponentName,
120122
directives
@@ -164,15 +166,26 @@ export class ${directive.name}Directive {}
164166
from: '} from "@angular/core";',
165167
to: 'ContentChild, TemplateRef } from "@angular/core";'
166168
});
169+
170+
const directiveExports = directives
171+
.map(
172+
(directive) =>
173+
`export * from './components/${componentName}/${directive.name}.directive';`
174+
)
175+
.join('\n');
176+
Replace.sync({
177+
files: `../../${outputFolder}/angular/src/index.ts`,
178+
from: `export * from './components/${componentName}';`,
179+
to: `export * from './components/${componentName}';\n${directiveExports}`
180+
});
167181
};
168182

169183
module.exports = (tmp) => {
184+
const outputFolder = `${tmp ? 'output/tmp' : 'output'}`;
170185
for (const component of components) {
171186
const componentName = component.name;
172187
const upperComponentName = `DB${getComponentName(component.name)}`;
173-
const file = `../../${
174-
tmp ? 'output/tmp' : 'output'
175-
}/angular/src/components/${componentName}/${componentName}.ts`;
188+
const file = `../../${outputFolder}/angular/src/components/${componentName}/${componentName}.ts`;
176189
const options = {
177190
files: file,
178191
processor: (input) => changeFile(component, input)
@@ -206,6 +219,7 @@ module.exports = (tmp) => {
206219
if (component.config?.angular?.directives?.length > 0) {
207220
setDirectiveReplacements(
208221
replacements,
222+
outputFolder,
209223
componentName,
210224
upperComponentName,
211225
component.config.angular.directives

packages/components/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ export * from './components/icon';
1111
export * from './components/infotext';
1212
export * from './components/input';
1313
export * from './components/link';
14-
export * from './components/navigation-item';
1514
export * from './components/page';
1615
export * from './components/radio';
1716
export * from './components/section';
1817
export * from './components/select';
1918
export * from './components/tab';
2019
export * from './components/tag';
21-
export * from './components/tag';
2220
export * from './components/textarea';
2321
export * from './components/navigation-item';
2422
export * from './components/accordion';

0 commit comments

Comments
 (0)