Skip to content

Commit 390c533

Browse files
author
Franck
committed
chore: Initial setup
1 parent 506390f commit 390c533

File tree

11 files changed

+2396
-0
lines changed

11 files changed

+2396
-0
lines changed

.eslintrc.cjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": ["eslint:recommended", "prettier"],
7+
"parserOptions": {
8+
"ecmaVersion": 12,
9+
"sourceType": "module"
10+
},
11+
"rules": {
12+
}
13+
};

.github/CODE_OF_CONDUCT.md

Whitespace-only changes.

.github/CONTRIBUTING.md

Whitespace-only changes.

.gitignore

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Microbundle cache
58+
.rpt2_cache/
59+
.rts2_cache_cjs/
60+
.rts2_cache_es/
61+
.rts2_cache_umd/
62+
63+
# Optional REPL history
64+
.node_repl_history
65+
66+
# Output of 'npm pack'
67+
*.tgz
68+
69+
# Yarn Integrity file
70+
.yarn-integrity
71+
72+
# dotenv environment variables file
73+
.env
74+
.env.test
75+
.env.production
76+
77+
# parcel-bundler cache (https://parceljs.org/)
78+
.cache
79+
.parcel-cache
80+
81+
# Next.js build output
82+
.next
83+
out
84+
85+
# Nuxt.js build / generate output
86+
.nuxt
87+
dist
88+
89+
# Gatsby files
90+
.cache/
91+
# Comment in the public line in if your project uses Gatsby and not Next.js
92+
# https://nextjs.org/blog/next-9-1#public-directory-support
93+
# public
94+
95+
# vuepress build output
96+
.vuepress/dist
97+
98+
# Serverless directories
99+
.serverless/
100+
101+
# FuseBox cache
102+
.fusebox/
103+
104+
# DynamoDB Local files
105+
.dynamodb/
106+
107+
# TernJS port file
108+
.tern-port
109+
110+
# Stores VSCode versions used for testing VSCode extensions
111+
.vscode-test
112+
113+
# yarn v2
114+
.yarn/cache
115+
.yarn/unplugged
116+
.yarn/build-state.yml
117+
.yarn/install-state.gz
118+
.pnp.*
119+
120+
# library build output
121+
dist

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Ignore artifacts:
2+
build
3+
dist
4+
coverage

.prettierrc.json

Whitespace-only changes.

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# `tokens`
2+
3+
> TODO: description
4+
5+
## Usage
6+
7+
```
8+
const tokens = require('tokens');
9+
10+
// TODO: DEMONSTRATE API
11+
```

package.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "@igloo-ui/tokens",
3+
"version": "0.0.0",
4+
"description": "Design tokens are all the values needed to construct and maintain a design system — spacing, color, typography, object styles, animation, etc.",
5+
"main": "index.js",
6+
"type": "module",
7+
"scripts": {
8+
"build": "node src/tokens.js",
9+
"lint": "eslint src/*.js",
10+
"format": "prettier -w src/*",
11+
"test": "echo \"Error: no test specified\" && exit 1"
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "git+https://github.com/gsoft-inc/igloo-ui-tokens.git"
16+
},
17+
"keywords": [
18+
"design tokens",
19+
"igloo-ui"
20+
],
21+
"author": "Officevibe",
22+
"license": "Apache-2.0",
23+
"bugs": {
24+
"url": "https://github.com/gsoft-inc/igloo-ui-tokens/issues"
25+
},
26+
"homepage": "https://github.com/gsoft-inc/igloo-ui-tokens#readme",
27+
"devDependencies": {
28+
"eslint": "^7.28.0",
29+
"eslint-config-prettier": "^8.3.0",
30+
"prettier": "2.3.1",
31+
"theo": "^8.1.5"
32+
}
33+
}

src/tokens.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*global process*/
2+
3+
import theo from "theo";
4+
import fs from "fs";
5+
6+
const OUTPUT = "dist";
7+
const SOURCE = "src/tokens";
8+
9+
const files = {
10+
scss: `${OUTPUT}/index.scss`,
11+
};
12+
13+
function createDir(dirPath) {
14+
fs.mkdirSync(`${process.cwd()}/${dirPath}`, { recursive: true }, (error) => {
15+
if (error) throw error;
16+
});
17+
}
18+
19+
function createFile(filePath, fileContent) {
20+
fs.writeFile(filePath, fileContent, (err) => {
21+
if (err) throw err;
22+
console.log("The file was succesfully saved!");
23+
});
24+
}
25+
26+
async function generateTokens() {
27+
theo.registerTransform("web", ["color/hex"]);
28+
29+
theo
30+
.convert({
31+
transform: {
32+
type: "web",
33+
file: `${SOURCE}/colors.json`,
34+
},
35+
format: {
36+
type: "scss",
37+
},
38+
})
39+
.then((scss) => {
40+
!fs.existsSync(OUTPUT) ? createDir(OUTPUT) : createFile(files.scss, scss);
41+
})
42+
.catch((error) => console.log(`Something went wrong: ${error}`));
43+
}
44+
45+
generateTokens();

src/tokens/colors.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"props": {
3+
"electric-blue-50": {
4+
"value": "EDF3FE",
5+
"type": "color",
6+
"category": "colors"
7+
}
8+
}
9+
}

0 commit comments

Comments
 (0)