lerna-publisher
Advanced tools
Comparing version 1.0.12 to 1.0.14
@@ -33,2 +33,3 @@ "use strict"; | ||
secretAccessKey: secretAccessKeyPar, | ||
region: 'us-east-1', | ||
}); | ||
@@ -35,0 +36,0 @@ const filesPaths = await walkSync(localFolder); |
@@ -14,2 +14,3 @@ #!/usr/bin/env node | ||
const { version, description } = require('../package.json'); | ||
const chalk = require('chalk'); | ||
process.on('unhandledRejection', printErrorAndExit); | ||
@@ -27,2 +28,3 @@ commander_1.default | ||
// function to execute when command is uses | ||
// .option('--aws-bucket-name <string>', 'aws bucket name to publish to.') | ||
.action((pkgName, folder) => { | ||
@@ -74,4 +76,4 @@ console.log(pkgName, folder); | ||
const bucketName = process.env.AWS_BUCKET_NAME || ''; | ||
const bucketLink = `http://${bucketName}.s3-website-us-east-1.amazonaws.com`; | ||
const branchName = process.env.TRAVIS_BRANCH || ''; | ||
const bucketLink = `http://${bucketName}.s3-website-us-east-1.amazonaws.com`; | ||
const githubToken = process.env.GITHUB_TOKEN || ''; | ||
@@ -82,6 +84,6 @@ const githubSlug = process.env.TRAVIS_REPO_SLUG || ''; | ||
const org = slugParts[0]; | ||
console.log('Deploy package from folder: ' + pkgToDeploy.location); | ||
console.log('Deploy package from folder: ', pkgToDeploy.location, 'to', bucketName); | ||
const pathToPublish = path_1.default.join(pkgToDeploy.location, 'dist'); | ||
result = await aws_1.uploadFolder(pathToPublish, pkgToDeploy.package.name, branchName); | ||
console.debug('Upload folder to s3 result: ', result ? 'SUCCESS' : 'FAIL'); | ||
console.debug('Upload folder to s3 result: ', result ? chalk.green('SUCCESS') : chalk.red('FAILED')); | ||
if (result) { | ||
@@ -93,3 +95,3 @@ const cureentToime = new Date(); | ||
result = await github_1.postLinkToPRTest(textToPublish, linkToPublish, githubToken, org, repo, prNum); | ||
console.debug('Post link to PR result: ', result ? 'SUCCESS' : 'FAIL'); | ||
console.debug('Post link to PR result: ', result ? chalk.green('SUCCESS') : chalk.red('FAILED')); | ||
} | ||
@@ -110,2 +112,3 @@ console.log('Exiting', result ? 0 : 1); | ||
} | ||
console.log('Exiting', result ? 0 : 1); | ||
process.exit(result ? 0 : 1); | ||
@@ -112,0 +115,0 @@ } |
@@ -12,8 +12,8 @@ "use strict"; | ||
try { | ||
childProcess.execSync(cmdSetRegistry, { cwd: pathToFolder }); | ||
childProcess.execSync(cmdText, { cwd: pathToFolder }); | ||
childProcess.execSync(cmdSetRegistry, { cwd: pathToFolder, stdio: 'inherit' }); | ||
childProcess.execSync(cmdText, { cwd: pathToFolder, stdio: 'inherit' }); | ||
retVal = true; | ||
} | ||
catch (error) { | ||
console.log(chalk.red('\tyarn publish failed')); | ||
console.log(chalk.red('\tyarn publish failed'), error); | ||
} | ||
@@ -24,3 +24,2 @@ return retVal; | ||
let result = true; | ||
const pjson = pkgJsonContent; | ||
const opts = { | ||
@@ -37,8 +36,9 @@ '//registry.npmjs.org/:token': process.env.NPM_TOKEN | ||
} | ||
const pkjJsonVer = pjson.version; | ||
if (verArray.indexOf(pkjJsonVer) === -1) { | ||
if (verArray.indexOf(pkgJsonContent.version) === -1) { | ||
result = await runPublishCommand(pathToFolder); | ||
const resultString = result ? chalk.green('SUCCESS') : chalk.red('FAILED'); | ||
console.log(chalk.grey(pkgJsonContent.name, pkgJsonContent.version, '\tPublish '), resultString); | ||
} | ||
else { | ||
console.log(chalk.grey('\tNothing to publish:', pkgJsonContent.name, pkjJsonVer)); | ||
console.log(chalk.grey(pkgJsonContent.name, pkgJsonContent.version, '\tNothing to publish')); | ||
} | ||
@@ -45,0 +45,0 @@ return result; |
{ | ||
"name": "lerna-publisher", | ||
"description": "Utility to publish lerna/yarn/workspace types of packages from ci to npm", | ||
"version": "1.0.12", | ||
"version": "1.0.14", | ||
"main": "cjs/index.js", | ||
@@ -6,0 +6,0 @@ "bin": { |
@@ -28,2 +28,3 @@ [![Build Status](https://travis-ci.com/wixplosives/lerna-publisher.svg?branch=master)](https://travis-ci.com/wixplosives/lerna-publisher)[![npm version](https://badge.fury.io/js/lerna-publisher.svg)](https://badge.fury.io/js/lerna-publisher) | ||
deploy: | ||
skip_cleanup: true | ||
provider: script | ||
@@ -30,0 +31,0 @@ script: lerna-publisher |
@@ -32,2 +32,3 @@ import AWS from 'aws-sdk' | ||
secretAccessKey: secretAccessKeyPar, | ||
region: 'us-east-1', | ||
}) | ||
@@ -34,0 +35,0 @@ |
#!/usr/bin/env node | ||
import program from 'commander' | ||
import path from 'path' | ||
import { CheckAndPublishMonorepo } from './publish_lerna' | ||
import { uploadFolder } from './aws' | ||
import { postLinkToPRTest } from './github' | ||
const getPackages = require( 'get-monorepo-packages' ) | ||
const { version, description } = require('../package.json') | ||
const chalk = require('chalk') | ||
process.on('unhandledRejection', printErrorAndExit) | ||
@@ -26,5 +26,6 @@ | ||
// function to execute when command is uses | ||
.action( ( pkgName: string, folder: string) => { | ||
// .option('--aws-bucket-name <string>', 'aws bucket name to publish to.') | ||
.action( ( pkgName: string, folder: string ) => { | ||
console.log( pkgName, folder ) | ||
runDeployCommand(folder, pkgName) | ||
runDeployCommand(folder, pkgName ) | ||
}) | ||
@@ -60,3 +61,3 @@ | ||
export async function runDeployCommand(folder: string, pkgname: string) { | ||
export async function runDeployCommand(folder: string, pkgname: string ) { | ||
console.log('Deploy ' , pkgname , 'from' , folder) | ||
@@ -74,10 +75,8 @@ let prNum = 0 | ||
const packages = getPackages(pathToProject) | ||
const pkgToDeploy = packages.find((element: { package: { name: string, version: string }, location: string}) => { | ||
return element.package.name === pkgname | ||
}) | ||
const bucketName = process.env.AWS_BUCKET_NAME || '' | ||
const bucketLink = `http://${bucketName}.s3-website-us-east-1.amazonaws.com` | ||
const branchName = process.env.TRAVIS_BRANCH || '' | ||
const bucketLink = `http://${bucketName}.s3-website-us-east-1.amazonaws.com` | ||
const githubToken = process.env.GITHUB_TOKEN || '' | ||
@@ -89,6 +88,6 @@ const githubSlug = process.env.TRAVIS_REPO_SLUG || '' | ||
console.log('Deploy package from folder: ' + pkgToDeploy.location ) | ||
console.log('Deploy package from folder: ', pkgToDeploy.location, 'to', bucketName ) | ||
const pathToPublish = path.join(pkgToDeploy.location, 'dist') | ||
result = await uploadFolder(pathToPublish, pkgToDeploy.package.name, branchName) | ||
console.debug('Upload folder to s3 result: ', result ? 'SUCCESS' : 'FAIL') | ||
console.debug('Upload folder to s3 result: ', result ? chalk.green('SUCCESS') : chalk.red('FAILED')) | ||
if ( result ) { | ||
@@ -100,7 +99,7 @@ const cureentToime = new Date() | ||
pkgToDeploy.package.name, branchName ) | ||
console.debug('Link to publish',linkToPublish) | ||
console.debug('Link to publish', linkToPublish) | ||
result = await postLinkToPRTest(textToPublish, linkToPublish, | ||
githubToken, org, repo, | ||
prNum) | ||
console.debug('Post link to PR result: ', result ? 'SUCCESS' : 'FAIL') | ||
console.debug('Post link to PR result: ', result ? chalk.green('SUCCESS') : chalk.red('FAILED')) | ||
} | ||
@@ -121,2 +120,3 @@ console.log('Exiting', result ? 0 : 1) | ||
} | ||
console.log('Exiting', result ? 0 : 1) | ||
process.exit( result ? 0 : 1 ) | ||
@@ -123,0 +123,0 @@ } |
@@ -12,7 +12,7 @@ | ||
try { | ||
childProcess.execSync(cmdSetRegistry , {cwd: pathToFolder}) | ||
childProcess.execSync(cmdText , {cwd: pathToFolder}) | ||
childProcess.execSync(cmdSetRegistry , {cwd: pathToFolder, stdio: 'inherit'}) | ||
childProcess.execSync(cmdText , {cwd: pathToFolder, stdio: 'inherit'}) | ||
retVal = true | ||
} catch (error) { | ||
console.log(chalk.red('\tyarn publish failed')) | ||
console.log(chalk.red('\tyarn publish failed'), error) | ||
} | ||
@@ -24,3 +24,2 @@ return retVal | ||
let result = true | ||
const pjson = pkgJsonContent | ||
const opts = { | ||
@@ -36,7 +35,9 @@ '//registry.npmjs.org/:token': process.env.NPM_TOKEN | ||
} | ||
const pkjJsonVer = pjson.version | ||
if ( verArray.indexOf(pkjJsonVer) === -1 ) { | ||
if ( verArray.indexOf(pkgJsonContent.version) === -1 ) { | ||
result = await runPublishCommand(pathToFolder) | ||
const resultString = result ? chalk.green('SUCCESS') : chalk.red('FAILED') | ||
console.log(chalk.grey( pkgJsonContent.name, pkgJsonContent.version, '\tPublish '), resultString) | ||
} else { | ||
console.log(chalk.grey('\tNothing to publish:', pkgJsonContent.name, pkjJsonVer)) | ||
console.log(chalk.grey( pkgJsonContent.name, pkgJsonContent.version, '\tNothing to publish')) | ||
} | ||
@@ -43,0 +44,0 @@ return result |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
38659
534
66
1