Skip to content

Commit

Permalink
Add package manager (#87)
Browse files Browse the repository at this point in the history
* Add Lerna and tools

* Add Jest

* Add Storybook

* Actualize Codecov

* Update common atoms and molecules

* Build old packages into the special dir

* Deprecate legacy targets

* Add source map tools

* Add semaphore-ci workflow
  • Loading branch information
rogaldh authored Feb 16, 2021
1 parent ce2e41d commit 4d672fd
Show file tree
Hide file tree
Showing 115 changed files with 38,366 additions and 14,758 deletions.
67 changes: 0 additions & 67 deletions .babelrc.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,6 @@
{
"plugins":[],
"env":{
"es": {
"presets": [
"@babel/preset-react",
["@babel/preset-env", {
"modules": false,
"targets":{
"chrome": 43,
"firefox": 43,
"safari": 10,
"ios": 10,
"opera": 40,
"edge": 13,
"ie": 9
}
}]
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"babel-plugin-annotate-pure-calls"
]
},
"cjs": {
"presets": [
"@babel/preset-react",
["@babel/preset-env", {
"targets":{
"chrome": 43,
"firefox": 43,
"safari": 10,
"ios": 10,
"opera": 40,
"edge": 13,
"ie": 9
}
}]
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"babel-plugin-annotate-pure-calls",
"babel-plugin-transform-es2015-modules-commonjs"
]
},
"packages":{
"presets": [
"@babel/preset-react",
Expand All @@ -65,29 +21,6 @@
"@babel/plugin-proposal-object-rest-spread",
"babel-plugin-annotate-pure-calls"
]
},
"styleguidist": {
"presets": [
"@babel/preset-react",
["@babel/preset-env", {
"modules": false,
"targets":{
"chrome": 43,
"firefox": 43,
"safari": 10,
"ios": 10,
"opera": 40,
"edge": 13,
"ie": 9
}
}]
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-syntax-dynamic-import",
"babel-plugin-annotate-pure-calls"
]
}
}
}
6 changes: 3 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/es
/lib
/packages
/packages-v0
/packages/*/es
node_modules
20 changes: 13 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
*.sw*
.DS_Store
.idea/
.idea
.nyc_output
node_modules
/es
/lib
/packages
/styleguide
.vscode
/coverage
*.sw*
/packages-v0
node_modules
lerna-debug.log

/packages/*/es/*
!/packages/*/es/.gitkeep

/packages/*/rollup
/packages/*/rollup.config.js
/packages/*/.babelrc.json
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.16.3
36 changes: 36 additions & 0 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: v1.0
name: ulms-media-ui
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
execution_time_limit:
minutes: 20
blocks:
- name: Install
task:
jobs:
- name: prepare
commands:
- checkout
- nvm use $(cat .nvmrc) # semaphore does not use node version from .nvmrc for some reason
- cache restore node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum package-lock.json),node-modules-$SEMAPHORE_GIT_BRANCH
- npm ci
- cache store node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum package-lock.json) node_modules
- name: Commit
task:
env_vars:
- name: NODE_ENV
value: production
secrets:
- name: codecov-token-ulms
jobs:
- name: test
commands:
- checkout
- nvm use $(cat .nvmrc) # semaphore does not use node version from .nvmrc for some reason
- cache restore node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum package-lock.json)
- npx lerna bootstrap
- npm test
- npm run coverage/report

36 changes: 36 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
"stories": [
"../packages/**/src/*.stories.mdx",
"../packages/**/src/*.stories.@(js|jsx|ts|tsx)",
"../**/*.stories.mdx",
"../**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-essentials",
"@storybook/addon-links",
"@storybook/addon-storysource/register",
"storybook-css-modules-preset",
],
webpackFinal: async (config, { configType }) => {
config.module.rules.push({
enforce: 'pre',
test: /\.svg$/,
use: [{
loader: '@svgr/webpack',
options: {},
}],
})

const i = config.module.rules.findIndex(a => a.test.toString().startsWith('/\\.(svg'))

if (~i) {
config.module.rules.splice(i, 1, {
...config.module.rules[i],
test: new RegExp(config.module.rules[i].test.toString()
.replace(/\//gi, '').replace('(svg|', '(')),
})
}

return config
},
}
4 changes: 4 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
}
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ULMS kit

[![codecov](https://codecov.io/gh/netology-group/ulms-media-ui/branch/add-package-manager/graph/badge.svg?token=e10nIirTN9)](https://codecov.io/gh/netology-group/ulms-media-ui)
[![Build Status](https://netology-group.semaphoreci.com/badges/ulms-media-ui/branches/master.svg?style=shields)](https://netology-group.semaphoreci.com/projects/ulms-media-ui)

## Development

Lerna is a dev-dependency so there is no need to install it globally.

- Link all the components

```bash
npx lerna exec 'npm link'
```

- Build all packages

```bash
npx lerna run build
```

- Provide build capabilities to the packages (runs automatically after installation)

```bash
npm run postinstall
```
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [['@babel/preset-env', { targets: { node: 'current' } }]],
}
8 changes: 8 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
comment:
layout: "reach, diff, flags, files"
behavior: default
require_changes: true # if true: only post the comment if coverage changes
require_base: no # [yes :: must have a base report to post]
require_head: yes # [yes :: must have a head report to post]
branches: # branch names that can post comment
- "master"
Loading

0 comments on commit 4d672fd

Please sign in to comment.