-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
135 changed files
with
87,423 additions
and
4,372 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,68 +12,30 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Tools | ||
uses: volta-cli/action@v1 | ||
- name: Cache pnpm modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: latest | ||
- uses: wyvox/action@v1 | ||
- run: pnpm build | ||
- run: pnpm build:fixtures | ||
- run: pnpm lint | ||
|
||
- run: pnpm install | ||
- run: pnpm --filter 'theemo' lint | ||
# build: | ||
# runs-on: ubuntu-latest | ||
|
||
# steps: | ||
# - uses: wyvox/action@v1 | ||
# - run: pnpm build | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [14.x, 16.x, 18.x] | ||
node-version: [16.x, 18.x, 20.x] | ||
|
||
# needs: build | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Tools | ||
uses: volta-cli/action@v1 | ||
- uses: wyvox/action@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Cache pnpm modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: latest | ||
|
||
- run: pnpm install | ||
- run: pnpm --filter 'theemo' test | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Tools | ||
uses: volta-cli/action@v1 | ||
- name: Cache pnpm modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: latest | ||
|
||
- run: pnpm install | ||
- run: pnpm -r --parallel build | ||
- run: pnpm --filter 'theemo' dts | ||
- run: pnpm build | ||
- run: pnpm build:fixtures | ||
- run: pnpm --filter '@theemo/*' test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,6 @@ | |
.eslintcache | ||
.env | ||
node_modules/ | ||
coverage/ | ||
coverage/ | ||
dist/ | ||
.turbo/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
#public-hoist-pattern[]=*prettier* | ||
#public-hoist-pattern[]=*eslint* | ||
public-hoist-pattern[]=*prettier* | ||
public-hoist-pattern[]=*eslint* | ||
public-hoist-pattern[]=*ember-template-lint* | ||
public-hoist-pattern[]=*stylelint* | ||
strict-peer-dependencies=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
{ | ||
"typescript.preferences.importModuleSpecifier": "relative" | ||
"typescript.preferences.importModuleSpecifier": "relative", | ||
"eslint.workingDirectories": [ | ||
// problem with glob, doesn't work with `prettier/prettier` - wants me to | ||
// use trailing comma, dafuq no! | ||
// "packages/@theemo/*", | ||
"packages/@theemo/cli", | ||
"packages/@theemo/core", | ||
"packages/@theemo/figma", | ||
"packages/@theemo/sync", | ||
"packages/@theemo/style-dictionary", | ||
"packages/@theemo/theme", | ||
"packages/theemo", | ||
"testing/fixtures" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
const { configs } = require('@gossi/config-eslint'); | ||
|
||
const config = configs.nodeESM(); | ||
|
||
module.exports = { | ||
...config, | ||
overrides: [ | ||
...config.overrides, | ||
{ | ||
files: ['**/*.ts'], | ||
rules: { | ||
'n/no-missing-import': 0 | ||
} | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'use strict'; | ||
|
||
module.exports = require('@gossi/config-prettier'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"sourceMaps": true, | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript", | ||
"tsx": false, | ||
"decorators": false, | ||
"dynamicImport": true | ||
}, | ||
"target": "es2019", | ||
"loose": true | ||
}, | ||
"module": { | ||
"type": "es6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env node | ||
|
||
// eslint-disable-next-line import/no-unassigned-import, n/no-missing-import | ||
import '../dist/cli.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "@theemo/cli", | ||
"version": "0.0.1", | ||
"description": "Theemo CLI", | ||
"license": "MIT", | ||
"author": "Thomas Gossmann", | ||
"homepage": "https://theemo.io", | ||
"bugs": "https://github.com/theemo-tokens/theemo/issues", | ||
"repository": "https://github.com/theemo-tokens/theemo", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"keywords": [ | ||
"design system", | ||
"theme", | ||
"design tokens" | ||
], | ||
"type": "module", | ||
"bin": { | ||
"theemo": "bin/theemo.js" | ||
}, | ||
"files": [ | ||
"dist", | ||
"bin", | ||
"package.json" | ||
], | ||
"typings": "./dist/index.d.ts", | ||
"exports": { | ||
".": "./dist/index.js", | ||
"./package.json": "./package.json" | ||
}, | ||
"scripts": { | ||
"build": "concurrently -r 'npm:build:*'", | ||
"build:js": "swc ./src -d ./dist", | ||
"build:types": "tsc --emitDeclarationOnly", | ||
"lint": "concurrently -g 'npm:lint:*(!fix)'", | ||
"lint:fix": "concurrently -g 'npm:lint:*:fix'", | ||
"lint:js": "eslint . --cache", | ||
"lint:js:fix": "eslint . --fix", | ||
"lint:types": "tsc --noEmit", | ||
"start": "concurrently -r 'npm:start:*'", | ||
"start:js": "swc ./src -d ./dist -w", | ||
"start:types": "tsc --emitDeclarationOnly -w" | ||
}, | ||
"dependencies": { | ||
"@theemo/sync": "workspace:*", | ||
"commander": "^11.0.0", | ||
"cosmiconfig": "^8.2.0", | ||
"dotenv": "^16.3.1", | ||
"read-pkg-up": "^10.0.0", | ||
"esm": "^3.2.25" | ||
}, | ||
"devDependencies": { | ||
"@gossi/config-eslint": "^0.4.0", | ||
"@gossi/config-prettier": "^0.4.0", | ||
"@swc/cli": "^0.1.62", | ||
"@swc/core": "^1.3.67", | ||
"@types/node": "^20.3.3", | ||
"concurrently": "^8.2.0", | ||
"eslint": "^8.44.0", | ||
"prettier": "^2.8.5", | ||
"typescript": "^5.1.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import path from 'node:path'; | ||
import { argv } from 'node:process'; | ||
import { fileURLToPath } from 'node:url'; | ||
|
||
import { Command } from 'commander'; | ||
import { cosmiconfig } from 'cosmiconfig'; | ||
import dotenv from 'dotenv'; | ||
import { readPackageUp } from 'read-pkg-up'; | ||
|
||
import Theemo from './theemo.js'; | ||
|
||
import type { TheemoConfig } from './config.js'; | ||
|
||
dotenv.config(); | ||
|
||
async function loadPackage() { | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
const foundPkg = await readPackageUp({ cwd: __dirname }); | ||
|
||
if (foundPkg) { | ||
return foundPkg.packageJson; | ||
} | ||
|
||
return undefined; | ||
} | ||
|
||
async function loadConfig(program: Command): Promise<TheemoConfig | undefined> { | ||
const explorer = cosmiconfig('theemo', { | ||
searchPlaces: [ | ||
`.theemorc.js`, | ||
`.theemorc.cjs`, | ||
`.theemorc.mjs`, | ||
`.config/theemorc.js`, | ||
`.config/theemorc.cjs`, | ||
`.config/theemorc.mjs`, | ||
`theemo.config.js`, | ||
`theemo.config.cjs`, | ||
`theemo.config.mjs` | ||
] | ||
}); | ||
const result = await explorer.search(); | ||
|
||
if (result === null) { | ||
return program.error( | ||
'Cannot find config for theemo. Please provide a config for theemo to function properly' | ||
); | ||
} | ||
|
||
return result.config as TheemoConfig; | ||
} | ||
|
||
export async function cli() { | ||
// setup program | ||
const program = new Command(); | ||
const pkg = await loadPackage(); | ||
|
||
if (pkg) { | ||
program.version(pkg.version).name(pkg.name); | ||
} | ||
|
||
program.usage('command'); | ||
|
||
program | ||
.command('sync') | ||
.description('sync from your source into your token manager tool') | ||
.action(async () => { | ||
// config | ||
const config = await loadConfig(program); | ||
|
||
if (config) { | ||
const theemo = new Theemo(config); | ||
|
||
await theemo.sync(); | ||
} | ||
}); | ||
|
||
// program | ||
// .command('generate') | ||
// .description('generates an adaptive CSS theme file') | ||
// .action(() => { | ||
// theemo.generate(); | ||
// }); | ||
|
||
program.parse(argv); | ||
} | ||
|
||
cli(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { SyncConfig } from '@theemo/sync'; | ||
|
||
/** | ||
* The main config to control all commands for theemo: | ||
* | ||
* - `sync` | ||
* - `build` | ||
*/ | ||
export interface TheemoConfig { | ||
/** Config for the sync command */ | ||
sync?: SyncConfig; | ||
} | ||
|
||
export function defineConfig(config: TheemoConfig) { | ||
return config; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { defineConfig } from './config.js'; |
Oops, something went wrong.