1 /*---------------------------------------------------------------------------------------------
2 * Copyright (c) Microsoft Corporation. All rights reserved.
3 * Licensed under the MIT License. See License.txt in the project root for license information.
4 *--------------------------------------------------------------------------------------------*/
6 const cp = require('child_process');
7 const path = require('path');
8 const fs = require('fs');
9 const readline = require('readline');
10 const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
12 function updateNextTag() {
14 // read package.json from the current working directory
15 var packageJSON = JSON.parse(fs.readFileSync('package.json').toString());
16 var name = packageJSON.name;
17 var version = packageJSON.version;
18 if (version.indexOf('next') !== -1) {
23 opts.stdio = 'inherit';
25 console.log(name + ": set 'next' tag to latest version");
27 const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
29 rl.question('Enter OTP token: ', (token) => {
30 const result = cp.spawnSync(npm, ['--otp', token, 'dist-tags', 'add', name + '@' + version, 'next'], opts);
34 if (result.error || result.status !== 0) {