diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6f42146 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: Publish Package to npmjs + +on: + push: + branches: [main] + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.x + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npx semantic-release diff --git a/README.md b/README.md index 3254434..565e45b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,17 @@ +[![npm version](https://badge.fury.io/js/@makerstreet%2Fdesign-tokens.svg)](https://badge.fury.io/js/@makerstreet%2Fdesign-tokens) + # Elements Design Tokens > Design System code generation for Elements projects with Figma Tokens and Style Dictionary -# Goal of this library +## Contents + +- [Goal of this library](#goal-of-this-library) +- [Supported platforms](#supported-platforms) +- [Installation](#installation) +- [CLI Usage](#cli-Usage) + +## Goal of this library At Elements we use Figma to create our designs. By using the [Figma Tokens](https://www.figmatokens.com/) plugin we define design tokens by with all the values needed to construct and maintain a design system for a project. @@ -12,6 +21,26 @@ With this library you can generate the theme code for a specific platform. - Android with Compose UI +## Installation + +You can install it globally: + +```bash +$ npm install -g @makerstreet/design-tokens +``` + +Or as a dev dependency: + +```bash +$ npm install -D @makerstreet/design-tokens +``` + +If you use yarn: + +```bash +$ yarn add @makerstreet/design-tokens --dev +``` + ## CLI Usage ```bash diff --git a/package.json b/package.json index 421a29b..59f938a 100644 --- a/package.json +++ b/package.json @@ -28,17 +28,14 @@ "commitmsg": "validate-commit-msg", "build": "tsc && yarn copy-files", "test": "jest", - "predocs": "rm -rf docs/", - "docs": "esdoc -c .esdoc.json", - "prepack": "npm run build", - "prepublish": "npm run build", - "semantic-release": "semantic-release pre && npm run publish && semantic-release post", + "prepublish": "yarn build", "prettier": "prettier", "prettier-write": "yarn prettier -- --parser typescript --no-semi --trailing-comma all --write --print-width 120", "prettier-project": "yarn prettier-write -- 'lib/**/*.{ts,tsx}'", "lint": "eslint \"lib/**/*.ts\"", "local": "sudo npm i -g && elements-design-tokens", - "copy-files": "copyfiles -u 1 src/**/*.ejs dist/" + "copy-files": "copyfiles -u 1 src/**/*.ejs dist/", + "semantic-release": "semantic-release" }, "license": "MIT", "engines": { @@ -98,5 +95,21 @@ "\\.snap$", "/node_modules/" ] - } + }, + "release":{ + "branches": [ + "+([0-9])?(.{+([0-9]),x}).x", + "main", + "next", + "next-major", + { + "name": "beta", + "prerelease": true + }, + { + "name": "alpha", + "prerelease": true + } + ] + } } diff --git a/yarn.lock b/yarn.lock index 2eb291e..a9d1358 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1189,14 +1189,6 @@ "@typescript-eslint/typescript-estree" "5.29.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@5.27.1": - version "5.27.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.27.1.tgz#4d1504392d01fe5f76f4a5825991ec78b7b7894d" - integrity sha512-fQEOSa/QroWE6fAEg+bJxtRZJTH8NTskggybogHt4H9Da8zd4cJji76gA5SBlR0MgtwF7rebxTbDKB49YUCpAg== - dependencies: - "@typescript-eslint/types" "5.27.1" - "@typescript-eslint/visitor-keys" "5.27.1" - "@typescript-eslint/scope-manager@5.29.0": version "5.29.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.29.0.tgz#2a6a32e3416cb133e9af8dcf54bf077a916aeed3" @@ -1214,29 +1206,11 @@ debug "^4.3.4" tsutils "^3.21.0" -"@typescript-eslint/types@5.27.1": - version "5.27.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.27.1.tgz#34e3e629501349d38be6ae97841298c03a6ffbf1" - integrity sha512-LgogNVkBhCTZU/m8XgEYIWICD6m4dmEDbKXESCbqOXfKZxRKeqpiJXQIErv66sdopRKZPo5l32ymNqibYEH/xg== - "@typescript-eslint/types@5.29.0": version "5.29.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.29.0.tgz#7861d3d288c031703b2d97bc113696b4d8c19aab" integrity sha512-X99VbqvAXOMdVyfFmksMy3u8p8yoRGITgU1joBJPzeYa0rhdf5ok9S56/itRoUSh99fiDoMtarSIJXo7H/SnOg== -"@typescript-eslint/typescript-estree@5.27.1": - version "5.27.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.27.1.tgz#7621ee78607331821c16fffc21fc7a452d7bc808" - integrity sha512-DnZvvq3TAJ5ke+hk0LklvxwYsnXpRdqUY5gaVS0D4raKtbznPz71UJGnPTHEFo0GDxqLOLdMkkmVZjSpET1hFw== - dependencies: - "@typescript-eslint/types" "5.27.1" - "@typescript-eslint/visitor-keys" "5.27.1" - debug "^4.3.4" - globby "^11.1.0" - is-glob "^4.0.3" - semver "^7.3.7" - tsutils "^3.21.0" - "@typescript-eslint/typescript-estree@5.29.0": version "5.29.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.29.0.tgz#e83d19aa7fd2e74616aab2f25dfbe4de4f0b5577" @@ -1262,14 +1236,6 @@ eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/visitor-keys@5.27.1": - version "5.27.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.27.1.tgz#05a62666f2a89769dac2e6baa48f74e8472983af" - integrity sha512-xYs6ffo01nhdJgPieyk7HAOpjhTsx7r/oB9LWEhwAXgwn33tkr+W8DI2ChboqhZlC4q3TC6geDYPoiX8ROqyOQ== - dependencies: - "@typescript-eslint/types" "5.27.1" - eslint-visitor-keys "^3.3.0" - "@typescript-eslint/visitor-keys@5.29.0": version "5.29.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.29.0.tgz#7a4749fa7ef5160c44a451bf060ac1dc6dfb77ee"