@navikt/aksel 2.9.2 → 2.9.3-beta.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.
Files changed (29) hide show
  1. package/README.md +157 -1
  2. package/dist/codemod/index.js +36 -0
  3. package/dist/codemod/migrations.js +75 -0
  4. package/dist/codemod/run-codeshift.js +91 -0
  5. package/dist/codemod/tokens-map.mjs +364 -0
  6. package/dist/codemod/transforms/rename-prop/rename-prop.js +21 -0
  7. package/dist/codemod/transforms/v1.0.0/chat/chat.js +65 -0
  8. package/dist/codemod/transforms/v1.0.0/pagination/pagination.js +66 -0
  9. package/dist/codemod/transforms/v1.0.0/preset/preset.js +19 -0
  10. package/dist/codemod/transforms/v1.0.0/tabs/tabs.js +78 -0
  11. package/dist/codemod/transforms/v2.0.0/update-css-tokens/update-css-tokens.js +21 -0
  12. package/dist/codemod/transforms/v2.0.0/update-js-tokens/update-js-tokens.js +36 -0
  13. package/dist/codemod/transforms/v2.0.0/update-less-tokens/update-less-tokens.js +18 -0
  14. package/dist/codemod/transforms/v2.0.0/update-sass-tokens/update-sass-tokens.js +18 -0
  15. package/dist/codemod/utils/check.js +66 -0
  16. package/dist/codemod/utils/imports.js +20 -0
  17. package/dist/codemod/utils/rename-props.js +13 -0
  18. package/dist/codemod/utils/translate-token.js +20 -0
  19. package/dist/codemod/validation.js +41 -0
  20. package/dist/css-imports/config.js +5 -2
  21. package/dist/css-imports/generate-output.js +42 -35
  22. package/dist/css-imports/get-directories.js +12 -5
  23. package/dist/css-imports/get-version.js +11 -4
  24. package/dist/css-imports/index.js +36 -33
  25. package/dist/css-imports/inquiry.js +11 -4
  26. package/dist/css-imports/scan-code.js +10 -5
  27. package/dist/help.js +17 -6
  28. package/dist/index.js +22 -6
  29. package/package.json +20 -13
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const imports_1 = require("../../../utils/imports");
4
+ const translate_token_1 = require("../../../utils/translate-token");
5
+ const tokens_map_mjs_1 = require("../../../tokens-map.mjs");
6
+ /**
7
+ * @param {import('jscodeshift').FileInfo} file
8
+ * @param {import('jscodeshift').API} api
9
+ */
10
+ function transformer(file, api) {
11
+ let src = file.source;
12
+ const j = api.jscodeshift;
13
+ let root = j(file.source);
14
+ const jsImport = root.find(j.ImportDeclaration).filter((x) => {
15
+ return ["@navikt/ds-tokens/dist/tokens"].includes(x.node.source.value);
16
+ });
17
+ if (!jsImport) {
18
+ return src;
19
+ }
20
+ tokens_map_mjs_1.tokens.forEach((x) => {
21
+ const name = (0, translate_token_1.translateToken)(x[0], "js");
22
+ const out = (0, translate_token_1.translateToken)(x[1], "js");
23
+ let foundName = "";
24
+ (0, imports_1.getImportSpecifier)(j, root, name, "@navikt/ds-tokens/dist/tokens").forEach((x) => (foundName = x.node.imported.name));
25
+ if (name === foundName) {
26
+ const localName = (0, imports_1.getImportSpecifierName)(j, root, name, "@navikt/ds-tokens/dist/tokens") || name;
27
+ (0, imports_1.renameImportSpecifier)(j, root, name, out, "@navikt/ds-tokens/dist/tokens");
28
+ let code = root.toSource();
29
+ const rgx = new RegExp("(" + localName + ")", "gm");
30
+ code = code.replace(rgx, out);
31
+ root = j(code);
32
+ }
33
+ });
34
+ return root.toSource();
35
+ }
36
+ exports.default = transformer;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const translate_token_1 = require("../../../utils/translate-token");
4
+ const tokens_map_mjs_1 = require("../../../tokens-map.mjs");
5
+ /**
6
+ * @param {import('jscodeshift').FileInfo} file
7
+ * @param {import('jscodeshift').API} api
8
+ */
9
+ function transformer(file, api) {
10
+ let src = file.source;
11
+ tokens_map_mjs_1.tokens.forEach((tok) => {
12
+ const lessToken = (0, translate_token_1.translateToken)(tok[0], "less");
13
+ const rgx = new RegExp("(\\" + lessToken + ")", "gm");
14
+ src = src.replace(rgx, (0, translate_token_1.translateToken)(tok[1], "less"));
15
+ });
16
+ return src;
17
+ }
18
+ exports.default = transformer;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const translate_token_1 = require("../../../utils/translate-token");
4
+ const tokens_map_mjs_1 = require("../../../tokens-map.mjs");
5
+ /**
6
+ * @param {import('jscodeshift').FileInfo} file
7
+ * @param {import('jscodeshift').API} api
8
+ */
9
+ function transformer(file, api) {
10
+ let src = file.source;
11
+ tokens_map_mjs_1.tokens.forEach((tok) => {
12
+ const scssToken = (0, translate_token_1.translateToken)(tok[0], "scss");
13
+ const rgx = new RegExp("(\\" + scssToken + ")", "gm");
14
+ src = src.replace(rgx, (0, translate_token_1.translateToken)(tok[1], "scss"));
15
+ });
16
+ return src;
17
+ }
18
+ exports.default = transformer;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.check = void 0;
39
+ const node_fs_1 = __importDefault(require("node:fs"));
40
+ const node_path_1 = __importDefault(require("node:path"));
41
+ const prettier_1 = __importDefault(require("prettier"));
42
+ const applyTransform = require("jscodeshift/dist/testUtils").applyTransform;
43
+ function check(dirName, { fixture, migration, extension = "js", options = {} }) {
44
+ describe(migration, () => {
45
+ it(fixture, () => __awaiter(this, void 0, void 0, function* () {
46
+ var _a;
47
+ const fixtureDir = node_path_1.default.join(dirName);
48
+ const inputPath = node_path_1.default.join(fixtureDir, `${fixture}.input.${extension}`);
49
+ const parser = extension;
50
+ const source = node_fs_1.default.readFileSync(inputPath, "utf8");
51
+ const expected = node_fs_1.default.readFileSync(node_path_1.default.join(fixtureDir, `${fixture}.output.${extension}`), "utf8");
52
+ // Assumes transform is one level up from tests directory
53
+ const module = yield (_a = node_path_1.default.join(dirName, "..", migration), Promise.resolve().then(() => __importStar(require(_a))));
54
+ const output = applyTransform(Object.assign(Object.assign({}, module), { parser: "tsx" }), options, {
55
+ source,
56
+ });
57
+ // Format output and expected with prettier for white spaces and line breaks consistency
58
+ expect(prettier_1.default.format(output, {
59
+ parser: parser === "js" ? "typescript" : parser,
60
+ })).toBe(prettier_1.default.format(expected, {
61
+ parser: parser === "js" ? "typescript" : parser,
62
+ }));
63
+ }));
64
+ });
65
+ }
66
+ exports.check = check;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getImportSpecifierName = exports.renameImportSpecifier = exports.getImportSpecifier = void 0;
4
+ function getImportSpecifier(j, source, specifier, sourcePath) {
5
+ return source
6
+ .find(j.ImportDeclaration)
7
+ .filter((path) => path.node.source.value === sourcePath)
8
+ .find(j.ImportSpecifier)
9
+ .filter((path) => path.value.imported.name === specifier);
10
+ }
11
+ exports.getImportSpecifier = getImportSpecifier;
12
+ function renameImportSpecifier(j, source, specifier, newSpecifier, sourcePath) {
13
+ getImportSpecifier(j, source, specifier, sourcePath).replaceWith(j.importSpecifier(j.identifier(newSpecifier)));
14
+ }
15
+ exports.renameImportSpecifier = renameImportSpecifier;
16
+ function getImportSpecifierName(j, source, specifier, sourcePath) {
17
+ const specifiers = getImportSpecifier(j, source, specifier, sourcePath);
18
+ return specifiers.length > 0 ? specifiers.nodes()[0].local.name : null;
19
+ }
20
+ exports.getImportSpecifierName = getImportSpecifierName;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function renameProps({ root, componentName, props }) {
4
+ return root.findJSXElements(componentName).forEach((path) => {
5
+ path.node.openingElement.attributes.forEach((node) => {
6
+ if (node.type === "JSXAttribute" &&
7
+ Object.keys(props).includes(node.name.name)) {
8
+ node.name.name = props[node.name.name];
9
+ }
10
+ });
11
+ });
12
+ }
13
+ exports.default = renameProps;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.translateToken = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const translateToken = (token, type) => {
9
+ switch (type) {
10
+ case "scss":
11
+ return token.replace("--", "$");
12
+ case "less":
13
+ return token.replace("--", "@");
14
+ case "js":
15
+ return lodash_1.default.startCase(token).split(" ").join("");
16
+ default:
17
+ return token;
18
+ }
19
+ };
20
+ exports.translateToken = translateToken;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.validateGit = exports.validateMigration = void 0;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const is_git_clean_1 = __importDefault(require("is-git-clean"));
9
+ const migrations_js_1 = require("./migrations.js");
10
+ function validateMigration(str, program) {
11
+ if (!(0, migrations_js_1.getMigrationNames)().includes(str)) {
12
+ program.error(chalk_1.default.red(`Migration <${str}> not found!\n${chalk_1.default.gray(`\nAvailable migrations:\n${(0, migrations_js_1.getMigrationString)()}`)}`));
13
+ }
14
+ const path = (0, migrations_js_1.getMigrationPath)(str);
15
+ if (!path) {
16
+ program.error(chalk_1.default.red(`Code for migration <${str}> not found!\n${chalk_1.default.gray(`\nContact creator (Aksel) to get it fixed!\n`)}`));
17
+ }
18
+ }
19
+ exports.validateMigration = validateMigration;
20
+ function validateGit(options, program) {
21
+ if (options.dryRun) {
22
+ return;
23
+ }
24
+ if (options.force) {
25
+ console.log(chalk_1.default.yellow("Forcing migration without git check"));
26
+ return;
27
+ }
28
+ let clean = false;
29
+ try {
30
+ clean = is_git_clean_1.default.sync(process.cwd());
31
+ }
32
+ catch (err) {
33
+ if (err && err.stderr && err.stderr.indexOf("Not a git repository") >= 0) {
34
+ clean = true;
35
+ }
36
+ }
37
+ if (!clean) {
38
+ program.error(`${chalk_1.default.yellow("\nBefore we continue, please stash or commit your git changes.")}${"\nYou can use the --force flag to override this safety check."}`);
39
+ }
40
+ }
41
+ exports.validateGit = validateGit;
@@ -1,2 +1,5 @@
1
- export const ComponentPrefix = "C_";
2
- export const layerSuffix = " layer(aksel)";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.layerSuffix = exports.ComponentPrefix = void 0;
4
+ exports.ComponentPrefix = "C_";
5
+ exports.layerSuffix = " layer(aksel)";
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -7,20 +8,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
9
  });
9
10
  };
10
- import { ComponentPrefix, layerSuffix } from "./config.js";
11
- import { formCss, typoCss, componentsCss, StyleMappings, componentDir, rootDir, globalDir, } from "@navikt/ds-css/config/_mappings.js";
12
- import { inquiry } from "./inquiry.js";
13
- import clipboard from "clipboardy";
14
- import lodash from "lodash";
15
- import chalk from "chalk";
16
- export function generateImportOutput(answers) {
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.generateImportOutput = void 0;
16
+ const config_js_1 = require("./config.js");
17
+ const _mappings_1 = require("@navikt/ds-css/config/_mappings");
18
+ const inquiry_1 = require("./inquiry");
19
+ const clipboardy_1 = __importDefault(require("clipboardy"));
20
+ const lodash_1 = __importDefault(require("lodash"));
21
+ const chalk_1 = __importDefault(require("chalk"));
22
+ function generateImportOutput(answers) {
17
23
  return __awaiter(this, void 0, void 0, function* () {
18
24
  const useCdn = answers.cdn === "yes";
19
25
  const useTailwind = answers.tailwind === "yes";
20
26
  const version = answers.version;
21
27
  const imports = [];
22
28
  let importStr = "";
23
- yield inquiry(answers, [
29
+ yield (0, inquiry_1.inquiry)(answers, [
24
30
  {
25
31
  type: "select",
26
32
  name: "output",
@@ -48,56 +54,57 @@ ${imports.join("\n")}
48
54
  importStr = imports.join("\n");
49
55
  }
50
56
  if (answers.output.includes("print")) {
51
- console.log(chalk.bold.cyan(`\nImports 🚀 \n`));
52
- console.log(chalk.green(`${importStr}`));
57
+ console.log(chalk_1.default.bold.cyan(`\nImports 🚀 \n`));
58
+ console.log(chalk_1.default.green(`${importStr}`));
53
59
  }
54
60
  if (useCdn) {
55
- console.log(chalk.bold.underline.cyan(`\nNotes on CDN-usage 📝`));
61
+ console.log(chalk_1.default.bold.underline.cyan(`\nNotes on CDN-usage 📝`));
56
62
  console.log(`We recommend using Static imports, then uploading the your bundled static-files to your own CDN-instance.
57
63
  ✔︎ This allows you to control the version of the CSS-files with package.json, and avoids desync between ds-react/ds-css.
58
64
  ✔︎ Remember to add 'https://cdn.nav.no' to your applications CSP!`);
59
65
  }
60
66
  if (useTailwind) {
61
- console.log(chalk.bold.underline.cyan(`\nNotes on Tailwind-use 📝`));
62
- console.log(`When using tailwind with Aksel, you will need to add the postcss plugin ${chalk.cyan("postcss-import")}
67
+ console.log(chalk_1.default.bold.underline.cyan(`\nNotes on Tailwind-use 📝`));
68
+ console.log(`When using tailwind with Aksel, you will need to add the postcss plugin ${chalk_1.default.cyan("postcss-import")}
63
69
  ✔︎ NPM: https://www.npmjs.com/package/postcss-import
64
70
  ✔︎ Read more here: https://aksel.nav.no/grunnleggende/kode/tailwind`);
65
71
  }
66
72
  if (answers.layers === "yes") {
67
- console.log(chalk.bold.underline.cyan(`\nNotes on Layers 📝`));
73
+ console.log(chalk_1.default.bold.underline.cyan(`\nNotes on Layers 📝`));
68
74
  console.log(`Layers is not yet supported in Safari <= 15.3. (https://caniuse.com/css-cascade-layers)`);
69
75
  }
70
- answers.output.includes("clipboard") && clipboard.writeSync(importStr);
76
+ answers.output.includes("clipboard") && clipboardy_1.default.writeSync(importStr);
71
77
  });
72
78
  }
79
+ exports.generateImportOutput = generateImportOutput;
73
80
  function simpleOutput(cdn, layers, version) {
74
81
  const options = {
75
- static: `@import "@navikt/ds-css"${layers ? layerSuffix : ""};`,
82
+ static: `@import "@navikt/ds-css"${layers ? config_js_1.layerSuffix : ""};`,
76
83
  cdn: toCdn("index.css", version),
77
84
  };
78
85
  return cdn ? options.cdn : options.static;
79
86
  }
80
87
  function advancedOutput(answers, cdn, layers, version) {
81
88
  const imports = ["/* Defaults */"];
82
- const baselineImports = answers.imports.filter((x) => !x.startsWith(ComponentPrefix) && x !== "default");
89
+ const baselineImports = answers.imports.filter((x) => !x.startsWith(config_js_1.ComponentPrefix) && x !== "default");
83
90
  const componentImports = answers.imports
84
- .filter((x) => x.startsWith(ComponentPrefix) && x !== "components")
85
- .map((x) => x.replace(ComponentPrefix, ""));
91
+ .filter((x) => x.startsWith(config_js_1.ComponentPrefix) && x !== "components")
92
+ .map((x) => x.replace(config_js_1.ComponentPrefix, ""));
86
93
  baselineImports.forEach((x) => {
87
94
  cdn
88
- ? imports.push(toCdn(`${globalDir}/${x}.css`, version))
89
- : imports.push(toCssImport(`${globalDir}/${x}.css`, layers));
95
+ ? imports.push(toCdn(`${_mappings_1.globalDir}/${x}.css`, version))
96
+ : imports.push(toCssImport(`${_mappings_1.globalDir}/${x}.css`, layers));
90
97
  });
91
98
  if (answers["config-type"] === "easy") {
92
99
  cdn
93
- ? imports.push(toCdn(componentsCss, version))
94
- : imports.push(toCssImport(`${rootDir}/${componentsCss}`, layers));
100
+ ? imports.push(toCdn(_mappings_1.componentsCss, version))
101
+ : imports.push(toCssImport(`${_mappings_1.rootDir}/${_mappings_1.componentsCss}`, layers));
95
102
  return imports;
96
103
  }
97
104
  const components = new Set();
98
105
  componentImports.forEach((x) => {
99
106
  var _a;
100
- const styleRef = StyleMappings.components.find((y) => y.component === x);
107
+ const styleRef = _mappings_1.StyleMappings.components.find((y) => y.component === x);
101
108
  if (styleRef) {
102
109
  components.add(styleRef.main);
103
110
  (_a = styleRef === null || styleRef === void 0 ? void 0 : styleRef.dependencies) === null || _a === void 0 ? void 0 : _a.forEach((dep) => components.add(dep));
@@ -106,13 +113,13 @@ function advancedOutput(answers, cdn, layers, version) {
106
113
  let componentImportsList = Array.from(components)
107
114
  .filter((x) => x.length > 0)
108
115
  .sort((a, b) => a.localeCompare(b));
109
- if (componentImportsList.find((x) => x === formCss)) {
110
- componentImportsList = componentImportsList.filter((x) => x !== formCss);
111
- componentImportsList.unshift(formCss);
116
+ if (componentImportsList.find((x) => x === _mappings_1.formCss)) {
117
+ componentImportsList = componentImportsList.filter((x) => x !== _mappings_1.formCss);
118
+ componentImportsList.unshift(_mappings_1.formCss);
112
119
  }
113
- if (componentImportsList.find((x) => x === typoCss)) {
114
- componentImportsList = componentImportsList.filter((x) => x !== typoCss);
115
- componentImportsList.unshift(typoCss);
120
+ if (componentImportsList.find((x) => x === _mappings_1.typoCss)) {
121
+ componentImportsList = componentImportsList.filter((x) => x !== _mappings_1.typoCss);
122
+ componentImportsList.unshift(_mappings_1.typoCss);
116
123
  }
117
124
  if (componentImportsList.length === 0) {
118
125
  return imports;
@@ -120,18 +127,18 @@ function advancedOutput(answers, cdn, layers, version) {
120
127
  imports.push(``);
121
128
  imports.push(`/* Components */`);
122
129
  componentImportsList.forEach((x) => {
123
- const pascalCase = lodash.camelCase(x.replace("css", "")).toLowerCase();
130
+ const pascalCase = lodash_1.default.camelCase(x.replace("css", "")).toLowerCase();
124
131
  cdn
125
- ? imports.push(toCdn(`${componentDir}/${pascalCase}.css`, version))
126
- : imports.push(toCssImport(`${componentDir}/${pascalCase}.css`, layers));
132
+ ? imports.push(toCdn(`${_mappings_1.componentDir}/${pascalCase}.css`, version))
133
+ : imports.push(toCssImport(`${_mappings_1.componentDir}/${pascalCase}.css`, layers));
127
134
  });
128
135
  return imports;
129
136
  }
130
137
  function toCdn(str, version) {
131
138
  return `<link rel="preload" href="https://cdn.nav.no/aksel/@navikt/ds-css/${version}/${str
132
139
  .replace(".css", ".min.css")
133
- .replace(`${rootDir}/`, "")}" as="style"></link>`;
140
+ .replace(`${_mappings_1.rootDir}/`, "")}" as="style"></link>`;
134
141
  }
135
142
  function toCssImport(str, layers) {
136
- return `@import "@navikt/ds-css/${str}"${layers ? layerSuffix : ""};`;
143
+ return `@import "@navikt/ds-css/${str}"${layers ? config_js_1.layerSuffix : ""};`;
137
144
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -7,9 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
9
  });
9
10
  };
10
- import fg from "fast-glob";
11
- import path from "path";
12
- export function getDirectories() {
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.getDirectories = void 0;
16
+ const fast_glob_1 = __importDefault(require("fast-glob"));
17
+ const path_1 = __importDefault(require("path"));
18
+ function getDirectories() {
13
19
  return __awaiter(this, void 0, void 0, function* () {
14
20
  const baseDir = process.cwd();
15
21
  const ignoreNodeModules = [
@@ -18,11 +24,12 @@ export function getDirectories() {
18
24
  "**/build/**",
19
25
  "**/lib/**",
20
26
  ];
21
- const directories = yield fg(`${baseDir}/**`, {
27
+ const directories = yield (0, fast_glob_1.default)(`${baseDir}/**`, {
22
28
  onlyDirectories: true,
23
29
  ignore: ignoreNodeModules,
24
30
  });
25
31
  directories.sort((a, b) => a.length - b.length);
26
- return [baseDir, ...directories].map((x) => x.replace(baseDir, path.basename(baseDir)));
32
+ return [baseDir, ...directories].map((x) => x.replace(baseDir, path_1.default.basename(baseDir)));
27
33
  });
28
34
  }
35
+ exports.getDirectories = getDirectories;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -7,16 +8,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
9
  });
9
10
  };
10
- import axios from "axios";
11
- export function getAllVersions() {
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.getAllVersions = void 0;
16
+ const axios_1 = __importDefault(require("axios"));
17
+ function getAllVersions() {
12
18
  return __awaiter(this, void 0, void 0, function* () {
13
19
  try {
14
- const npmPackageData = yield axios.get(`https://registry.npmjs.org/@navikt/ds-css`);
20
+ const npmPackageData = yield axios_1.default.get(`https://registry.npmjs.org/@navikt/ds-css`);
15
21
  return Object.keys(npmPackageData.data["versions"]);
16
22
  }
17
23
  catch (e) {
18
- console.log(e);
24
+ console.error(e);
19
25
  return [];
20
26
  }
21
27
  });
22
28
  }
29
+ exports.getAllVersions = getAllVersions;