@navikt/aksel 7.15.0 → 7.16.1
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.
- package/dist/codemod/migrations.js +10 -0
- package/dist/codemod/run-codeshift.js +5 -0
- package/dist/codemod/transforms/darkside/darkside.test.js +20 -0
- package/dist/codemod/transforms/darkside/darkside.tokens.js +1968 -0
- package/dist/codemod/transforms/darkside/token-update/token-update.js +110 -0
- package/dist/codemod/transforms/darkside/token-update-js/token-update-js.js +96 -0
- package/package.json +2 -2
|
@@ -105,6 +105,16 @@ exports.migrations = {
|
|
|
105
105
|
value: "token-spacing-js",
|
|
106
106
|
path: "darkside/token-spacing-js/spacing",
|
|
107
107
|
},
|
|
108
|
+
{
|
|
109
|
+
description: "Updates css, scss and less-variables to use new token-prefix",
|
|
110
|
+
value: "token-update",
|
|
111
|
+
path: "darkside/token-update/token-update",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
description: "Updates js tokens to use new token-prefix and names",
|
|
115
|
+
value: "token-update-js",
|
|
116
|
+
path: "darkside/token-update-js/token-update-js",
|
|
117
|
+
},
|
|
108
118
|
],
|
|
109
119
|
};
|
|
110
120
|
function getMigrationPath(str) {
|
|
@@ -35,6 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.messages = void 0;
|
|
38
39
|
exports.runCodeshift = runCodeshift;
|
|
39
40
|
const chalk_1 = __importDefault(require("chalk"));
|
|
40
41
|
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
@@ -48,6 +49,7 @@ const ignoreNodeModules = [
|
|
|
48
49
|
"**/lib/**",
|
|
49
50
|
"**/.next/**",
|
|
50
51
|
];
|
|
52
|
+
exports.messages = new Map();
|
|
51
53
|
function runCodeshift(input, options, program) {
|
|
52
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
55
|
var _a;
|
|
@@ -74,6 +76,9 @@ function runCodeshift(input, options, program) {
|
|
|
74
76
|
print: options === null || options === void 0 ? void 0 : options.print,
|
|
75
77
|
});
|
|
76
78
|
warning && console.info(`\n${chalk_1.default.yellow(warning)}\n`);
|
|
79
|
+
exports.messages.forEach((value) => {
|
|
80
|
+
value.format(value.data);
|
|
81
|
+
});
|
|
77
82
|
}
|
|
78
83
|
catch (error) {
|
|
79
84
|
program.error(chalk_1.default.red("Error:", error.message));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const darkside_tokens_1 = require("./darkside.tokens");
|
|
5
|
+
(0, vitest_1.describe)("Darkside codemods", () => {
|
|
6
|
+
(0, vitest_1.test)("Token migration references exists", () => {
|
|
7
|
+
Object.entries(darkside_tokens_1.updatedTokens).forEach(([oldToken, config]) => {
|
|
8
|
+
if (config.replacement.length > 1) {
|
|
9
|
+
(0, vitest_1.expect)(darkside_tokens_1.newTokens, `${oldToken} has valid replacement: ${config.replacement}`).toContain(config.replacement);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
(0, vitest_1.test)("Has raw value if no reference is set", () => {
|
|
14
|
+
Object.values(darkside_tokens_1.updatedTokens).forEach((config) => {
|
|
15
|
+
if (config.replacement.length === 0) {
|
|
16
|
+
(0, vitest_1.expect)(config.raw.length > 0).toBeTruthy();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|