Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lerna-publisher

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lerna-publisher - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

19

cjs/cli.js

@@ -33,2 +33,21 @@ #!/usr/bin/env node

commander_1.default
.command('publishSnapshot [folder]') // sub-command name
.description('publish all unpublish pacakges') // command description
// function to execute when command is uses
.action(async (folder) => {
if (!NPM_TOKEN) {
console.log('process.env.NPM_TOKEN is empty or not defined. Not publishing.');
return;
}
try {
const directoryPath = path_1.default.resolve(folder || '');
console.log('lerna-publisher starting in ' + directoryPath);
const shortSha = String(process.env.GITHUB_SHA);
await publish_1.publishSnpashot(directoryPath, shortSha);
}
catch (e) {
printErrorAndExit(e);
}
});
commander_1.default
.command('deploydemo [pkgName] [folder]') // sub-command name

@@ -35,0 +54,0 @@ .description('Deploy package for demo usage') // command description

1

cjs/publish.d.ts
export declare function publish(directoryPath: string): Promise<void>;
export declare function publishSnpashot(directoryPath: string, shortSha: string): Promise<void>;
//# sourceMappingURL=publish.d.ts.map

@@ -11,2 +11,3 @@ "use strict";

const cmdPublishText = 'npm publish --registry https://registry.npmjs.org/';
const cmdPublishTextNext = 'npm publish --tag next --registry https://registry.npmjs.org/';
const pacoteOptions = {

@@ -48,2 +49,21 @@ '//registry.npmjs.org/:token': process.env.NPM_TOKEN

}
async function patchPkgJsonVersion(packLocation, version, customText) {
console.log(chalk_1.default.green('<<<<<<<<<<<<<<<<<<<<< Patching version for package: ', packLocation));
const cmdVersionText = `npm version ${version}-${customText}`;
child_process_1.default.execSync(cmdVersionText, { cwd: packLocation, stdio: 'inherit' });
}
async function publishSnpashot(directoryPath, shortSha) {
const packages = await getPackages(directoryPath);
for (const entry of packages) {
if (entry.package.private) {
console.log(chalk_1.default.yellow(`package ${entry.package.name} is private. skipping.`));
continue;
}
await patchPkgJsonVersion(entry.location, entry.package.version, shortSha);
console.log(chalk_1.default.green('<<<<<<<<<<<<<<<<<<<<< Publishing snapshot for package: ', entry.location));
child_process_1.default.execSync(cmdPublishTextNext, { cwd: entry.location, stdio: 'inherit' });
console.log(chalk_1.default.green('>>>>>>>>>>>>>>>>>>>>> Done: ', entry.location));
}
}
exports.publishSnpashot = publishSnpashot;
//# sourceMappingURL=publish.js.map

14

package.json
{
"name": "lerna-publisher",
"description": "Utility to publish lerna/yarn/workspace types of packages from ci to npm",
"version": "1.1.3",
"version": "1.1.4",
"main": "cjs/index.js",

@@ -20,3 +20,3 @@ "bin": {

"dependencies": {
"aws-sdk": "^2.569.0",
"aws-sdk": "^2.585.0",
"chalk": "^3.0.0",

@@ -28,7 +28,7 @@ "commander": "^4.0.1",

"mime": "^2.4.4",
"pacote": "^10.1.2"
"pacote": "^10.2.1"
},
"devDependencies": {
"@ts-tools/node": "^1.1.2",
"@types/chai": "^4.2.4",
"@types/chai": "^4.2.6",
"@types/chai-as-promised": "^7.1.2",

@@ -38,5 +38,5 @@ "@types/glob": "^7.1.1",

"@types/mocha": "^5.2.7",
"@types/node": "^12.12.7",
"@types/node": "^12.12.15",
"@types/semver": "^6.2.0",
"@types/sinon": "^7.5.0",
"@types/sinon": "^7.5.1",
"chai": "^4.2.0",

@@ -48,3 +48,3 @@ "chai-as-promised": "^7.1.1",

"tslint": "^5.20.1",
"typescript": "^3.7.2"
"typescript": "~3.7.3"
},

@@ -51,0 +51,0 @@ "files": [

#!/usr/bin/env node
import path from 'path';
import program from 'commander';
import { publish } from './publish';
import { publish, publishSnpashot } from './publish';
import { deploy } from './deploy';

@@ -38,2 +38,21 @@ const { version, description } = require('../package.json');

program
.command('publishSnapshot [folder]') // sub-command name
.description('publish all unpublish pacakges') // command description
// function to execute when command is uses
.action(async (folder: string) => {
if (!NPM_TOKEN) {
console.log('process.env.NPM_TOKEN is empty or not defined. Not publishing.');
return;
}
try {
const directoryPath = path.resolve(folder || '');
console.log('lerna-publisher starting in ' + directoryPath);
const shortSha = String(process.env.GITHUB_SHA);
await publishSnpashot(directoryPath, shortSha);
} catch (e) {
printErrorAndExit(e);
}
});
program
.command('deploydemo [pkgName] [folder]') // sub-command name

@@ -40,0 +59,0 @@ .description('Deploy package for demo usage') // command description

@@ -5,4 +5,4 @@ import childProcess from 'child_process';

const pacote = require('pacote');
const cmdPublishText = 'npm publish --registry https://registry.npmjs.org/';
const cmdPublishTextNext = 'npm publish --tag next --registry https://registry.npmjs.org/';
const pacoteOptions = {

@@ -51,1 +51,21 @@ '//registry.npmjs.org/:token': process.env.NPM_TOKEN

}
async function patchPkgJsonVersion(packLocation: string, version: string, customText: string): Promise<void> {
console.log(chalk.green('<<<<<<<<<<<<<<<<<<<<< Patching version for package: ', packLocation));
const cmdVersionText = `npm version ${version}-${customText}`;
childProcess.execSync(cmdVersionText, { cwd: packLocation, stdio: 'inherit' });
}
export async function publishSnpashot(directoryPath: string, shortSha: string): Promise<void> {
const packages = await getPackages(directoryPath);
for (const entry of packages) {
if (entry.package.private) {
console.log(chalk.yellow(`package ${entry.package.name} is private. skipping.`));
continue;
}
await patchPkgJsonVersion(entry.location, entry.package.version, shortSha);
console.log(chalk.green('<<<<<<<<<<<<<<<<<<<<< Publishing snapshot for package: ', entry.location));
childProcess.execSync(cmdPublishTextNext, { cwd: entry.location, stdio: 'inherit' });
console.log(chalk.green('>>>>>>>>>>>>>>>>>>>>> Done: ', entry.location));
}
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc