From 81d42c4688618f19b74513230e7e30c69599f4ed Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Wed, 8 Aug 2018 15:14:23 -0700 Subject: [PATCH] feat: prepare for publishing puppeteer-core (#3047) --- CONTRIBUTING.md | 10 +++++++--- install.js | 4 ++++ utils/prepare_puppeteer_core.js | 25 +++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100755 utils/prepare_puppeteer_core.js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 978f838dec4..abc56e1ca8e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -215,13 +215,17 @@ Releasing to NPM consists of 3 phases: 3. Merge the PR. 4. Once merged, publish release notes using the "create new tag" option. - **NOTE**: tag names are prefixed with `'v'`, e.g. for version `1.4.0` tag is `v1.4.0`. -2. Publish to NPM. +2. Publish `puppeteer` to NPM. 1. On your local machine, pull from [upstream](https://github.com/GoogleChrome/puppeteer) and make sure the last commit is the one just merged. 2. Run `git status` and make sure there are no untracked files. - **WHY**: this is to avoid bundling unnecessary files to NPM package 3. Run [`pkgfiles`](https://www.npmjs.com/package/pkgfiles) to make sure you don't publish anything unnecessary. - 4. Run `npm publish`. -3. Source Code: mark post-release. + 4. Run `npm publish`. This will publish `puppeteer` package. +3. Publish `puppeteer-core` to NPM. + 1. Run `./utils/prepare_puppeteer_core.js`. The script will change the name inside `package.json` to `puppeteer-core`. + 2. Run `npm publish`. This will publish `puppeteer-core` package. + 3. Run `git reset --hard` to reset the changes to `package.json`. +4. Source Code: mark post-release. 1. Bump `package.json` version to `-post` version and send a PR titled `'chore: bump version to vXXX.YYY.ZZZ-post'` ([example](https://github.com/GoogleChrome/puppeteer/commit/d02440d1eac98028e29f4e1cf55413062a259156)) - **NOTE**: make sure to update the "released APIs" section in the top of `docs/api.md`. - **NOTE**: no other commits should be landed in-between release commit and bump commit. diff --git a/install.js b/install.js index 3870985dcf2..2d0a2656bad 100644 --- a/install.js +++ b/install.js @@ -14,6 +14,10 @@ * limitations under the License. */ +// puppeteer-core should not install anything. +if (require('./package.json').name === 'puppeteer-core') + return; + buildNode6IfNecessary(); if (process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD) { diff --git a/utils/prepare_puppeteer_core.js b/utils/prepare_puppeteer_core.js new file mode 100755 index 00000000000..515731241ca --- /dev/null +++ b/utils/prepare_puppeteer_core.js @@ -0,0 +1,25 @@ +#!/usr/bin/env node +/** + * Copyright 2018 Google Inc. All rights reserved. + * + * 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. + */ + +const fs = require('fs'); +const path = require('path'); + +const packagePath = path.join(__dirname, '..', 'package.json'); +const json = require(packagePath); + +json.name = 'puppeteer-core'; +fs.writeFileSync(packagePath, JSON.stringify(json, null, ' '));