Skip to content

Commit

Permalink
removing yarn in favour of npm (#464)
Browse files Browse the repository at this point in the history
* removing yarn in favour of npm

* remove yarn lock for storybook

* rebuild lock files & remove unused failing import

* trying webpack fix

---------

Co-authored-by: Reza Rahman <[email protected]>
  • Loading branch information
lukasoppermann and rezrah authored Jan 30, 2023
1 parent cd4d5b3 commit 57c70a6
Show file tree
Hide file tree
Showing 41 changed files with 73,089 additions and 32,209 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
node-version: 16

- name: Install dependencies
run: yarn install --frozen-lockfile && cd docs && yarn install --frozen-lockfile
run: npm ci --legacy-peer-deps --no-audit --no-fund && cd docs && npm ci --legacy-peer-deps --no-audit --no-fund

- name: Build v1 tokens
run: npm run build
Expand All @@ -43,7 +43,7 @@ jobs:
node-version: 16

- name: Install dependencies
run: yarn install --frozen-lockfile && cd docs && yarn install --frozen-lockfile
run: npm ci --legacy-peer-deps --no-audit --no-fund && cd docs && npm ci --legacy-peer-deps --no-audit --no-fund

- name: Build v1 tokens
run: npm run build
Expand All @@ -68,7 +68,7 @@ jobs:
node-version: 16

- name: Install dependencies
run: yarn install --frozen-lockfile && cd docs && yarn install --frozen-lockfile
run: npm ci --legacy-peer-deps --no-audit --no-fund && cd docs && npm ci --legacy-peer-deps --no-audit --no-fund

- name: Lint
run: npm run format:check
Expand All @@ -87,7 +87,7 @@ jobs:
node-version: 16

- name: Install dependencies
run: yarn install --frozen-lockfile && cd docs && yarn install --frozen-lockfile
run: npm ci --legacy-peer-deps --no-audit --no-fund && cd docs && npm ci --legacy-peer-deps --no-audit --no-fund

- name: Build v1 tokens
run: npm run build
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: Build and deploy
uses: primer/.github/.github/workflows/deploy.yml@main
with:
node_version: 14
install: yarn && cd docs && yarn && cd ..
build: cd docs && yarn build
node_version: 16
install: npm ci && cd docs && npm ci && cd ..
build: cd docs && npm run build
output_dir: docs/public
6 changes: 3 additions & 3 deletions .github/workflows/deploy_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
name: Build and deploy
uses: primer/.github/.github/workflows/deploy_preview.yml@main
with:
node_version: 14
install: yarn
build: yarn build:tokens && yarn build && yarn build:v3 && cd docs && yarn build:preview
node_version: 16
install: npm ci --no-audit --no-fund
build: npm run build:tokens && npm run build && npm run build:v3 && cd docs && npm run build:preview
output_dir: docs/public

post_storybook:
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 16.x

- name: Create comment (if necessary)
uses: actions/github-script@v5
Expand Down Expand Up @@ -54,25 +54,25 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 16.x

- name: Install dependencies
run: yarn
run: npm ci --no-audit --no-fund --include=dev

- name: Build tokens
run: yarn build
run: npm run build

- name: Build experimental tokens
run: yarn build:tokens
run: npm run build:tokens

- name: Install dependencies (base)
run: pushd base; yarn; popd
run: pushd base; npm i --no-audit --no-fund; popd

- name: Build (base)
run: pushd base; yarn build; popd
run: pushd base; npm run build; popd

- name: Build (base experimental)
run: pushd base; yarn build:tokens; popd
run: pushd base; npm run build:tokens; popd

- name: Diff
uses: primer/comment-token-update@main
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 16.x

- name: Install dependencies
run: yarn && pushd docs; yarn; popd
run: npm ci --legacy-peer-deps --no-audit --no-fund && pushd docs; npm ci --legacy-peer-deps --no-audit --no-fund; popd

- name: Build tokens
run: yarn build
run: npm run build

- name: Build experimental tokens
run: yarn build:tokens
run: npm run build:tokens

- name: Create release pull request or publish to npm
id: changesets
uses: changesets/[email protected]
with:
title: Release Tracking
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: yarn release
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GPR_AUTH_TOKEN_SHARED }}
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}
12 changes: 6 additions & 6 deletions .github/workflows/release_canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 16.x

- name: Install dependencies
run: yarn
run: npm ci --legacy-peer-deps --no-audit --no-fund --include=dev

- name: Build tokens
run: yarn build
run: npm run build

- name: Build experimental tokens
run: yarn build:tokens
run: npm run build:tokens

- name: Create .npmrc
run: |
Expand All @@ -45,8 +45,8 @@ jobs:
run: |
echo "$( jq '.version = "0.0.0"' package.json )" > package.json
echo -e "---\n'@primer/primitives': patch\n---\n\nFake entry to force publishing" > .changeset/force-snapshot-release.md
yarn changeset version --snapshot
yarn changeset publish --tag canary
npx changeset version --snapshot
npx changeset publish --tag canary
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release_candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 16.x

- name: Install dependencies
run: yarn
run: npm ci --legacy-peer-deps

- name: Build tokens
run: yarn build
run: npm run build

- name: Build experimental tokens
run: yarn build:tokens
run: npm run build:tokens

- name: Create .npmrc
run: |
Expand All @@ -43,7 +43,7 @@ jobs:
run: |
version=$(jq -r .version package.json)
echo "$( jq ".version = \"$(echo $version)-rc.$(git rev-parse --short HEAD)\"" package.json )" > package.json
yarn publish --tag next
npm publish --tag next
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ node_modules
/dist/
/tokens-v2-private/
/tokens-v3-private/
package-lock.json
yarn.lock
coverage/
2 changes: 1 addition & 1 deletion DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

## Build

`yarn run build`
`npm run build`

Tokens are transforms and built with [style-dictionary](https://amzn.github.io/style-dictionary/#/). The [config](./build.js) contains custom transforms, formats, and exports to generate tokens for each platform. We currently support CSS vars, TS and JS.

Expand Down
13 changes: 13 additions & 0 deletions docs/babel-defines.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const shared = {
__DEV__: "process.env.NODE_ENV !== 'production'",
}

module.exports = {
development: shared,
test: shared,
production: {
...shared,
__DEV__: 'false',
'process.env.NODE_ENV': "'production'",
},
}
1 change: 0 additions & 1 deletion docs/content/spacing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import InlineCode from '@primer/gatsby-theme-doctocat/src/components/inline-code
import List from '@primer/gatsby-theme-doctocat/src/components/list.js'
import Note from '@primer/gatsby-theme-doctocat/src/components/note.js'
import Status from '@primer/gatsby-theme-doctocat/src/components/status-label.js'
import DoDont from '@primer/gatsby-theme-doctocat/src/components/do-dont.js'
import {createGlobalStyle} from 'styled-components'
import ControlVisual from '../src/components/control.tsx'
import UIControlTable from '../src/components/tables/UIControlTable.tsx'
Expand Down
10 changes: 5 additions & 5 deletions docs/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ module.exports = {
title: 'Primer Primitives',
shortName: 'Primitives',
description: 'Color, spacing, and typography primitives for the Primer Design System',
imageUrl: 'https://user-images.githubusercontent.com/10384315/53922681-2f6d3100-402a-11e9-9719-5d1811c8110a.png'
imageUrl: 'https://user-images.githubusercontent.com/10384315/53922681-2f6d3100-402a-11e9-9719-5d1811c8110a.png',
},
pathPrefix: '/primitives',
plugins: [
{
resolve: '@primer/gatsby-theme-doctocat',
options: {
defaultBranch: 'main',
repoRootPath: '..'
}
}
]
repoRootPath: '..',
},
},
],
}
23 changes: 23 additions & 0 deletions docs/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const defines = require('./babel-defines')

exports.onCreateWebpackConfig = ({actions, plugins, getConfig}) => {
const config = getConfig()
// Add our `__DEV__` and `process.env.NODE_ENV` defines
config.plugins.push(plugins.define(defines[process.env.NODE_ENV || 'development']))

// Polyfill `path` and stub `fs` for use in the browser
// https://www.gatsbyjs.com/docs/reference/release-notes/migrating-from-v2-to-v3/#webpack-5-node-configuration-changed-nodefs-nodepath-
config.resolve = {
...config.resolve,
alias: {
...config.resolve.alias,
path: require.resolve('path-browserify'),
},
fallback: {
...config.resolve.fallback,
fs: false,
},
}

actions.replaceWebpackConfig(config)
}
Loading

0 comments on commit 57c70a6

Please sign in to comment.