1
1
mirror of https://github.com/primer/css.git synced 2025-01-02 03:02:40 +03:00

Merge branch 'dev' into shawnbot/type-vars

This commit is contained in:
Shawn Allen 2017-07-26 16:11:24 -07:00 committed by GitHub
commit 7a4fb98a6f
36 changed files with 178 additions and 198 deletions

View File

@ -20,16 +20,12 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"alerts",
"callouts",

View File

@ -20,16 +20,12 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"avatars",
"primer",

View File

@ -20,16 +20,12 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -20,16 +20,12 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -20,16 +20,12 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -17,20 +17,17 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"test-docs": "ava --verbose ../../tests/modules/test-*.js",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint test-docs"
},
"dependencies": {
"primer-marketing-support": "^1.1.0",
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"breadcrumb",
"css",

View File

@ -20,16 +20,12 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -20,17 +20,13 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-marketing-support": "^1.1.0",
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"cards",
"css",

View File

@ -33,8 +33,5 @@
"primer-truncate": "^1.1.1",
"primer-utilities": "^4.4.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint-config-primer": "^2.0.0"
}
"devDependencies": {}
}

View File

@ -49,10 +49,7 @@
"primer-truncate": "^1.1.1",
"primer-utilities": "^4.4.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -20,16 +20,12 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -20,16 +20,12 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -20,16 +20,12 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -20,16 +20,12 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"github",
"markdown",

View File

@ -18,10 +18,7 @@
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run lint"
},
"devDependencies": {
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -17,20 +17,17 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"test-docs": "ava --verbose ../../tests/modules/test-*.js",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint test-docs"
},
"dependencies": {
"primer-marketing-support": "^1.1.0",
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"css",
"github",

View File

@ -20,17 +20,13 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-marketing-support": "^1.1.0",
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -31,8 +31,5 @@
"primer-support": "^4.1.1",
"primer-tables": "^1.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint-config-primer": "^2.0.0"
}
"devDependencies": {}
}

View File

@ -20,16 +20,12 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -20,17 +20,13 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-marketing-support": "^1.1.0",
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"css",
"flash",

View File

@ -20,17 +20,13 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-marketing-support": "^1.1.0",
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"css",
"github",

View File

@ -28,8 +28,5 @@
"primer-markdown": "^3.4.1",
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint-config-primer": "^2.0.0"
}
"devDependencies": {}
}

View File

@ -18,10 +18,7 @@
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run lint"
},
"devDependencies": {
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -17,19 +17,16 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"test-docs": "ava --verbose ../../tests/modules/test-*.js",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint test-docs"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -20,17 +20,13 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-marketing-support": "^1.1.0",
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"css",
"github",

View File

@ -17,19 +17,16 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"test-docs": "ava --verbose ../../tests/modules/test-*.js",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint test-docs"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -17,19 +17,16 @@
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"test-docs": "ava --verbose ../../tests/modules/test-*.js",
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint test-docs"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -20,16 +20,12 @@
"build": "primer-module-build index.scss",
"prepare": "npm run build",
"lint": "stylelint **/*.scss -c .stylelintrc.json -s scss",
"test": "npm run build && npm run lint"
"test": "npm-run-all -s build lint"
},
"dependencies": {
"primer-support": "^4.1.1"
},
"devDependencies": {
"primer-module-build": "*",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
},
"devDependencies": {},
"keywords": [
"primer",
"css",

View File

@ -1,7 +1,7 @@
{
"private": true,
"scripts": {
"bootstrap": "lerna bootstrap",
"bootstrap": "lerna bootstrap --hoist",
"clean": "lerna clean",
"diff": "lerna diff",
"updated": "lerna updated",
@ -13,8 +13,14 @@
"test": "lerna run test"
},
"devDependencies": {
"ava": "^0.21.0",
"commit-status": "^4.1.0",
"glob": "^7.1.2",
"lerna": "^2.0.0",
"semver": "^5.3.0"
"npm-run-all": "^4.0.2",
"primer-module-build": "^1.0.2",
"semver": "^5.3.0",
"stylelint": "^7.13.0",
"stylelint-config-primer": "^2.0.0"
}
}

View File

@ -5,45 +5,35 @@ set -e
# which makes this easier to test locally
args=$@
event="$TRAVIS_EVENT_TYPE"
branch="$TRAVIS_BRANCH"
# use $TRAVIS_PULL_REQUEST_BRANCH if this is a PR
event=$TRAVIS_EVENT_TYPE
branch=$TRAVIS_BRANCH
echo "🐛 script/cibuild"
(
echo "TRAVIS_EVENT_TYPE,$TRAVIS_EVENT_TYPE"
echo "TRAVIS_BRANCH,$TRAVIS_BRANCH"
echo "TRAVIS_PULL_REQUEST,$TRAVIS_PULL_REQUEST"
echo "TRAVIS_PULL_REQUEST_BRANCH,$TRAVIS_PULL_REQUEST_BRANCH"
) | column -t -s=,
# the presence of $TRAVIS_PULL_REQUEST_BRANCH tells us
# whether this is a pull request
if [[ "$event" = "pull_request" ]]; then
branch="$TRAVIS_PULL_REQUEST_BRANCH"
fi
echo "===== CI build ====="
echo " event: $event"
echo " branch: $branch"
echo "===================="
if [[ "$event" = "" || "$branch" = "" ]]; then
echo '❌ Missing $TRAVIS_EVENT_TYPE or $TRAVIS_BRANCH!'
exit 1
fi
# release branches publish a release candidate
if [[ "$branch" =~ ^release- ]]; then
# only publish RCs for push builds
if [[ "$event" = "push" ]]; then
script/notify pending
upstream_branch=$branch
branch=$TRAVIS_PULL_REQUEST_BRANCH
# if the *source* branch begins with "release"
if [[ "$branch" =~ ^release ]]; then
script/release-candidate $args
script/notify success
# otherwise, if the *target* branch is dev
elif [[ "$upstream_branch" = "dev" ]]; then
script/release-pr $args
else
echo "⚠️ This appears to be a release branch, but we only publish *push* builds."
echo "(TRAVIS_EVENT_TYPE: $event)"
echo "⚠️ This is a PR, but '$branch' isn't a release branch"
echo " and '$upstream_branch' isn't a recognized upstream branch."
exit 1
fi
# always publish a pr release if this is a PR build
elif [[ "$event" = "pull_request" ]]; then
script/notify pending
script/release-pr $args
script/notify success
# publish a release when we merge to master
elif [[ "$branch" = "master" ]]; then
script/notify pending
script/release $args
script/notify success
else
echo "⚠️ This isn't a PR and '$branch' isn't a release branch."
exit 1

View File

@ -1,7 +1,10 @@
#!/bin/bash
set -e
if [[ $# -lt 1 ]]; then
if [[ "$CI" != "true" ]]; then
echo "(notify bailing: not in CI)"
exit
elif [[ $# -lt 1 ]]; then
echo "No status provided!" >&2
exit 1
fi

View File

@ -1,4 +1,8 @@
#!/bin/bash
set -e
echo "📦 Publishing latest release..."
lerna exec -- npm publish
script/notify pending
# note: try-publish should exit cleanly if it detects a duplicate
# published version
lerna exec -- $(pwd)/script/try-publish
script/notify success

View File

@ -8,10 +8,6 @@ package=primer-css
npm_tag=rc
log=/tmp/rc.log
function bump() {
npm version --no-git $@
}
# get the version we're publishing as a release candidate
local_version=$(jq -r .version modules/$package/package.json)
if [[ $local_version =~ "-" ]]; then
@ -25,6 +21,9 @@ fi
rc_version=$(npm info $package@$npm_tag version)
echo "📦 Published version for $package@$npm_tag: $rc_version"
rc_release=${rc_version%-*}
if [[ $local_version != $rc_release ]]; then
rc_version=$local_version
fi
# determine the
next_version=$(
@ -47,15 +46,20 @@ for module_dir in $module_dirs; do
# determine the local version (in git)
module_version=$(jq -r .version package.json)
# strip the rc version, just in case
module_version=${module_version%-*}
module_next_version="$module_version$pre_version"
echo "$module@$module_version => $module_next_version"
# "upgrade" to the most recent RC version so that
# `npm version prerelease` can increment automatically
bump --quiet "$module_next_version" >> $log
npm version --no-git --quiet "$module_next_version" >> $log
popd > /dev/null
done
# publish all the things!
lerna exec --bail -- npm publish --tag=$npm_tag
script/notify pending
# note: this should NOT fail, so --bail=true applies
lerna exec -- npm publish --tag=$npm_tag
script/notify success

View File

@ -5,4 +5,6 @@ args=$@
npm_tag=pr
echo "🐦 Publishing PR release to dist-tag '$npm_tag'..."
# script/notify pending
lerna publish --npm-tag=$npm_tag --canary --no-git $args
script/notify success

12
script/try-publish Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
set -e
# pwd
package=$(jq .name package.json)
version=$(jq .version package.json)
published=$(npm info "$package@$version")
if [[ "$version" = "$published" ]]; then
echo "⚠️ $package@$version is already published!"
else
echo "📦 npm publish: $package@$version"
npm publish $@
fi

View File

@ -0,0 +1,60 @@
const test = require("ava")
const css = require(process.env.PWD)
const fs = require("fs")
const glob = require("glob")
var selectors, classnames = null
const classRegex = /class="([^"]+)"/ig
// Find unique selectors from the cssstats selector list
function uniqueSelectors(s) {
s = s.map(s => {
// split multi-selectors into last class used .foo .bar .baz
return s.split(" ").pop()
}).filter(s => {
// remove any selector that aren't just regular classnames eg. ::hover [type]
return s.match(/^\.[a-z\-_]+$/ig)
})
// return only the unique selectors
return [...new Set(s)]
}
// From the given glob sources array, read the files and return found classnames
function documentedClassnames(sources) {
var cn = []
sources.forEach( f => {
glob.sync(f).forEach( g => {
var match = null
// While we match a classRegex in the source
while ((match = classRegex.exec(fs.readFileSync(g, "utf8"))) != null) {
// Get the matched classnames "..." and split by space into classes
cn = cn.concat(match[1].split(" "))
}
})
})
// return only the unique classnames
return [...new Set(cn)]
}
// Before all the tests get the selectors and classnames
test.before(t => {
selectors = uniqueSelectors(css.cssstats.selectors.values)
classnames = documentedClassnames([
'docs/*.md',
'README.md'
])
})
test("Every selector class is documented", t => {
var undocumented = []
selectors.forEach( selector => {
if (!classnames.includes(selector.replace(".", ""))) {
undocumented.push(selector)
}
})
t.is(undocumented.length, 0, `I did not find documentation for the "${undocumented.join(", ")}" selector(s) in the ${process.env.npm_package_name} module.`);
})