7.4.2 • Published 8 months ago

@navikt/aksel v7.4.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Aksel command line interface

CLI tool for managing CSS-imports and Codemods when consuming Aksel-packages.

Documentation

run:
npx @navikt/aksel

commands:
css-imports: Generate css-imports for all components from Aksel
codemod: Codemods for version-migrations related to Aksel

Codemods

Codemods are code-transformations that patches breaking changes in your project. This helps when migrating without spending time doing it manually.

To get started:
npx @navikt/aksel codemod --help

v4

In v4, we moved all the components from @navikt/ds-react-internal to @navikt/ds-react. This means that you will need to update all your imports to the new package. As a part of this, Header was renamed to InternalHeader and all the CSS-classes was renamed to use navds as a prefix instead of navdsi.

react

npx @navikt/aksel codemod v4-internal-react ...

Rewrites all imports from @navikt/ds-react-internal to @navikt/ds-react. Remember to remove @navikt/ds-react-internal as a dependency after migration.

- import { Dropdown, Timeline, Header } from "@navikt/ds-react-internal";
- import { Button, CopyButton } from "@navikt/ds-react";
+ import { Button, CopyButton, Dropdown, Timeline, InternalHeader as Header } from "@navikt/ds-react";

css

npx @navikt/aksel codemod v4-internal-css ...

Rewrites all css with navdsi-prefix to navds-prefix. Rewrites all .navdsi-header classes to .navds-internalheader.

Remember to remove @navikt/ds-css-internal as a dependency after migration + remove it from you lists of imports in the CSS-bundle.

- .navdsi-dropdown
+ .navds-dropdown
- .navdsi-header
+ .navds-internalheader
- .navdsi-timeline
+ .navds-timeline

Note: This is a "dumb" codemod that uses a simple regex to find and replace. This can lead to unknown sideeffects, so its reccomended to scope the codemod to spesific files.

`npx @navikt/aksel codemod v4-internal-css **/*.css`

v3

There is no general codemods for migrating from v2 -> v3.

CopyButton

npx @navikt/aksel codemod v3-copybutton ...

<CopyToClipboard /> has been renamed to <CopyButton /> and refactored.

  • Namechange
  • removed props popoverText, iconPosition, popoverPlacement
  • changed variants
  • refactored CSS and React-code. ⚠️ Overwritten CSS will not be migrated!
-import { CopyToClipboard } from "@navikt/ds-react-internal";
+import { CopyButton } from "@navikt/ds-react";

-<CopyToClipboard
+<CopyButton
- popoverText="popoverText"
- iconPosition="left"
- popoverPlacement="bottom-end"
  copyText="Text to copy"
  size="medium"
>
- text
+</CopyButton>
-</CopyToClipboard>

v1 -> v2

Documentation

v2-css: Patches changed css-variables v2-js: Patches changed js-variables v2-sass: Patches changed sass-variables v2-less: Patches changed less-variables

css-tokens (--navds format)

npx @navikt/aksel codemod v2-css src

When having redefined a token, you will need to manually find and replace these instances after the codemod-run. A global search for --v2-migration__ will show all found instances where you had redefined a token.

.example{
- color: var(--navds-global-color-gray-900);
+ color: var(--a-gray-900);

- --navds-semantic-color-text: red;
+ --v2-migration__navds-semantic-color-text: red;
}

sass/scss-tokens ($navds format)

npx @navikt/aksel codemod v2-sass src

.example{
- color: $navds-global-color-gray-900;
+ color: $a-gray-900;
}

less-tokens (@navds format)

npx @navikt/aksel codemod v2-less src

.example{
- color: @navds-global-color-gray-900;
+ color: @a-gray-900;
}

js-tokens

npx @navikt/aksel codemod v2-js src

- import { NavdsGlobalColorGray900 } from "@navikt/ds-tokens";
+ import { AGray900 } from "@navikt/ds-tokens";

const styled = styled.p`
- color: ${NavdsGlobalColorGray900};
+ color: ${AGray900};
`

beta -> v1

Documentation

v1-preset: Runs all codemods for beta -> v1 v1-pagination: Fixes breaking API-changes for component v1-tabs: Fixes breaking API-changes for component v1-chat: Fixes breaking API-changes for (now ) component

preset

Combines all avaliable codemods for migrating from beta -> v1. This transform should only be ran once.

Includes these transforms

  • v1-tabs
  • v1-chat
  • v1-pagination

tabs

npx @navikt/aksel codemod v1-tabs src

<Tabs
  defaultValue="logg"
  onChange={(x) => console.log(x)}
-  loop
+  iconPosition="left"
>
  <Tabs.List
-    loop
  >
    <Tabs.Tab
      value="logg"
      label="logg"
-     iconPosition="left"
    />
  </Tabs.List>
  <Tabs.Panel value="logg">TabPanel for Logg-tab</Tabs.Panel>
</Tabs>

chat

npx @navikt/aksel codemod v1-chat src

-<SpeechBubble
+<Chat
-  illustration={<Illustration />}
-  topText="Ola Normann 01.01.21 14:00"
-  illustrationBgColor="blue"
+  avatar={<Illustration />}
+  name="Ola Normann 01.01.21 14:00"
+  avatarBgColor="blue"
  backgroundColor="red"
>
- <SpeechBubble.Bubble>
+ <Chat.Bubble>
    Aute minim nisi sunt mollit duis sunt nulla minim non proident.
- </SpeechBubble.Bubble>
+ </Chat.Bubble>
-</SpeechBubble>
+</Chat>

pagination

npx @navikt/aksel codemod v1-pagination src

This codemod can only be ran once, since the size-scale will keep decreasing for each subsequent iteration.

-<Pagiation />
+<Pagiation size="small"/>

-<Pagiation size="medium"/>
+<Pagiation size="small"/>

-<Pagiation size="small"/>
+<Pagiation size="xsmall"/>

License

MIT

7.4.2

8 months ago

7.4.1

8 months ago

7.4.0

8 months ago

7.3.1

8 months ago

7.3.0

8 months ago

7.1.2

9 months ago

7.1.1

9 months ago

7.2.1

9 months ago

7.2.0

9 months ago

7.1.0

9 months ago

7.0.1

9 months ago

6.17.0

9 months ago

7.0.0

9 months ago

6.16.3

10 months ago

6.13.0

12 months ago

6.16.1

10 months ago

6.16.2

10 months ago

6.12.0

12 months ago

6.16.0

10 months ago

6.11.0

1 year ago

6.15.0

11 months ago

6.10.1

1 year ago

6.10.0

1 year ago

6.14.0

11 months ago

6.9.0

1 year ago

6.8.0

1 year ago

6.7.1

1 year ago

6.7.0

1 year ago

6.6.1

1 year ago

6.6.0

1 year ago

6.5.0

1 year ago

6.4.1

1 year ago

6.4.0

1 year ago

6.3.4

1 year ago

6.3.6

1 year ago

6.3.5

1 year ago

6.3.3

1 year ago

6.3.2

1 year ago

6.3.0

1 year ago

6.3.1

1 year ago

6.2.0

1 year ago

6.1.1

1 year ago

6.1.0

1 year ago

5.18.3

1 year ago

5.18.2

1 year ago

6.0.0

1 year ago

5.18.1

1 year ago

5.18.0

1 year ago

5.17.5

1 year ago

5.17.4

1 year ago

5.17.3

1 year ago

5.17.2

1 year ago

5.16.0

1 year ago

5.17.1

1 year ago

5.17.0

1 year ago

5.15.1

1 year ago

5.15.0

1 year ago

5.14.0

1 year ago

5.13.0

1 year ago

5.12.5

1 year ago

5.12.4

1 year ago

5.12.3

1 year ago

5.12.2

2 years ago

5.12.1

2 years ago

5.12.0

2 years ago

5.11.5

2 years ago

5.11.4

2 years ago

5.3.3

2 years ago

5.3.2

2 years ago

5.3.1

2 years ago

5.3.0

2 years ago

4.9.0

2 years ago

4.9.1

2 years ago

5.11.3

2 years ago

5.11.2

2 years ago

5.11.1

2 years ago

5.11.0

2 years ago

4.10.1

2 years ago

4.10.2

2 years ago

5.8.0

2 years ago

4.10.0

2 years ago

5.4.1

2 years ago

5.4.0

2 years ago

5.0.3

2 years ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

4.8.0

2 years ago

4.7.0

2 years ago

5.9.2

2 years ago

5.9.1

2 years ago

5.9.0

2 years ago

5.5.0

2 years ago

5.1.0

2 years ago

4.7.2

2 years ago

4.7.1

2 years ago

4.7.4

2 years ago

4.7.3

2 years ago

4.6.1

2 years ago

4.6.0

2 years ago

4.12.0

2 years ago

4.12.1

2 years ago

5.6.5

2 years ago

5.6.4

2 years ago

5.6.3

2 years ago

5.6.1

2 years ago

5.6.0

2 years ago

5.2.1

2 years ago

5.2.0

2 years ago

5.10.4

2 years ago

5.10.3

2 years ago

5.10.2

2 years ago

5.10.1

2 years ago

5.10.0

2 years ago

4.5.0

2 years ago

4.11.0

2 years ago

5.7.6

2 years ago

4.11.1

2 years ago

5.7.5

2 years ago

4.11.2

2 years ago

5.7.4

2 years ago

5.7.3

2 years ago

5.7.2

2 years ago

5.7.1

2 years ago

5.3.5

2 years ago

5.7.0

2 years ago

5.3.4

2 years ago

4.4.1

2 years ago

4.4.2

2 years ago

4.1.7

2 years ago

3.4.0

2 years ago

3.2.2

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

3.0.1

2 years ago

3.4.2

2 years ago

3.2.4

2 years ago

3.4.1

2 years ago

3.2.3

2 years ago

2.9.4

2 years ago

3.0.0

2 years ago

2.9.6

2 years ago

2.9.5

2 years ago

2.9.8

2 years ago

2.9.7

2 years ago

4.4.0

2 years ago

4.0.0

2 years ago

4.2.0

2 years ago

3.3.1

2 years ago

3.1.3

2 years ago

3.3.0

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

2.9.3-beta.1

2 years ago

4.1.4

2 years ago

4.1.3

2 years ago

4.1.6

2 years ago

4.1.5

2 years ago

4.1.0

2 years ago

4.3.0

2 years ago

4.1.2

2 years ago

4.1.1

2 years ago

2.9.3

2 years ago

2.9.2

2 years ago

2.9.1

2 years ago

2.9.0

2 years ago

2.8.16-rc.9

2 years ago

2.8.16-rc.8

2 years ago

2.8.16-rc.7

2 years ago

2.8.16-rc.6

2 years ago

2.8.16-rc.5

2 years ago

2.8.16-rc.4

2 years ago

2.8.16-rc.3

2 years ago

2.8.16-rc.2

2 years ago

2.8.16-rc.1

2 years ago

2.8.16-rc.0

2 years ago