chore: remove extracted packages

This commit is contained in:
Sérgio Ramos 2017-09-18 14:05:45 +01:00 committed by Sérgio Ramos
parent d36f869a64
commit 7749f1eb62
94 changed files with 30 additions and 4014 deletions

5
.travis.yml Normal file
View File

@ -0,0 +1,5 @@
language: node_js
node_js:
- '8'
script:
- echo 0

View File

@ -1,45 +0,0 @@
machine:
pre:
- git config --global user.email "circleci@joyent.zone"
- git config --global user.name "circlebot"
- curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0
services:
- docker
node:
version: 8.1.2
dependencies:
override:
# add rethinkdb sources
- source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
- wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
# install zmq and rdb
- sudo apt-get update && sudo apt-get install libzmq3-dev rethinkdb
# install node dependencies
- yarn install
test:
pre:
# mkdir lint reports
- mkdir -p $CIRCLE_TEST_REPORTS/lint
# mkdir test reports
- mkdir -p $CIRCLE_TEST_REPORTS/test
# mkdir coverage artifact folders
- ls -1 packages | xargs -I % mkdir -p $CIRCLE_ARTIFACTS/"%"
override:
# lint
- yarn run lint-ci
# test
- yarn run test-ci
# deployment:
# pre:
# # install docker-compose
# - sudo curl -L https://github.com/docker/compose/releases/download/1.13.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
# - sudo chmod +x /usr/local/bin/docker-compose
# # install and setup triton
# - yarn global add triton@4.15.0 || cat /home/ubuntu/.yarn-config/global/yarn-error.log
# development:
# branch: master
# commands:
# - ./scripts/deploy

View File

@ -5,7 +5,6 @@
"license": "MPL-2.0", "license": "MPL-2.0",
"repository": "github:yldio/joyent-portal", "repository": "github:yldio/joyent-portal",
"scripts": { "scripts": {
"wizard": "lerna-wizard",
"release": "./scripts/release", "release": "./scripts/release",
"format": "./scripts/format", "format": "./scripts/format",
"test-staged": "./scripts/run-staged-pkg --test", "test-staged": "./scripts/run-staged-pkg --test",
@ -13,9 +12,8 @@
"format-staged": "./scripts/format --staged", "format-staged": "./scripts/format --staged",
"lint-license": "./scripts/license-to-fail", "lint-license": "./scripts/license-to-fail",
"lint-docs": "./scripts/quality-docs", "lint-docs": "./scripts/quality-docs",
"lint-ci:root": "lint-ci:root": "eslint scripts/*",
"echo 0 `# eslint scripts/* --format junit --output-file $CIRCLE_TEST_REPORTS/lint/joyent-portal.xml`", "lint:root": "eslint scripts/* --fix",
"lint:root": "echo 0 `# eslint scripts/* --fix`",
"lint-ci:packages": "lerna run lint-ci", "lint-ci:packages": "lerna run lint-ci",
"lint:packages": "lerna run lint", "lint:packages": "lerna run lint",
"lint-ci": "redrun -s lint-ci:*", "lint-ci": "redrun -s lint-ci:*",
@ -42,18 +40,13 @@
"apr-awaitify": "^1.0.4", "apr-awaitify": "^1.0.4",
"apr-filter": "^1.0.5", "apr-filter": "^1.0.5",
"apr-for-each": "^1.0.6", "apr-for-each": "^1.0.6",
"apr-intercept": "^1.0.4",
"apr-main": "^1.0.7", "apr-main": "^1.0.7",
"apr-map": "^1.0.5", "apr-map": "^1.0.5",
"apr-parallel": "^1.0.5", "apr-parallel": "^1.0.5",
"apr-reduce": "^1.0.5", "apr-reduce": "^1.0.5",
"apr-series": "^1.0.5",
"apr-sort-by": "^1.0.5",
"babel-eslint": "^7.2.3", "babel-eslint": "^7.2.3",
"chalk": "^2.1.0",
"checksum": "^0.1.1", "checksum": "^0.1.1",
"cross-env": "^5.0.5", "cross-env": "^5.0.5",
"dotenv": "^4.0.0",
"eslint": "^4.5.0", "eslint": "^4.5.0",
"eslint-config-prettier": "^2.3.0", "eslint-config-prettier": "^2.3.0",
"eslint-config-react-app": "^2.0.0", "eslint-config-react-app": "^2.0.0",
@ -63,30 +56,18 @@
"eslint-plugin-jsx-a11y": "^6.0.2", "eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-prettier": "^2.2.0", "eslint-plugin-prettier": "^2.2.0",
"eslint-plugin-react": "^7.3.0", "eslint-plugin-react": "^7.3.0",
"eslint-tap": "^2.0.1",
"execa": "^0.8.0", "execa": "^0.8.0",
"figures": "^2.0.0",
"force-array": "^3.1.0", "force-array": "^3.1.0",
"husky": "^0.14.3", "husky": "^0.14.3",
"inquirer": "^3.2.3",
"lerna": "^2.1.2", "lerna": "^2.1.2",
"lerna-wizard": "ramitos/lerna-wizard#7bcdc11",
"license-to-fail": "^2.2.0", "license-to-fail": "^2.2.0",
"lodash.flatten": "^4.4.0",
"lodash.isplainobject": "^4.0.6",
"lodash.isstring": "^4.0.1",
"lodash.uniq": "^4.5.0", "lodash.uniq": "^4.5.0",
"lodash.uniqby": "^4.7.0",
"prettier": "1.6.1", "prettier": "1.6.1",
"quality-docs": "^3.3.0", "quality-docs": "^3.3.0",
"read-pkg": "^2.0.0", "read-pkg": "^2.0.0",
"redrun": "^5.9.17", "redrun": "^5.9.17",
"semver": "^5.4.1",
"staged-git-files": "0.0.4", "staged-git-files": "0.0.4",
"yargs": "^8.0.2" "yargs": "^8.0.2"
}, },
"config": {
"fmt-opt-out": ["portal-data", "portal-api", "control-tower"]
},
"workspaces": ["packages/*"] "workspaces": ["packages/*"]
} }

View File

@ -1,3 +0,0 @@
{
"extends": "joyent-portal"
}

View File

@ -1,9 +0,0 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true
}
}

View File

@ -1,30 +0,0 @@
# babel-preset-joyent-portal
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)
[`babel`](http://github.com/babel/babel) preset to be used across this repo. At the moment it only extends the one used by [`create-react-app`](https://github.com/facebookincubator/create-react-app/tree/master/packages/babel-preset-react-app) but it can be extended as needed.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add --dev babel-preset-joyent-portal
```
## Usage
```json
{
"presets": "joyent-portal"
}
```
## License
MPL-2.0

View File

@ -1,3 +0,0 @@
module.exports = (ctx, opts) => ({
presets: [require('babel-preset-react-app')]
});

View File

@ -1,21 +0,0 @@
{
"name": "babel-preset-joyent-portal",
"version": "2.0.0",
"license": "MPL-2.0",
"repository": "github:yldio/joyent-portal",
"main": "index.js",
"scripts": {
"lint": "eslint . --fix",
"lint-ci": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/babel-preset-joyent-portal.xml",
"test": "echo 0",
"test-ci": "echo 0",
"prepublish": "echo 0"
},
"dependencies": {
"babel-preset-react-app": "^3.0.2"
},
"devDependencies": {
"eslint": "^4.5.0",
"eslint-config-joyent-portal": "3.0.0"
}
}

View File

@ -1,13 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.4"></a>
## 1.0.4 (2017-05-25)
<a name="1.0.3"></a>
## 1.0.3 (2017-05-25)

View File

@ -7,8 +7,6 @@
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {
"lint": "eslint . --fix", "lint": "eslint . --fix",
"lint-ci":
"eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/cloudapi-gql.xml",
"test": "echo 0", "test": "echo 0",
"test-ci": "echo 0", "test-ci": "echo 0",
"start": "node src/index.js", "start": "node src/index.js",

View File

@ -1,3 +0,0 @@
{
"extends": "./index.js"
}

View File

@ -1,10 +0,0 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true,
"node": true
}
}

View File

@ -1,28 +0,0 @@
# eslint-config-joyent-portal
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add eslint-config-joyent-portal
```
## Usage
```json
{
"extends": "joyent-portal"
}
```
## License
MPL-2.0

View File

@ -1,9 +0,0 @@
// eslint-disable-next-line no-warning-comments
// TODO wait for eslint/eslint#3458
module.exports = {
extends: ['eslint:recommended', 'xo-space/esnext', 'react-app', 'prettier', 'prettier/react'],
rules: {
'capitalized-comments': 0
}
};

View File

@ -1,38 +0,0 @@
{
"name": "eslint-config-joyent-portal",
"version": "3.0.0",
"license": "MPL-2.0",
"repository": "github:yldio/joyent-portal",
"main": "index.js",
"scripts": {
"lint": "eslint . --fix",
"lint-ci": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/eslint-config-joyent-portal.xml",
"test": "echo 0",
"test-ci": "echo 0",
"prepublish": "echo 0"
},
"devDependencies": {
"babel-eslint": "^7.2.3",
"eslint": "^4.5.0",
"eslint-config-prettier": "^2.3.0",
"eslint-config-react-app": "^2.0.0",
"eslint-config-xo-space": "^0.16.0",
"eslint-plugin-flowtype": "^2.35.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-prettier": "^2.2.0",
"eslint-plugin-react": "^7.3.0"
},
"peerDependencies": {
"babel-eslint": "^7.2.3",
"eslint": "^4.5.0",
"eslint-config-prettier": "^2.3.0",
"eslint-config-react-app": "^2.0.0",
"eslint-config-xo-space": "^0.16.0",
"eslint-plugin-flowtype": "^2.35.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-prettier": "^2.2.0",
"eslint-plugin-react": "^7.3.0"
}
}

View File

@ -1,4 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

View File

@ -11,11 +11,8 @@
"lint:css": "stylelint './src/**/*.js'", "lint:css": "stylelint './src/**/*.js'",
"lint:js": "eslint . --fix", "lint:js": "eslint . --fix",
"lint": "redrun -s lint:*", "lint": "redrun -s lint:*",
"lint-ci:css": "stylelint './src/**/*.js'",
"lint-ci:js": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/cp-frontend.xml",
"lint-ci": "redrun -p lint-ci:*",
"test": "NODE_ENV=test ./test/run --env=jsdom", "test": "NODE_ENV=test ./test/run --env=jsdom",
"test-ci": "echo 0 `# NODE_ENV=test JEST_JUNIT_OUTPUT=$CIRCLE_TEST_REPORTS/test/cp-frontend.xml ./test/run --env=jsdom --coverage --coverageDirectory=$CIRCLE_ARTIFACTS/cp-frontend --testResultsProcessor=$(node -e \"console.log(require.resolve('jest-junit'))\")`", "test-ci": "echo 0 `# NODE_ENV=test ./test/run --env=jsdom --coverage`",
"prepublish": "node scripts/postinstall" "prepublish": "node scripts/postinstall"
}, },
"dependencies": { "dependencies": {

View File

@ -1,35 +0,0 @@
{
"sourceMaps": true,
"presets": [
["babel-preset-env", {
"targets": {
"ie": 9,
"uglify": true
},
"useBuiltIns": false
}]
],
"plugins": [
"transform-react-jsx",
"syntax-jsx",
"transform-react-display-name",
"transform-class-properties",
["transform-object-rest-spread", {
"useBuiltIns": true
}],
["transform-react-jsx", {
"useBuiltIns": true
}],
["transform-runtime", {
"helpers": false,
"polyfill": false,
"regenerator": true
}],
"transform-react-jsx-source",
"transform-react-jsx-self",
["transform-regenerator", {
"async": false
}],
"syntax-dynamic-import"
]
}

View File

@ -1,3 +0,0 @@
.nyc_output
coverage
dist

View File

@ -1,3 +0,0 @@
{
"extends": "joyent-portal"
}

View File

@ -1,10 +0,0 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true,
"node": true
}
}

View File

@ -1,19 +0,0 @@
# manifest-editor
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![npm](https://img.shields.io/npm/v/manifest-editor.svg)](https://npmjs.com/package/manifest-editor)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
## Usage
## License
MPL-2.0

View File

@ -1,45 +0,0 @@
{
"name": "joyent-manifest-editor",
"version": "1.2.1",
"license": "MPL-2.0",
"description": "",
"keywords": [],
"repository": "github:yldio/joyent-portal",
"main": "dist/joyent-manifest-editor.umd.js",
"jsnext:main": "dist/joyent-manifest-editor.es.js",
"module": "dist/joyent-manifest-editor.es.js",
"entry": "src/index.js",
"scripts": {
"lint:css": "echo 0",
"lint-ci:css": "echo 0",
"lint:js": "eslint . --fix",
"lint-ci:js": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/manifest-editor.xml",
"lint": "redrun -s lint:*",
"lint-ci": "redrun -p lint-ci:*",
"test": "echo 0 `# bup && NODE_ENV=test jest --coverage`",
"test-ci": "echo 0 `# NODE_ENV=test JEST_JUNIT_OUTPUT=$CIRCLE_TEST_REPORTS/test/manifest-editor.xml jest --coverage --coverageDirectory=$CIRCLE_ARTIFACTS/manifest-editor --testResultsProcessor=$(node -e \"console.log(require.resolve('jest-junit'))\")`",
"build": "bup",
"prepublish": "redrun build"
},
"dependencies": {
"prop-types": "^15.5.10",
"react-codemirror": "^1.0.0"
},
"devDependencies": {
"babel-preset-react-app": "^3.0.2",
"bup": "^1.0.9",
"eslint": "^4.5.0",
"eslint-config-joyent-portal": "3.0.0",
"jest": "^20.0.4",
"react": "^15.6.1",
"react-test-renderer": "^15.6.1",
"redrun": "^5.9.16"
},
"peerDependencies": {
"react": "*"
},
"jest": {
"testEnvironment": "jsdom",
"testRegex": "test/index.js"
}
}

View File

@ -1,108 +0,0 @@
import 'codemirror/lib/codemirror.css';
import 'codemirror/theme/eclipse.css';
import 'codemirror/addon/fold/foldgutter.css';
import 'codemirror/addon/lint/lint.css';
import 'codemirror/mode/yaml/yaml';
import 'codemirror/mode/javascript/javascript';
import 'codemirror/mode/properties/properties';
import 'codemirror/addon/edit/closebrackets';
import 'codemirror/addon/edit/matchbrackets';
import 'codemirror/addon/fold/foldcode';
import 'codemirror/addon/fold/foldgutter';
import 'codemirror/addon/fold/brace-fold';
import 'codemirror/addon/fold/indent-fold';
import 'codemirror/addon/fold/comment-fold';
import 'codemirror/addon/hint/show-hint';
import 'codemirror/addon/selection/active-line';
import 'codemirror/addon/edit/closetag';
import React, { Component } from 'react';
import ReactCodeMirror from 'react-codemirror';
import PropTypes from 'prop-types';
const options = {
theme: 'eclipse',
indentUnit: 2,
smartIndent: true,
tabSize: 2,
indentWithTabs: false,
electricChars: true,
lineNumbers: true,
inputStyle: 'contenteditable',
lint: true,
autoCloseBrackets: true,
styleActiveLine: true,
matchBrackets: true,
lineWrapping: true,
foldGutter: true,
autoCloseTags: true,
viewportMargin: Infinity,
gutters: [
'CodeMirror-lint-markers',
'CodeMirror-foldgutter',
'CodeMirror-linenumbers'
]
};
class ManifestEditor extends Component {
constructor() {
super();
this._refs = {};
}
ref(name) {
return ref => {
this._refs[name] = ref;
};
}
options({ mode, readOnly }) {
const modes = {
json: {
name: 'javascript',
json: true
},
yaml: 'yaml',
ini: 'properties'
};
return Object.assign({}, options, {
mode: modes[mode.toLowerCase()],
readOnly
});
}
render() {
return (
<ReactCodeMirror
ref={this.ref('cm')}
value={this.props.value || this.props.defaultValue}
onChange={this.props.onChange}
onFocusChange={this.props.onFocusChange}
options={this.options(this.props)}
autoSave={this.props.autoSave}
preserveScrollPosition={this.props.preserveScrollPosition}
/>
);
}
}
ManifestEditor.defaultProps = {
mode: 'json',
defaultValue: '',
onChange: () => null,
onFocusChange: () => null,
autoSave: true,
preserveScrollPosition: true,
readOnly: false
};
ManifestEditor.propTypes = {
mode: PropTypes.oneOf(['json', 'yaml', 'ini']),
value: PropTypes.string,
onChange: PropTypes.func,
onFocusChange: PropTypes.func,
autoSave: PropTypes.bool,
preserveScrollPosition: PropTypes.bool,
readOnly: PropTypes.bool
};
export default ManifestEditor;

View File

@ -1,8 +0,0 @@
// import React from 'react';
// import renderer from 'react-test-renderer';
// import ManifestEditor from '../src/index';
// It('renders <ManifestEditor /> correctly', () => {
// const tree = renderer.create(<ManifestEditor />).toJSON();
// expect(tree).toMatchSnapshot();
// });

View File

@ -1,4 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

View File

@ -11,11 +11,8 @@
"lint:css": "stylelint './src/**/*.js'", "lint:css": "stylelint './src/**/*.js'",
"lint:js": "eslint . --fix", "lint:js": "eslint . --fix",
"lint": "redrun -s lint:*", "lint": "redrun -s lint:*",
"lint-ci:css": "stylelint './src/**/*.js'",
"lint-ci:js": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/cp-frontend.xml",
"lint-ci": "redrun -p lint-ci:*",
"test": "NODE_ENV=test ./test/run --env=jsdom", "test": "NODE_ENV=test ./test/run --env=jsdom",
"test-ci": "echo 0 `# NODE_ENV=test JEST_JUNIT_OUTPUT=$CIRCLE_TEST_REPORTS/test/cp-frontend.xml ./test/run --env=jsdom --coverage --coverageDirectory=$CIRCLE_ARTIFACTS/cp-frontend --testResultsProcessor=$(node -e \"console.log(require.resolve('jest-junit'))\")`", "test-ci": "echo 0 `# NODE_ENV=test ./test/run --env=jsdom --coverage`",
"prepublish": "node scripts/postinstall" "prepublish": "node scripts/postinstall"
}, },
"dependencies": { "dependencies": {
@ -23,7 +20,6 @@
"graphql-tag": "^2.4.2", "graphql-tag": "^2.4.2",
"jest-cli": "^21.0.1", "jest-cli": "^21.0.1",
"joyent-ui-toolkit": "^2.0.0", "joyent-ui-toolkit": "^2.0.0",
"lodash.isequal": "^4.5.0",
"normalized-styled-components": "^1.0.9", "normalized-styled-components": "^1.0.9",
"prop-types": "^15.5.10", "prop-types": "^15.5.10",
"react": "^15.6.1", "react": "^15.6.1",

View File

@ -1,13 +0,0 @@
{
"sourceMaps": "inline",
"plugins": [
"styled-components"
],
"env": {
"test": {
"presets": [
"react-app"
]
}
}
}

View File

@ -1,3 +0,0 @@
.nyc_output
coverage
dist

View File

@ -1,3 +0,0 @@
{
"extends": "joyent-portal"
}

View File

@ -1,5 +0,0 @@
{
"syntax": "scss",
"processors": ["stylelint-processor-styled-components"],
"extends": ["stylelint-config-standard", "stylelint-config-primer"]
}

View File

@ -1,10 +0,0 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true,
"node": true
}
}

View File

@ -1,13 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.5"></a>
## 1.0.5 (2017-05-25)
<a name="1.0.4"></a>
## 1.0.4 (2017-05-25)

View File

@ -1,64 +0,0 @@
# normalized-styled-components
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![npm](https://img.shields.io/npm/v/normalized-styled-components.svg)](https://npmjs.com/package/normalized-styled-components)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)
[`normalize.css`](https://github.com/necolas/normalize.css) with a [`styled-components`](https://github.com/styled-components/styled-components) mindset.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add --dev normalized-styled-components
```
## Usage
```js
import { Button } from 'normalized-styled-components';
export default () => (
<Button>Click Here!</Button>
)
```
```css
.jdhBdT {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: visible;
text-transform: none;
appearance: button;
-moz-appearance: button;
-webkit-appearance: button;
}
.jdhBdT::-moz-focus-inner,
.jdhBdT[type="button"]::-moz-focus-inner,
.jdhBdT[type="reset"]::-moz-focus-inner,
.jdhBdT[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
.jdhBdT:-moz-focusring,
.jdhBdT[type="button"]:-moz-focusring,
.jdhBdT[type="reset"]:-moz-focusring,
.jdhBdT[type="submit"]:-moz-focusring {
outline: 0.0625rem dotted ButtonText;
}
```
```html
<button className="bgTKnx">Click Here!</button>
```
## License
MPL-2.0

View File

@ -1,79 +0,0 @@
{
"name": "normalized-styled-components",
"version": "1.0.10",
"license": "MPL-2.0",
"description": "normalize.css with a styled-components mindset",
"keywords": [
"normalizations",
"style",
"css",
"react",
"css",
"css-in-js",
"styled-components"
],
"repository": "github:yldio/joyent-portal",
"main": "dist/normalized-styled-components.umd.js",
"jsnext:main": "dist/normalized-styled-components.es.js",
"module": "dist/normalized-styled-components.es.js",
"entry": "src/index.js",
"scripts": {
"lint:css": "echo 0",
"lint-ci:css": "echo 0",
"lint:js": "eslint . --fix",
"lint-ci:js": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/normalized-styled-components.xml",
"lint": "redrun -s lint:*",
"lint-ci": "redrun -p lint-ci:*",
"test": "bup && NODE_ENV=test jest --coverage",
"test-ci": "NODE_ENV=test JEST_JUNIT_OUTPUT=$CIRCLE_TEST_REPORTS/test/normalized-styled-components.xml jest --coverage --coverageDirectory=$CIRCLE_ARTIFACTS/normalized-styled-components --testResultsProcessor=$(node -e \"console.log(require.resolve('jest-junit'))\")",
"build": "bup",
"prepublish": "redrun build"
},
"dependencies": {
"remcalc": "^1.0.8"
},
"devDependencies": {
"babel-plugin-styled-components": "^1.2.0",
"babel-preset-react-app": "^3.0.2",
"bup": "^1.0.9",
"chalk": "^2.1.0",
"eslint": "^4.5.0",
"eslint-config-joyent-portal": "3.0.0",
"jest": "^20.0.4",
"jest-diff": "^20.0.3",
"jest-junit": "^3.0.0",
"jest-matcher-utils": "^20.0.3",
"jest-snapshot": "^20.0.3",
"jest-styled-components": "^4.4.1",
"react": "^15.6.1",
"react-scripts": "^1.0.12",
"react-test-renderer": "^15.6.1",
"redrun": "^5.9.17",
"strip-ansi": "^4.0.0",
"styled-components": "^2.1.2",
"stylelint": "^8.0.0",
"stylelint-config-primer": "^2.0.1",
"stylelint-config-standard": "^17.0.0",
"stylelint-processor-styled-components": "styled-components/stylelint-processor-styled-components#2a33b5f"
},
"peerDependencies": {
"react": "*",
"styled-components": "*"
},
"jest": {
"testEnvironment": "jsdom",
"testRegex": "test/index.js",
"setupFiles": [
"<rootDir>/../../node_modules/react-scripts/config/polyfills.js"
],
"testEnvironment": "node",
"transform": {
"^.+\\.(js|jsx)$": "<rootDir>/../../node_modules/react-scripts/config/jest/babelTransform.js",
"^(?!.*\\.(js|jsx|css|json)$)": "<rootDir>/../../node_modules/react-scripts/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
],
"rootDir": "."
}
}

View File

@ -1,259 +0,0 @@
import styled from 'styled-components';
import remcalc from 'remcalc';
export const Article = styled.article`
display: block;
`;
export const Aside = styled.aside`
display: block;
`;
export const Footer = styled.footer`
display: block;
`;
export const Header = styled.header`
display: block;
`;
export const Nav = styled.nav`
display: block;
`;
export const Section = styled.section`
display: block;
`;
export const FigCaption = styled.figcaption`
display: block;
`;
export const Figure = styled.figure`
display: block;
margin: ${remcalc(16)} ${remcalc(40)};
`;
export const Main = styled.main`
display: block;
`;
export const H1 = styled.h1`
font-size: ${remcalc(32)};
margin: ${remcalc(10)} 0;
`;
export const Hr = styled.hr`
box-sizing: content-box;
height: 0;
overflow: visible;
`;
export const Pre = styled.pre`
font-family: monospace, monospace;
font-size: ${remcalc(16)};
`;
export const A = styled.a`
background-color: transparent;
text-decoration-skip: objects;
`;
export const Abbr = styled.abbr`
&[title] {
border-bottom: none;
text-decoration: underline;
text-decoration: underline dotted;
}
`;
export const B = styled.b`
font-weight: bolder;
`;
export const Strong = styled.strong`
font-weight: bolder;
`;
export const Code = styled.code`
font-family: monospace, monospace;
font-size: ${remcalc(16)};
`;
export const Kbd = styled.kbd`
font-family: monospace, monospace;
font-size: ${remcalc(16)};
`;
export const Samp = styled.samp`
font-family: monospace, monospace;
font-size: ${remcalc(16)};
`;
export const Dfn = styled.dfn`
font-style: italic;
`;
export const Mark = styled.mark`
background-color: #ff0;
color: #000;
`;
export const Small = styled.small`
font-size: 80%;
`;
export const Sub = styled.sub`
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
bottom: -0.25em;
`;
export const Sup = styled.sup`
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
top: -0.5em;
`;
export const Audio = styled.audio`
display: inline-block;
&:not([controls]) {
display: none;
height: 0;
}
`;
export const Video = styled.video`
display: inline-block;
`;
export const Img = styled.img`
border-style: none;
`;
export const Svg = styled.svg`
&:not(:root) {
overflow: hidden;
}
`;
export const Button = styled.button`
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: visible;
text-transform: none;
appearance: button;
&::-moz-focus-inner,
&[type='button']::-moz-focus-inner,
&[type='reset']::-moz-focus-inner,
&[type='submit']::-moz-focus-inner {
border-style: none;
padding: 0;
}
&:-moz-focusring,
&[type='button']:-moz-focusring,
&[type='reset']:-moz-focusring,
&[type='submit']:-moz-focusring {
outline: ${remcalc(1)} dotted ButtonText;
}
`;
export const Input = styled.input`
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: visible;
&[type='checkbox'],
&[type='radio'] {
box-sizing: border-box;
padding: 0;
}
&[type='number']::-webkit-inner-spin-button,
&[type='number']::-webkit-outer-spin-button {
height: auto;
}
&[type='search'] {
appearance: textfield;
outline-offset: ${remcalc(-2)};
}
&[type='search']::-webkit-search-cancel-button,
&[type='search']::-webkit-search-decoration {
appearance: none;
}
&::-webkit-file-upload-button {
appearance: button;
font: inherit;
}
`;
export const Optgroup = styled.optgroup`
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
`;
export const Select = styled.select`
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
text-transform: none;
`;
export const Textarea = styled.textarea`
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: auto;
`;
export const Fieldset = styled.fieldset`
padding: 0.35em 0.75em 0.625em;
`;
export const Legend = styled.legend`
box-sizing: border-box;
color: inherit;
display: table;
max-width: 100%;
padding: 0;
white-space: normal;
`;
export const Progress = styled.progress`
display: inline-block;
vertical-align: baseline;
`;
export const Details = styled.details`
display: block;
`;
export const Menu = styled.menu`
display: block;
`;
export const Summary = styled.summary`
display: list-item;
`;
export const Canvas = styled.canvas`
display: inline-block;
`;

View File

@ -1,502 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders <A /> correctly 1`] = `
.c0 {
background-color: transparent;
text-decoration-skip: objects;
}
<a
className="c0"
/>
`;
exports[`renders <Abbr /> correctly 1`] = `
.c0[title] {
border-bottom: none;
text-decoration: underline;
text-decoration: underline dotted;
}
<abbr
className="c0"
/>
`;
exports[`renders <Article /> correctly 1`] = `
.c0 {
display: block;
}
<article
className="c0"
/>
`;
exports[`renders <Aside /> correctly 1`] = `
.c0 {
display: block;
}
<aside
className="c0"
/>
`;
exports[`renders <Audio /> correctly 1`] = `
.c0 {
display: inline-block;
}
.c0:not([controls]) {
display: none;
height: 0;
}
<audio
className="c0"
/>
`;
exports[`renders <B /> correctly 1`] = `
.c0 {
font-weight: bolder;
}
<b
className="c0"
/>
`;
exports[`renders <Button /> correctly 1`] = `
.c0 {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: visible;
text-transform: none;
-webkit-appearance: button;
-moz-appearance: button;
appearance: button;
}
.c0::-moz-focus-inner,
.c0[type='button']::-moz-focus-inner,
.c0[type='reset']::-moz-focus-inner,
.c0[type='submit']::-moz-focus-inner {
border-style: none;
padding: 0;
}
.c0:-moz-focusring,
.c0[type='button']:-moz-focusring,
.c0[type='reset']:-moz-focusring,
.c0[type='submit']:-moz-focusring {
outline: 0.0625rem dotted ButtonText;
}
<button
className="c0"
/>
`;
exports[`renders <Canvas /> correctly 1`] = `
.c0 {
display: inline-block;
}
<canvas
className="c0"
/>
`;
exports[`renders <Code /> correctly 1`] = `
.c0 {
font-family: monospace,monospace;
font-size: 1rem;
}
<code
className="c0"
/>
`;
exports[`renders <Details /> correctly 1`] = `
.c0 {
display: block;
}
<details
className="c0"
/>
`;
exports[`renders <Dfn /> correctly 1`] = `
.c0 {
font-style: italic;
}
<dfn
className="c0"
/>
`;
exports[`renders <Fieldset /> correctly 1`] = `
.c0 {
padding: 0.35em 0.75em 0.625em;
}
<fieldset
className="c0"
/>
`;
exports[`renders <FigCaption /> correctly 1`] = `
.c0 {
display: block;
}
<figcaption
className="c0"
/>
`;
exports[`renders <Figure /> correctly 1`] = `
.c0 {
display: block;
margin: 1rem 2.5rem;
}
<figure
className="c0"
/>
`;
exports[`renders <Footer /> correctly 1`] = `
.c0 {
display: block;
}
<footer
className="c0"
/>
`;
exports[`renders <H1 /> correctly 1`] = `
.c0 {
font-size: 2rem;
margin: 0.625rem 0;
}
<h1
className="c0"
/>
`;
exports[`renders <Header /> correctly 1`] = `
.c0 {
display: block;
}
<header
className="c0"
/>
`;
exports[`renders <Hr /> correctly 1`] = `
.c0 {
box-sizing: content-box;
height: 0;
overflow: visible;
}
<hr
className="c0"
/>
`;
exports[`renders <Img /> correctly 1`] = `
.c0 {
border-style: none;
}
<img
className="c0"
/>
`;
exports[`renders <Input /> correctly 1`] = `
.c0 {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: visible;
}
.c0[type='checkbox'],
.c0[type='radio'] {
box-sizing: border-box;
padding: 0;
}
.c0[type='number']::-webkit-inner-spin-button,
.c0[type='number']::-webkit-outer-spin-button {
height: auto;
}
.c0[type='search'] {
-webkit-appearance: textfield;
-moz-appearance: textfield;
appearance: textfield;
outline-offset: -0.125rem;
}
.c0[type='search']::-webkit-search-cancel-button,
.c0[type='search']::-webkit-search-decoration {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.c0::-webkit-file-upload-button {
-webkit-appearance: button;
-moz-appearance: button;
appearance: button;
font: inherit;
}
<input
className="c0"
/>
`;
exports[`renders <Kbd /> correctly 1`] = `
.c0 {
font-family: monospace,monospace;
font-size: 1rem;
}
<kbd
className="c0"
/>
`;
exports[`renders <Legend /> correctly 1`] = `
.c0 {
box-sizing: border-box;
color: inherit;
display: table;
max-width: 100%;
padding: 0;
white-space: normal;
}
<legend
className="c0"
/>
`;
exports[`renders <Main /> correctly 1`] = `
.c0 {
display: block;
}
<main
className="c0"
/>
`;
exports[`renders <Mark /> correctly 1`] = `
.c0 {
background-color: #ff0;
color: #000;
}
<mark
className="c0"
/>
`;
exports[`renders <Menu /> correctly 1`] = `
.c0 {
display: block;
}
<menu
className="c0"
/>
`;
exports[`renders <Nav /> correctly 1`] = `
.c0 {
display: block;
}
<nav
className="c0"
/>
`;
exports[`renders <Optgroup /> correctly 1`] = `
.c0 {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
}
<optgroup
className="c0"
/>
`;
exports[`renders <Pre /> correctly 1`] = `
.c0 {
font-family: monospace,monospace;
font-size: 1rem;
}
<pre
className="c0"
/>
`;
exports[`renders <Progress /> correctly 1`] = `
.c0 {
display: inline-block;
vertical-align: baseline;
}
<progress
className="c0"
/>
`;
exports[`renders <Samp /> correctly 1`] = `
.c0 {
font-family: monospace,monospace;
font-size: 1rem;
}
<samp
className="c0"
/>
`;
exports[`renders <Section /> correctly 1`] = `
.c0 {
display: block;
}
<section
className="c0"
/>
`;
exports[`renders <Select /> correctly 1`] = `
.c0 {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
text-transform: none;
}
<select
className="c0"
/>
`;
exports[`renders <Small /> correctly 1`] = `
.c0 {
font-size: 80%;
}
<small
className="c0"
/>
`;
exports[`renders <Strong /> correctly 1`] = `
.c0 {
font-weight: bolder;
}
<strong
className="c0"
/>
`;
exports[`renders <Sub /> correctly 1`] = `
.c0 {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
bottom: -0.25em;
}
<sub
className="c0"
/>
`;
exports[`renders <Summary /> correctly 1`] = `
.c0 {
display: list-item;
}
<summary
className="c0"
/>
`;
exports[`renders <Sup /> correctly 1`] = `
.c0 {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
top: -0.5em;
}
<sup
className="c0"
/>
`;
exports[`renders <Svg /> correctly 1`] = `
.c0:not(:root) {
overflow: hidden;
}
<svg
className="c0"
/>
`;
exports[`renders <Textarea /> correctly 1`] = `
.c0 {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: auto;
}
<textarea
className="c0"
/>
`;
exports[`renders <Video /> correctly 1`] = `
.c0 {
display: inline-block;
}
<video
className="c0"
/>
`;

View File

@ -1,246 +0,0 @@
import React from 'react';
import renderer from 'react-test-renderer';
import 'jest-styled-components';
import {
Article,
Aside,
Footer,
Header,
Nav,
Section,
FigCaption,
Figure,
Main,
H1,
Hr,
Pre,
A,
Abbr,
B,
Strong,
Code,
Kbd,
Samp,
Dfn,
Mark,
Small,
Sub,
Sup,
Audio,
Video,
Img,
Svg,
Button,
Input,
Optgroup,
Select,
Textarea,
Fieldset,
Legend,
Progress,
Details,
Menu,
Summary,
Canvas
} from '../src/';
it('renders <Article /> correctly', () => {
const tree = renderer.create(<Article />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Aside /> correctly', () => {
const tree = renderer.create(<Aside />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Footer /> correctly', () => {
const tree = renderer.create(<Footer />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Header /> correctly', () => {
const tree = renderer.create(<Header />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Nav /> correctly', () => {
const tree = renderer.create(<Nav />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Section /> correctly', () => {
const tree = renderer.create(<Section />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <FigCaption /> correctly', () => {
const tree = renderer.create(<FigCaption />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Figure /> correctly', () => {
const tree = renderer.create(<Figure />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Main /> correctly', () => {
const tree = renderer.create(<Main />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <H1 /> correctly', () => {
const tree = renderer.create(<H1 />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Hr /> correctly', () => {
const tree = renderer.create(<Hr />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Pre /> correctly', () => {
const tree = renderer.create(<Pre />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <A /> correctly', () => {
const tree = renderer.create(<A />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Abbr /> correctly', () => {
const tree = renderer.create(<Abbr />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <B /> correctly', () => {
const tree = renderer.create(<B />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Strong /> correctly', () => {
const tree = renderer.create(<Strong />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Code /> correctly', () => {
const tree = renderer.create(<Code />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Kbd /> correctly', () => {
const tree = renderer.create(<Kbd />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Samp /> correctly', () => {
const tree = renderer.create(<Samp />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Dfn /> correctly', () => {
const tree = renderer.create(<Dfn />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Mark /> correctly', () => {
const tree = renderer.create(<Mark />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Small /> correctly', () => {
const tree = renderer.create(<Small />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Sub /> correctly', () => {
const tree = renderer.create(<Sub />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Sup /> correctly', () => {
const tree = renderer.create(<Sup />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Audio /> correctly', () => {
const tree = renderer.create(<Audio />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Video /> correctly', () => {
const tree = renderer.create(<Video />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Img /> correctly', () => {
const tree = renderer.create(<Img />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Svg /> correctly', () => {
const tree = renderer.create(<Svg />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Button /> correctly', () => {
const tree = renderer.create(<Button />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Input /> correctly', () => {
const tree = renderer.create(<Input />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Optgroup /> correctly', () => {
const tree = renderer.create(<Optgroup />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Select /> correctly', () => {
const tree = renderer.create(<Select />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Textarea /> correctly', () => {
const tree = renderer.create(<Textarea />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Fieldset /> correctly', () => {
const tree = renderer.create(<Fieldset />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Legend /> correctly', () => {
const tree = renderer.create(<Legend />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Progress /> correctly', () => {
const tree = renderer.create(<Progress />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Details /> correctly', () => {
const tree = renderer.create(<Details />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Menu /> correctly', () => {
const tree = renderer.create(<Menu />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Summary /> correctly', () => {
const tree = renderer.create(<Summary />).toJSON();
expect(tree).toMatchSnapshot();
});
it('renders <Canvas /> correctly', () => {
const tree = renderer.create(<Canvas />).toJSON();
expect(tree).toMatchSnapshot();
});

View File

@ -1,31 +0,0 @@
{
"sourceMaps": "inline",
"presets": [
["env", {
"spec": true,
"modules": false,
"targets": {
"browsers": [
"last 2 versions",
"safari >= 7"
],
"node": 6
}
}]
],
"env": {
"test": {
"presets": [
["env", {
"spec": true,
"targets": {
"node": "current"
}
}]
],
"plugins": [
"istanbul"
]
}
}
}

View File

@ -1,3 +0,0 @@
.nyc_output
coverage
dist

View File

@ -1,3 +0,0 @@
{
"extends": "joyent-portal"
}

View File

@ -1,10 +0,0 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true,
"node": true
}
}

View File

@ -1,13 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.6"></a>
## 1.0.6 (2017-05-25)
<a name="1.0.5"></a>
## 1.0.5 (2017-05-25)

View File

@ -1,63 +0,0 @@
# pseudo-json-ast
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![npm](https://img.shields.io/npm/v/pseudo-json-ast.svg)](https://npmjs.com/package/pseudo-json-ast)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)
Parse a JSON string into an object with location properties.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add --dev pseudo-json-ast
```
## Usage
```js
import jsonAST, { loc } from 'pseudo-json-ast';
import assert from 'assert';
const ast = jsonAST(`{
"obj": {
"arr": [{
"nums": [1, 2, 3],
"strs1": ["1", "2", "3"],
"strs: ["1", "2", "3"]
}],
"str": "1",
"num": 1
}
}`);
assert.deepEqual(Object.keys(ast), ['obj']);
assert.deepEqual(ast[loc].start.line, 1);
assert.deepEqual(ast[loc].end.line, 11);
assert.deepEqual(Object.keys(ast.obj), ['arr', 'str', 'num']);
assert.deepEqual(ast.obj[loc].start.line, 2);
assert.deepEqual(ast.obj[loc].end.line, 10);
assert.deepEqual(ast.obj.str[loc].start.line, 8);
assert.deepEqual(ast.obj.str[loc].end.line, 8);
assert.deepEqual(ast.obj.num[loc].start.line, 9);
assert.deepEqual(ast.obj.num[loc].end.line, 9);
assert.deepEqual(ast.obj.arr[0][loc].start.line, 3);
assert.deepEqual(ast.obj.arr[0][loc].end.line, 7);
assert.deepEqual(Object.keys(ast.obj.arr[0]), ['nums', 'strs1']);
assert.deepEqual(ast.obj.arr[0].nums[loc].start.line, 4);
assert.deepEqual(ast.obj.arr[0].nums[loc].end.line, 4);
assert.deepEqual(ast.obj.arr[0].strs1[loc].start.line, 5);
assert.deepEqual(ast.obj.arr[0].strs1[loc].end.line, 5);
```
## License
MPL-2.0

View File

@ -1,60 +0,0 @@
{
"name": "pseudo-json-ast",
"version": "1.0.6",
"license": "MPL-2.0",
"description": "Parse a JSON string into an object with location properties",
"keywords": [
"parse",
"json",
"ast",
"abstract",
"syntax",
"tree",
"loc",
"location"
],
"repository": "github:yldio/joyent-portal",
"main": "dist/pseudo-json-ast.umd.js",
"jsnext:main": "dist/pseudo-json-ast.es.js",
"module": "dist/pseudo-json-ast.es.js",
"entry": "src/index.js",
"files": ["dist"],
"scripts": {
"lint": "eslint . --fix",
"lint-ci": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/pseudo-json-ast.xml",
"test:run": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text ava",
"test-ci:run": "cross-env NODE_ENV=test nyc --report-dir=$CIRCLE_ARTIFACTS/pseudo-json-ast --reporter=lcov --reporter=text ava --tap | tap-xunit > $CIRCLE_TEST_REPORTS/test/pseudo-json-ast.xml",
"test": "redrun -s build test:run",
"test-ci": "redrun -s build test-ci:run",
"build": "bup",
"prepublish": "bup"
},
"dependencies": {
"acorn": "^5.1.1",
"has-own-prop": "^1.0.0",
"lodash.isnull": "^3.0.0",
"lodash.isundefined": "^3.0.1"
},
"devDependencies": {
"ava": "^0.22.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-preset-env": "^1.6.0",
"babel-register": "^6.26.0",
"bup": "^1.0.9",
"cross-env": "^5.0.5",
"eslint": "^4.5.0",
"eslint-config-joyent-portal": "3.0.0",
"nyc": "^11.1.0",
"redrun": "^5.9.17",
"tap-xunit": "^1.7.0"
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"ava": {
"tap": true,
"require": ["babel-register"],
"babel": "inherit"
}
}

View File

@ -1,109 +0,0 @@
import { parse_dammit as looseParse } from 'acorn/dist/acorn_loose';
import isUndefined from 'lodash.isundefined';
import isNull from 'lodash.isnull';
import hasOwnProp from 'has-own-prop';
export const loc = Symbol('pseudo-json-ast-loc');
const isPrimitive = v =>
Number.isNaN(v) || isNull(v) || isUndefined(v) || typeof v === 'symbol';
const isPrimitiveNode = node =>
isPrimitive(node.value) || !hasOwnProp(node, 'value');
const visitors = {
// eslint-disable-next-line new-cap
VariableDeclaration: (node = {}, ctx = {}) => walk(node.declarations, ctx),
// eslint-disable-next-line new-cap
VariableDeclarator: (node = {}, ctx = {}) => walk([node.init], ctx),
// eslint-disable-next-line new-cap
ObjectExpression: (node = {}, ctx = {}) =>
walk(node.properties, {
[loc]: node.loc
}),
// eslint-disable-next-line new-cap
Property: (node = {}, ctx = {}) => {
const value = walk([node.value]);
const isPrimitiveProperty = !node.key.value || isPrimitive(value);
if (isPrimitiveProperty) {
return ctx;
}
ctx[node.key.value] = value;
return ctx;
},
// eslint-disable-next-line new-cap
Literal: (node = {}, ctx = {}) => {
if (isPrimitiveNode(node)) {
return node.value;
}
const wrappable = Constructor => () => {
const v = new Constructor(node.value);
v[loc] = node.loc;
return v;
};
const object = () => {
node.value[loc] = node.loc;
return node.value;
};
const types = {
boolean: wrappable(Boolean),
number: wrappable(Number),
string: wrappable(String),
function: object,
object
};
return types[typeof node.value]();
},
// eslint-disable-next-line new-cap
Identifier: (node = {}) => undefined,
// eslint-disable-next-line new-cap
ArrayExpression: (node = {}) => {
const ctx = [];
ctx[loc] = node.loc;
return walk(node.elements, ctx);
}
};
const walk = (nodes = [], ctx = {}) => {
const onNode = (node, ctx, fallback) => {
const visitor = visitors[node.type];
return visitor ? visitor(node, ctx) : fallback;
};
const walkObj = () =>
nodes.reduce((sum, node) => onNode(node, sum, sum), ctx);
const walkArr = () => {
const arr = nodes.map(node => onNode(node, ctx, null)).filter(Boolean);
arr[loc] = ctx[loc];
return arr;
};
return Array.isArray(ctx) ? walkArr() : walkObj();
};
export default input => {
const isValid = typeof input === 'string' && input.trim().indexOf('{') === 0;
if (!isValid) {
return null;
}
const ast = looseParse(`var payload = ${input}`, {
ecmaVersion: 5,
sourceType: 'script',
locations: true,
range: true
});
return walk(ast.body);
};

View File

@ -1,37 +0,0 @@
const { default: jsonAST, loc } = require('../src/index');
const test = require('ava');
test('should accurately add locations', t => {
const ast = jsonAST(`{
"obj": {
"arr": [{
"nums": [1, 2, 3],
"strs1": ["1", "2", "3"],
"strs: ["1", "2", "3"]
}],
"str": "1",
"num": 1
}
}`);
t.deepEqual(Object.keys(ast), ['obj']);
t.deepEqual(ast[loc].start.line, 1);
t.deepEqual(ast[loc].end.line, 11);
t.deepEqual(Object.keys(ast.obj), ['arr', 'str', 'num']);
t.deepEqual(ast.obj[loc].start.line, 2);
t.deepEqual(ast.obj[loc].end.line, 10);
t.deepEqual(ast.obj.str[loc].start.line, 8);
t.deepEqual(ast.obj.str[loc].end.line, 8);
t.deepEqual(ast.obj.num[loc].start.line, 9);
t.deepEqual(ast.obj.num[loc].end.line, 9);
t.deepEqual(ast.obj.arr[0][loc].start.line, 3);
t.deepEqual(ast.obj.arr[0][loc].end.line, 7);
t.deepEqual(Object.keys(ast.obj.arr[0]), ['nums', 'strs1']);
t.deepEqual(ast.obj.arr[0].nums[loc].start.line, 4);
t.deepEqual(ast.obj.arr[0].nums[loc].end.line, 4);
t.deepEqual(ast.obj.arr[0].strs1[loc].start.line, 5);
t.deepEqual(ast.obj.arr[0].strs1[loc].end.line, 5);
});

View File

@ -1,31 +0,0 @@
{
"sourceMaps": "inline",
"presets": [
["env", {
"spec": true,
"modules": false,
"targets": {
"browsers": [
"last 2 versions",
"safari >= 7"
],
"node": 6
}
}]
],
"env": {
"test": {
"presets": [
["env", {
"spec": true,
"targets": {
"node": "current"
}
}]
],
"plugins": [
"istanbul"
]
}
}
}

View File

@ -1,3 +0,0 @@
.nyc_output
coverage
dist

View File

@ -1,3 +0,0 @@
{
"extends": "joyent-portal"
}

View File

@ -1,10 +0,0 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true,
"node": true
}
}

View File

@ -1,13 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.6"></a>
## 1.0.6 (2017-05-25)
<a name="1.0.5"></a>
## 1.0.5 (2017-05-25)

View File

@ -1,66 +0,0 @@
# pseudo-yaml-ast
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![npm](https://img.shields.io/npm/v/pseudo-yaml-ast.svg)](https://npmjs.com/package/pseudo-yaml-ast)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)
Parse a YAML string into an object with location properties.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add --dev pseudo-yaml-ast
```
## Usage
```js
import yamlAST, { loc } from 'pseudo-yaml-ast';
import assert from 'assert';
const ast = yamlAST(`
obj:
arr:
- nums:
- 1
- 2
- 3
strs1:
- '1'
- '2'
- '3'
str: '1'
num: 1
`);
assert.deepEqual(Object.keys(ast), ['obj']);
assert.deepEqual(ast[loc].start.line, 2);
assert.deepEqual(ast[loc].end.line, 14);
assert.deepEqual(Object.keys(ast.obj), ['arr', 'str', 'num']);
assert.deepEqual(ast.obj[loc].start.line, 2);
assert.deepEqual(ast.obj[loc].end.line, 13);
assert.deepEqual(ast.obj.str[loc].start.line, 12);
assert.deepEqual(ast.obj.str[loc].end.line, 12);
assert.deepEqual(ast.obj.num[loc].start.line, 13);
assert.deepEqual(ast.obj.num[loc].end.line, 13);
assert.deepEqual(ast.obj.arr[0][loc].start.line, 4);
assert.deepEqual(ast.obj.arr[0][loc].end.line, 12);
assert.deepEqual(Object.keys(ast.obj.arr[0]), ['nums', 'strs1']);
assert.deepEqual(ast.obj.arr[0].nums[loc].start.line, 4);
assert.deepEqual(ast.obj.arr[0].nums[loc].end.line, 8);
assert.deepEqual(ast.obj.arr[0].strs1[loc].start.line, 8);
assert.deepEqual(ast.obj.arr[0].strs1[loc].end.line, 12);
```
## License
MPL-2.0

View File

@ -1,62 +0,0 @@
{
"name": "pseudo-yaml-ast",
"version": "1.0.6",
"license": "MPL-2.0",
"description": "Parse a YAML string into an object with location properties",
"keywords": [
"parse",
"yaml",
"yml",
"json",
"ast",
"abstract",
"syntax",
"tree",
"loc",
"location"
],
"repository": "github:yldio/joyent-portal",
"main": "dist/pseudo-yaml-ast.umd.js",
"jsnext:main": "dist/pseudo-yaml-ast.es.js",
"module": "dist/pseudo-yaml-ast.es.js",
"entry": "src/index.js",
"files": ["dist"],
"scripts": {
"lint": "eslint . --fix",
"lint-ci": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/pseudo-yaml-ast.xml",
"test:run": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text ava",
"test-ci:run": "cross-env NODE_ENV=test nyc --report-dir=$CIRCLE_ARTIFACTS/pseudo-yaml-ast --reporter=lcov --reporter=text ava --tap | tap-xunit > $CIRCLE_TEST_REPORTS/test/pseudo-yaml-ast.xml",
"test": "redrun build test:run",
"test-ci": "redrun build test-ci:run",
"build": "bup",
"prepublish": "bup"
},
"dependencies": {
"has-own-prop": "^1.0.0",
"lodash.isnull": "^3.0.0",
"lodash.isundefined": "^3.0.1",
"yaml-ast-parser": "0.0.34"
},
"devDependencies": {
"ava": "^0.22.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-preset-env": "^1.6.0",
"babel-register": "^6.26.0",
"bup": "^1.0.9",
"cross-env": "^5.0.5",
"eslint": "^4.5.0",
"eslint-config-joyent-portal": "3.0.0",
"nyc": "^11.1.0",
"redrun": "^5.9.17",
"tap-xunit": "^1.7.0"
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"ava": {
"tap": true,
"require": ["babel-register"],
"babel": "inherit"
}
}

View File

@ -1,133 +0,0 @@
import { load, Kind } from 'yaml-ast-parser';
import isUndefined from 'lodash.isundefined';
import isNull from 'lodash.isnull';
import hasOwnProp from 'has-own-prop';
export const loc = Symbol('pseudo-yaml-ast-loc');
const isPrimitive = v =>
Number.isNaN(v) || isNull(v) || isUndefined(v) || typeof v === 'symbol';
const isPrimitiveNode = node =>
isPrimitive(node.value) || !hasOwnProp(node, 'value');
const getLoc = (input, { start = 0, end = 0 }) => {
const lines = input.split(/\n/);
const loc = {
start: {},
end: {}
};
const isBetween = (start, pos, end) => pos <= end && pos >= start;
let sum = 0;
for (const i of lines.keys()) {
const line = lines[i];
const ls = sum;
const le = sum + line.length + 1; // +1 because the break is also a char
if (isUndefined(loc.start.line) && isBetween(ls, start, le)) {
loc.start.line = i + 1;
loc.start.column = start - ls;
}
if (isUndefined(loc.end.line) && isBetween(ls, end, le)) {
loc.end.line = i + 1;
loc.end.column = end - ls;
}
sum = le;
}
return loc;
};
const visitors = {
MAP: (node = {}, input = '', ctx = {}) =>
Object.assign(walk(node.mappings, input), {
[loc]: getLoc(input, {
start: node.startPosition,
end: node.endPosition
})
}),
MAPPING: (node = {}, input = '', ctx = {}) => {
const value = walk([node.value], input);
if (!isPrimitive(value)) {
value[loc] = getLoc(input, {
start: node.startPosition,
end: node.endPosition
});
}
return Object.assign(ctx, {
[node.key.value]: value
});
},
SCALAR: (node = {}, input = '') => {
if (isPrimitiveNode(node)) {
return node.value;
}
const _loc = getLoc(input, {
start: node.startPosition,
end: node.endPosition
});
const wrappable = Constructor => () => {
const v = new Constructor(node.value);
v[loc] = _loc;
return v;
};
const object = () => {
node.value[loc] = _loc;
return node.value;
};
const types = {
boolean: wrappable(Boolean),
number: wrappable(Number),
string: wrappable(String),
function: object,
object
};
return types[typeof node.value]();
},
SEQ: (node = {}, input = '') => {
const items = walk(node.items, input, []);
items[loc] = getLoc(input, {
start: node.startPosition,
end: node.endPosition
});
return items;
}
};
const walk = (nodes = [], input, ctx = {}) => {
const onNode = (node, ctx, fallback) => {
const visitor = visitors[Kind[node.kind]];
return visitor ? visitor(node, input, ctx) : fallback;
};
const walkObj = () =>
nodes.reduce((sum, node) => {
return onNode(node, sum, sum);
}, ctx);
const walkArr = () =>
nodes
.map(node => {
return onNode(node, ctx, null);
}, ctx)
.filter(Boolean);
return Array.isArray(ctx) ? walkArr() : walkObj();
};
export default input => walk([load(input)], input);

View File

@ -1,40 +0,0 @@
const { default: jsonAST, loc } = require('../src/index');
const test = require('ava');
test('should accurately add locations', t => {
const ast = jsonAST(`
obj:
arr:
- nums:
- 1
- 2
- 3
strs1:
- '1'
- '2'
- '3'
str: '1'
num: 1
`);
t.deepEqual(Object.keys(ast), ['obj']);
t.deepEqual(ast[loc].start.line, 2);
t.deepEqual(ast[loc].end.line, 14);
t.deepEqual(Object.keys(ast.obj), ['arr', 'str', 'num']);
t.deepEqual(ast.obj[loc].start.line, 2);
t.deepEqual(ast.obj[loc].end.line, 13);
t.deepEqual(ast.obj.str[loc].start.line, 12);
t.deepEqual(ast.obj.str[loc].end.line, 12);
t.deepEqual(ast.obj.num[loc].start.line, 13);
t.deepEqual(ast.obj.num[loc].end.line, 13);
t.deepEqual(ast.obj.arr[0][loc].start.line, 4);
t.deepEqual(ast.obj.arr[0][loc].end.line, 12);
t.deepEqual(Object.keys(ast.obj.arr[0]), ['nums', 'strs1']);
t.deepEqual(ast.obj.arr[0].nums[loc].start.line, 4);
t.deepEqual(ast.obj.arr[0].nums[loc].end.line, 8);
t.deepEqual(ast.obj.arr[0].strs1[loc].start.line, 8);
t.deepEqual(ast.obj.arr[0].strs1[loc].end.line, 12);
});

View File

@ -1,3 +0,0 @@
.nyc_output
coverage
dist

View File

@ -1,3 +0,0 @@
{
"extends": "joyent-portal"
}

View File

@ -1,10 +0,0 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true,
"node": true
}
}

View File

@ -1,25 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.8"></a>
## 1.0.8 (2017-05-26)
<a name="1.0.6"></a>
## 1.0.6 (2017-05-26)
<a name="1.0.5"></a>
## 1.0.5 (2017-05-25)
<a name="1.0.4"></a>
## 1.0.4 (2017-05-25)

View File

@ -1,63 +0,0 @@
# remcalc
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg?style=flat-square)](https://opensource.org/licenses/MPL-2.0)
[![npm](https://img.shields.io/npm/v/remcalc.svg?style=flat-square)](https://npmjs.com/package/remcalc)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
Calculate the `rem`'s from `px` values.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add --dev remcalc
```
## Usage
```js
import remcalc from 'remcalc';
import assert from 'assert';
assert.deepEqual(remcalc.withBase(10, 1, 2, 3, 4), '0.1rem 0.2rem 0.3rem 0.4rem');
assert.deepEqual(remcalc('1'), '0.0625rem');
assert.deepEqual(remcalc('1px'), '0.0625rem');
assert.deepEqual(remcalc.withBase(10, '1px'), '0.1rem');
assert.deepEqual(
remcalc('1', '2', '3', '4'),
'0.0625rem 0.125rem 0.1875rem 0.25rem'
);
assert.deepEqual(
remcalc('1px', '2px', '3px', '4px'),
'0.0625rem 0.125rem 0.1875rem 0.25rem'
);
assert.deepEqual(
remcalc.withBase(10, '1', '2', '3', '4'),
'0.1rem 0.2rem 0.3rem 0.4rem'
);
assert.deepEqual(
remcalc.withBase(10, '1px', '2px', '3px', '4px'),
'0.1rem 0.2rem 0.3rem 0.4rem'
);
assert.deepEqual(remcalc('1 2 3 4'), '0.0625rem 0.125rem 0.1875rem 0.25rem');
assert.deepEqual(remcalc.withBase(10, '1 2 3 4'), '0.1rem 0.2rem 0.3rem 0.4rem');
```
## License
MPL-2.0

View File

@ -1,72 +0,0 @@
{
"name": "remcalc",
"version": "1.0.8",
"license": "MPL-2.0",
"description": "Calculate the `rem`'s from `px` values",
"keywords": [
"calc",
"rem",
"em",
"px",
"pixels",
"pixel"
],
"repository": "github:yldio/joyent-portal",
"main": "dist/remcalc.umd.js",
"jsnext:main": "dist/remcalc.es.js",
"module": "dist/remcalc.es.js",
"entry": "src/index.js",
"scripts": {
"lint": "eslint . --fix",
"lint-ci": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/remcalc.xml",
"test": "bup && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text ava",
"test-ci": "cross-env NODE_ENV=test nyc --report-dir=$CIRCLE_ARTIFACTS/remcalc --reporter=lcov --reporter=text ava --tap | tap-xunit > $CIRCLE_TEST_REPORTS/test/remcalc.xml",
"build": "bup",
"prepublish": "bup"
},
"dependencies": {
"lodash.flatten": "^4.4.0"
},
"devDependencies": {
"ava": "^0.22.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-parameters": "^6.24.1",
"babel-plugin-transform-es2015-spread": "^6.22.0",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-register": "^6.26.0",
"bup": "^1.0.9",
"cross-env": "^5.0.5",
"eslint": "^4.5.0",
"eslint-config-joyent-portal": "3.0.0",
"nyc": "^11.1.0",
"tap-xunit": "^1.7.0"
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"babel": {
"sourceMaps": "inline",
"plugins": [
"transform-es2015-parameters",
"transform-es2015-template-literals",
"transform-es2015-arrow-functions",
"transform-es2015-spread"
],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
},
"ava": {
"tap": true,
"require": [
"babel-register"
],
"babel": "inherit"
}
}

View File

@ -1,11 +0,0 @@
const flatten = require('lodash.flatten');
const BASE = 16;
const calc = (base, ...values) =>
flatten(values.map(value => String(value).split(/\s/gim)))
.map(value => `${Number(value.replace('px', '')) / base}rem`)
.join(' ');
module.exports = (...values) => calc(BASE, ...values);
module.exports.withBase = calc;

View File

@ -1,40 +0,0 @@
const test = require('ava');
const remcalc = require('../');
test('with multiple num arguments', t => {
t.deepEqual(remcalc(1, 2, 3, 4), '0.0625rem 0.125rem 0.1875rem 0.25rem');
t.deepEqual(remcalc.withBase(10, 1, 2, 3, 4), '0.1rem 0.2rem 0.3rem 0.4rem');
});
test('with single str argument', t => {
t.deepEqual(remcalc('1'), '0.0625rem');
t.deepEqual(remcalc('1px'), '0.0625rem');
t.deepEqual(remcalc.withBase(10, '1px'), '0.1rem');
});
test('with multiple str arguments', t => {
t.deepEqual(
remcalc('1', '2', '3', '4'),
'0.0625rem 0.125rem 0.1875rem 0.25rem'
);
t.deepEqual(
remcalc('1px', '2px', '3px', '4px'),
'0.0625rem 0.125rem 0.1875rem 0.25rem'
);
t.deepEqual(
remcalc.withBase(10, '1', '2', '3', '4'),
'0.1rem 0.2rem 0.3rem 0.4rem'
);
t.deepEqual(
remcalc.withBase(10, '1px', '2px', '3px', '4px'),
'0.1rem 0.2rem 0.3rem 0.4rem'
);
});
test('with single str argument spaced', t => {
t.deepEqual(remcalc('1 2 3 4'), '0.0625rem 0.125rem 0.1875rem 0.25rem');
t.deepEqual(remcalc.withBase(10, '1 2 3 4'), '0.1rem 0.2rem 0.3rem 0.4rem');
});

View File

@ -1,3 +0,0 @@
.nyc_output
coverage
dist

View File

@ -1,3 +0,0 @@
{
"extends": "joyent-portal"
}

View File

@ -1,10 +0,0 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true,
"node": true
}
}

View File

@ -1,25 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.8"></a>
## 1.0.8 (2017-05-26)
<a name="1.0.6"></a>
## 1.0.6 (2017-05-26)
<a name="1.0.5"></a>
## 1.0.5 (2017-05-25)
<a name="1.0.4"></a>
## 1.0.4 (2017-05-25)

View File

@ -1,36 +0,0 @@
# rnd-id
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg?style=flat-square)](https://opensource.org/licenses/MPL-2.0)
[![npm](https://img.shields.io/npm/v/rnd-id.svg?style=flat-square)](https://npmjs.com/package/rnd-id)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
Generate a random alphabetical string.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add --dev rnd-id
```
## Usage
```js
const rndId = require('rnd-id');
console.log(rndId()) // kbtpZ
console.log(rndId()) // cuBuLn
console.log(rndId()) // sPwzn
console.log(rndId()) // kKUko
console.log(rndId()) // czzpgR
console.log(rndId()) // cjtzdI
```
## License
MPL-2.0

View File

@ -1,65 +0,0 @@
{
"name": "rnd-id",
"version": "1.0.8",
"license": "MPL-2.0",
"description": "Generate a random alpha string",
"keywords": [
"random",
"alphabetical"
],
"repository": "github:yldio/joyent-portal",
"main": "dist/rnd-id.umd.js",
"jsnext:main": "dist/rnd-id.es.js",
"module": "dist/rnd-id.es.js",
"entry": "src/index.js",
"scripts": {
"lint": "eslint . --fix",
"lint-ci": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/rnd-id.xml",
"test": "bup && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text ava",
"test-ci": "cross-env NODE_ENV=test nyc --report-dir=$CIRCLE_ARTIFACTS/rnd-id --reporter=lcov --reporter=text ava --tap | tap-xunit > $CIRCLE_TEST_REPORTS/test/rnd-id.xml",
"build": "bup",
"prepublish": "bup"
},
"dependencies": {
"random-natural": "^1.0.3"
},
"devDependencies": {
"ava": "^0.22.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-register": "^6.26.0",
"bup": "^1.0.9",
"cross-env": "^5.0.5",
"eslint": "^4.5.0",
"eslint-config-joyent-portal": "3.0.0",
"lodash.uniq": "^4.5.0",
"nyc": "^11.1.0",
"tap-xunit": "^1.7.0"
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"babel": {
"sourceMaps": "inline",
"plugins": [
"transform-es2015-arrow-functions",
"transform-es2015-template-literals"
],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
},
"ava": {
"tap": true,
"require": [
"babel-register"
],
"babel": "inherit"
}
}

View File

@ -1,15 +0,0 @@
const randomNatural = require('random-natural');
// From https://github.com/styled-components/styled-components/blob/065001c725744629c7870240e4a955b924ef5337/src/utils/generateAlphabeticName.js
const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
const rndId = _code => {
const code = _code ? _code : randomNatural({ min: 1000000000 });
const lastDigit = chars[code % chars.length];
return code > chars.length
? `${rndId(Math.floor(code / chars.length))}${lastDigit}`
: lastDigit;
};
module.exports = rndId;

View File

@ -1,17 +0,0 @@
const test = require('ava');
const uniq = require('lodash.uniq');
const rndId = require('../src');
test('should generate strings', t => {
t.truthy(
[rndId(), rndId(), rndId(), rndId()].every(
s => typeof s === 'string' && s.length
)
);
});
test('should generate unique strings', t => {
const arr = [rndId(), rndId(), rndId(), rndId()];
t.deepEqual(uniq(arr).length, arr.length);
});

View File

@ -1,3 +0,0 @@
.nyc_output
coverage
dist

View File

@ -1,3 +0,0 @@
{
"extends": "joyent-portal"
}

View File

@ -1,10 +0,0 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true,
"node": true
}
}

View File

@ -1,23 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.7"></a>
## 1.0.7 (2017-05-25)
### Bug Fixes
* **styled-is:** correct package entrypoints ([44a2f2e](https://github.com/yldio/joyent-portal/commit/44a2f2e))
<a name="1.0.6"></a>
## 1.0.6 (2017-05-25)
### Bug Fixes
* **styled-is:** correct package entrypoints ([44a2f2e](https://github.com/yldio/joyent-portal/commit/44a2f2e))

View File

@ -1,91 +0,0 @@
# styled-is
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![npm](https://img.shields.io/npm/v/styled-is.svg)](https://npmjs.com/package/styled-is)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)
Flag utility for [`styled-components`](https://github.com/styled-components/styled-components).
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add --dev styled-is
```
## Usage
```js
import is, { isNot, isOr, isSomeNot } from 'styled-is';
import styled from 'styled-components';
const Div = styled.div`
display: block;
opacity: 0;
${is('red')`
background-color: red;
`};
${is('blue')`
background-color: blue;
`};
${is('red', 'blue')`
opacity: 1;
`};
${is('left')`
float: left;
`};
${is('right')`
float: right;
`};
${isNot('left', 'right')`
float: center;
`};
${isOr('left', 'right')`
position: relative;
`};
${isSomeNot('red', 'left')`
wat: 1;
`};
`;
```
```js
// display: block;
// opacity: 0;
// float: center;
// wat: 1;
<Div>
// display: block;
// opacity: 0;
// background-color: red;
// opacity: 1;
// float: center;
// wat: 1;
<Div red>
// display: block;
// opacity: 0;
// background-color: red;
// opacity: 1;
// float: left;
// position: relative;
<Div red left>
```
## License
MPL-2.0

View File

@ -1,78 +0,0 @@
{
"name": "styled-is",
"version": "1.0.11",
"license": "MPL-2.0",
"description": "Flag utility for styled-components",
"keywords": [
"flag",
"flags",
"react",
"css",
"css-in-js",
"styled-components"
],
"repository": "github:yldio/joyent-portal",
"main": "dist/styled-is.umd.js",
"jsnext:main": "dist/styled-is.es.js",
"module": "dist/styled-is.es.js",
"entry": "src/index.js",
"scripts": {
"lint": "eslint . --fix",
"lint-ci": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/styled-is.xml",
"test:run": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text ava",
"test-ci:run": "cross-env NODE_ENV=test nyc --report-dir=$CIRCLE_ARTIFACTS/styled-is --reporter=lcov --reporter=text ava --tap | tap-xunit > $CIRCLE_TEST_REPORTS/test/styled-is.xml",
"test": "redrun -s build test:run",
"test-ci": "redrun -s build test-ci:run",
"build": "bup",
"prepublish": "redrun build"
},
"devDependencies": {
"ava": "^0.22.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-parameters": "^6.24.1",
"babel-plugin-transform-es2015-spread": "^6.22.0",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-register": "^6.26.0",
"bup": "^1.0.9",
"cross-env": "^5.0.5",
"eslint": "^4.5.0",
"eslint-config-joyent-portal": "3.0.0",
"nyc": "^11.1.0",
"react": "^15.6.1",
"redrun": "^5.9.17",
"styled-components": "^2.1.2",
"tap-xunit": "^1.7.0"
},
"peerDependencies": {
"react": "*",
"styled-components": "*"
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"babel": {
"sourceMaps": "inline",
"plugins": [
"transform-es2015-parameters",
"transform-es2015-template-literals",
"transform-es2015-arrow-functions",
"transform-es2015-spread"
],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
},
"ava": {
"tap": true,
"require": [
"babel-register"
],
"babel": "inherit"
}
}

View File

@ -1,13 +0,0 @@
import { css } from 'styled-components';
export default (...names) => (...args) => props =>
names.every(name => props[name]) ? css(...args) : css``;
export const isNot = (...names) => (...args) => props =>
names.every(name => !props[name]) ? css(...args) : css``;
export const isOr = (...names) => (...args) => props =>
names.some(name => props[name]) ? css(...args) : css``;
export const isSomeNot = (...names) => (...args) => props =>
names.some(name => !props[name]) ? css(...args) : css``;

View File

@ -1,52 +0,0 @@
const { default: is, isNot, isOr, isSomeNot } = require('../');
const test = require('ava');
test('should render only if prop is truthy', t => {
const rule = is('test')`hello`;
t.deepEqual(rule({ test: false }), []);
t.deepEqual(rule({ test: true }), ['hello']);
});
test('should render only if prop is falsy', t => {
const rule = isNot('test')`hello`;
t.deepEqual(rule({ test: false }), ['hello']);
t.deepEqual(rule({ test: true }), []);
});
test('should render only if all props are truthy', t => {
const rule = is('t1', 't2')`hello`;
t.deepEqual(rule({ t1: true, t2: false }), []);
t.deepEqual(rule({ t1: false, t2: false }), []);
t.deepEqual(rule({ t1: false, t2: true }), []);
t.deepEqual(rule({ t1: true, t2: true }), ['hello']);
});
test('should render only if all props are falsy', t => {
const rule = isNot('t1', 't2')`hello`;
t.deepEqual(rule({ t1: true, t2: false }), []);
t.deepEqual(rule({ t1: false, t2: false }), ['hello']);
t.deepEqual(rule({ t1: false, t2: true }), []);
t.deepEqual(rule({ t1: true, t2: true }), []);
});
test('should render only if one prop is truthy', t => {
const rule = isOr('t1', 't2')`hello`;
t.deepEqual(rule({ t1: true, t2: false }), ['hello']);
t.deepEqual(rule({ t1: false, t2: false }), []);
t.deepEqual(rule({ t1: false, t2: true }), ['hello']);
t.deepEqual(rule({ t1: true, t2: true }), ['hello']);
});
test('should render only if one prop is falsy', t => {
const rule = isSomeNot('t1', 't2')`hello`;
t.deepEqual(rule({ t1: true, t2: false }), ['hello']);
t.deepEqual(rule({ t1: false, t2: false }), ['hello']);
t.deepEqual(rule({ t1: false, t2: true }), ['hello']);
t.deepEqual(rule({ t1: true, t2: true }), []);
});

View File

@ -1,29 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.1.0"></a>
# 1.1.0 (2017-05-25)
### Bug Fixes
* **ui-toolkit:** compile on postinstall ([7bf95fd](https://github.com/yldio/joyent-portal/commit/7bf95fd))
* **ui-toolkit:** copy fonts before compiling ([19f3678](https://github.com/yldio/joyent-portal/commit/19f3678))
### Features
* **cp-frontend,ui-toolkit:** style inheritance using `.extend` (#458) ([f3e531d](https://github.com/yldio/joyent-portal/commit/f3e531d))
<a name="1.0.3"></a>
## 1.0.3 (2017-05-25)
### Bug Fixes
* **ui-toolkit:** copy fonts before compiling ([19f3678](https://github.com/yldio/joyent-portal/commit/19f3678))

View File

@ -8,18 +8,20 @@
"module": "dist/es/index.js", "module": "dist/es/index.js",
"scripts": { "scripts": {
"lint:css": "echo 0", "lint:css": "echo 0",
"lint-ci:css": "echo 0",
"lint:js": "eslint . --fix", "lint:js": "eslint . --fix",
"lint-ci:js": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/ui-toolkit.xml",
"lint": "redrun -s lint:*", "lint": "redrun -s lint:*",
"lint-ci": "redrun -s lint-ci:*",
"test": "echo 0", "test": "echo 0",
"test-ci": "echo 0", "test-ci": "echo 0",
"copy-fonts": "rm -rf dist; mkdir -p dist/es/typography; mkdir -p dist/umd/typography; cp -r src/typography/libre-franklin dist/es/typography; cp -r src/typography/libre-franklin dist/umd/typography", "copy-fonts":
"compile-watch:es": "NODE_ENV=development babel src --out-dir dist/es --source-maps inline --watch", "rm -rf dist; mkdir -p dist/es/typography; mkdir -p dist/umd/typography; cp -r src/typography/libre-franklin dist/es/typography; cp -r src/typography/libre-franklin dist/umd/typography",
"compile:es": "NODE_ENV=development babel src --out-dir dist/es --source-maps inline", "compile-watch:es":
"compile:umd": "cross-env NODE_ENV=test babel src --out-dir dist/umd --source-maps inline", "NODE_ENV=development babel src --out-dir dist/es --source-maps inline --watch",
"compile-watch:umd": "cross-env NODE_ENV=test babel src --out-dir dist/umd --source-maps inline --watch", "compile:es":
"NODE_ENV=development babel src --out-dir dist/es --source-maps inline",
"compile:umd":
"cross-env NODE_ENV=test babel src --out-dir dist/umd --source-maps inline",
"compile-watch:umd":
"cross-env NODE_ENV=test babel src --out-dir dist/umd --source-maps inline --watch",
"compile": "redrun -p compile:*", "compile": "redrun -p compile:*",
"watch": "redrun copy-fonts && redrun -p compile-watch:*", "watch": "redrun copy-fonts && redrun -p compile-watch:*",
"styleguide:build": "cross-env NODE_ENV=production styleguidist build", "styleguide:build": "cross-env NODE_ENV=production styleguidist build",
@ -58,7 +60,6 @@
"unitcalc": "^1.0.8" "unitcalc": "^1.0.8"
}, },
"devDependencies": { "devDependencies": {
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"csso": "^3.1.1", "csso": "^3.1.1",
"eslint": "^4.5.0", "eslint": "^4.5.0",
"eslint-config-joyent-portal": "2.0.0", "eslint-config-joyent-portal": "2.0.0",
@ -83,7 +84,8 @@
"stylelint": "^8.0.0", "stylelint": "^8.0.0",
"stylelint-config-primer": "^2.0.1", "stylelint-config-primer": "^2.0.1",
"stylelint-config-standard": "^17.0.0", "stylelint-config-standard": "^17.0.0",
"stylelint-processor-styled-components": "styled-components/stylelint-processor-styled-components#2a33b5f", "stylelint-processor-styled-components":
"styled-components/stylelint-processor-styled-components#2a33b5f",
"svgo": "^0.7.2", "svgo": "^0.7.2",
"tinycolor2": "^1.4.1", "tinycolor2": "^1.4.1",
"title-case": "^2.1.1", "title-case": "^2.1.1",

View File

@ -1,3 +0,0 @@
.nyc_output
coverage
dist

View File

@ -1,3 +0,0 @@
{
"extends": "joyent-portal"
}

View File

@ -1,10 +0,0 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true,
"node": true
}
}

View File

@ -1,25 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.8"></a>
## 1.0.8 (2017-05-26)
<a name="1.0.6"></a>
## 1.0.6 (2017-05-26)
<a name="1.0.5"></a>
## 1.0.5 (2017-05-25)
<a name="1.0.4"></a>
## 1.0.4 (2017-05-25)

View File

@ -1,54 +0,0 @@
# unitcalc
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg?style=flat-square)](https://opensource.org/licenses/MPL-2.0)
[![npm](https://img.shields.io/npm/v/unitcalc.svg?style=flat-square)](https://npmjs.com/package/unitcalc)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
Calculate the `rem`'s from unit values.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add --dev unitcalc
```
## Usage
```js
import unitcalc from 'unitcalc';
import assert from 'assert';
assert.deepEqual(unitcalc(1, 2, 3, 4), '0.375rem 0.75rem 1.125rem 1.5rem');
assert.deepEqual(unitcalc('1'), '0.375rem');
assert.deepEqual(unitcalc.withBase(10, '1'), '0.625rem');
assert.deepEqual(
unitcalc('1', '2', '3', '4'),
'0.375rem 0.75rem 1.125rem 1.5rem'
);
assert.deepEqual(
unitcalc.withBase(10, '1', '2', '3', '4'),
'0.625rem 1.25rem 1.875rem 2.5rem'
);
assert.deepEqual(unitcalc('1 2 3 4'), '0.375rem 0.75rem 1.125rem 1.5rem');
assert.deepEqual(
unitcalc.withBase(10, '1 2 3 4'),
'0.625rem 1.25rem 1.875rem 2.5rem'
);
```
## License
MPL-2.0

View File

@ -1,73 +0,0 @@
{
"name": "unitcalc",
"version": "1.0.8",
"license": "MPL-2.0",
"description": "Calculate the `rem`'s from unit values",
"keywords": [
"calc",
"rem",
"em",
"px",
"pixels",
"pixel",
"baseline",
"unit"
],
"repository": "github:yldio/joyent-portal",
"main": "dist/unitcalc.umd.js",
"jsnext:main": "dist/unitcalc.es.js",
"module": "dist/unitcalc.es.js",
"entry": "src/index.js",
"scripts": {
"lint": "eslint . --fix",
"lint-ci": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/unitcalc.xml",
"test": "bup && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text ava",
"test-ci": "cross-env NODE_ENV=test nyc --report-dir=$CIRCLE_ARTIFACTS/unitcalc --reporter=lcov --reporter=text ava --tap | tap-xunit > $CIRCLE_TEST_REPORTS/test/unitcalc.xml",
"build": "bup",
"prepublish": "bup"
},
"dependencies": {
"lodash.flatten": "^4.4.0",
"remcalc": "^1.0.8"
},
"devDependencies": {
"ava": "^0.22.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-parameters": "^6.24.1",
"babel-plugin-transform-es2015-spread": "^6.22.0",
"babel-register": "^6.26.0",
"bup": "^1.0.9",
"cross-env": "^5.0.5",
"eslint": "^4.5.0",
"eslint-config-joyent-portal": "3.0.0",
"nyc": "^11.1.0",
"tap-xunit": "^1.7.0"
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"babel": {
"sourceMaps": "inline",
"plugins": [
"transform-es2015-parameters",
"transform-es2015-arrow-functions",
"transform-es2015-spread"
],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
},
"ava": {
"tap": true,
"require": [
"babel-register"
],
"babel": "inherit"
}
}

View File

@ -1,12 +0,0 @@
const flatten = require('lodash.flatten');
const remcalc = require('remcalc');
const BASE = 6;
const calc = (base, ...values) =>
flatten(values.map(value => String(value).split(/\s/gim)))
.map(value => remcalc(Number(value) * base))
.join(' ');
module.exports = (...values) => calc(BASE, ...values);
module.exports.withBase = calc;

View File

@ -1,27 +0,0 @@
const test = require('ava');
const unitcalc = require('../');
test('with multiple num arguments', t => {
t.deepEqual(unitcalc(1, 2, 3, 4), '0.375rem 0.75rem 1.125rem 1.5rem');
});
test('with single str argument', t => {
t.deepEqual(unitcalc('1'), '0.375rem');
t.deepEqual(unitcalc.withBase(10, '1'), '0.625rem');
});
test('with multiple str arguments', t => {
t.deepEqual(unitcalc('1', '2', '3', '4'), '0.375rem 0.75rem 1.125rem 1.5rem');
t.deepEqual(
unitcalc.withBase(10, '1', '2', '3', '4'),
'0.625rem 1.25rem 1.875rem 2.5rem'
);
});
test('with single str argument spaced', t => {
t.deepEqual(unitcalc('1 2 3 4'), '0.375rem 0.75rem 1.125rem 1.5rem');
t.deepEqual(
unitcalc.withBase(10, '1 2 3 4'),
'0.625rem 1.25rem 1.875rem 2.5rem'
);
});

View File

@ -1,186 +0,0 @@
#!/usr/bin/env node
const execa = require('execa');
const { parse } = require('dotenv');
const main = require('apr-main');
const map = require('apr-map');
const series = require('apr-series');
const globby = require('globby');
const path = require('path');
const flatten = require('lodash.flatten');
const readPkg = require('read-pkg');
const figures = require('figures');
const COMPOSE_PROJECT_NAME = `cp-${process.env.CIRCLE_BRANCH}`;
const NAMESPACE = 'quay.io/yldio';
const ROOT = path.join(__dirname, '..');
const LOG = console.log;
const createTritonProfile = async () => {
const { SDC_ACCOUNT = '', SDC_KEY_ID = '' } = process.env;
LOG(
`${figures.arrowRight} create triton profile SDC_ACCOUNT=${SDC_ACCOUNT.length} SDC_KEY_ID=${SDC_KEY_ID.length}`
);
const payload = JSON.stringify({
url: 'https://eu-ams-1.api.joyent.com',
account: SDC_ACCOUNT,
keyId: SDC_KEY_ID,
name: 'eu-ams-1',
curr: true
});
const cp = execa('triton', ['profile', 'create', '--yes', '-f', '-'], {
input: payload
});
cp.stdout.pipe(process.stdout);
cp.stderr.pipe(process.stderr);
return cp;
};
const getEnv = async () => {
await createTritonProfile();
const tritonEnv = await execa.stdout('triton', ['env']);
const dotEnv = tritonEnv.replace(/^export /gim, '');
return Object.assign({}, process.env, parse(dotEnv));
};
const login = async () => {
LOG(`${figures.arrowRight} login`);
const {
_DOCKER_LOGIN_USERNAME,
_DOCKER_LOGIN_PASSWORD,
_DOCKER_REGISTRY
} = process.env;
return execa(
'docker',
[
'login',
'--email="."',
`--username="${_DOCKER_LOGIN_USERNAME}"`,
`--password="${_DOCKER_LOGIN_PASSWORD}"`,
_DOCKER_REGISTRY
],
{
stdio: 'inherit'
}
);
};
const build = async () => {
LOG(`${figures.arrowRight} build`);
const { CIRCLE_BRANCH } = process.env;
const dockerfiles = await globby(['packages/*/Dockerfile'], {
cwd: ROOT
});
LOG(`${figures.arrowRight} build.dockerfiles`);
LOG(JSON.stringify(dockerfiles, null, 2));
const images = await map(dockerfiles, async dockerfile => {
const folder = path.resolve(ROOT, path.dirname(dockerfile));
const { name } = await readPkg(folder);
const tags = [`${name}:${CIRCLE_BRANCH}`, `${name}:latest`];
// todo remove this
if (name === 'portal-api') {
return;
}
LOG(`${figures.arrowRight} build.name ${name}`);
LOG(JSON.stringify(tags, null, 2));
await execa(
'docker',
flatten([
'build',
flatten(tags.map(name => ['-t', `${NAMESPACE}/${name}`])),
'-f',
dockerfile,
'.'
]),
{
stdio: 'inherit'
}
);
return `${NAMESPACE}/${name}`;
});
await map(images.filter(Boolean), image => {
LOG(`${figures.arrowRight} build.push ${image}`);
return execa('docker', ['push', `${image}`], {
stdio: 'inherit'
});
});
};
const logout = () => {
LOG(`${figures.arrowRight} logout`);
return execa('docker', ['logout'], {
stdio: 'inherit'
});
};
const deploy = async () => {
const env = await getEnv();
LOG(`${figures.arrowRight} deploy`);
// stop containers
await execa('docker-compose', ['stop'], {
stdio: 'inherit',
env: Object.assign({}, env, {
COMPOSE_PROJECT_NAME
})
});
// kill containers
await execa('docker-compose', ['kill'], {
stdio: 'inherit',
env: Object.assign({}, env, {
COMPOSE_PROJECT_NAME
})
});
// rm containers
await execa('docker-compose', ['rm', '-f', '-v'], {
stdio: 'inherit',
env: Object.assign({}, env, {
COMPOSE_PROJECT_NAME
})
});
// pull new images
await execa('docker-compose', ['pull', '--parallel'], {
stdio: 'inherit',
env: Object.assign({}, env, {
COMPOSE_PROJECT_NAME
})
});
// up project
return execa('docker-compose', ['up', '-d', '--build', '--force-recreate'], {
stdio: 'inherit',
env: Object.assign({}, env, {
COMPOSE_PROJECT_NAME
})
});
};
const run = async () => {
LOG(`${figures.arrowRight} .env`);
LOG(JSON.stringify(Object.keys(process.env), null, 2));
return series([login, build, logout, deploy]);
};
LOG(`${figures.arrowRight} DEPLOY`);
main(run());

View File

@ -22,25 +22,26 @@ const asyncChecksum = awaitify(checksum.file);
const ROOT = path.join(__dirname, '../'); const ROOT = path.join(__dirname, '../');
const SCRIPTS = path.resolve(__dirname); const SCRIPTS = path.resolve(__dirname);
const optOut = forceArray(config['fmt-opt-out']).map(pkg =>
path.join(ROOT, `packages/${pkg}`)
);
const statuses = ['Added', 'Modified']; const statuses = ['Added', 'Modified'];
const filter = (files = []) => const filter = (files = []) =>
files files
.filter(file => !/node_modules|dist/.test(file)) .filter(file => !/node_modules|dist/.test(file))
.map(file => path.resolve(ROOT, file)) .map(file => path.resolve(ROOT, file));
.filter(file => !optOut.some(pkg => file.indexOf(pkg) === 0));
const run = async (files = []) => { const run = async (files = []) => {
const filteredFiles = filter(files); const filteredFiles = filter(files);
const _files = filteredFiles.reduce( const _files = filteredFiles.reduce(
(files, file) => { (files, file) => {
const ext = path.extname(file).replace(/^./, '') || 'js'; const ext = path.extname(file).replace(/^./, '');
if (!ext) {
return files;
}
return Object.assign(files, { return Object.assign(files, {
[ext]: (files[ext] || 'js').concat(file) [ext]: (files[ext] || []).concat(file)
}); });
}, },
{ {

View File

@ -1,34 +0,0 @@
#!/usr/bin/env node
const argv = require('yargs').argv;
const forEach = require('apr-for-each');
const main = require('apr-main');
const intercept = require('apr-intercept');
const execa = require('execa');
const path = require('path');
const ROOT = process.cwd();
if (!argv.cmd) {
throw new Error('Missing --cmd argument');
}
const run = () =>
forEach(argv._, async file => {
const cwd = path.dirname(path.join(ROOT, file));
const [err] = await intercept(
execa('yarn', ['run', argv.cmd], {
stdio: 'inherit',
cwd
})
);
if (err) {
console.error(`cmd: ${argv.cmd} | cwd: ${cwd}`);
console.error(err);
throw err;
}
});
main(run());

View File

@ -1,496 +0,0 @@
#!/usr/bin/env node
const { EOL } = require('os');
const inquirer = require('inquirer');
const isString = require('lodash.isstring');
const isPlainObject = require('lodash.isplainobject');
const uniqBy = require('lodash.uniqby');
const sortBy = require('apr-sort-by');
const map = require('apr-map');
const pkg = require('../package.json');
const { writeFile } = require('mz/fs');
const readPkg = require('read-pkg');
const reduce = require('apr-reduce');
const intercept = require('apr-intercept');
const execa = require('execa');
const argv = require('yargs').argv;
const semver = require('semver');
const globby = require('globby');
const figures = require('figures');
const chalk = require('chalk');
const path = require('path');
const ROOT = path.join(__dirname, '..');
const exec = (...args) =>
execa(...args, {
stdio: 'inherit'
});
const releaseTypes = {
dev: 'dev',
staging: 'staging',
production: 'production'
};
const incs = {
production: 'major',
staging: 'minor',
dev: 'patch'
};
const tasks = [
{
title: 'Git Check',
description: 'Checks whether the current git state is ideal for a publish',
task: [
{
title: 'Branch',
description:
'Checks if the current branch is `master`. To ignore use the `--any-branch` flag',
filter: () => !argv['any-branch'],
task: async () => {
const branch = await execa.stdout('git', [
'symbolic-ref',
'--short',
'HEAD'
]);
if (branch !== 'master') {
throw new Error(
'Not on `master` branch. Use --any-branch to publish anyway'
);
}
}
},
{
title: 'Working tree',
description:
'Checks if working tree is clean. To ignore use the `--force` flag',
filter: () => !argv.force,
task: async () => {
const status = await execa.stdout('git', ['status', '--porcelain']);
if (status !== '') {
throw new Error(
'Unclean working tree. Commit or stash changes first. Use --force to publish anyway'
);
}
}
},
{
title: 'Remote history',
description: 'Checks if remote history differs',
task: async () => {
const history = await execa.stdout('git', [
'rev-list',
'--count',
'--left-only',
'@{u}...HEAD'
]);
if (history !== '0') {
throw new Error('Remote history differs. Please pull changes');
}
}
}
]
},
{
title: 'Lerna',
task: [
{
title: 'Updated',
description: 'Shows a list of updated packages',
task: () =>
exec('lerna', ['updated', '--conventional-commits', '--independent'])
},
{
title: 'Publish',
description:
'Publish updated packages, based on the changes from last tag',
task: async ({ prefix }) => {
const { publish } = await inquirer.prompt([
{
name: 'publish',
type: 'confirm',
message: `${prefix}Want to publish packages?`
}
]);
if (!publish) {
return {
published: false
};
}
const msg = 'chore: publish packages';
const prevCommit = await execa.stdout('git', [
'log',
'-1',
"--format='%h'"
]);
const [err] = await intercept(
exec('lerna', [
'publish',
'--conventional-commits',
'--independent',
'-m',
`"${msg}"`
])
);
// check if user denied publish
if (/^Command\sfailed:/.test(err.message)) {
return {
published: false
};
}
// check if last commit is the publish
const lastCommit = await execa.stdout('git', [
'log',
'-1',
"--format=\"title:'%s' hash:'%h'\""
]);
// eslint-disable-next-line no-unused-vars
const [_, title, hash] = lastCommit.match(
/title:'(.*?) hash:'(.*?)'/
);
return {
published: title === msg && hash !== prevCommit
};
}
}
]
},
{
title: 'Release',
description: 'Cut a release for Continuous Delivery',
task: [
{
filter: ({ published }) => !published,
task: async ({ prefix }) =>
inquirer.prompt([
{
name: 'release',
type: 'confirm',
default: false,
message: `${prefix}No lerna publish detected. Are you sure you want to release? \n ${prefix}${chalk.dim(
`(${chalk.yellow(
figures.warning
)} this can have negative effects on future lerna publishes since it detects changes based on tags)`
)}`
}
])
},
{
filter: ({ published }) => published,
task: async ({ prefix }) =>
inquirer.prompt([
{
name: 'release',
type: 'confirm',
default: false,
message: `${prefix}Want to cut a release?`
}
])
},
{
title: 'Type',
filter: ({ release }) => release,
task: async ({ prefix }) =>
inquirer.prompt([
{
name: 'releaseType',
type: 'list',
message: `${prefix}What type of release?`,
choices: Object.keys(releaseTypes),
default: 'dev'
}
])
},
{
title: 'Version bump',
description: 'Bum version based on release type',
filter: ({ release }) => release,
task: async ({ releaseType }) => {
const version = Object.keys(incs)
.filter(k => releaseType === k)
.reduce((v, k) => semver.inc(v, incs[k]), pkg.version);
return {
version: String(version)
};
}
},
{
title: 'Tag',
description: 'Create new tag for release',
filter: ({ release }) => release,
task: async ({ version, releaseType, prefix }) => {
// from a tag hash, get the timestamp
const tagTimestamp = async ({ hash }) => {
if (!hash) {
return 0;
}
const show = await execa.stdout('git', [
'show',
'-s',
'--format=%ct',
hash
]);
return -Number(show.split(/\n/).pop());
};
// from a string of tags, get the name, hash, version and pkg
const parseTags = str =>
str.split(/\n/).map(line => {
const meta = line.match(/(.*?)\s*?refs\/tags\/(.*?)@(.*)/);
const hashname = line.match(/(.*?)\s*?refs\/tags\/(.*)/);
// eslint-disable-next-line no-unused-vars
const [_, __, pkg, version] = meta || [];
// eslint-disable-next-line no-unused-vars
const [___, hash, name] = hashname || [];
return {
hash,
name: (name || '').replace('^{}', ''),
pkg,
version: (version || '').replace('^{}', '')
};
});
// get a tag parent tag
// this is needed to build a summary of changes
const getLastTag = async () => {
// get all remote tags
const remoteTags = await execa.stdout('git', [
'ls-remote',
'--tags'
]);
// get all local tags
const localTags = await execa.stdout('git', [
'show-ref',
'--tags',
'-d'
]);
// gather all tags, remote and local
const allTags = parseTags(remoteTags)
.concat(parseTags(localTags))
.filter(Boolean);
// from all tags, filter duplicates
const uniqueTags = uniqBy(allTags, ({ name }) => name);
// sort tags by timestamp, most recent to oldest
const tags = await sortBy(uniqueTags, tagTimestamp);
// check whether any of the tags matches the name
const type = releaseTypes[releaseType];
const projTags = tags.filter(
({ name }) => name.indexOf(`${pkg.name}-${type}`) >= 0
);
// if tags found, get the most recent
if (projTags.length) {
return projTags.shift().name;
}
// get all package folders
const pkgFolders = (await globby(['packages/*'], {
cwd: path.join(__dirname, '..')
})).map(folder => path.resolve(ROOT, folder));
// get package names
const pkgs = await map(
pkgFolders,
async folder => (await readPkg(folder)).name
);
// filter tags that are scoped to packages
const nonLernaTags = tags.filter(
tag => !pkgs.some(pkg => tag.pkg === pkg)
);
// if no remaining tag, get first repo commit
if (!nonLernaTags.length) {
return execa.stdout('git', [
'rev-list',
'--max-parents=0',
'HEAD'
]);
}
// from the remaining tags, pick one
const { tag } = await inquirer.prompt([
{
name: 'tag',
type: 'list',
message: `${prefix}What tag to base your release on?`,
choices: nonLernaTags.map(({ name }) => name),
pageSize: nonLernaTags.length
}
]);
return tag;
};
const lastTag = await getLastTag();
const lastCommits = await execa.stdout('git', [
'log',
`${lastTag}..HEAD`,
'--no-merges',
'--format="%h %s (%aN)"'
]);
const tagName = `${pkg.name}-${releaseType}@${version}`;
const tagBody = `${EOL}${lastCommits}`;
console.log(
`${prefix}${chalk.yellow(
'Tag Name: '
)}\n${prefix}${prefix}${chalk.dim(tagName)}`
);
console.log(`${prefix}${chalk.yellow('Tag Description: ')}`);
console.log(
`${chalk.dim(
lastCommits
.split(/\n/)
.map(line => `${prefix}${prefix}${line}`)
.join('\n')
)}`
);
const { createTag } = await inquirer.prompt([
{
name: 'createTag',
type: 'confirm',
message: `${prefix}Should above tag be created?`
}
]);
if (!createTag) {
return {
createTag
};
}
await exec('git', ['tag', tagName, '-m', tagBody]);
return {
tagName,
tagBody,
lastCommits,
createTag
};
}
},
{
title: 'Push',
description: 'Push just created tag to origin',
filter: ({ createTag }) => createTag,
task: async ({ tagName, prefix }) => {
const { pushTag } = await inquirer.prompt([
{
name: 'pushTag',
type: 'confirm',
message: `${prefix}Should ${chalk.yellow(
tagName
)} be pushed to origin?`
}
]);
if (!pushTag) {
return;
}
return exec('git', ['push', 'origin', tagName]);
}
},
{
title: 'Version write',
filter: ({ createTag }) => createTag,
description: 'Write new version to `package.json`',
task: ({ version }) => {
pkg.version = version;
return writeFile(
path.join(__dirname, '../package.json'),
JSON.stringify(pkg, null, 2),
'utf-8'
);
}
}
]
}
];
const run = (tasks = [], ctx = {}, prefix = '') =>
reduce(
tasks,
async (ctx = {}, { title, description, filter, task }) => {
if (!task) {
return;
}
const context = Object.assign({}, ctx, {
prefix
});
const shouldRun = filter ? await filter(context) : true;
if (!shouldRun) {
return;
}
if (isString(title)) {
console.log(`${prefix}${chalk.green(figures.arrowRight)} ${title}`);
}
if (isString(description)) {
console.log(
`${chalk.dim(`${prefix}${figures.arrowRight} ${description}`)}`
);
}
if (Array.isArray(task)) {
return run(task, context, `${prefix} `);
}
const [err, nCtx] = await intercept(task(context));
if (err) {
console.log(`${chalk.red(figures.cross)} ${chalk.dim(err.message)}`);
console.log(
`${chalk.dim(err.stack.replace(`Error: ${err.message}`, '').trim())}`
);
throw err;
}
return Object.assign({}, context, isPlainObject(nCtx) ? nCtx : {});
},
ctx
);
// eslint-disable-next-line handle-callback-err
const exit = err => {
process.exit(1);
};
process.on('SIGTERM', exit);
process.on('SIGINT', exit);
process.on('SIGHUP', exit);
run(tasks).catch(exit);