feat: hook up ci to publish to npm (#226)

* chore: add missing fields to  package.json

* feat: add postlight org scope to package name

* feat: automate npm publish

* test: npm publish without filters

* fix: add docker image

* test: change directory

* test: add working directory

* fix: defaults syntax

* test: add workspace

* fix: attach workspace

* fix: use standard mercury email

* fix: use ISO time format and preserve original timezone offset

* fix: do not match time zone offset

* chore: move babel runtime-corejs2 to prod deps

* chore: uncomment config to deploy on git tag

* feat: publish to npm public

* adding browser-request

It doesn't seem to impact the build, but technically it should be there
so for good measure, why not...

* chore: roll version back to original state
pull/234/head
George Haddad 5 years ago committed by GitHub
parent 663cc45bf4
commit 5c0325f5a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,39 +1,58 @@
version: 2
defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:8.10-browsers
jobs:
test-node:
docker:
- image: circleci/node:8.10-browsers
<<: *defaults
steps:
- checkout
# For some reason phantomjs-prebuild is failing w/yarn, but npm installing works
- run: "npm install phantomjs-prebuilt"
- run: "yarn install"
- run: "yarn lint:ci"
- run: "yarn build:ci"
- run: "yarn test:node --maxWorkers=4"
- run: "./scripts/pr-parser-preview.sh"
- run: 'npm install phantomjs-prebuilt'
- run: 'yarn install'
- run: 'yarn lint:ci'
- run: 'yarn build:ci'
- run: 'yarn test:node --maxWorkers=4'
- run: './scripts/pr-parser-preview.sh'
- store_artifacts:
path: tmp/artifacts
- persist_to_workspace:
root: ~/repo
paths: .
test-web:
docker:
- image: circleci/node:8.10-browsers
<<: *defaults
steps:
- attach_workspace:
at: ~/repo
- checkout
- run: "yarn install"
- run: "yarn add karma-cli --dev"
- run: "yarn test:web --maxWorkers=4"
- run: "yarn build:web:ci --maxWorkers=4"
- run: 'yarn install'
- run: 'yarn add karma-cli --dev'
- run: 'yarn test:web --maxWorkers=4'
- run: 'yarn build:web:ci --maxWorkers=4'
deploy:
<<: *defaults
steps:
- attach_workspace:
at: ~/repo
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
- run:
name: Publish package
command: npm publish --access public
update-fixtures:
docker:
- image: circleci/node:8.10
steps:
- checkout
- run: "yarn install"
- run: "node ./scripts/update-fixtures.js"
- run: 'yarn install'
- run: 'node ./scripts/update-fixtures.js'
workflows:
version: 2
@ -41,6 +60,15 @@ workflows:
jobs:
- test-node
- test-web
- deploy:
requires:
- test-node
- test-web
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
# UNCOMMENT WHEN READY TO AUTOMATE THIS TASK
# scheduled_tasks:
# triggers:

@ -1,8 +1,24 @@
{
"name": "mercury-parser",
"name": "@postlight/mercury-parser",
"version": "1.0.13",
"description": "",
"repository": "github:postlight/mercury-parser",
"description": "Mercury transforms web pages into clean text. Publishers and programmers use it to make the web make sense, and readers use it to read any web article comfortably.",
"author": "Postlight <mercury@postlight.com>",
"homepage": "https://mercury.postlight.com",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/postlight/mercury-parser.git"
},
"bugs": {
"url": "https://github.com/postlight/mercury-parser/issues"
},
"keywords": [
"mercury",
"parser",
"reader",
"web",
"content"
],
"main": "./dist/mercury.js",
"scripts": {
"lint": "eslint . --fix",
@ -25,15 +41,15 @@
"add-contributor": "all-contributors add",
"generate-contributors": "all-contributors generate"
},
"author": "Postlight",
"license": "ISC",
"engines": {
"node": ">=8.10"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/runtime": "^7.0.0",
"@babel/runtime-corejs2": "^7.2.0",
"@jesses/circle-github-bot": "^2.1.0",
"@octokit/rest": "^16.9.0",
"all-contributors-cli": "^5.10.0",
@ -87,22 +103,28 @@
"watchify": "^3.11.0"
},
"dependencies": {
"browser-request": "postlight/browser-request#feat-add-headers-to-response",
"browser-request": "github:postlight/browser-request#feat-add-headers-to-response",
"cheerio": "^0.22.0",
"difflib": "postlight/difflib.js",
"difflib": "github:postlight/difflib.js",
"ellipsize": "0.1.0",
"iconv-lite": "0.4.24",
"jquery": "^3.3.1",
"moment": "^2.23.0",
"moment-parseformat": "3.0.0",
"moment-timezone": "0.5.23",
"request": "czardoz/request",
"request": "github:czardoz/request",
"request-promise": "^4.2.2",
"string-direction": "^0.1.2",
"url": "^0.11.0",
"valid-url": "^1.0.9",
"wuzzy": "^0.1.3"
"wuzzy": "^0.1.3",
"@babel/runtime-corejs2": "^7.2.0"
},
"bundleDependencies": [
"jquery",
"moment-timezone",
"browser-request"
],
"browser": {
"main": "./dist/mercury.web.js",
"cheerio": "./src/shims/cheerio-query",

@ -48,6 +48,7 @@ ${failedTests
`;
return failureReport;
} catch (e) {
// eslint-disable-next-line no-console
console.log('Error generating test report', e);
return false;
}

@ -59,7 +59,7 @@ describe('WwwFastcompanyComExtractor', () => {
// Update these values with the expected values from
// the article.
assert.equal(date_published, '2017-01-09T05:00:00.000Z');
assert.equal(date_published.split('T')[0], '2017-01-09');
});
it('returns the dek', async () => {

@ -1693,7 +1693,7 @@ browser-process-hrtime@^0.1.2:
resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz#616f00faef1df7ec1b5bf9cfe2bdc3170f26c7b4"
integrity sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==
browser-request@postlight/browser-request#feat-add-headers-to-response:
"browser-request@github:postlight/browser-request#feat-add-headers-to-response":
version "0.3.2"
resolved "https://codeload.github.com/postlight/browser-request/tar.gz/38faa5b85741aabfca61aa37d1ef044d68969ddf"
dependencies:
@ -2898,7 +2898,7 @@ diffie-hellman@^5.0.0:
miller-rabin "^4.0.0"
randombytes "^2.0.0"
difflib@postlight/difflib.js:
"difflib@github:postlight/difflib.js":
version "0.2.6"
resolved "https://codeload.github.com/postlight/difflib.js/tar.gz/32e8e38c7fcd935241b9baab71bb432fd9b166ed"
dependencies:
@ -8158,7 +8158,7 @@ request@^2.87.0:
tunnel-agent "^0.6.0"
uuid "^3.3.2"
request@czardoz/request:
"request@github:czardoz/request":
version "2.74.1"
resolved "https://codeload.github.com/czardoz/request/tar.gz/6ebb4651b72bee7292e54943adfa6b503465adfb"
dependencies:

Loading…
Cancel
Save