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

node-publisher

Package Overview
Dependencies
Maintainers
5
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-publisher - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

4

CHANGELOG.md

@@ -0,1 +1,5 @@

### v1.3.0 (2019-01-03)
- [#26](https://github.com/zendesk/node-publisher/pull/26) Support multiple release configurations ([Attila Večerek](mailto:avecerek@zendesk.com))
### v1.2.0 (2018-12-26)

@@ -2,0 +6,0 @@

2

package.json

@@ -13,3 +13,3 @@ {

},
"version": "1.3.0",
"version": "1.3.1",
"main": "src/index.js",

@@ -16,0 +16,0 @@ "bin": {

@@ -70,2 +70,5 @@ <p align="center">

## Custom branch
Using the `--branch` release param, it is possible to specify which branch should be checked out during the `prepare` [lifecycle](#lifecycle) step. When no `branch` is specified, the `master` branch will be checked out by default.
## Multiple configuration files

@@ -72,0 +75,0 @@

@@ -14,3 +14,3 @@ const yaml = require('js-yaml');

'git diff-index --quiet HEAD --',
'git checkout master',
`git checkout ${env.branch}`,
'git pull --rebase',

@@ -34,3 +34,3 @@ `[[ -f .nvmrc ]] && ${binPathPrefix}check-node-version --node $(cat .nvmrc)`,

`${scriptRunner} build`,
'git diff --staged --quiet || git commit -am "Update build file"'
'git diff --quiet || git commit -am "Update build file"'
];

@@ -37,0 +37,0 @@ } else {

const { buildReleaseConfig } = require('./');
const baseEnv = { testRunner: 'travis', branch: 'master' };
describe('buildReleaseConfig', () => {
describe('when build script is defined in package.json', () => {
const baseEnv = { testRunner: 'travis', withBuildStep: true };
const withBuildEnv = Object.assign({}, baseEnv, { withBuildStep: true });
describe('and npm is the detected npm client', () => {
const env = Object.assign({}, baseEnv, { npmClient: 'npm' });
const env = Object.assign({}, withBuildEnv, { npmClient: 'npm' });

@@ -20,3 +21,3 @@ it('returns a configuration with the build step', () => {

describe('and yarn is the detected npm client', () => {
const env = Object.assign({}, baseEnv, { npmClient: 'yarn' });
const env = Object.assign({}, withBuildEnv, { npmClient: 'yarn' });

@@ -34,10 +35,9 @@ it('returns a configuration with the build step', () => {

describe('when build script is not defined in package.json', () => {
const env = {
const withoutBuildEnv = Object.assign({}, baseEnv, {
npmClient: 'yarn',
testRunner: 'travis',
withBuildStep: false
};
});
it('returns a configuration without the build step', () => {
const config = buildReleaseConfig(env);
const config = buildReleaseConfig(withoutBuildEnv);

@@ -47,2 +47,15 @@ expect(config.build).toBeUndefined();

});
describe('when the configured branch is other than master', () => {
const customBranchEnv = Object.assign({}, baseEnv, {
npmClient: 'yarn',
branch: 'my-branch'
});
it('returns a configuration with a check ou step to the custom branch', () => {
const config = buildReleaseConfig(customBranchEnv);
expect(config.prepare[1]).toBe('git checkout my-branch');
});
});
});

@@ -6,2 +6,3 @@ const path = require('path');

const VALID_TEST_RUNNERS = [DEFAULT_TEST_RUNNER, 'ci'];
const DEFAULT_BRANCH = 'master';
const DEFAULT_CONFIG_PATH = '.release.yml';

@@ -15,2 +16,3 @@ const PACKAGE_JSON_PATH = path.resolve(process.env.PWD, 'package.json');

VALID_TEST_RUNNERS,
DEFAULT_BRANCH,
DEFAULT_CONFIG_PATH,

@@ -17,0 +19,0 @@ PACKAGE_JSON_PATH,

@@ -7,2 +7,3 @@ const path = require('path');

DEFAULT_CONFIG_PATH,
DEFAULT_BRANCH,
VALID_TEST_RUNNERS,

@@ -21,2 +22,3 @@ DEFAULT_TEST_RUNNER

const buildReleaseEnvironment = ({
branch = DEFAULT_BRANCH,
configPath = DEFAULT_CONFIG_PATH,

@@ -48,2 +50,3 @@ quiet = false

npmClient: npmClient(),
branch: branch,
configPath: configPath,

@@ -50,0 +53,0 @@ testRunner: testRunner,

const path = require('path');
const childProcess = require('child_process');
const { execSync } = childProcess;
const { DEFAULT_TEST_RUNNER, DEFAULT_CONFIG_PATH } = require('./constants');
const {
DEFAULT_TEST_RUNNER,
DEFAULT_BRANCH,
DEFAULT_CONFIG_PATH
} = require('./constants');
const {
buildReleaseEnvironment,

@@ -38,2 +42,20 @@ loadReleaseConfig,

describe('when branch is passed', () => {
beforeAll(() => mockTestRunner('test'));
it('contains the passed in branch', () => {
const env = buildReleaseEnvironment({ branch: 'my-branch' });
expect(env.branch).toBe('my-branch');
});
});
describe('when branch is not passed', () => {
it('contains the default branch', () => {
const env = buildReleaseEnvironment({});
expect(env.branch).toBe(DEFAULT_BRANCH);
});
});
describe('when configPath is passed', () => {

@@ -40,0 +62,0 @@ beforeAll(() => mockTestRunner('test'));

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