@servicetitan/tokens
Advanced tools
Comparing version 11.5.3-develop.0 to 11.6.0
{ | ||
"name": "@servicetitan/tokens", | ||
"version": "11.5.3-develop.0", | ||
"description": "", | ||
"homepage": "https://anvil.servicetitan.com", | ||
"repository": { | ||
"type": "git", | ||
"url": "github:servicetitan/pritchel" | ||
}, | ||
"main": "build/web/index.js", | ||
"scripts": { | ||
"build": "run-s clean build:*", | ||
"build:web": "node ./build-web.js", | ||
"build:swift": "node ./build-swift.js", | ||
"build:jetpack": "node ./build-kotlin.js", | ||
"build:figma": "node ./build-figma.js", | ||
"clean": "rm -rf build && echo \"Cleaning build folder\"", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"release": "auto shipit --dry-run && cli-confirm \"Are you sure the changes look correct?\" && npm run build && auto shipit" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"devDependencies": { | ||
"@auto-it/first-time-contributor": "^10.36.5", | ||
"@auto-it/omit-release-notes": "^10.36.5", | ||
"@auto-it/released": "^10.36.5", | ||
"auto": "^10.36.5", | ||
"cli-confirm": "^1.0.1", | ||
"handlebars": "^4.7.7", | ||
"lodash": "^4.17.21", | ||
"npm-run-all": "^4.1.5", | ||
"sass": "^1.50.1", | ||
"style-dictionary": "latest", | ||
"tinycolor2": "^1.4.2" | ||
} | ||
"name": "@servicetitan/tokens", | ||
"version": "11.6.0", | ||
"description": "", | ||
"homepage": "https://anvil.servicetitan.com", | ||
"repository": { | ||
"type": "git", | ||
"url": "github:servicetitan/anvil", | ||
"directory": "packages/tokens" | ||
}, | ||
"main": "./dist/tokens.js", | ||
"scripts": { | ||
"start": "npm-run-all watch --silent", | ||
"build": "npm-run-all build:init build:style-dictionary --silent", | ||
"build:init": "rimraf dist", | ||
"build:style-dictionary": "npm-run-all build:variables build:typescript build:message", | ||
"build:variables": "node ./build.js", | ||
"build:typescript": "tsc", | ||
"prebuild:message": "echo \" \"", | ||
"build:message": "echo \"🎉 Anvil Tokens built\"", | ||
"postbuild:message": "echo \" \"", | ||
"watch": "chokidar \"src/**/*.*\" -c \"npm run build\"" | ||
}, | ||
"files": [ | ||
"dist", | ||
"readme.md" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "16.9.1", | ||
"chokidar-cli": "3.0.0", | ||
"core-js": "3.17.3", | ||
"npm-run-all": "4.1.5", | ||
"rimraf": "3.0.2", | ||
"style-dictionary": "3.0.2", | ||
"typescript": "4.4.3" | ||
}, | ||
"gitHead": "57bea051dfc1e6cdf2275352a0e17301ee22620f" | ||
} |
@@ -1,26 +0,44 @@ | ||
# Project information | ||
https://servicetitan.atlassian.net/wiki/spaces/ADS/pages/2205188101/Pritchel | ||
# Anvil Tokens | ||
The design tokens project is available to use in developing custom components and UI that is also used in `@servicetitan/design-system`. It contains variables in SCSS, Less, and JS variables that can be imported into any type of project. | ||
# How it works | ||
## Installation | ||
``` | ||
npm install @servicetitan/tokens --save | ||
``` | ||
All of the design tokens and assets are in this package. This package has iOS(Swift), Android(Jetpack), and web code. | ||
Within the packages `dist/` directory there are a few files that can be used. | ||
To get started, run | ||
| File | Description | | ||
| ---------------- | ---------------------------------------- | | ||
| tokens.common.js | JS object of variables as module.exports | | ||
| tokens.less | Less variables | | ||
| tokens.scss | SCSS variables | | ||
## Using Less Tokens | ||
``` | ||
$ npm install | ||
$ npm run build | ||
@import (reference) '~@servicetitan/tokens/dist/tokens.less'; | ||
div { | ||
color: @color-blue; | ||
} | ||
``` | ||
The npm build task is what performs the style dictionary build steps to generate the files for each platform. Every time you change something in the style dictionary, like changing colors or adding design tokens, you will have to run this command again to generate the files. | ||
## Using SCSS Tokens | ||
# Adding new theme | ||
``` | ||
@import 'node_modules/@servicetitan/tokens/dist/tokens'; | ||
Source of all that is generated is at `tokens/themes/<theme name>`. Copy a theme to base on and make changes to the values and that's all you have to do. Don't forget that we also have Figma assets that needs to be created for a new theme. | ||
div { | ||
color: $color-blue; | ||
} | ||
``` | ||
# Updating existing token | ||
> Align with Anvil team before proceeding | ||
## Using JS Tokens | ||
1. Make a branch | ||
2. Update the token object located under `tokens/themes/<theme name>` with the new value | ||
3. run `npm run build` to build all assets | ||
4. Make a PR | ||
``` | ||
import tokens from '@servicetitan/tokens'; | ||
const Component = () => <div style={{backgroundColor: tokens.colorBlue}} /> | ||
``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 72 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
7
0
45
0
1
164301
89
4759