Skip to content

Minor updates against issues #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.148.1/containers/javascript-node/.devcontainer/base.Dockerfile

# [Choice] Node.js version: 14, 12, 10
ARG VARIANT="14-buster"
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"

# [Optional] Uncomment if you want to install more global node modules
# RUN sudo -u node npm install -g <your-package-list-here>

22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "Node.js",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "14"
}
},
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"github.vscode-pull-request-github",
"ms-vsliveshare.vsliveshare",
"eamodio.gitlens",
"streetsidesoftware.code-spell-checker"
],
"postCreateCommand": "yarn install",
"remoteUser": "node"
}
82 changes: 0 additions & 82 deletions .drone.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: build

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
name: Build, lint, test, sonar on main branch
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: '12'

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1

- name: Lint
run: yarn lint

- name: Danger
run: yarn danger ci
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Test
run: yarn test --ci --coverage --maxWorkers=2

- name: Build
run: yarn build

- name: Build Storybook
run: yarn build-storybook --quiet

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }}
45 changes: 23 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
name: CI
on: [push]
name: build

on:
push:
branches:
- main

jobs:
build:
name: Build, lint, test, sonar on main branch
runs-on: ubuntu-latest

steps:
- name: Begin CI...
- name: Checkout repo
uses: actions/checkout@v2

- name: Use Node 12
uses: actions/setup-node@v1
with:
node-version: 12.x
fetch-depth: 0

- name: Use cached node_modules
uses: actions/cache@v1
- name: Set up Node
uses: actions/setup-node@v1
with:
path: node_modules
key: nodeModules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
nodeModules-
node-version: '12'

- name: Install dependencies
run: yarn install --frozen-lockfile
env:
CI: true
- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1

- name: Lint
run: yarn lint
env:
CI: true

- name: Test
run: yarn test --ci --coverage --maxWorkers=2
env:
CI: true

- name: Build
run: yarn build

- name: Build Storybook
run: yarn build-storybook --quiet

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
CI: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: release

on:
release:
types: [created]

jobs:
release:
name: Build and publish
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: '12'
registry-url: 'https://registry.npmjs.org'

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1

- name: Publish Package
run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish Docs
run: yarn deploy-storybook --ci
env:
GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/size.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: size
on: [pull_request]
jobs:
size:
runs-on: ubuntu-latest
env:
CI_JOB_NUMBER: 1
steps:
- uses: actions/checkout@v1
- uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ lib
lib-esm
_bundles
docs
coverage
test-report.xml

# misc
.cache
Expand Down
7 changes: 5 additions & 2 deletions .storybook/committed/withTheme.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { useDarkMode } from 'storybook-dark-mode'
import { ThemeProvider } from '../../src'
import { ThemeProvider, Box } from '../../src'

/**
* Wrap a component with the default ThemeProvider
Expand All @@ -11,7 +11,10 @@ export const withTheme = (Story) => {
const choice = useDarkMode() ? 'dark' : 'light'
return (
<ThemeProvider choice={choice}>
<Story />
{/* Temporary background until themeing in docs is supported */}
<Box bgcolor="background.paper" p={3}>
<Story />
</Box>
</ThemeProvider>
)
}
1 change: 0 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module.exports = {
stories: ['../stories/**/*.stories.@(ts|tsx|mdx)'],
addons: [
'@storybook/addon-links',
{
name: '@storybook/addon-essentials',
options: {
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ We use storybook to develop and document the components, this is run in developm
yarn storybook
```

## Dev Containers

This project contains a [VSCode Dev Container Configuration](https://code.visualstudio.com/docs/remote/containers).

To use this, you must install the [VSCode Remote Container Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).

Once this is installed, you should be prompted (when opening the project in it's root directory) to `Reopen in Container`. If this prompt does not appear, open the Command Palette and run `Remote Containers: Rebuild and Reopen in Container`.

This will re-open the project, with the project files mounted in a Docker container, which will include all the VSCode extensions from the dev container (e.g. useful extensions, formatters etc).

## CI

Pull requests go through CI checks using Drone. Merged pull requests to master update the deployed documentation and can update the package in the GitHub registry if the version number is updated.
Expand Down
3 changes: 3 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@
"parcel": "^1.12.4",
"shx": "^0.3.2",
"typescript": "^4.0.5"
},
"resolutions": {
"node-forge": "^0.10.0"
}
}
8 changes: 4 additions & 4 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3307,10 +3307,10 @@ node-addon-api@^1.7.1:
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-1.7.1.tgz#cf813cd69bb8d9100f6bdca6755fc268f54ac492"
integrity sha512-2+DuKodWvwRTrCfKOeR24KIc5unKjOh8mz17NCzVnHWfjAdDqbfbjqh7gUT+BkXBRQM52+xCHciKWonJ3CbJMQ==

node-forge@^0.7.1:
version "0.7.6"
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.7.6.tgz#fdf3b418aee1f94f0ef642cd63486c77ca9724ac"
integrity sha512-sol30LUpz1jQFBjOKwbjxijiE3b6pjd74YwfD0fJOKPjF+fONKb2Yg8rYgS6+bK6VDl+/wfr4IYpC7jDzLUIfw==
node-forge@^0.10.0, node-forge@^0.7.1:
version "0.10.0"
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3"
integrity sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==

node-libs-browser@^2.0.0:
version "2.2.1"
Expand Down
Loading