diff --git a/.cz-config.js b/.cz-config.js new file mode 100644 index 0000000..7d9cfd4 --- /dev/null +++ b/.cz-config.js @@ -0,0 +1,20 @@ +'use strict'; + +module.exports = { + + types: [ + {value: 'feat', name: 'feat: A new feature'}, + {value: 'fix', name: 'fix: A bug fix'}, + {value: 'docs', name: 'docs: Documentation only changes'}, + {value: 'style', name: 'style: Changes that do not affect the meaning of the code\n (white-space, formatting, missing semi-colons, etc)'}, + {value: 'refactor', name: 'refactor: A code change that neither fixes a bug nor adds a feature'}, + {value: 'perf', name: 'perf: A code change that improves performance'}, + {value: 'test', name: 'test: Adding missing tests'}, + {value: 'chore', name: 'chore: Changes to the build process or auxiliary tools\n and libraries such as documentation generation'}, + {value: 'revert', name: 'revert: Revert to a commit'}, + {value: 'WIP', name: 'WIP: Work in progress'} + ], + + allowBreakingChanges: ['feat', 'fix', 'perf'] + +}; diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd4f2b0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +.DS_Store diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..2c630f1 --- /dev/null +++ b/.npmignore @@ -0,0 +1,2 @@ +test +.* diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..0760cfb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: "6" +after_success: + - npm run semantic-release diff --git a/README.md b/README.md index 83f7e71..5155674 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -Topcoat Variables Shared -======================== +# Topcoat Variables Shared -Shared variables for the Topcoat theme. +[![Build Status](https://travis-ci.org/topcoat/variables-shared.svg?branch=master)](https://travis-ci.org/topcoat/variables-shared) [![npm version](https://badge.fury.io/js/topcoat-variables-shared.svg)](https://badge.fury.io/js/topcoat-variables-shared) -[![NPM](https://nodei.co/npm/topcoat-variables-shared.png)](https://nodei.co/npm/topcoat-variables-shared/) +--- + +Shared variables for theme. diff --git a/package.json b/package.json index 4fed97f..9cd4b5c 100644 --- a/package.json +++ b/package.json @@ -1,24 +1,52 @@ { "name": "topcoat-variables-shared", - "version": "0.1.4", "description": "Shared variables for Topcoat theme", - "main": "index.html", "style": "src/variables-shared", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "ava", + "semantic-release": "semantic-release pre && npm publish && semantic-release post" }, "repository": { "type": "git", - "url": "git://github.com/topcoat/variables-shared.git" + "url": "https://github.com/topcoat/variables-shared.git" }, "keywords": [ "variables", "theme", "topcoat" ], - "author": "@dam Kristofer Joseph", - "license": "Apache2", + "author": "Kristofer Joseph (http://kristoferjoseph.com/)", + "contributors": [ + "Garth Braithwaite (http://garthdb.com)" + ], + "license": "Apache-2.0", "bugs": { - "url": "https://github.com/topcoat/variables-shared/issues" + "url": "https://github.com/topcoat/topcoat/issues" + }, + "ava": { + "require": [ + "babel-register" + ], + "babel": "inherit" + }, + "babel": { + "presets": [ + "es2015" + ] + }, + "devDependencies": { + "ava": "^0.16.0", + "babel-cli": "^6.14.0", + "babel-core": "^6.14.0", + "babel-preset-es2015": "^6.14.0", + "babel-register": "^6.14.0", + "cz-customizable": "^4.0.0", + "resin": "^1.1.0", + "semantic-release": "^4.3.5" + }, + "config": { + "commitizen": { + "path": "./node_modules/cz-customizable" + } } } diff --git a/src/variables-shared.css b/src/variables-shared.css index b217482..693c532 100644 --- a/src/variables-shared.css +++ b/src/variables-shared.css @@ -1,51 +1,32 @@ -/** -* -* Copyright 2012 Adobe Systems Inc.; -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*/ - :root { - var-font-weight--cta: 500; - var-overflow: hidden; - var-radio-offset: -109px; - var-radio-offset--checked: -74px; - var-radio-width: 37px; - var-radio-bgsize: var(radio-width); - var-radio-height: 31px; - var-radio-line-height: var(radio-height); - var-radio-margin: 15px; - var-overlay-bg-color: rgba(88, 90, 92, 0.7); - var-overlay-bg-box-shadow: inset 0px 0px 115px 0px #000000; - var-font-size--textarea--large: 1.3rem; - var-line-height--large: 1.3rem; - var-margin: 0; - var-bar-border-radius : 12px; - var-bar-width : 250px; - var-bar-height : 1.25rem; - var-progress-border-radius: 12px 0 0 12px; - var-content--switch__label--left: 'ON'; - var-content--switch__label--right: 'OFF'; - var-margin-bottom--switch__toggle: -1px; - var-margin-top--switch__toggle: -1px; - var-transition--switch__toggle: margin-left 0.05s ease-in-out; - var-margin-bottom--switch__toggle: -1px; - var-margin-top--switch__toggle: -1px; - var-padding--notification: 0.15em 0.5em 0.2em; - var-margin--notification: 5px; - var-border-radius--notification: 2px; - var-color--notification: #fff; - var-search-icon: url("../img/search.svg"); + --font-weight--cta: 500; + --overflow: hidden; + --radio-offset: -109px; + --radio-offset--checked: -74px; + --radio-width: 37px; + --radio-bgsize: var(--radio-width); + --radio-height: 31px; + --radio-line-height: var(--radio-height); + --radio-margin: 15px; + --overlay-bg-color: rgba(88, 90, 92, 0.7); + --overlay-bg-box-shadow: inset 0px 0px 115px 0px #000000; + --font-size--textarea--large: 1.3rem; + --line-height--large: 1.3rem; + --margin: 0; + --bar-border-radius : 12px; + --bar-width : 250px; + --bar-height : 1.25rem; + --progress-border-radius: 12px 0 0 12px; + --content--switch__label--left: 'ON'; + --content--switch__label--right: 'OFF'; + --margin-bottom--switch__toggle: -1px; + --margin-top--switch__toggle: -1px; + --transition--switch__toggle: margin-left 0.05s ease-in-out; + --margin-bottom--switch__toggle: -1px; + --margin-top--switch__toggle: -1px; + --padding--notification: 0.15em 0.5em 0.2em; + --margin--notification: 5px; + --border-radius--notification: 2px; + --color--notification: #fff; + --search-icon: url("../img/search.svg"); } - diff --git a/test/example.expected.css b/test/example.expected.css new file mode 100644 index 0000000..74b6592 --- /dev/null +++ b/test/example.expected.css @@ -0,0 +1,32 @@ +:root { + font-weight-cta: 500; + overflow: hidden; + radio-offset: -109px; + radio-offset-checked: -74px; + radio-width: 37px; + radio-bgsize: 37px; + radio-height: 31px; + radio-line-height: 31px; + radio-margin: 15px; + overlay-bg-color: rgba(88, 90, 92, .7); + overlay-bg-box-shadow: inset 0px 0px 115px 0px #000; + font-size-textarea-large: 1.3rem; + line-height-large: 1.3rem; + margin: 0; + bar-border-radius: 12px; + bar-width: 250px; + bar-height: 1.25rem; + progress-border-radius: 12px 0 0 12px; + content-switch__label-left: 'ON'; + content-switch__label-right: 'OFF'; + margin-bottom-switch__toggle: -1px; + margin-top-switch__toggle: -1px; + transition-switch__toggle: margin-left .05s ease-in-out; + margin-bottom-switch__toggle: -1px; + margin-top-switch__toggle: -1px; + padding-notification: .15em .5em .2em; + margin-notification: 5px; + border-radius-notification: 2px; + color-notification: #fff; + search-icon: url("../img/search.svg"); +} diff --git a/test/example.fixture.css b/test/example.fixture.css new file mode 100644 index 0000000..e08dfa8 --- /dev/null +++ b/test/example.fixture.css @@ -0,0 +1,32 @@ +:root { + font-weight-cta: var(--font-weight--cta); + overflow: var(--overflow); + radio-offset: var(--radio-offset); + radio-offset-checked: var(--radio-offset--checked); + radio-width: var(--radio-width); + radio-bgsize: var(--radio-bgsize); + radio-height: var(--radio-height); + radio-line-height: var(--radio-line-height); + radio-margin: var(--radio-margin); + overlay-bg-color: var(--overlay-bg-color); + overlay-bg-box-shadow: var(--overlay-bg-box-shadow); + font-size-textarea-large: var(--font-size--textarea--large); + line-height-large: var(--line-height--large); + margin: var(--margin); + bar-border-radius: var(--bar-border-radius); + bar-width: var(--bar-width); + bar-height: var(--bar-height); + progress-border-radius: var(--progress-border-radius); + content-switch__label-left: var(--content--switch__label--left); + content-switch__label-right: var(--content--switch__label--right); + margin-bottom-switch__toggle: var(--margin-bottom--switch__toggle); + margin-top-switch__toggle: var(--margin-top--switch__toggle); + transition-switch__toggle: var(--transition--switch__toggle); + margin-bottom-switch__toggle: var(--margin-bottom--switch__toggle); + margin-top-switch__toggle: var(--margin-top--switch__toggle); + padding-notification: var(--padding--notification); + margin-notification: var(--margin--notification); + border-radius-notification: var(--border-radius--notification); + color-notification: var(--color--notification); + search-icon: var(--search-icon); +} diff --git a/test/variables-shared.test.js b/test/variables-shared.test.js new file mode 100644 index 0000000..fa9378d --- /dev/null +++ b/test/variables-shared.test.js @@ -0,0 +1,16 @@ +import test from 'ava'; +import resin from 'resin'; +import fs from 'fs'; + +test('compilation', t => { + const input = './example.fixture.css'; + const expected = fs.readFileSync('./example.expected.css','utf-8').trim(); + return resin({ + src: input, + vars: true, + extend: true, + prepend: '../src/variables-shared.css' + }).then(result => { + t.is(result.css.trim(), expected); + }); +});