♻️(tokens) expose default tokens in a lib and various config

This allow to use the default tokens from Typescript or Javascript file
of dependents repos. For instance this wîll be used by packages/react
to aggregate components tokens files.
This commit is contained in:
Nathan Vasse
2023-01-04 15:51:06 +01:00
committed by NathanVss
parent be2f220624
commit 67dd0048d0
11 changed files with 57 additions and 17 deletions

View File

@@ -1,2 +1,4 @@
node_modules
dist
dist
src/bin/tests/assets
src/lib/cunningham-tokens.ts

View File

@@ -4,10 +4,7 @@
"custom"
],
"parserOptions": {
"project": [
"./tsconfig.json",
"./tsconfig.node.json"
]
"project": "./tsconfig.eslint.json"
},
"rules": {
"no-console": "off",

View File

@@ -4,10 +4,17 @@
"version": "0.0.0",
"license": "MIT",
"bin": {
"cunningham": "dist/bin/Main.js"
"cunningham": "./dist/bin/Main.js"
},
"main": "./dist/lib/index.js",
"types": "./dist/lib/index.d.ts",
"exports": {
"./default-tokens": "./dist/cunningham-tokens.css"
"./default-tokens": "./dist/cunningham-tokens.css",
".": {
"require": "./dist/lib/index.js",
"import": "./dist/lib/index.js",
"types": "./dist/lib/index.d.ts"
}
},
"files": [
"dist/"
@@ -15,16 +22,18 @@
"scripts": {
"lint": "eslint . 'src/**/*.{ts,tsx}'",
"dev": "nodemon --watch 'src/bin' --ext '*' --exec 'yarn build'",
"build": "tsc -p tsconfig.json && tsc-alias && cp src/bin/cunningham.dist.js dist/bin && chmod +x dist/bin/Main.js && yarn build-default-theme",
"build-default-theme": "./dist/bin/Main.js -o dist -s html -g css,js",
"test": "FORCE_COLOR=1 jest --verbose src/bin"
"build-bin": "cd src/bin && tsc -p tsconfig.json && tsc-alias && cp ./cunningham.dist.js ../../dist/bin && chmod +x ../../dist/bin/Main.js",
"build-lib": "cp dist/cunningham-tokens.ts src/lib && cd src/lib && tsc -p tsconfig.json",
"build": "yarn build-bin && yarn build-default-theme && yarn build-lib && cd ../.. && ln -sf ../../packages/tokens/dist/bin/Main.js node_modules/.bin/cunningham",
"build-default-theme": "./dist/bin/Main.js -o dist -s html -g css,js,ts",
"test": "FORCE_COLOR=1 jest --runInBand --verbose src"
},
"dependencies": {
"chalk": "4.1.2",
"commander": "9.4.1",
"deepmerge": "4.2.2",
"figlet": "1.5.2",
"tsc-alias": "^1.8.2"
"ts-node": "10.9.1"
},
"devDependencies": {
"@types/figlet": "1.5.5",
@@ -35,7 +44,7 @@
"nodemon": "2.0.20",
"prettier": "2.8.1",
"ts-jest": "29.0.3",
"ts-node": "10.9.1",
"tsc-alias": "1.8.2",
"typescript": "4.9.4"
},
"engines": {

View File

@@ -1,7 +1,8 @@
module.exports = {
theme: {
colors: {
primary: "#055FD2",
primary: "#002d7f",
"primary-gradient": "linear-gradient(90deg,#002d7f,#0069b3)",
secondary: "#DA0000",
},
},

View File

@@ -0,0 +1,7 @@
export default {
theme: {
colors: {
primary: "typescript",
},
},
};

View File

@@ -1,14 +1,14 @@
{
"extends": "@openfun/typescript-configs/node.json",
"include": [
"./src/**/*"
"**/*",
],
"compilerOptions": {
"baseUrl": "./src/bin",
"baseUrl": "./",
"paths": {
"*": ["*"]
},
"resolveJsonModule": true,
"outDir": "./dist/bin",
"outDir": "../../dist/bin",
}
}

View File

@@ -0,0 +1 @@
export const tokens = {"theme":{"colors":{"primary":"#002d7f","primary-gradient":"linear-gradient(90deg,#002d7f,#0069b3)","secondary":"#DA0000"}}};

View File

@@ -0,0 +1,4 @@
import { tokens } from "./cunningham-tokens";
export type DefaultTokens = typeof tokens;
export const defaultTokens = tokens;

View File

@@ -0,0 +1,11 @@
{
"extends": "@openfun/typescript-configs/node.json",
"include": [
"./*"
],
"compilerOptions": {
"baseUrl": "./",
"outDir": "../../dist/lib",
"declaration": true
}
}

View File

@@ -0,0 +1,6 @@
{
"include": [
"**/*.ts",
"**/*.js",
]
}

View File

@@ -1,3 +1,5 @@
{
"include": ["jest.config.ts"]
"include": [
"./jest.config.ts"
]
}