-
-// display: block;
-// opacity: 0;
-// background-color: red;
-// opacity: 1;
-// float: left;
-// position: relative;
-
-```
-
-## License
-
-MPL-2.0
diff --git a/packages/styled-is/package.json b/packages/styled-is/package.json
deleted file mode 100644
index c5521456..00000000
--- a/packages/styled-is/package.json
+++ /dev/null
@@ -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"
- }
-}
\ No newline at end of file
diff --git a/packages/styled-is/src/index.js b/packages/styled-is/src/index.js
deleted file mode 100644
index e9634f68..00000000
--- a/packages/styled-is/src/index.js
+++ /dev/null
@@ -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``;
diff --git a/packages/styled-is/test/index.js b/packages/styled-is/test/index.js
deleted file mode 100644
index 6914f33c..00000000
--- a/packages/styled-is/test/index.js
+++ /dev/null
@@ -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 }), []);
-});
diff --git a/packages/ui-toolkit/CHANGELOG.md b/packages/ui-toolkit/CHANGELOG.md
deleted file mode 100644
index 722531f0..00000000
--- a/packages/ui-toolkit/CHANGELOG.md
+++ /dev/null
@@ -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.
-
-
-# 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))
-
-
-
-
-
-## 1.0.3 (2017-05-25)
-
-
-### Bug Fixes
-
-* **ui-toolkit:** copy fonts before compiling ([19f3678](https://github.com/yldio/joyent-portal/commit/19f3678))
diff --git a/packages/ui-toolkit/package.json b/packages/ui-toolkit/package.json
index 911c4bc7..f126e025 100644
--- a/packages/ui-toolkit/package.json
+++ b/packages/ui-toolkit/package.json
@@ -8,18 +8,20 @@
"module": "dist/es/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/ui-toolkit.xml",
"lint": "redrun -s lint:*",
- "lint-ci": "redrun -s lint-ci:*",
"test": "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",
- "compile-watch:es": "NODE_ENV=development babel src --out-dir dist/es --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",
+ "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",
+ "compile-watch:es":
+ "NODE_ENV=development babel src --out-dir dist/es --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:*",
"watch": "redrun copy-fonts && redrun -p compile-watch:*",
"styleguide:build": "cross-env NODE_ENV=production styleguidist build",
@@ -58,7 +60,6 @@
"unitcalc": "^1.0.8"
},
"devDependencies": {
- "babel-plugin-transform-decorators-legacy": "^1.3.4",
"csso": "^3.1.1",
"eslint": "^4.5.0",
"eslint-config-joyent-portal": "2.0.0",
@@ -83,7 +84,8 @@
"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",
+ "stylelint-processor-styled-components":
+ "styled-components/stylelint-processor-styled-components#2a33b5f",
"svgo": "^0.7.2",
"tinycolor2": "^1.4.1",
"title-case": "^2.1.1",
diff --git a/packages/unitcalc/.eslintignore b/packages/unitcalc/.eslintignore
deleted file mode 100644
index fd5c1106..00000000
--- a/packages/unitcalc/.eslintignore
+++ /dev/null
@@ -1,3 +0,0 @@
-.nyc_output
-coverage
-dist
diff --git a/packages/unitcalc/.eslintrc b/packages/unitcalc/.eslintrc
deleted file mode 100644
index 14dc524b..00000000
--- a/packages/unitcalc/.eslintrc
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "extends": "joyent-portal"
-}
diff --git a/packages/unitcalc/.tern-project b/packages/unitcalc/.tern-project
deleted file mode 100644
index 6d78dea5..00000000
--- a/packages/unitcalc/.tern-project
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "libs": [
- "ecmascript"
- ],
- "plugins": {
- "doc_comment": true,
- "local-scope": true,
- "node": true
- }
-}
\ No newline at end of file
diff --git a/packages/unitcalc/CHANGELOG.md b/packages/unitcalc/CHANGELOG.md
deleted file mode 100644
index d30978e9..00000000
--- a/packages/unitcalc/CHANGELOG.md
+++ /dev/null
@@ -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.
-
-
-## 1.0.8 (2017-05-26)
-
-
-
-
-
-## 1.0.6 (2017-05-26)
-
-
-
-
-
-## 1.0.5 (2017-05-25)
-
-
-
-
-
-## 1.0.4 (2017-05-25)
diff --git a/packages/unitcalc/README.md b/packages/unitcalc/README.md
deleted file mode 100644
index 1dde66f3..00000000
--- a/packages/unitcalc/README.md
+++ /dev/null
@@ -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
diff --git a/packages/unitcalc/package.json b/packages/unitcalc/package.json
deleted file mode 100644
index 24965636..00000000
--- a/packages/unitcalc/package.json
+++ /dev/null
@@ -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"
- }
-}
\ No newline at end of file
diff --git a/packages/unitcalc/src/index.js b/packages/unitcalc/src/index.js
deleted file mode 100644
index 8acc0d41..00000000
--- a/packages/unitcalc/src/index.js
+++ /dev/null
@@ -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;
diff --git a/packages/unitcalc/test/index.js b/packages/unitcalc/test/index.js
deleted file mode 100644
index cfa52523..00000000
--- a/packages/unitcalc/test/index.js
+++ /dev/null
@@ -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'
- );
-});
diff --git a/scripts/deploy b/scripts/deploy
deleted file mode 100755
index 64036c2f..00000000
--- a/scripts/deploy
+++ /dev/null
@@ -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());
diff --git a/scripts/format b/scripts/format
index da0f8a9d..bc9f8697 100755
--- a/scripts/format
+++ b/scripts/format
@@ -22,25 +22,26 @@ const asyncChecksum = awaitify(checksum.file);
const ROOT = path.join(__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 filter = (files = []) =>
files
.filter(file => !/node_modules|dist/.test(file))
- .map(file => path.resolve(ROOT, file))
- .filter(file => !optOut.some(pkg => file.indexOf(pkg) === 0));
+ .map(file => path.resolve(ROOT, file));
const run = async (files = []) => {
const filteredFiles = filter(files);
+
const _files = filteredFiles.reduce(
(files, file) => {
- const ext = path.extname(file).replace(/^./, '') || 'js';
+ const ext = path.extname(file).replace(/^./, '');
+
+ if (!ext) {
+ return files;
+ }
+
return Object.assign(files, {
- [ext]: (files[ext] || 'js').concat(file)
+ [ext]: (files[ext] || []).concat(file)
});
},
{
diff --git a/scripts/parallel-run b/scripts/parallel-run
deleted file mode 100755
index 15c610ea..00000000
--- a/scripts/parallel-run
+++ /dev/null
@@ -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());
diff --git a/scripts/release b/scripts/release
deleted file mode 100755
index 9873ee10..00000000
--- a/scripts/release
+++ /dev/null
@@ -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);