-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from tokens-studio/types
feat: remove types, use @tokens-studio/types instead
- Loading branch information
Showing
13 changed files
with
36 additions
and
71 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@tokens-studio/sd-transforms': minor | ||
--- | ||
|
||
BREAKING: remove modifier type files, use @tokens-studio/types instead for it. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,35 +1,28 @@ | ||
import cjs from '@rollup/plugin-commonjs'; | ||
import nodeResolve from '@rollup/plugin-node-resolve'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
|
||
const __dirname = new URL(import.meta.url).pathname; | ||
const input = path.join(__dirname, '..', '..', 'src', 'index.ts'); | ||
const file = path.join(__dirname, '..', '..', 'dist', 'index.cjs'); | ||
const pkg = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf-8')); | ||
|
||
const externalPackages = [ | ||
...Object.keys(pkg.dependencies || {}), | ||
...Object.keys(pkg.peerDependencies || {}), | ||
]; | ||
// Creating regexes of the packages to make sure subpaths of the | ||
// packages are also treated as external | ||
const regexesOfPackages = externalPackages.map(packageName => new RegExp(`^${packageName}(/.*)?`)); | ||
|
||
export default { | ||
external: regexesOfPackages, | ||
input, | ||
output: { | ||
file, | ||
dir: 'dist', | ||
format: 'cjs', | ||
preserveModules: true, | ||
entryFileNames: '[name].cjs', | ||
}, | ||
plugins: [ | ||
cjs(), | ||
nodeResolve(), | ||
typescript({ noEmit: true }), // noEmit doesn't seem to do anything...? | ||
// For some reason I can't get this typescript rollup plugin to stop emitting .D.TS files | ||
// so here's a quick plugin to delete those from the bundle pre- bundle.write(). | ||
// .D.TS files are already emitted by TSC when compiling the lib, this config is only for | ||
// outputting a CJS bundle for users that require CJS... | ||
{ | ||
name: 'prevent-type-decl', | ||
generateBundle(_, bundle) { | ||
Object.keys(bundle).forEach(filename => { | ||
if (filename.endsWith('.d.ts')) { | ||
delete bundle[filename]; | ||
} | ||
}); | ||
}, | ||
}, | ||
], | ||
plugins: [nodeResolve(), typescript({ tsconfig: 'tsconfig.build.json', declaration: 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
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
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,10 +1,10 @@ | ||
import { DesignToken } from 'style-dictionary'; | ||
import { modifyColor } from './modifyColor.js'; | ||
import { ColorModifier } from '@tokens-studio/types'; | ||
/** | ||
* Helper: Transforms color tokens with tokens studio color modifiers | ||
*/ | ||
export function transformColorModifiers(token: DesignToken): string | undefined { | ||
/** @type {ColorModifier} */ | ||
const modifier = token.$extensions['studio.tokens']?.modify; | ||
const modifier = token.$extensions['studio.tokens']?.modify as ColorModifier; | ||
return modifyColor(token.value, modifier); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"exclude": ["node_modules", "**/coverage/*", "test/**/*.test.ts"] | ||
"exclude": ["node_modules", "**/coverage/*", "test/**/*"] | ||
} |