Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion design-system/primitives/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"@types/lodash": "^4.14.191",
"color2k": "^2.0.2",
"emery": "^1.4.1",
"fast-glob": "^3.2.12",
"json5": "^2.2.1",
"lodash": "^4.17.21",
"prettier": "^3.0.3",
Expand Down
28 changes: 16 additions & 12 deletions design-system/primitives/scripts/build.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import glob from 'fast-glob';
import { glob } from 'fs/promises';
import fs from 'fs';
import StyleDictionary from 'style-dictionary';

Expand All @@ -25,14 +25,18 @@ const build = ({
});
};

build({
// bring themes to the top of the file, but dark must be after light
files: glob.sync('dist/css/**/*.css').sort((a, b) => {
if (a.includes('theme')) return -1;
if (b.includes('theme')) return 1;
if (a.includes('dark')) return 1;
if (b.includes('dark')) return -1;
return 0;
}),
destination: 'dist/keystar.css',
});
async function main() {
build({
// bring themes to the top of the file, but dark must be after light
files: (await Array.fromAsync(glob('dist/css/**/*.css'))).sort((a, b) => {
if (a.includes('theme')) return -1;
if (b.includes('theme')) return 1;
if (a.includes('dark')) return 1;
if (b.includes('dark')) return -1;
return 0;
}),
destination: 'dist/keystar.css',
});
}

main();
10 changes: 5 additions & 5 deletions design-system/primitives/scripts/buildTokens.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import glob from 'fast-glob';
import { glob } from 'fs/promises';
import type StyleDictionary from 'style-dictionary';

import { KeystarStyleDictionary } from '../KeystarStyleDictionary';
Expand Down Expand Up @@ -36,9 +36,9 @@ const getStyleDictionaryConfig: StyleDictionaryConfigGenerator = (
},
});

export const buildDesignTokens = (
export const buildDesignTokens = async (
buildOptions: ConfigGeneratorOptions
): void => {
): Promise<void> => {
// buildFigma(buildOptions);

/** -----------------------------------
Expand Down Expand Up @@ -68,7 +68,7 @@ export const buildDesignTokens = (
/** -----------------------------------
* Size tokens
* ----------------------------------- */
const sizeFiles = glob.sync('tokens/size/*');
const sizeFiles = await Array.fromAsync(glob('tokens/size/*'));
for (const file of sizeFiles) {
KeystarStyleDictionary.extend(
getStyleDictionaryConfig(
Expand All @@ -95,7 +95,7 @@ export const buildDesignTokens = (
/** -----------------------------------
* JavaScript token schema
* ----------------------------------- */
const allFiles = glob.sync('tokens/**/*.json5');
const allFiles = await Array.fromAsync(glob('tokens/**/*.json5'));
KeystarStyleDictionary.extend(
getStyleDictionaryConfig(
`tokenSchema`,
Expand Down
1 change: 0 additions & 1 deletion packages/keystatic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@
"@types/signal-exit": "^3.0.1",
"@vitest/pretty-format": "^3.0.5",
"eslint": "^8.18.0",
"fast-glob": "^3.2.12",
"jest-diff": "^29.0.1",
"outdent": "^0.8.0",
"prismjs": "^1.29.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/keystatic/test/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import path from 'path';
import fs from 'fs/promises';
import nonPromiseFs from 'fs';
import outdent from 'outdent';
import fastGlob from 'fast-glob';
import onExit from 'signal-exit';
import { tmpdir } from 'os';
import { randomUUID } from 'crypto';
Expand Down Expand Up @@ -66,7 +65,7 @@ expect.addSnapshotSerializer({
const dirPrintingSymbol = Symbol('dir printing symbol');

export async function getFiles(dir: string, glob: string[] = ['**']) {
const files = await fastGlob(glob, { cwd: dir });
const files = await Array.fromAsync(fs.glob(glob, { cwd: dir }));
const filesObj: Record<string, string> = {
[dirPrintingSymbol]: true,
};
Expand Down
18 changes: 0 additions & 18 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.