Skip to content

Commit

Permalink
chore: Migrate from npm to yarn (#40)
Browse files Browse the repository at this point in the history
Co-authored-by: Raisa Primerova <[email protected]>
  • Loading branch information
alanbsmith and RayRedGoose authored Oct 10, 2023
1 parent 3626ca5 commit 13b551c
Show file tree
Hide file tree
Showing 9 changed files with 6,050 additions and 10,203 deletions.
46 changes: 9 additions & 37 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,10 @@ jobs:

steps:
- uses: actions/checkout@v3
## This step installs node and sets up several matchers (regex matching for Github Annotations). See
## https://github.com/actions/setup-node/blob/25316bbc1f10ac9d8798711f44914b1cf3c4e954/src/main.ts#L58-L65
- uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: https://registry.npmjs.org

## The caching steps create a cache key based on the OS and hash of the package-json.lock file.
## A cache hit will copy files from Github cache into the `node_modules` folder.
## A cache hit will skip the cache steps.
- name: Cache node modules
id: npm-cache
uses: actions/cache@v3
- uses: Workday/canvas-kit-actions/install@v1
with:
path: node_modules
key: ${{ runner.os }}-16.x-node-modules-hash-${{ hashFiles('package-lock.json') }}

## If `node_modules` has a cache hit, we're going to skip the `npm install` step.
- name: Install Packages
if: steps.npm-cache.outputs.cache-hit != 'true'
shell: bash
run: npm install --production=false
node_version: 18.x

check:
runs-on: ubuntu-latest
Expand All @@ -38,29 +20,19 @@ jobs:
steps:
- uses: actions/checkout@v3

## The caching steps create a cache key based on the OS and hash of the package-json.lock file.
## A cache hit will copy files from Github cache into the `node_modules` folder.
## A cache hit will skip the cache steps.
- name: Cache node modules
id: npm-cache
uses: actions/cache@v3
- uses: Workday/canvas-kit-actions/install@v1
with:
path: node_modules
key: ${{ runner.os }}-16.x-node-modules-hash-${{ hashFiles('package-lock.json') }}

- name: Install Packages
if: steps.npm-cache.outputs.cache-hit != 'true'
shell: bash
run: npm install --production=false

node_version: 18.x

# Keep steps separate for Github Actions annotation matching: https://github.com/actions/setup-node/blob/83c9f7a7df54d6b57455f7c57ac414f2ae5fb8de/src/setup-node.ts#L26-L33
- name: Lint
shell: bash
run: npm run lint
run: yarn lint

- name: Type Check
shell: bash
run: npm run typecheck
run: yarn typecheck

- name: Run Unit Tests
shell: bash
run: npm test
run: yarn test
28 changes: 4 additions & 24 deletions .github/workflows/release-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,9 @@ jobs:
persist-credentials: false
fetch-depth: 0 # Used for conventional commit ranges

## This step installs node and sets up several matchers (regex matching for Github
## Annotations). See
## https://github.com/actions/setup-node/blob/25316bbc1f10ac9d8798711f44914b1cf3c4e954/src/main.ts#L58-L65
- uses: actions/setup-node@v3
- uses: Workday/canvas-kit-actions/install@v1
with:
node-version: '18.x'
registry-url: https://registry.npmjs.org

## The caching steps create a cache key based on the OS and hash of the yarn.lock file. A
## cache hit will copy files from Github cache into the `node_modules` and `.cache/cypress`
## folders. A cache hit will skip the cache steps
- name: Cache node modules
id: npm-cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-18.x-node-modules-hash-${{ hashFiles('package-lock.json') }}

## If both `node_modules` and `.cache/cypress` were cache hits, we're going to skip the `yarn
## install` step. This effectively saves up to 3m on a cache hit build.
- name: Install Packages
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm install --production=false
node_version: 18.x

- name: Config git user
shell: bash
Expand Down Expand Up @@ -166,7 +146,7 @@ jobs:
# uses: changesets/action@v1
# with:
# # This expects you to have a script called release which does a build for your packages and calls changeset publish
# publish: npm run release
# publish: yarn release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ tmp
# dependencies
node_modules

# Prevent yarn.lock from accidentally being committed
yarn.lock

# IDE - VSCode
.vscode/*
!.vscode/settings.json
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.20.0
v18.18.0
12 changes: 6 additions & 6 deletions MAINTAINING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# clone the repo
git clone https://github.com/workday/canvas-tokens.git
# install dependencies
npm install
yarn install
```

## Building Tokens
Expand All @@ -22,7 +22,7 @@ npx nx build @workday/canvas-tokens
Our token documentation and visual tests are rendered in Storybook. To start Storybook locally, run:

```sh
npm run storybook
yarn storybook
```

## Syncing with Tokens Studio
Expand All @@ -49,7 +49,7 @@ you're good to go.
### Syncing Token Configurations

```sh
npm run tokens-config sync
yarn tokens-config sync
```

By default, this script fetches the config files for base, brand, and system tokens from the Canvas
Expand All @@ -60,7 +60,7 @@ If you only want to update one type of tokens, you can specify it in the script.

```sh
# only sync base tokens
npm run tokens-config sync base
yarn tokens-config sync base
```

### Merging Configuration Updates
Expand All @@ -71,7 +71,7 @@ or you can run the script. The script below will create a pull request to merge
tokens-studio-sync branch into main. If a pull request already exists, it will fail.

```sh
npm run tokens-config create-pull
yarn tokens-config create-pull
```

## Testing
Expand All @@ -82,7 +82,7 @@ We use [Jest](https://jestjs.io/docs/getting-started) to unit test internal logi
tests locally:

```sh
npm test
yarn test
```

## Publishing
Loading

0 comments on commit 13b551c

Please sign in to comment.