-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const { transformer } = require('./src/transformer') | ||
const { nameTransformer } = require('./src/transformer') | ||
|
||
/** @type { import('style-dictionary') } */ | ||
/** @type { import('style-dictionary').Config } */ | ||
module.exports = { | ||
source: ['tokens/base.json', 'tokens/pixiv-dark.json'], | ||
transform: { | ||
'name/cti/kebab': { | ||
'charcoal/kebab': { | ||
type: 'name', | ||
transformer: transformer, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
transformer: nameTransformer, | ||
}, | ||
}, | ||
platforms: { | ||
css: { | ||
transforms: ['charcoal/kebab'], | ||
transformGroup: 'css', | ||
buildPath: 'build/css/', | ||
prefix: 'charcoal', | ||
files: [ | ||
{ | ||
destination: '_variables_dark.css', | ||
format: 'css/variables', | ||
options: { | ||
selector: ":root[data-color-scheme='dark']", | ||
outputReferences: true, | ||
}, | ||
}, | ||
], | ||
options: { | ||
outputReferences: true, | ||
}, | ||
}, | ||
}, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const { transformer } = require('./src/transformer') | ||
const { nameTransformer } = require('./src/transformer') | ||
|
||
/** @type { import('style-dictionary') } */ | ||
/** @type { import('style-dictionary').Config } */ | ||
module.exports = { | ||
source: ['tokens/base.json', 'tokens/pixiv-light.json'], | ||
transform: { | ||
'name/cti/kebab': { | ||
'charcoal/kebab': { | ||
type: 'name', | ||
transformer: transformer, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
transformer: nameTransformer, | ||
}, | ||
}, | ||
platforms: { | ||
css: { | ||
transforms: ['charcoal/kebab'], | ||
transformGroup: 'css', | ||
buildPath: 'build/css/', | ||
prefix: 'charcoal', | ||
files: [ | ||
{ | ||
destination: '_variables_light.css', | ||
format: 'css/variables', | ||
options: { | ||
selector: | ||
":root[data-color-scheme='light'], :root:not([data-color-scheme])", | ||
outputReferences: true, | ||
}, | ||
}, | ||
], | ||
options: { | ||
outputReferences: true, | ||
}, | ||
}, | ||
}, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const { transformer } = require('.') | ||
const { nameTransformer } = require('.') | ||
test('tests transformer real case', () => { | ||
expect(transformer({ path: ['Color', 'container/secondary/defaultA'] })).toBe( | ||
'color-container-secondary-default-a' | ||
) | ||
expect( | ||
nameTransformer({ path: ['Color', 'container/secondary/defaultA'] }) | ||
).toBe('color-container-secondary-default-a') | ||
Check failure on line 6 in packages/token-cli/src/transformer/index.test.js GitHub Actions / testpackages/token-cli/src/transformer/index.test.js > tests transformer real case
|
||
}) | ||
test('tests transformer negative primitive value case', () => { | ||
expect(transformer({ path: ['Colors', 'Dark/Neutral/-10'] })).toBe( | ||
expect(nameTransformer({ path: ['Colors', 'Dark/Neutral/-10'] })).toBe( | ||
Check failure on line 9 in packages/token-cli/src/transformer/index.test.js GitHub Actions / testpackages/token-cli/src/transformer/index.test.js > tests transformer negative primitive value case
|
||
'colors-dark-neutral--10' | ||
) | ||
}) | ||
test('tests transformer negative primitive value unreal case', () => { | ||
expect(transformer({ path: ['Colors', 'dark/neutralABCDEF/-10'] })).toBe( | ||
expect(nameTransformer({ path: ['Colors', 'dark/neutralABCDEF/-10'] })).toBe( | ||
Check failure on line 14 in packages/token-cli/src/transformer/index.test.js GitHub Actions / testpackages/token-cli/src/transformer/index.test.js > tests transformer negative primitive value unreal case
|
||
'colors-dark-neutral-a-b-c-d-e-f--10' | ||
) | ||
}) | ||
test('tests transformer unreal case', () => { | ||
expect( | ||
transformer({ path: ['Color', 'Container/Secondary/DefaultABCDEF'] }) | ||
nameTransformer({ path: ['Color', 'Container/Secondary/DefaultABCDEF'] }) | ||
).toBe('color-container-secondary-default-a-b-c-d-e-f') | ||
Check failure on line 21 in packages/token-cli/src/transformer/index.test.js GitHub Actions / testpackages/token-cli/src/transformer/index.test.js > tests transformer unreal case
|
||
}) |