diff --git a/.circleci/config.yml b/.circleci/config.yml index 4055d552e..7a4f9368e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: diff --git a/package.json b/package.json index 7aec6fc27..ec1a1ae9a 100644 --- a/package.json +++ b/package.json @@ -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 ", + "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", diff --git a/scripts/get-test-report.js b/scripts/get-test-report.js index 275386558..08a36b965 100644 --- a/scripts/get-test-report.js +++ b/scripts/get-test-report.js @@ -48,6 +48,7 @@ ${failedTests `; return failureReport; } catch (e) { + // eslint-disable-next-line no-console console.log('Error generating test report', e); return false; } diff --git a/src/extractors/custom/www.fastcompany.com/index.test.js b/src/extractors/custom/www.fastcompany.com/index.test.js index 8c3350b3d..b2560cb0c 100644 --- a/src/extractors/custom/www.fastcompany.com/index.test.js +++ b/src/extractors/custom/www.fastcompany.com/index.test.js @@ -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 () => { diff --git a/yarn.lock b/yarn.lock index 4eaea22bc..6dc21d2b6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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: