Skip to content
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

Adds a monorepo structure #261

Merged
merged 14 commits into from
Dec 6, 2019
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
187 changes: 123 additions & 64 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,35 @@ version: 2
aliases:
- &workspace
at: ~/
- &yarn_cache
- &yarn-cache
keys:
- v1-yarn-packages-{{ checksum "yarn.lock" }}
- v1-yarn-packages-
- &persist_build
- v1-yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
- v1-yarn-packages-{{ .Branch }}-
- &persist-build
root: ~/
paths:
- release/cjs
- release/esm
- release/umd
- release/packages

node_env: &node_env
node-env: &node-env
working_directory: ~/release
docker:
- image: circleci/node:lts
environment:
TERM: xterm

e2e_env: &e2e_env
e2e-env: &e2e-env
working_directory: ~/release
docker:
- image: cypress/browsers:chrome67
- image: cypress/browsers:node12.13.0-chrome78-ff70
environment:
TERM: xterm

jobs:
bootstrap:
<<: *node_env
<<: *node-env
steps:
- checkout
- restore_cache: *yarn_cache
- restore_cache: *yarn-cache
- run:
name: Checking environment
command: |
Expand All @@ -42,140 +40,201 @@ jobs:
yarn --version
- run:
name: Installing dependencies
command: yarn install --frozen-lockfile
command: yarn --frozen-lockfile
- save_cache:
key: v1-yarn-packages-{{ checksum "yarn.lock" }}
key: v1-yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- .cache
- run:
name: Building @atomic-layout/core
command: yarn build
working_directory: packages/atomic-layout-core
- run:
name: Bootstrapping the monorepo
command: node_modules/.bin/lerna bootstrap
- run:
name: Linting
command: yarn lint
- persist_to_workspace:
root: ~/
paths:
- .cache
- release

build_cjs:
<<: *node_env
##
# Core
##
core-test-unit:
<<: *node-env
steps:
- attach_workspace: *workspace
- restore_cache: *yarn-cache
- run:
name: Running unit tests
command: yarn test
working_directory: packages/atomic-layout-core

##
# styled-components
##
styled-build-cjs:
<<: *node-env
steps:
- attach_workspace: *workspace
- restore_cache: *yarn_cache
- restore_cache: *yarn-cache
- run:
name: Building CJS module
command: yarn build:cjs
working_directory: packages/atomic-layout
- run:
name: Checking bundle size
command: yarn bundlesize
- persist_to_workspace: *persist_build
name: Checking CJS bundle size
command: yarn bundlesize:cjs
working_directory: packages/atomic-layout
- persist_to_workspace: *persist-build

build_umd:
<<: *node_env
styled-build-umd:
<<: *node-env
steps:
- attach_workspace: *workspace
- restore_cache: *yarn_cache
- restore_cache: *yarn-cache
- run:
name: Building UMD module
command: yarn build:umd
- persist_to_workspace: *persist_build
working_directory: packages/atomic-layout
- run:
name: Chechking UMD bundle size
command: yarn bundlesize:umd
working_directory: packages/atomic-layout
- persist_to_workspace: *persist-build

build_esm:
<<: *node_env
styled-build-esm:
<<: *node-env
steps:
- attach_workspace: *workspace
- restore_cache: *yarn_cache
- restore_cache: *yarn-cache
- run:
name: Building ESM module
command: yarn build:esm
- persist_to_workspace: *persist_build
working_directory: packages/atomic-layout
- run:
name: Chechking ESM bundle size
command: yarn bundlesize:esm
working_directory: packages/atomic-layout
- persist_to_workspace: *persist-build

test_unit:
<<: *node_env
styled-test-unit:
<<: *node-env
steps:
- attach_workspace: *workspace
- restore_cache: *yarn_cache
- restore_cache: *yarn-cache
- run:
name: Unit tests
command: yarn test:unit --coverage --coverageReporters=text-lcov | node_modules/.bin/coveralls
name: Running unit tests
command: yarn test:unit
working_directory: packages/atomic-layout

test_e2e_cjs:
<<: *e2e_env
styled-test-e2e-cjs:
<<: *e2e-env
steps:
- attach_workspace: *workspace
- restore_cache: *yarn_cache
- restore_cache: *yarn-cache
- run:
name: DEBUG Check that CJS build exists
command: ls -R packages/atomic-layout/lib
- run:
name: Building Storybook (CJS)
command: yarn build:storybook
working_directory: packages/atomic-layout
- run:
name: Integration tests
command: yarn test:e2e
working_directory: packages/atomic-layout
- run:
name: Creating test results directory
command: mkdir test-results
working_directory: packages/atomic-layout
- store_test_results:
path: test-results
- store_artifacts:
path: cypress/videos
path: packages/atomic-layout/test-results
- store_artifacts:
path: cypress/screenshots
path: packages/atomic-layout/cypress/screenshots

test_e2e_umd:
<<: *e2e_env
styled-test-e2e-umd:
<<: *e2e-env
steps:
- attach_workspace: *workspace
- restore_cache: *yarn_cache
- restore_cache: *yarn-cache
- run:
name: DEBUG Check that CJS build exists
command: ls -R packages/atomic-layout/lib
- run:
name: Building Storybook (UMD)
command: yarn build:storybook:umd
working_directory: packages/atomic-layout
- run:
name: Integration tests
command: yarn test:e2e
working_directory: packages/atomic-layout
- store_test_results:
path: test-results
- store_artifacts:
path: cypress/videos
path: packages/atomic-layout/test-results
- store_artifacts:
path: cypress/screenshots
path: packages/atomic-layout/cypress/screenshots

test_e2e_esm:
<<: *e2e_env
styled-test-e2e-esm:
<<: *e2e-env
steps:
- attach_workspace: *workspace
- restore_cache: *yarn_cache
- restore_cache: *yarn-cache
- run:
name: DEBUG Check that CJS build exists
command: ls -R packages/atomic-layout/lib
- run:
name: Building Storybook (ESM)
command: yarn build:storybook:esm
working_directory: packages/atomic-layout
- run:
name: Integration tests
command: yarn test:e2e
working_directory: packages/atomic-layout
- store_test_results:
path: test-results
path: packages/atomic-layout/test-results
- store_artifacts:
path: cypress/videos
- store_artifacts:
path: cypress/screenshots
path: packages/atomic-layout/cypress/screenshots

workflows:
version: 2
release:
jobs:
- bootstrap

- test_unit:
# @atomic-layout/core
- core-test-unit:
requires:
- bootstrap

# styled-components
- styled-test-unit:
requires:
- bootstrap

- build_cjs:
- styled-build-cjs:
requires:
- bootstrap
- test_e2e_cjs:
- styled-test-e2e-cjs:
requires:
- build_cjs
- bootstrap
- styled-build-cjs

- build_umd:
- styled-build-umd:
requires:
- bootstrap
- test_e2e_umd:
- styled-test-e2e-umd:
requires:
- build_umd
- bootstrap
- styled-build-umd

- build_esm:
- styled-build-esm:
requires:
- bootstrap
- test_e2e_esm:
- styled-test-e2e-esm:
requires:
- build_esm
- bootstrap
- styled-build-esm
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,13 @@ Verify your newly created E2E test by [Running E2E tests](#running-e2e-tests) an

### Verifying changes

There is a shorthand command to verify your introduced changes:
There is a shorthand command to verify your newly introduced changes on local:

```bash
$ yarn ci
$ yarn verify
```

> This is going to build the library, Storybook, and run unit and E2E tests. It's **recommended you perform this command** before creating a Pull request.
> This is going to build and test all the packages. This command can also be run in a package's directory to verify that respective package.

## Afterword

Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
<!-- Make sure all of the below are checked -->

- [ ] My branch is up-to-date with the latest `master`
- [ ] I ran `yarn ci` and verified the build and tests passing
- [ ] I ran `yarn verify` and verified the build and tests passing
11 changes: 4 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ node_modules
/coverage

# Build
/cjs
/esm
/umd
/types
lib

# Cypress
cypress/fixtures
cypress/videos
cypress/screenshots
**/cypress/fixtures
**/cypress/videos
**/cypress/screenshots
storybook-static

# Editors
Expand Down
16 changes: 0 additions & 16 deletions .storybook/webpack.config.js

This file was deleted.

20 changes: 0 additions & 20 deletions cypress/support/index.js

This file was deleted.

16 changes: 0 additions & 16 deletions jest.config.js

This file was deleted.

Loading