Skip to content

Commit

Permalink
chore(demo): fix stackblitz (#5534)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Oct 5, 2023
1 parent 88f3af5 commit 065ceca
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class StackblitzDepsService {
this.location.pathname.startsWith(`/next/`) ||
this.location.host.endsWith(`web.app`) ||
!environment.production
? `dev`
? `canary`
: `${TUI_VERSION.split(`.`)[0]}.x.x`;

return {
Expand Down
28 changes: 21 additions & 7 deletions projects/demo/src/modules/app/stackblitz/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,23 @@ export const getSupportModules = (
new TsFileModuleParser(fileContent),
]);

export function getAllModules(entryPoint: Record<string, unknown>): string {
const allModules = Object.keys(entryPoint)
.filter(name => name.endsWith(`Module`))
.filter(name => name !== `TuiOrderWeekDaysPipeModule`) // TODO remove after release 3.7.0
.join(`,\n\t\t`);
function getAllModules(entryPoint: Record<string, unknown>, names: Set<string>): string {
const modules = Object.keys(entryPoint).reduce((modules, name) => {
const unique =
name.endsWith(`Module`) &&
name !== `TuiOrderWeekDaysPipeModule` &&
!names.has(name);

return `${allModules}`;
if (unique) {
names.add(name);

return modules.concat(name);
}

return modules;
}, [] as string[]);

return `${modules.join(`,\n\t\t`)}`;
}

/**
Expand Down Expand Up @@ -106,7 +116,11 @@ export async function getAllTaigaUIModulesFile(
import(`@taiga-ui/addon-preview`),
import(`@taiga-ui/addon-table`),
import(`@taiga-ui/addon-tablebars`),
]).then(modules => modules.map(getAllModules));
]).then(modules => {
const allModuleNames = new Set<string>();

return modules.map(entryPoint => getAllModules(entryPoint, allModuleNames));
});

const additionalModulesImports = additionalModules
.map(
Expand Down

0 comments on commit 065ceca

Please sign in to comment.