feat: prepare for publishing puppeteer-core (#3047)

This commit is contained in:
Andrey Lushnikov 2018-08-08 15:14:23 -07:00 committed by GitHub
parent d822401449
commit 81d42c4688
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 3 deletions

View File

@ -215,13 +215,17 @@ Releasing to NPM consists of 3 phases:
3. Merge the PR. 3. Merge the PR.
4. Once merged, publish release notes using the "create new tag" option. 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`. - **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. 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. 2. Run `git status` and make sure there are no untracked files.
- **WHY**: this is to avoid bundling unnecessary files to NPM package - **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. 3. Run [`pkgfiles`](https://www.npmjs.com/package/pkgfiles) to make sure you don't publish anything unnecessary.
4. Run `npm publish`. 4. Run `npm publish`. This will publish `puppeteer` package.
3. Source Code: mark post-release. 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)) 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**: 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. - **NOTE**: no other commits should be landed in-between release commit and bump commit.

View File

@ -14,6 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
// puppeteer-core should not install anything.
if (require('./package.json').name === 'puppeteer-core')
return;
buildNode6IfNecessary(); buildNode6IfNecessary();
if (process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD) { if (process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD) {

25
utils/prepare_puppeteer_core.js Executable file
View File

@ -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, ' '));