-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
2,013 additions
and
1,241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
export const TAIGA_GLOBAL_STYLE = | ||
'node_modules/@taiga-ui/core/styles/taiga-ui-global.less'; | ||
export const TAIGA_GLOBAL_STYLE = [ | ||
'node_modules/@taiga-ui/core/styles/taiga-ui-local.less', | ||
'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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {getActiveProject} from 'ng-morph'; | ||
|
||
export function replaceStyles() { | ||
getActiveProject() | ||
?.getSourceFiles('**/**.less') | ||
.forEach(sourceFile => { | ||
const fullText = sourceFile.getFullText(); | ||
|
||
sourceFile.replaceWithText( | ||
fullText.replace( | ||
`@import '~@taiga-ui/core/styles/taiga-ui-global';`, | ||
`@import '~@taiga-ui/core/styles/taiga-ui-local';\n@import '~@taiga-ui/styles/taiga-ui-global';`, | ||
), | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
projects/cdk/schematics/ng-update/tests/schematic-replace-styles.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import {HostTree} from '@angular-devkit/schematics'; | ||
import {SchematicTestRunner, UnitTestTree} from '@angular-devkit/schematics/testing'; | ||
|
||
import { | ||
createProject, | ||
createSourceFile, | ||
resetActiveProject, | ||
saveActiveProject, | ||
setActiveProject, | ||
} from 'ng-morph'; | ||
import {join} from 'path'; | ||
import {createAngularJson} from '../../utils/create-angular-json'; | ||
|
||
const collectionPath = join(__dirname, '../../migration.json'); | ||
|
||
const BEFORE_GLOBAL_STYLE = ` | ||
@import '~@taiga-ui/core/styles/taiga-ui-fonts'; | ||
@import '~@taiga-ui/core/styles/taiga-ui-global'; | ||
@import '~@taiga-ui/proprietary-core/styles/tinkoff-fonts'; | ||
@import '~@taiga-ui/proprietary-core/styles/theme-tinkoff-v2'; | ||
@import '~@taiga-ui/proprietary-core/styles/theme-tinkoff-mobile'; | ||
`; | ||
|
||
const AFTER_GLOBAL_STYLE = ` | ||
@import '~@taiga-ui/core/styles/taiga-ui-fonts'; | ||
@import '~@taiga-ui/core/styles/taiga-ui-local'; | ||
@import '~@taiga-ui/styles/taiga-ui-global'; | ||
@import '~@taiga-ui/proprietary-core/styles/tinkoff-fonts'; | ||
@import '~@taiga-ui/proprietary-core/styles/theme-tinkoff-v2'; | ||
@import '~@taiga-ui/proprietary-core/styles/theme-tinkoff-mobile'; | ||
`; | ||
|
||
const BEFORE_LOCAL_STYLE = ` | ||
@import '~@taiga-ui/core/styles/taiga-ui-local'; | ||
`; | ||
|
||
const AFTER_LOCAL_STYLE = ` | ||
@import '~@taiga-ui/core/styles/taiga-ui-local'; | ||
`; | ||
|
||
describe('replace styles', () => { | ||
let host: UnitTestTree; | ||
let runner: SchematicTestRunner; | ||
|
||
beforeEach(() => { | ||
host = new UnitTestTree(new HostTree()); | ||
runner = new SchematicTestRunner('schematics', collectionPath); | ||
|
||
setActiveProject(createProject(host, '/', '**/**')); | ||
|
||
createMainFiles(); | ||
|
||
saveActiveProject(); | ||
}); | ||
|
||
it('should replace with new global styles', async () => { | ||
const tree = await runner.runSchematicAsync('updateToV3', {}, host).toPromise(); | ||
|
||
expect(tree.readContent('test/style.less')).toBe(AFTER_GLOBAL_STYLE); | ||
expect(tree.readContent('test/app/app.template.less')).toBe(AFTER_LOCAL_STYLE); | ||
}); | ||
|
||
afterEach(() => { | ||
resetActiveProject(); | ||
}); | ||
}); | ||
|
||
function createMainFiles(): void { | ||
createSourceFile( | ||
'test/app/app.component.ts', | ||
` | ||
@Component({ | ||
templateUrl: './app.template.html', | ||
styleUrls: ['./app.template.less'] | ||
}) | ||
export class AppComponent { | ||
} | ||
`, | ||
); | ||
|
||
createSourceFile('test/app/app.template.html', `<app></app>`); | ||
createSourceFile('test/style.less', BEFORE_GLOBAL_STYLE); | ||
createSourceFile('test/app/app.template.less', BEFORE_LOCAL_STYLE); | ||
|
||
createAngularJson(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
projects/core/styles/markup/tui-group.less → ...ts/core/components/group/group.style.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@import '../taiga-ui-local'; | ||
@import '../../styles/taiga-ui-local'; | ||
|
||
.tui-group { | ||
.createStackingContext(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
@import 'theme/fonts.css'; | ||
@import (css) url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;800&display=swap'); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.