Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .circleci/check-tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

set -eu

PKG=draft-js-markdown-shortcuts-plugin
V=$(npm show $PKG version)
[ $V = $CIRCLE_TAG ] || (
echo "${PKG} ${V} does not match with CIRCLE_TAG ${CIRCLE_TAG}"; exit 1
)
114 changes: 114 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
version: 2

references:
base: &base
docker:
- image: circleci/node:8.11.3

environment:
MOCHA_FILE: mocha-test-results/test-results.xml

restore_cache: &restore_yarn_cache
restore_cache:
keys:
- v1-yarn-cache-{{ checksum "yarn.lock" }}

save_cache: &save_yarn_cache
save_cache:
paths:
- ~/.cache/yarn
key: v1-yarn-cache-{{ checksum "yarn.lock" }}

restore_cache: &restore_npm_cache
restore_cache:
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}

save_cache: &save_npm_cache
save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "yarn.lock" }}

jobs:
lint:
<<: *base
steps:
- checkout
- <<: *restore_yarn_cache
- <<: *restore_npm_cache
- run: yarn
- <<: *save_yarn_cache
- <<: *save_npm_cache
- run:
name: Run eslint
command: npm run eslint -- --max-warnings 0

tests:
<<: *base
steps:
- checkout
- <<: *restore_npm_cache
- run: npm test
- run:
name: Send coverage to Coveralls
command: cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
- store_test_results:
path: mocha-test-results
- store_artifacts:
path: lib
destination: lib
- store_artifacts:
path: coverage
destination: coverage

publish:
<<: *base
steps:
- checkout
- <<: *restore_npm_cache
# - run: .circleci/check-tag.sh
# - run: .circleci/export-api-key.sh
- run: npm publish


deploy_demo:
<<: *base
steps:
- checkout
- <<: *restore_npm_cache
- run: .circleci/setup-git-user.sh
- run: npm run build:demo
- run: npm run deploy:demo
- store_artifacts:
path: demo/public
destination: demo

workflows:
version: 2
pkg:
jobs:
- lint:
filters:
branches:
ignore: gh-pages

- tests:
requires:
- lint

- publish:
requires:
- tests
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/

- deploy_demo:
requires:
- tests
filters:
branches:
only: [master, /deploy-.+/]
6 changes: 6 additions & 0 deletions .circleci/export-api-key.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

set -eu

echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" >> ~/.npmrc
chmod 600 ~/.npmrc
4 changes: 4 additions & 0 deletions .circleci/setup-git-user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

git config --global user.email "a+circleci@ngs.io"
git config --global user.name "Circle CI"
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.9.4
8.11.1
31 changes: 0 additions & 31 deletions circle.yml

This file was deleted.

38 changes: 18 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,42 @@
"scripts": {
"eslint": "node_modules/.bin/eslint .",
"build": "npm run clean && npm run build:js",
"build:demo": "NODE_ENV=production webpack --config demo/webpack.config.prod.js && rm -rf demo/public/css && cp -R demo/publicTemplate/* demo/public/",
"build:js": "BABEL_DISABLE_CACHE=1 BABEL_ENV=production NODE_ENV=production node_modules/.bin/babel --out-dir='lib' --ignore='**/__test__/*' src",
"clean": "node_modules/.bin/rimraf lib; node_modules/.bin/rimraf demo/public",
"deploy:demo": "COMMIT=$(git rev-parse --short HEAD) && BRANCH=gh-pages && GIT_URL=$(git remote get-url origin) && DIR=.deploy; rm -rf $DIR; (git clone $GIT_URL -b $BRANCH $DIR || (git init $DIR && cd $DIR && git remote add origin $GIT_URL && git checkout -b $BRANCH)) && rm -rf ${DIR}/* && cp -R ${DIR}/../demo/public/* $DIR && cd $DIR && git add -A && git commit -m \"Built artifacts of ${COMMIT} [ci skip]\" && git push origin $BRANCH",
"build:demo":
"NODE_ENV=production webpack --config demo/webpack.config.prod.js && rm -rf demo/public/css && cp -R demo/publicTemplate/* demo/public/",
"build:js":
"BABEL_DISABLE_CACHE=1 BABEL_ENV=production NODE_ENV=production node_modules/.bin/babel --out-dir='lib' --ignore='**/__test__/*' src",
"clean":
"node_modules/.bin/rimraf lib; node_modules/.bin/rimraf demo/public",
"deploy:demo":
"COMMIT=$(git rev-parse --short HEAD) && BRANCH=gh-pages && GIT_URL=$(git config --get remote.origin.url) && DIR=.deploy; rm -rf $DIR; (git clone $GIT_URL -b $BRANCH $DIR || (git init $DIR && cd $DIR && git remote add origin $GIT_URL && git checkout -b $BRANCH)) && rm -rf ${DIR}/* && cp -R ${DIR}/../demo/public/* $DIR && cd $DIR && git add -A && git commit -m \"Built artifacts of ${COMMIT}\" && git push origin $BRANCH",
"prepublish": "npm run build",
"start": "npm run start:dev",
"start:dev": "node_modules/.bin/babel-node ./demo/server.js",
"test": "npm run test:coverage",
"test:coverage": "node_modules/.bin/nyc --require babel-core/register npm run test:mocha",
"test:coverage":
"node_modules/.bin/nyc --require babel-core/register npm run test:mocha",
"test:mocha": "mocha --opts .mocha.opts $(find src -name '*-test.js')",
"test:watch": "npm test | npm run watch",
"watch": "npm-watch",
"postinstall": "opencollective postinstall"
},
"watch": {
"test": {
"patterns": [
"src/**/*.js"
]
"patterns": ["src/**/*.js"]
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/ngs/draft-js-markdown-shortcuts-plugin.git"
},
"keywords": [
"draftjs",
"editor",
"plugin",
"markdown"
],
"keywords": ["draftjs", "editor", "plugin", "markdown"],
"author": "Atsushi Nagase",
"license": "MIT",
"bugs": {
"url": "https://github.com/ngs/draft-js-markdown-shortcuts-plugin/issues"
},
"homepage": "https://github.com/ngs/draft-js-markdown-shortcuts-plugin#readme",
"homepage":
"https://github.com/ngs/draft-js-markdown-shortcuts-plugin#readme",
"devDependencies": {
"autoprefixer": "^6.5.3",
"babel-cli": "^6.18.0",
Expand Down Expand Up @@ -102,13 +101,12 @@
"webpack-hot-middleware": "^2.13.2"
},
"peerDependencies": {
"draft-js-plugins-editor": "^2.0.0 || ~2.0.0-rc.1 || 2.0.0-rc2 || 2.0.0-rc1 || 2.0.0-beta12",
"draft-js-plugins-editor":
"^2.0.0 || ~2.0.0-rc.1 || 2.0.0-rc2 || 2.0.0-rc1 || 2.0.0-beta12",
"react": "^16.0.0 || ^15.0.0",
"react-dom": "^16.0.0 || ^15.0.0"
},
"contributors": [
"Atsushi Nagase <a@ngs.io>"
],
"contributors": ["Atsushi Nagase <a@ngs.io>"],
"dependencies": {
"decorate-component-with-props": "^1.1.0",
"draft-js": "~0.10.5",
Expand All @@ -120,4 +118,4 @@
"type": "opencollective",
"url": "https://opencollective.com/draft-js-markdown-shortcuts-plugin"
}
}
}
Loading