Skip to content

Commit

Permalink
chore: ng-add remove global styles (#8804)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin authored Sep 3, 2024
1 parent 6ec662f commit 33a2dcf
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 44 deletions.
5 changes: 0 additions & 5 deletions projects/cdk/schematics/constants/taiga-styles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
export const TAIGA_GLOBAL_OLD_STYLE =
'node_modules/@taiga-ui/core/styles/taiga-ui-global.less';
export const TAIGA_GLOBAL_NEW_STYLE =
'node_modules/@taiga-ui/styles/taiga-ui-global.less';

export const TAIGA_THEME_STYLE = 'node_modules/@taiga-ui/core/styles/taiga-ui-theme.less';
export const TAIGA_THEME_FONTS = 'node_modules/@taiga-ui/core/styles/taiga-ui-fonts.less';
8 changes: 0 additions & 8 deletions projects/cdk/schematics/ng-add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ function addDependencies(tree: Tree, options: TuiSchema): void {

removeTaigaSchematicsPackage(tree);

if (options.addGlobalStyles) {
addPackageJsonDependency(tree, {
name: '@taiga-ui/styles',
version: TAIGA_VERSION,
type: NodeDependencyType.Default,
});
}

if (packages.includes('addon-table') || packages.includes('addon-mobile')) {
addAngularCdkDep(tree);
}
Expand Down
9 changes: 0 additions & 9 deletions projects/cdk/schematics/ng-add/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@
"$source": "projectName"
}
},
"addGlobalStyles": {
"description": "Setting up global styles",
"type": "boolean",
"default": false,
"x-prompt": {
"message": "Do you want to use global Taiga UI classes, such as 'tui-space', 'tui-skeleton', etc?",
"type": "confirmation"
}
},
"addons": {
"description": "Setting up additional packages",
"type": "array",
Expand Down
1 change: 0 additions & 1 deletion projects/cdk/schematics/ng-add/schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export interface TuiSchema {
readonly addGlobalStyles: boolean;
readonly addons: readonly string[];
readonly project: string;

Expand Down
11 changes: 2 additions & 9 deletions projects/cdk/schematics/ng-add/steps/add-taiga-styles.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import type {Rule, Tree} from '@angular-devkit/schematics';

import {
TAIGA_GLOBAL_NEW_STYLE,
TAIGA_THEME_FONTS,
TAIGA_THEME_STYLE,
} from '../../constants/taiga-styles';
import {TAIGA_THEME_FONTS, TAIGA_THEME_STYLE} from '../../constants/taiga-styles';
import {addStylesToAngularJson} from '../../utils/angular-json-manipulations';
import type {TuiSchema} from '../schema';

export function addTaigaStyles(options: TuiSchema): Rule {
return (_: Tree, context) => {
const taigaLocalStyles = [TAIGA_THEME_STYLE, TAIGA_THEME_FONTS];
const taigaStyles = options.addGlobalStyles
? [...taigaLocalStyles, TAIGA_GLOBAL_NEW_STYLE]
: taigaLocalStyles;

return addStylesToAngularJson(options, context, taigaStyles);
return addStylesToAngularJson(options, context, taigaLocalStyles);
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ describe('ng-add [Standalone]', () => {

it('should add main modules in package.json', async () => {
const options: TuiSchema = {
addGlobalStyles: false,
addons: [],
project: '',
'skip-logs': process.env['TUI_CI'] === 'true',
Expand All @@ -60,7 +59,6 @@ describe('ng-add [Standalone]', () => {

it('should add additional modules in package.json and global styles', async () => {
const options: TuiSchema = {
addGlobalStyles: true,
addons: ['addon-doc', 'addon-mobile'],
project: '',
'skip-logs': process.env['TUI_CI'] === 'true',
Expand All @@ -78,8 +76,7 @@ describe('ng-add [Standalone]', () => {
"@taiga-ui/cdk": "${TAIGA_VERSION}",
"@taiga-ui/core": "${TAIGA_VERSION}",
"@taiga-ui/icons": "${TAIGA_VERSION}",
"@taiga-ui/kit": "${TAIGA_VERSION}",
"@taiga-ui/styles": "${TAIGA_VERSION}"
"@taiga-ui/kit": "${TAIGA_VERSION}"
}
}`,
);
Expand Down Expand Up @@ -184,7 +181,6 @@ describe('ng-add [Standalone]', () => {
"styles": [
"node_modules/@taiga-ui/core/styles/taiga-ui-theme.less",
"node_modules/@taiga-ui/core/styles/taiga-ui-fonts.less",
"node_modules/@taiga-ui/styles/taiga-ui-global.less",
"some.style"
],
"assets": [
Expand All @@ -204,7 +200,6 @@ describe('ng-add [Standalone]', () => {

it('should add Taiga-ui modules and providers to main component', async () => {
const options: TuiSchema = {
addGlobalStyles: false,
addons: [],
project: '',
'skip-logs': process.env['TUI_CI'] === 'true',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ describe('ng-add', () => {

it('should add main modules in package.json', async () => {
const options: TuiSchema = {
addGlobalStyles: false,
addons: [],
project: '',
'skip-logs': process.env['TUI_CI'] === 'true',
Expand All @@ -60,7 +59,6 @@ describe('ng-add', () => {

it('should add additional modules in package.json', async () => {
const options: TuiSchema = {
addGlobalStyles: false,
addons: ['addon-doc', 'addon-mobile'],
project: '',
'skip-logs': process.env['TUI_CI'] === 'true',
Expand All @@ -86,7 +84,6 @@ describe('ng-add', () => {

it('should add additional modules in package.json and global styles', async () => {
const options: TuiSchema = {
addGlobalStyles: true,
addons: ['addon-doc', 'addon-mobile'],
project: '',
'skip-logs': process.env['TUI_CI'] === 'true',
Expand All @@ -104,8 +101,7 @@ describe('ng-add', () => {
"@taiga-ui/cdk": "${TAIGA_VERSION}",
"@taiga-ui/core": "${TAIGA_VERSION}",
"@taiga-ui/icons": "${TAIGA_VERSION}",
"@taiga-ui/kit": "${TAIGA_VERSION}",
"@taiga-ui/styles": "${TAIGA_VERSION}"
"@taiga-ui/kit": "${TAIGA_VERSION}"
}
}`,
);
Expand Down Expand Up @@ -210,7 +206,6 @@ describe('ng-add', () => {
"styles": [
"node_modules/@taiga-ui/core/styles/taiga-ui-theme.less",
"node_modules/@taiga-ui/core/styles/taiga-ui-fonts.less",
"node_modules/@taiga-ui/styles/taiga-ui-global.less",
"some.style"
],
"assets": [
Expand Down

0 comments on commit 33a2dcf

Please sign in to comment.