Skip to content

Commit

Permalink
feat: split codebase into packages and set up monorepository (#1177)
Browse files Browse the repository at this point in the history
* refactor: try mono repo

* chore: merge

* chore: more packages

* chore: start creating presets

* chore: finish buttons

* chore: add some more packages

* chore: fixup

* chore: date input stuff

* chore: more inputs

* chore: more and more

* chore: more components

* chore: more and more fixup

* chore: add another field

* chore: more fields

* chore: more

* chore: move it

* chore: move it

* chore: finish move

* chore: fixup

* chore: fixup

* chore: fixup

* chore: fixup

* chore: add lerna

* chore: fix test

* chore: fix

* chore: ci fix

* chore: fixup

* chore: fixup

* chore: change bundelsize config

* chore: fix

* chore: fixup

* chore: bundlesize fix

* chore: add missing deps

* chore: fixup

* chore: revert bundlesize

* chore: try something

* chore: remove unnecessary code

* chore:  try this

* chore: remove unused dep

* chore: fixup

* chore: make vrt a package

* chore: move deps around

* chore: improve vrt webpack setup

* chore: fix

* chore: fix tests

* chore: package.json changes

* chore: package json change

* chore: rest

* chore: release

* chore: fixup

* chore: fix main package

* chore: fix

* chore: changes

* chore: add licence files for to each package

* refactor: release process, publish to canary

* chore: reorganize some folders, fix deps and build

* chore: fix imports and tests

* refactor(circleci): simplify workflows

* fix: netlify build command

* chore: test publish to canary from current branch

* chore: add alpha release command

* chore: use same version

* refactor: missing package.json info, keep internal code as non package, fix deps

* refactor: remove beta range version from react-intl peer dep

* refactor: use script to inject version on each package

* refactor: bump bundlesize limit for uikit

* refactor: add inputs preset

* refactor: drop input utils package

* refactor: add fields preset

* fix: exec file permissions

* fix: missing exports

* fix: do not use version in preset packages

* chore: bump bundlesize

* chore: update github labels

* feat: setup lerna changelog

* refactor: keep materials and i18n folders in ui-kit preset for backwards compatibility

* fix: missing files for npm publish

* chore: revert alpha version
  • Loading branch information
montezume authored and emmenko committed Dec 4, 2019
1 parent 7ae345a commit 4ed4f60
Show file tree
Hide file tree
Showing 624 changed files with 10,439 additions and 1,482 deletions.
163 changes: 56 additions & 107 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,58 @@ aliases:
- &working_directory ~/ui-kit

- &restore_yarn_cache
name: 'Restoring yarn cache'
keys:
- v1-yarn-cache-{{ checksum "yarn.lock" }}
- v1-yarn-cache
restore_cache:
name: 'Restoring yarn cache'
keys:
- v1-yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
- v1-yarn-cache-{{ .Branch }}
- v1-yarn-cache

- &save_yarn_cache
name: 'Saving yarn cache'
key: v1-yarn-cache-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- node_modules
save_cache:
name: 'Saving yarn cache'
key: v1-yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn

- &run_yarn
run: yarn --frozen-lockfile

executors:
node_10:
node_13:
docker:
- image: circleci/node:13.1
working_directory: *working_directory

commands:
install_dependencies:
description: 'Installing dependencies'
setup_dependencies:
description: Installing dependencies
steps:
- checkout
- restore_cache: *restore_yarn_cache
- run: yarn install --frozen-lockfile
- save_cache: *save_yarn_cache
build_artifacts:
description: 'Building artifacts'
steps:
- run: yarn build
- run: yarn bundlesize
save_workspace:
- *restore_yarn_cache
- *run_yarn
save_package_bundles:
steps:
- persist_to_workspace:
root: *working_directory
paths:
- dist
restore_workspace:
- design-system/dist/
- packages/**/dist/
- presets/**/dist/
restore_package_bundles:
steps:
- attach_workspace:
at: *working_directory
lint:
description: 'Running linters'
steps:
- run: yarn run generate-icons && yarn run jest --projects jest.eslint.config.js jest.stylelint.config.js --maxWorkers=3 --reporters jest-silent-reporter
unit_test:
description: 'Running unit tests'
build_packages:
description: Building packages
steps:
- run: yarn run jest --projects jest.test.config.js --maxWorkers=3 --reporters jest-silent-reporter
bundle_test:
description: 'Running bundle tests'
- run: yarn build
lint_and_test:
description: 'Running linters and tests'
steps:
- run: yarn run jest --projects jest.bundle.config.js --maxWorkers=3 --reporters jest-silent-reporter
- run:
name: Running linters and tests
command: yarn run jest --projects jest.{eslint,stylelint,test,bundle}.config.js --maxWorkers=3 --reporters jest-silent-reporter
vrt_test:
description: 'Running Visual Regression Tests'
steps:
Expand All @@ -79,100 +78,50 @@ commands:
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget --fix-missing
- run: ./scripts/run-percy.sh
publish_to_next:
parameters:
git_branch:
type: env_var_name
default: CIRCLE_BRANCH
git_tag:
type: env_var_name
default: CIRCLE_TAG
working_directory:
type: string
default: *working_directory
steps:
- run:
name: Checking if on master branch
command: |
if [ -z ${<< parameters.git_tag >>}]
then
echo "Git tag is not set, not publishing."
circleci-agent step halt
else
echo "Git branch is ${<< parameters.git_branch >>} and tag is ${<< parameters.git_tag >>}, publishing."
fi
- checkout
- restore_cache: *restore_yarn_cache
- install_dependencies
- build_artifacts
name: Bulding visual testing app
command: yarn visual-testing-app:build
- run:
name: Authenticating with npm registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > << parameters.working_directory >>/.npmrc
name: Running Percy against visual testing app
command: ./scripts/run-percy.sh
- run:
name: Publishing ${<< parameters.git_tag >>} from ${<< parameters.git_branch >>} to next dist-tag
command: yarn release:next
name: Checking bundle size of visual testing app
command: yarn bundlesize
publish:
description: Publishing to npm registry
steps:
- run: ./scripts/release_canary.sh

jobs:
lint_and_test:
executor: node_10
steps:
- install_dependencies
- lint
- unit_test
build:
executor: node_10
build_lint_and_test:
executor: node_13
steps:
- install_dependencies
- build_artifacts
- save_workspace
bundle_test:
executor: node_10
steps:
- install_dependencies
- restore_workspace
- bundle_test
vrt_test:
executor: node_10
steps:
- install_dependencies
- restore_workspace
- setup_dependencies
- *save_yarn_cache
- build_packages
- lint_and_test
- vrt_test
- save_package_bundles
publish:
executor: node_10
executor: node_13
steps:
- publish_to_next
- setup_dependencies
- restore_package_bundles
- publish

workflows:
version: 2
build_and_test:
jobs:
- lint_and_test:
filters:
tags:
only: /v[\.0-9]+.*/
- build:
requires:
- lint_and_test
- build_lint_and_test:
filters:
tags:
only: /v[\.0-9]+.*/
- bundle_test:
requires:
- build
filters:
tags:
only: /v[\.0-9]+.*/
- vrt_test:
requires:
- build
- publish:
requires:
- bundle_test
- build_lint_and_test
filters:
tags:
only: /v[\.0-9]+.*/
branches:
only:
- master
- /release\/.*/
- ml-mono
4 changes: 4 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PERCY_TOKEN= # for running percy locally
PERCY_BRANCH=local
GITHUB_AUTH= # for lerna changelog
AUTH_TOKEN= # for github labels
9 changes: 0 additions & 9 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,8 @@ rules:
- componentDidMount
- componentDidUpdate
'function-paren-newline': 0
# ui-kit is a mapped module in bundle tests, so it will not be found
# settting ignorePackages will disable the extension warning for it.
'import/extensions':
- error
- ignorePackages
- js: 'never'
'import/no-extraneous-dependencies': 0
'import/no-named-as-default': 0
# ui-kit is a mapped module in bundle tests, so it will not be found
# We exclude it from the checks
'import/no-unresolved': [2, { ignore: ['ui-kit'] }]
'import/first': 0
'import/order': 2
'no-restricted-globals': ['error', 'find', 'name', 'location']
Expand Down
Loading

0 comments on commit 4ed4f60

Please sign in to comment.