scripts/release.js
function publishRelease(npmDistTag) {
    const tag = npmDistTag || "latest";
    const distPath = path.resolve(process.cwd(), "dist");
    const distFolders = [];

    const asyncInSeries = (items, asyncFunc) => {
        return new Promise((resolve, reject) => {
            const series = index => {
                if (index === items.length) {
                    resolve();
                    return;
                }

                asyncFunc(items[index])
                    .then(() => series(index + 1))
                    .catch(error => reject(error));
            };
            series(0);
        });
    };

    for (const file of fs.readdirSync(distPath)) {
        let projectPath = path.join(distPath, file);
        if (fs.lstatSync(projectPath).isFile() && file === "package.json") {
            // Assume the  dist folder itself is the only project to be published
            distFolders.splice(0);
            distFolders.push(distPath);
            break;
        }
        if (fs.lstatSync(projectPath).isDirectory()) {
            distFolders.push(projectPath);
        }
    }

    return Promise.resolve()
        // Authentication is based on an OAuth provider.
        // Get the relevant authentication and paste it into your ~/.npmrc or invoke "npm adduser".
        // For details see here
        // https://www.jfrog.com/confluence/display/RTF/Npm+Registry#NpmRegistry-NpmPublish(DeployingPackages)
        // .then(() => runCommandWithRedirectedIo(`npm login --always-auth --registry=${reg}`))
        .then(() => asyncInSeries(distFolders, folder => runCommandWithRedirectedIo(`npm publish "${folder}" --tag=${tag}`)))
        .then(() => `published ${distFolders.length} distribution packages on '${tag}' tag to npm registry`);
}
function publishRelease(npmDistTag) {
    const tag = npmDistTag || "latest";
    const distPath = path.resolve(process.cwd(), "dist");
    const distFolders = [];

    const asyncInSeries = (items, asyncFunc) => {
        return new Promise((resolve, reject) => {
            const series = index => {
                if (index === items.length) {
                    resolve();
                    return;
                }

                asyncFunc(items[index])
                    .then(() => series(index + 1))
                    .catch(error => reject(error));
            };
            series(0);
        });
    };

    for (const file of fs.readdirSync(distPath)) {
        let projectPath = path.join(distPath, file);
        if (fs.lstatSync(projectPath).isFile() && file === "package.json") {
            // Assume the  dist folder itself is the only project to be published
            distFolders.splice(0);
            distFolders.push(distPath);
            break;
        }
        if (fs.lstatSync(projectPath).isDirectory()) {
            distFolders.push(projectPath);
        }
    }

    return Promise.resolve()
        // Authentication is based on an OAuth provider.
        // Get the relevant authentication and paste it into your ~/.npmrc or invoke "npm adduser".
        // For details see here
        // https://www.jfrog.com/confluence/display/RTF/Npm+Registry#NpmRegistry-NpmPublish(DeployingPackages)
        // .then(() => runCommandWithRedirectedIo(`npm login --always-auth --registry=${reg}`))
        .then(() => asyncInSeries(distFolders, folder => runCommandWithRedirectedIo(`npm publish "${folder}" --tag=${tag}`)))
        .then(() => `published ${distFolders.length} distribution packages on '${tag}' tag to npm registry`);
}
function publishRelease ( npmDistTag ) { const tag = npmDistTag || "latest" ; const distPath = path . resolve ( process . cwd ( ) , "dist" ) ; const distFolders = [ ] ; const asyncInSeries = ( items , asyncFunc ) => { return new Promise ( ( resolve , reject ) => { const series = index => { if ( index === items . length ) { resolve ( ) ; return ; } asyncFunc ( items [ index ] ) . then ( ( ) => series ( index + 1 ) ) . catch ( error => reject ( error ) ) ; } ; series ( 0 ) ; } ) ; } ; for ( const file of fs . readdirSync ( distPath ) ) { let projectPath = path . join ( distPath , file ) ; if ( fs . lstatSync ( projectPath ) . isFile ( ) && file === "package.json" ) { // Assume the  dist folder itself is the only project to be published distFolders . splice ( 0 ) ; distFolders . push ( distPath ) ; break ; } if ( fs . lstatSync ( projectPath ) . isDirectory ( ) ) { distFolders . push ( projectPath ) ; } } return Promise . resolve ( ) // Authentication is based on an OAuth provider. // Get the relevant authentication and paste it into your ~/.npmrc or invoke "npm adduser". // For details see here // https://www.jfrog.com/confluence/display/RTF/Npm+Registry#NpmRegistry-NpmPublish(DeployingPackages) // .then(() => runCommandWithRedirectedIo(`npm login --always-auth --registry=${reg}`)) . then ( ( ) => asyncInSeries ( distFolders , folder => runCommandWithRedirectedIo ( ` ${ folder } ${ tag } ` ) ) ) . then ( ( ) => ` ${ distFolders . length } ${ tag } ` ) ; }
Publishes all the distribution packages of the new release on an
npm registry. Authentication is required to publish packages. The
registry location is determined by the `publishConfig` section in the
package.json, if present. If not present, the public npm registry is used.

Registers the published packages with the given tag, such that npm install
<name>@<tag> will install this version. By default, `npm install` installs the
`latest` tag.
Publishes all the distribution packages of the new release on an npm registry . Authentication is required to publish packages . The registry location is determined by the publishConfig section in the package . json if present . If not present the public npm registry is used .