-
Notifications
You must be signed in to change notification settings - Fork 826
/
publish.js
49 lines (42 loc) · 1.25 KB
/
publish.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const {series} = require('gulp');
const execa = require('execa');
const fse = require('fs-extra');
const ol = require('common-tags').oneLine;
const {build} = require('./build');
const {build_packages_clean} = require('./build-packages');
const {publish_cdn} = require('./publish-cdn');
const {publish_github} = require('./publish-github');
const {publish_lerna} = require('./publish-lerna');
const {test} = require('./test');
const constants = require('./utils/constants');
async function publish_clean() {
await fse.remove(constants.GENERATED_RELEASE_FILES_DIRNAME);
}
async function publish_sign_in_check() {
await execa('npm', ['whoami']);
}
async function dist_tag_check() {
if (!global.cliOptions.distTag) {
throw new Error(ol`Please set the --distTag command line option, normally
to 'latest' (for a stable release) or 'next' (for a pre-release).`);
}
}
module.exports = {
publish: series(
dist_tag_check,
publish_sign_in_check,
build_packages_clean,
publish_clean,
build,
test,
publish_lerna,
publish_github,
publish_cdn,
),
};