diff --git a/packages/devkit/src/ng-add/files/i18n.initialize/i18n.initialize.__ts__ b/packages/devkit/src/ng-add/files/i18n.initialize/i18n.initialize.__ts__ index fef5a53b..6e258f95 100644 --- a/packages/devkit/src/ng-add/files/i18n.initialize/i18n.initialize.__ts__ +++ b/packages/devkit/src/ng-add/files/i18n.initialize/i18n.initialize.__ts__ @@ -2,8 +2,8 @@ import { BalConfigState, BalLanguage, onBalConfigChange, -} from '@baloise/design-system-components'; -import { BalConfigService } from '@baloise/design-system-components-angular/standalone'; +} from '@baloise/ds-core'; +import { BalConfigService } from '@baloise/ds-angular'; import { TranslocoService } from '@ngneat/transloco'; export function initializeI18n( diff --git a/packages/devkit/src/ng-add/generators/app.get.ts b/packages/devkit/src/ng-add/generators/app.get.ts index c714ea01..154ee084 100644 --- a/packages/devkit/src/ng-add/generators/app.get.ts +++ b/packages/devkit/src/ng-add/generators/app.get.ts @@ -1,15 +1,15 @@ import { SchematicsException, Tree } from '@angular-devkit/schematics' -import { SchemaOptions } from '../schema' +import { getPrefix } from '../utils/workspace' -export const updateAppComponent = (host: Tree, options: SchemaOptions) => { +// eslint-disable-next-line @typescript-eslint/no-unused-vars +export const updateAppComponent = (host: Tree) => { const appTemplatePath = `src/app/app.component.html` const appComponentPath = `src/app/app.component.ts` const appStylesPath = `src/app/app.component.css` const appStylesSassPath = `src/app/app.component.scss` const isInlineTemplate = !host.exists(appTemplatePath) - const tempContent = host.readText(isInlineTemplate ? appComponentPath : appTemplatePath) - const prefix = tempContent.includes('app-root') ? 'app' : options.project + const prefix = getPrefix(host) const hasCssStyles = host.exists(appStylesPath) const hasSassStyles = host.exists(appStylesSassPath) @@ -27,7 +27,7 @@ export const updateAppComponent = (host: Tree, options: SchemaOptions) => { appComponentPath, `import { Component, CUSTOM_ELEMENTS_SCHEMA${isOnPush ? ', ChangeDetectionStrategy' : ''} } from '@angular/core' import { CommonModule } from '@angular/common' -import { BalLayoutBundle, BalHeading, BalButton } from '@baloise/design-system-components-angular/standalone' +import { BalLayoutBundle, BalHeading, BalButton } from '@baloise/ds-angular' @Component({ selector: '${prefix}-root', @@ -57,7 +57,7 @@ export class AppComponent {} appComponentPath, `import { Component, CUSTOM_ELEMENTS_SCHEMA${isOnPush ? ', ChangeDetectionStrategy' : ''} } from '@angular/core' import { CommonModule } from '@angular/common' -import { BalLayoutBundle, BalHeading, BalButton } from '@baloise/design-system-components-angular/standalone' +import { BalLayoutBundle, BalHeading, BalButton } from '@baloise/ds-angular' @Component({ selector: '${prefix}-root', diff --git a/packages/devkit/src/ng-add/generators/project.gen.ts b/packages/devkit/src/ng-add/generators/project.gen.ts index 4ecd4e6c..a85fd789 100644 --- a/packages/devkit/src/ng-add/generators/project.gen.ts +++ b/packages/devkit/src/ng-add/generators/project.gen.ts @@ -30,10 +30,11 @@ export function updateProjectConfig(host: Tree) { /** * Angular Workspace */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any const angularConfig = getAngularWorkspace(host) as any const projectName = Object.keys(angularConfig.projects)[0] angularConfig.projects[projectName].architect.build.options.polyfills = POLYFILLS - angularConfig.projects[projectName].architect.build.configurations.production.budgets.budgets = BUDGETS + angularConfig.projects[projectName].architect.build.configurations.production.budgets = BUDGETS const newNxConfig = JSON.stringify(angularConfig, undefined, 2) return host.overwrite('angular.json', newNxConfig) } diff --git a/packages/devkit/src/ng-add/generators/styles.ts b/packages/devkit/src/ng-add/generators/styles.ts index 0124b1d5..2d6c26f5 100644 --- a/packages/devkit/src/ng-add/generators/styles.ts +++ b/packages/devkit/src/ng-add/generators/styles.ts @@ -8,33 +8,33 @@ export const addStyles = (host: Tree) => { } const content = configBuffer.toString() - if (!content.includes('@baloise/design-system-styles/css/core')) { + if (!content.includes('@baloise/ds-styles/css/core')) { const newContent = content + ` // SASS mixins and SASS variables -@import '@baloise/design-system-styles/sass/mixins'; +@import '@baloise/ds-styles/sass/mixins'; // Resets CSS for all browser -@import '@baloise/design-system-styles/css/normalize'; -@import '@baloise/design-system-styles/css/structure'; +@import '@baloise/ds-styles/css/normalize'; +@import '@baloise/ds-styles/css/structure'; // Custom font faces -@import '@baloise/design-system-styles/css/font'; +@import '@baloise/ds-styles/css/font'; // Core CSS with CSS variables, always required -@import '@baloise/design-system-styles/css/core'; +@import '@baloise/ds-styles/css/core'; // CSS utilities classes (optional) -@import '@baloise/design-system-styles/css/utilities/background'; -@import '@baloise/design-system-styles/css/utilities/border'; -@import '@baloise/design-system-styles/css/utilities/elevation'; -@import '@baloise/design-system-styles/css/utilities/flex'; -@import '@baloise/design-system-styles/css/utilities/interaction'; -@import '@baloise/design-system-styles/css/utilities/layout'; -@import '@baloise/design-system-styles/css/utilities/sizing'; -@import '@baloise/design-system-styles/css/utilities/spacing'; -@import '@baloise/design-system-styles/css/utilities/typography'; +@import '@baloise/ds-styles/css/utilities/background'; +@import '@baloise/ds-styles/css/utilities/border'; +@import '@baloise/ds-styles/css/utilities/elevation'; +@import '@baloise/ds-styles/css/utilities/flex'; +@import '@baloise/ds-styles/css/utilities/interaction'; +@import '@baloise/ds-styles/css/utilities/layout'; +@import '@baloise/ds-styles/css/utilities/sizing'; +@import '@baloise/ds-styles/css/utilities/spacing'; +@import '@baloise/ds-styles/css/utilities/typography'; ` host.overwrite(filePath, newContent) } diff --git a/packages/devkit/src/ng-add/index.ts b/packages/devkit/src/ng-add/index.ts index 5691f6c1..e8939b22 100644 --- a/packages/devkit/src/ng-add/index.ts +++ b/packages/devkit/src/ng-add/index.ts @@ -24,7 +24,7 @@ export default function (options: SchemaOptions): Rule { actions.push( addRootProvider(options.project, ({ code, external }) => { return code` - ${external('provideBaloiseDesignSystem', '@baloise/design-system-components-angular/standalone')}({ + ${external('provideBaloiseDesignSystem', '@baloise/ds-angular')}({ defaults: { region: '${options.region}', } @@ -43,7 +43,7 @@ export default function (options: SchemaOptions): Rule { multi: true, deps: [${external('TranslocoService', '@ngneat/transloco')}, ${external( 'BalConfigService', - '@baloise/design-system-components-angular/standalone', + '@baloise/ds-angular', )}], }` }), @@ -55,9 +55,9 @@ export default function (options: SchemaOptions): Rule { host.delete(nxExample) } - updateAppComponent(host, options) + updateAppComponent(host) - actions.push(addDependency('@baloise/design-system-components-angular', 'latest')) + actions.push(addDependency('@baloise/ds-angular', 'latest')) return chain(actions)(host, context) as any } diff --git a/packages/devkit/src/ng-add/utils/workspace.ts b/packages/devkit/src/ng-add/utils/workspace.ts index 69606ec5..f0b99fa1 100644 --- a/packages/devkit/src/ng-add/utils/workspace.ts +++ b/packages/devkit/src/ng-add/utils/workspace.ts @@ -22,3 +22,15 @@ export function getWorkspace(host: Tree, path: string): WorkspaceSchema { return JSON.parse(config) } + +export function getPrefix(host: Tree) { + if (isNxWorkspace(host)) { + const config = getNXWorkspace(host) + return config.prefix + } else { + const config = getAngularWorkspace(host) + const projektKeys = Object.keys(config.projects) + const mainProject = config.projects[projektKeys[0]] + return mainProject.prefix + } +} diff --git a/packages/devkit/tsconfig.json b/packages/devkit/tsconfig.json index db7b5666..a3370d03 100644 --- a/packages/devkit/tsconfig.json +++ b/packages/devkit/tsconfig.json @@ -1,14 +1,6 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "module": "commonjs", - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true - }, + "compilerOptions": {}, "files": [], "include": [], "references": [ diff --git a/packages/devkit/tsconfig.lib.json b/packages/devkit/tsconfig.lib.json index e5c96669..b25e8bc8 100644 --- a/packages/devkit/tsconfig.lib.json +++ b/packages/devkit/tsconfig.lib.json @@ -1,8 +1,24 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "dist/out-tsc", + "baseUrl": ".", + "lib": ["es2018", "dom"], "declaration": true, + "module": "commonjs", + "moduleResolution": "node", + "noEmitOnError": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitThis": true, + "noUnusedParameters": true, + "noUnusedLocals": true, + "rootDir": "src", + "skipDefaultLibCheck": true, + "skipLibCheck": true, + "sourceMap": true, + "strictNullChecks": true, + "target": "es6", "types": ["node"] }, "include": ["src/**/*"],