@navikt/aksel 5.18.3 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -77,6 +77,14 @@ exports.migrations = {
77
77
  path: "v4.0.0/date/date",
78
78
  },
79
79
  ],
80
+ "v6.0.0": [
81
+ {
82
+ description: "Removes `backgroundColor` and `avatarBgColor` properties from `Chat` and `Chat.Bubble`",
83
+ value: "v6-chat",
84
+ path: "v6.0.0/chat/chat",
85
+ warning: "Remember to update use of `variant`-prop to match previous use of colors. If needed the component exposes css-variables for custom overrides",
86
+ },
87
+ ],
80
88
  };
81
89
  function getMigrationPath(str) {
82
90
  var _a;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lineterminator_1 = require("../../../utils/lineterminator");
4
+ /**
5
+ * @param {import('jscodeshift').FileInfo} file
6
+ * @param {import('jscodeshift').API} api
7
+ */
8
+ function transformer(file, api) {
9
+ const j = api.jscodeshift;
10
+ let localName = "Chat";
11
+ const root = j(file.source);
12
+ /* Finds used name for Chat component */
13
+ root
14
+ .find(j.ImportDeclaration)
15
+ .filter((path) => path.node.source.value === "@navikt/ds-react")
16
+ .forEach((imp) => {
17
+ imp.value.specifiers.forEach((x) => {
18
+ if (x.imported.name === "Chat" && x.local.name !== x.imported.name) {
19
+ localName = x.local.name;
20
+ }
21
+ });
22
+ });
23
+ root
24
+ .find(j.JSXElement, {
25
+ openingElement: {
26
+ name: {
27
+ name: localName,
28
+ },
29
+ },
30
+ })
31
+ .forEach((path) => {
32
+ j(path)
33
+ .find(j.JSXAttribute, {
34
+ name: {
35
+ name: "backgroundColor",
36
+ },
37
+ })
38
+ .remove();
39
+ j(path)
40
+ .find(j.JSXAttribute, {
41
+ name: {
42
+ name: "avatarBgColor",
43
+ },
44
+ })
45
+ .remove();
46
+ });
47
+ root
48
+ .find(j.JSXElement, {
49
+ openingElement: {
50
+ name: {
51
+ type: "JSXMemberExpression",
52
+ object: {
53
+ name: localName,
54
+ },
55
+ property: {
56
+ name: "Bubble",
57
+ },
58
+ },
59
+ },
60
+ })
61
+ .forEach((path) => {
62
+ j(path)
63
+ .find(j.JSXAttribute, {
64
+ name: {
65
+ name: "backgroundColor",
66
+ },
67
+ })
68
+ .remove();
69
+ });
70
+ return root.toSource((0, lineterminator_1.getLineTerminator)(file.source));
71
+ }
72
+ exports.default = transformer;
@@ -40,9 +40,10 @@ const testUtils_1 = require("jscodeshift/dist/testUtils");
40
40
  const node_fs_1 = __importDefault(require("node:fs"));
41
41
  const node_path_1 = __importDefault(require("node:path"));
42
42
  const prettier_1 = __importDefault(require("prettier"));
43
+ const vitest_1 = require("vitest");
43
44
  function check(dirName, { fixture, migration, extension = "js", options = {} }) {
44
- describe(migration, () => {
45
- it(fixture, () => __awaiter(this, void 0, void 0, function* () {
45
+ (0, vitest_1.describe)(migration, () => {
46
+ (0, vitest_1.test)(fixture, () => __awaiter(this, void 0, void 0, function* () {
46
47
  const fixtureDir = node_path_1.default.join(dirName);
47
48
  const inputPath = node_path_1.default.join(fixtureDir, `${fixture}.input.${extension}`);
48
49
  const parser = extension;
@@ -54,7 +55,7 @@ function check(dirName, { fixture, migration, extension = "js", options = {} })
54
55
  source,
55
56
  });
56
57
  // Format output and expected with prettier for white spaces and line breaks consistency
57
- expect(yield prettier_1.default.format(output, {
58
+ (0, vitest_1.expect)(yield prettier_1.default.format(output, {
58
59
  parser: parser === "js" ? "typescript" : parser,
59
60
  })).toBe(yield prettier_1.default.format(expected, {
60
61
  parser: parser === "js" ? "typescript" : parser,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/aksel",
3
- "version": "5.18.3",
3
+ "version": "6.1.0",
4
4
  "description": "Aksel command line interface. Handles css-imports, codemods and more",
5
5
  "author": "Aksel | NAV designsystem team",
6
6
  "license": "MIT",
@@ -18,8 +18,8 @@
18
18
  "clean": "rimraf dist",
19
19
  "build": "yarn clean && tsc -p tsconfig.json",
20
20
  "dev": "tsc --watch -p tsconfig.json",
21
- "test": "yarn build && NODE_OPTIONS=--experimental-vm-modules yarn jest",
22
- "test:watch": "NODE_OPTIONS=--experimental-vm-modules yarn jest --watch"
21
+ "test": "vitest run",
22
+ "test:watch": "vitest watch"
23
23
  },
24
24
  "bin": "./dist/index.js",
25
25
  "repository": {
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "homepage": "https://aksel.nav.no/grunnleggende/kode/kommandolinje",
31
31
  "dependencies": {
32
- "@navikt/ds-css": "5.18.3",
32
+ "@navikt/ds-css": "6.1.0",
33
33
  "axios": "1.6.0",
34
34
  "chalk": "4.1.0",
35
35
  "clipboardy": "^2.3.0",
@@ -44,12 +44,9 @@
44
44
  "react-scanner": "^1.1.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/inquirer": "^9.0.3",
48
- "@types/jest": "^29.0.0",
49
- "jest": "^29.0.0",
50
47
  "rimraf": "3.0.2",
51
- "ts-jest": "^29.0.0",
52
- "typescript": "^5.1.6"
48
+ "typescript": "^5.1.6",
49
+ "vitest": "^1.2.2"
53
50
  },
54
51
  "sideEffects": false,
55
52
  "engines": {