-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update migration tool to run 006-007 (#3700)
- Loading branch information
Showing
9 changed files
with
101 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,25 @@ | ||
## Migration Beta (0.6.x) ➡ Beta (0.7.x) | ||
|
||
### Removed brand fonts | ||
### Removed brand assets | ||
|
||
We needed to remove the brand fonts from our [`@db-ui/foundations`](https://www.npmjs.com/package/@db-ui/foundations) node package. Please follow the guidelines within [DB Marketingportal](https://marketingportal.extranet.deutschebahn.com/marketingportal/Design-Anwendungen/db-ux-design-system/resources/db-theme) on how to retrieve it as an Inner Source package (DB internal) or to still install the node package from npmjs.com (DB external). | ||
We needed to remove the brand assets (font & icons) from our [`@db-ui/foundations`](https://www.npmjs.com/package/@db-ui/foundations) node package. Please follow the guidelines within [DB Marketingportal](https://marketingportal.extranet.deutschebahn.com/marketingportal/Design-Anwendungen/db-ux-design-system/resources/db-theme) on how to retrieve it either as an Inner Source package (DB internal) or to still install the node package from [npmjs.com](https://www.npmjs.com/package/@db-ux/db-theme) (DB external). | ||
|
||
### Path changes | ||
|
||
We needed to change some path, so you would probably need to make some adaptions within your code: | ||
- Changed `@db-ui/foundations/build/scss/` to `@db-ui/foundations/build/styles/` | ||
- Changed `@db-ui/foundations/build/css/` to `@db-ui/foundations/build/styles/` | ||
- Changed `@db-ux/core-icons/` to `@db-ux/core-icons/build` | ||
|
||
And icon font files have been moved from `functional/fonts/` one level up to `fonts/` folder, probably you would need to copy those to your codebase as well again if you don't use a bundler. | ||
|
||
## Automate migration via CLI | ||
|
||
We provide a CLI tool to auto migrate your source code. Use this command in your repository: | ||
|
||
\```shell | ||
|
||
npx @db-ui/migration --type=v006_v007 --src=./src | ||
\``` | ||
|
||
Please check the changes made in your codebase afterwards, as this is mainly a simple search & replace regarding the path. |
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,4 @@ | ||
export const AdditionalInformation: Record<string, string> = { | ||
v006_v007: | ||
'https://github.com/db-ui/mono/blob/main/docs/migration/v0.6.x-to-v0.7.x.md' | ||
}; |
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,34 @@ | ||
import type { ReplaceInFileConfig } from 'replace-in-file'; | ||
|
||
export const v006_v007: ReplaceInFileConfig[] = [ | ||
{ | ||
files: '', | ||
from: /db-ui-42-/g, | ||
to: '' | ||
}, | ||
{ | ||
files: '', | ||
from: /db-ui-42/g, | ||
to: 'relative' | ||
}, | ||
{ | ||
files: '', | ||
from: /db-ui-foundations-/g, | ||
to: '' | ||
}, | ||
{ | ||
files: '', | ||
from: /db-ui-foundations/g, | ||
to: 'relative' | ||
}, | ||
{ | ||
files: '', | ||
from: /foundations\/build\/css/g, | ||
to: 'foundations/build/styles' | ||
}, | ||
{ | ||
files: '', | ||
from: /foundations\/build\/scss/g, | ||
to: 'foundations/build/styles' | ||
} | ||
]; |
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,5 @@ | ||
import "@db-ui/components/build/styles/db-ui-42-rollup.css"; | ||
|
||
@use "@db-ui/foundations/build/scss/variables"; | ||
@use "@db-ui/foundations/build/scss/colors"; | ||
@use "@db-ui/foundations/build/scss/screen-sizes"; |
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,5 @@ | ||
import "@db-ui/components/build/styles/rollup.css"; | ||
|
||
@use "@db-ui/foundations/build/styles/variables"; | ||
@use "@db-ui/foundations/build/styles/colors"; | ||
@use "@db-ui/foundations/build/styles/screen-sizes"; |
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,19 @@ | ||
import { describe, expect, test } from 'vitest'; | ||
import { type ReplaceResult } from 'replace-in-file'; | ||
import { migrate } from '../../src/migration'; | ||
|
||
describe('v006_v007', () => { | ||
test('check if changes are detected', async () => { | ||
const result = migrate({ | ||
src: './test/v0.0.6-v0.0.7', | ||
type: ['v006_v007'], | ||
dryRun: true | ||
}); | ||
|
||
expect(result).not.undefined; | ||
|
||
expect( | ||
(result as ReplaceResult[]).filter((res) => res.hasChanged) | ||
).toHaveLength(1); | ||
}); | ||
}); |