@clabs/packages-publisher
Advanced tools
Comparing version 0.0.1-alpha.3 to 0.0.1
@@ -147,3 +147,3 @@ "use strict"; | ||
_loop_1 = function (packageName) { | ||
var _d, json, folderPath, version, publishResult; | ||
var _d, json, folderPath, version, privatePackage, publishResult; | ||
return __generator(this, function (_e) { | ||
@@ -160,3 +160,11 @@ switch (_e.label) { | ||
_d = packages[packageName], json = _d.json, folderPath = _d.folderPath; | ||
version = json.version; | ||
version = json.version, privatePackage = json.private; | ||
if (privatePackage) { | ||
logger_1.logger.info("".concat(packageName, " is private and will be skipped")); | ||
output.addPublishResult(packageName, { | ||
status: 'skipped', | ||
context: 'private' | ||
}); | ||
return [2 /*return*/, "continue"]; | ||
} | ||
assertNonDevVersion(version, packageName); | ||
@@ -163,0 +171,0 @@ return [4 /*yield*/, withRetryOnOtpError(function () { return (0, npmPublish_1.publishToNpm)(otp.getLatest(), dryRun, folderPath, version); }, otp)]; |
{ | ||
"version": "0.0.1-alpha.3", | ||
"version": "0.0.1", | ||
"name": "@clabs/packages-publisher", | ||
@@ -4,0 +4,0 @@ "repository": "celo-org/packages-publisher", |
@@ -77,2 +77,30 @@ import { createFakePackages } from '../../../test/mock-system'; | ||
it('should skip publish for private packages', async () => { | ||
const packageName = 'packageA'; | ||
const versionInPackageJson = '1.0.1'; | ||
mockedGetAllPackageJsons.mockReturnValue( | ||
createFakePackages({ | ||
name: packageName, | ||
version: versionInPackageJson, | ||
private: true, | ||
}) | ||
); | ||
// Mock that all CLI commands resolved without errors | ||
mockedExecCommand.mockResolvedValue(createExecaReturnValue()); | ||
const resultCollector = resultBuilder(); | ||
await buildAndPublishAllPackages(baseFlags, resultCollector); | ||
expect(resultCollector.getResult()).toStrictEqual({ | ||
[packageName]: { | ||
build: { status: 'success' }, | ||
publish: { | ||
status: 'skipped', | ||
context: 'private', | ||
}, | ||
}, | ||
}); | ||
}); | ||
it('should be successful on first publish (error about not finding package is ignored)', async () => { | ||
@@ -79,0 +107,0 @@ const packageName = 'packageA'; |
@@ -107,4 +107,13 @@ import { ArgumentsCamelCase } from 'yargs'; | ||
const { json, folderPath } = packages[packageName]; | ||
const { version } = json; | ||
const { version, private: privatePackage } = json; | ||
if (privatePackage) { | ||
logger.info(`${packageName} is private and will be skipped`); | ||
output.addPublishResult(packageName, { | ||
status: 'skipped', | ||
context: 'private', | ||
}); | ||
continue; | ||
} | ||
assertNonDevVersion(version, packageName); | ||
@@ -111,0 +120,0 @@ |
@@ -9,2 +9,3 @@ import fs from 'fs'; | ||
name: string; | ||
private?: boolean; | ||
version: string; | ||
@@ -11,0 +12,0 @@ dependencies: { [key: string]: string }; |
@@ -13,2 +13,3 @@ import mockFileSystem from 'mock-fs'; | ||
dependencies: props.dependencies || {}, | ||
private: props.private || false, | ||
devDependencies: {}, | ||
@@ -15,0 +16,0 @@ }; |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
135828
3579
60
1