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 8aa75c5..cb1a556 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 + } + ] + } }