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

Add build task for publishing #266

Merged
merged 23 commits into from Dec 2, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
78 changes: 52 additions & 26 deletions .babelrc
@@ -1,31 +1,57 @@
{
"plugins": [
"lodash",
"transform-es2015-modules-commonjs",
"transform-object-rest-spread",
"transform-class-properties",
[
"emotion",
{
"autoLabel": true,
"hoist": true,
"sourceMap": true
}
]
],
"presets": [
[
"env",
{
"targets": {
"node": "current"
}
}
],
"react",
"stage-3"
],
"env": {
"cjs": {
"plugins": [
"transform-class-properties",
"lodash",
"transform-object-rest-spread",
[
"emotion",
{
"autoLabel": true,
"hoist": true,
"sourceMap": true
}
]
],
"presets": [["env", { "loose": true }], "react", "stage-3"]
},
"es": {
"plugins": [
"transform-class-properties",
"lodash",
"transform-object-rest-spread",
[
"emotion",
{
"autoLabel": true,
"hoist": true,
"sourceMap": true
}
]
],
"presets": [
["env", { "loose": true, "modules": false }],
"react",
"stage-3"
]
},
"test": {
"plugins": [
"transform-class-properties",
"lodash",
"transform-object-rest-spread",
[
"emotion",
{
"autoLabel": true,
"hoist": true,
"sourceMap": true
}
]
],
"presets": ["env", "react", "stage-3"]
},
"static": {
"plugins": [
[
Expand Down
7 changes: 7 additions & 0 deletions PUBLISHING.md
@@ -0,0 +1,7 @@
## Publishing

The publish scripts for this projects rely on `gcp` unix utility that can be found on most linux distributions, but on mac should installed separately.

You can do that using `homebrew`:

`brew install coreutils`
13 changes: 10 additions & 3 deletions README.md
Expand Up @@ -29,10 +29,17 @@ Here are a few helpful links for getting started with Circuit UI:

## Installation

```
yarn add @sumup/circuit-ui
```

## Development

```
yarn && yarn start
```


## Deployment

```
Expand Down Expand Up @@ -76,9 +83,9 @@ describe('Button', () => {
Besides the component library, we also export some utilities which you
might need in order to use the components. Two main ones:

* `numbers` - a module for dealing with number localization.
* `currency` - a module for formatting currency amounts.
* `style-helpers` - a module containing helpers for writing styles.
* `numbersUtils` - a module for dealing with number localization.
* `currencyUtils` - a module for formatting currency amounts.
* `styleHelpers` - a module containing helpers for writing styles.

## Creating components

Expand Down
29 changes: 23 additions & 6 deletions package.json
@@ -1,9 +1,14 @@
{
"name": "circuit-ui",
"version": "0.0.1",
"name": "@sumup/circuit-ui",
"sideEffects": false,
"version": "0.0.13-canary",
"description": "SumUp's React UI component library",
"main": "src/index.js",
"module": "src/index.js",
"main": "lib/index.js",
"module": "lib/es/index.js",
"files": [
"lib",
"README.md"
],
"scripts": {
"coverage:upload": "codecov",
"fix:eslint": "eslint --fix --quiet src/**/**/*.js",
Expand All @@ -24,10 +29,17 @@
"build:stylesheet": "mkdir -p dist && BABEL_ENV=static node build/stylesheet > dist/circuit-ui.css",
"build:global-styles": "mkdir -p dist && ./build/global-styles > dist/circuit-ui-global.css",
"build:copy-global-styles": "cp -f dist/circuit-ui-global.css .storybook",
"build:js": "yarn clean:js && yarn build:js:cjs && yarn build:js:es && yarn build:svg:cjs && yarn build:svg:es",
"build:js:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir lib --ignore *.spec.js,*.story.js",
"build:js:es": "cross-env BABEL_ENV=es babel src --out-dir lib/es --ignore *.spec.js,*.story.js",
"build:svg:cjs": "cd src && find . -name *.svg -print | xargs -I@ gcp --parents @ ../lib && cd ..",
"build:svg:es": "cd src && find . -name *.svg -print | xargs -I@ gcp --parents @ ../lib/es && cd ..",
"clean:js": "rimraf lib",
"deploy": "rm -rf ./dist && mkdir dist && yarn run docz:build && yarn build && cp ./src/CNAME ./dist/CNAME && gh-pages -d dist",
"precommit": "lint-staged",
"docz:dev": "docz dev",
"docz:build": "docz build"
"docz:build": "docz build",
"precommit": "lint-staged",
"prepublishOnly": "yarn build:js"
},
"repository": {
"type": "git",
Expand All @@ -51,16 +63,21 @@
"@storybook/addons": "^3.4.0",
"@storybook/react": "^3.4.0",
"@sumup/foundry": "^0.0.8",
"babel-cli": "^6.26.0",
"babel-eslint": "^8.1.2",
"babel-jest": "^22.1.0",
"babel-loader": "^7.1.5",
"babel-plugin-dynamic-import-node": "^1.2.0",
"babel-plugin-emotion": "^9.2.6",
"babel-plugin-lodash": "^3.3.2",
"babel-plugin-module-resolver": "^3.0.0",
"babel-plugin-react-docgen": "^2.0.0-rc.1",
"babel-preset-env": "^1.7.0",
"babel-register": "^6.26.0",
"codecov": "^3.1.0",
"component-playground": "^3.2.0",
"create-emotion-styled": "^9.2.6",
"cross-env": "^5.2.0",
"docz": "^0.9.2",
"docz-plugin-babel6": "^0.9.2",
"docz-theme-default": "^0.9.2",
Expand Down
25 changes: 25 additions & 0 deletions src/index.js
Expand Up @@ -17,6 +17,15 @@ import {

import { normalizeAmount, isValidAmount } from './components/CurrencyInput';

import { circuit } from './themes';

export {
id as uniqueId,
numbers as numbersUtils,
currency as currencyUtils,
sharedPropTypes
} from './util';

const cardNumberUtils = {
isValidCardNumber,
isAcceptedCardScheme,
Expand Down Expand Up @@ -139,10 +148,26 @@ export { default as CardSchemes } from './components/CardSchemes';
export {
default as PaymentMethodIcon
} from './components/CardSchemes/components/PaymentMethodIcon';

export { default as SideNav } from './components/SideNav';
export { Menu } from './components/SideNav/components';
export { Drawer } from './components/SideNav/components';

// Helpers
export { default as State } from './components/State';
export { default as InlineElements } from './components/InlineElements';

// Theme
const standard = { ...circuit }; // otherwise this get exported as a `Module`
const theme = {
standard,
circuit: standard
};

export { theme };

export {
globalStyles as injectGlobalStyles,
styleHelpers,
constants as styleConstants
} from './styles';