Skip to content

Commit 004cd38

Browse files
committed
fix: avoid machine-based paths in generated files
1 parent 1187825 commit 004cd38

5 files changed

+9
-13
lines changed

scripts/generate-base-colors.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ const startCase = require('lodash').startCase;
1010
const flatMap = require('lodash').flatMap;
1111
const sortBy = require('lodash').sortBy;
1212

13-
const importPath = path.join(
14-
__dirname,
15-
'../src/materials/colors/decisions/base-colors.json'
16-
);
13+
const relativePath = '../src/materials/colors/decisions/base-colors.json';
14+
const importPath = path.join(__dirname, relativePath);
1715
const exportPath = path.join(
1816
__dirname,
1917
'../src/materials/colors/base-colors.mod.css'
@@ -69,7 +67,7 @@ const commentDoNotModify = {
6967
type: 'comment',
7068
comment: ` THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
7169
This file is created by 'scripts/generate-base-color.js' script. The real
72-
colors's values should be updated in '${importPath}';
70+
colors's values should be updated in '${relativePath}';
7371
Also, This file is transformed to JSON version in order to list the colors
7472
in the UIKit. Color groups are indicated by a comment preceeding the group
7573
of colors. `,

scripts/generate-base-shadows.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ const path = require('path');
88
const css = require('css');
99
const flatMap = require('lodash').flatMap;
1010

11-
const importPath = path.join(
12-
__dirname,
13-
'../src/materials/shadows/decisions/base-shadows.json'
14-
);
11+
const relativePath = '../src/materials/shadows/decisions/base-shadows.json';
12+
const importPath = path.join(__dirname, relativePath);
1513
const exportPath = path.join(
1614
__dirname,
1715
'../src/materials/shadows/base-shadows.mod.css'
@@ -38,7 +36,7 @@ const commentDoNotModify = {
3836
type: 'comment',
3937
comment: ` THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
4038
This file is created by 'scripts/generate-base-shadows.js' script. The real
41-
shadows's values should be updated in '${importPath}';
39+
shadows's values should be updated in '${relativePath}';
4240
Also, This file is transformed to JSON version in order to list the shadows
4341
in the UIKit. `,
4442
};

scripts/generate-colors-for-story.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ const loadedFile = fs.readFileSync(importPath, 'utf8');
1515
const fileToBeTransformed = css.parse(loadedFile);
1616

1717
// Path where decision file is located, for documentation purposes only
18-
1918
const originalPath = 'materials/colors/decisions/base-colors.json';
19+
2020
// Gets all declarations inside the `:root` selector from fileToBeTransformed
2121
const rootRulesFromFileToBeTransformed = fileToBeTransformed.stylesheet.rules.find(
2222
rule => rule.type === 'rule' && rule.selectors.includes(':root')

src/materials/colors/base-colors.mod.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
44
This file is created by 'scripts/generate-base-color.js' script. The real
5-
colors's values should be updated in '/Users/emmenko/dev/src/ui-kit/src/materials/colors/decisions/base-colors.json';
5+
colors's values should be updated in '../src/materials/colors/decisions/base-colors.json';
66
Also, This file is transformed to JSON version in order to list the colors
77
in the UIKit. Color groups are indicated by a comment preceeding the group
88
of colors. */

src/materials/shadows/base-shadows.mod.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
44
This file is created by 'scripts/generate-base-shadows.js' script. The real
5-
shadows's values should be updated in '/Users/emmenko/dev/src/ui-kit/src/materials/shadows/decisions/base-shadows.json';
5+
shadows's values should be updated in '../src/materials/shadows/decisions/base-shadows.json';
66
Also, This file is transformed to JSON version in order to list the shadows
77
in the UIKit. */
88

0 commit comments

Comments
 (0)