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

node-publisher

Package Overview
Dependencies
Maintainers
6
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.4.0 to 1.5.0

139

CHANGELOG.md

@@ -0,21 +1,68 @@

### v1.4.0 (2019-08-24)
#### Pull requests
- [#37](https://github.com/zendesk/node-publisher/pull/37) Update jest ([Attila Večerek](mailto:avecerek@zendesk.com))
- [#36](https://github.com/zendesk/node-publisher/pull/36) Update lint-staged ([Attila Večerek](mailto:avecerek@zendesk.com))
- [#33](https://github.com/zendesk/node-publisher/pull/33) Update dependencies ([Attila Večerek](mailto:avecerek@zendesk.com))
- [#35](https://github.com/zendesk/node-publisher/pull/35) Fix the generated config for custom release branches ([Attila Večerek](mailto:avecerek@zendesk.com))
- [#34](https://github.com/zendesk/node-publisher/pull/34) Order branches during the release branch selection setup process ([Attila Večerek](mailto:avecerek@zendesk.com))
- [#32](https://github.com/zendesk/node-publisher/pull/32) Implement a setup script, take 2 ([Attila Večerek](mailto:avecerek@zendesk.com))
- [#31](https://github.com/zendesk/node-publisher/pull/31) Address security alerts ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v1.4.0](https://github.com/zendesk/node-publisher/commit/683742b816cdfdd4fe6a40d3d58f0448cf96680e) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/851aff839411ebda209d57603995612d5291abae) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v1.3.1 (2019-02-21)
#### Pull requests
- [#30](https://github.com/zendesk/node-publisher/pull/30) Fix the build step not committing the changes ([Attila Večerek](mailto:avecerek@zendesk.com))
- [#28](https://github.com/zendesk/node-publisher/pull/28) Add --branch release param ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v1.3.1](https://github.com/zendesk/node-publisher/commit/0fe80894fc603ac1ecbae5f6c5e3e8b8a7da95a9) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/f659c47d710c7abf4a52c874977a4e050c51011a) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v1.3.0 (2019-01-03)
#### Pull requests
- [#26](https://github.com/zendesk/node-publisher/pull/26) Support multiple release configurations ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v1.3.0](https://github.com/zendesk/node-publisher/commit/2ec3242870d28a5bf5b15b3c64c4f86731758271) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/d524f6e243aca82b28a9d25537e7c93e110ca7c1) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v1.2.0 (2018-12-26)
#### Pull requests
- [#27](https://github.com/zendesk/node-publisher/pull/27) Remove version constraints and add prerelease option ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v1.2.0](https://github.com/zendesk/node-publisher/commit/715c5e672f04bf5acb440be63bb6f1e62b5d96be) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/f3182c77bce2d83852540fd109c77a4c9afe07c4) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v1.1.1 (2018-12-11)
#### Pull requests
- [#24](https://github.com/zendesk/node-publisher/pull/24) Add details to package.json + minor adjustments ([Attila Večerek](mailto:avecerek@zendesk.com))
- [#23](https://github.com/zendesk/node-publisher/pull/23) Fix small typo in readme ([Marc Høegh](mailto:Anifacted@users.noreply.github.com))
#### Commits to master
- [v1.1.1](https://github.com/zendesk/node-publisher/commit/266ea03c5e9ff03ff33262ef46498276e3bf95b0) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/f098461adb580224cce9a0f4fdcf12cde22fa02e) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v1.1.0 (2018-12-03)
#### Pull requests
- [#22](https://github.com/zendesk/node-publisher/pull/22) Add publish config to be able to release with yarn again ([Attila Večerek](mailto:avecerek@zendesk.com))

@@ -26,30 +73,80 @@ - [#21](https://github.com/zendesk/node-publisher/pull/21) Rename package and adds licenses field to package.json ([Attila Večerek](mailto:avecerek@zendesk.com))

#### Commits to master
- [v1.1.0](https://github.com/zendesk/node-publisher/commit/a60e510d9d3c300738e5b382faf1bdf574888305) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Removes yarn version check from .release.yml](https://github.com/zendesk/node-publisher/commit/28653d054bf74501c3c9d022f6404c3c652360d1) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/785b3c03faa64e24fc6496ce6c831bd7a07f8616) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v0.5.0 (2018-09-13)
#### Pull requests
- [#17](https://github.com/zendesk/node-publisher/pull/17) Commit build files only when there are files staged ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v0.5.0](https://github.com/zendesk/node-publisher/commit/865ee4b5cfb5167a72f2d9030686e7a5b7a7fd68) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/4de33c01de2352314e2bf09001b0c6296bfbe9aa) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v0.4.2 (2018-09-06)
#### Pull requests
- [#16](https://github.com/zendesk/node-publisher/pull/16) Fix publishing using Lerna ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v0.4.2](https://github.com/zendesk/node-publisher/commit/9e1ba73be5b5899bf5f7ea136324e84f1963e170) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/09f0ccad64ce32cdb03f362674fd3032438cbab8) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v0.4.1 (2018-08-31)
#### Pull requests
- [#15](https://github.com/zendesk/node-publisher/pull/15) Fix the order of steps in .release.yml when ejected ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v0.4.1](https://github.com/zendesk/node-publisher/commit/9c424d93c8a30a574893c523fa647726935b2980) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/4bfa3125231d648256d0919cf77e746cdc0bfce6) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v0.4.0 (2018-08-31)
#### Pull requests
- [#14](https://github.com/zendesk/node-publisher/pull/14) Add test runner whitelist ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v0.4.0](https://github.com/zendesk/node-publisher/commit/7043e17939f6373175c556e1c16732939489afd5) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/d589da3113e9b96e705c339e68ef86f9f55e842b) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v0.3.0 (2018-08-30)
#### Pull requests
- [#12](https://github.com/zendesk/node-publisher/pull/12) Autodetect whether package needs to be built during release ([Attila Večerek](mailto:avecerek@zendesk.com))
- [#13](https://github.com/zendesk/node-publisher/pull/13) Remove the assumption about the output build directory ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v0.3.0](https://github.com/zendesk/node-publisher/commit/4c317fe37464b2d1c9c13c922173256bf62b09f7) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/14245e5c9005e9063ce89a3bfea0164213600599) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v0.2.1 (2018-07-24)
#### Pull requests
- [#11](https://github.com/zendesk/node-publisher/pull/11) Allow unmodified bundles to be committed ([Attila Večerek](mailto:avecerek@zendesk.com))
- [#10](https://github.com/zendesk/node-publisher/pull/10) Clarifies getting started and simplifies usage in README ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v0.2.1](https://github.com/zendesk/node-publisher/commit/81eb87bffe33124c10999b10753d0cf8bdfd4e29) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/bdd79c3b9b1254f2e6333d40ec1caaf243f7f23c) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v0.2.0 (2018-07-23)
#### Pull requests
- [#9](https://github.com/zendesk/node-publisher/pull/9) Add alias to own release command in package.json ([Attila Večerek](mailto:avecerek@zendesk.com))

@@ -59,22 +156,64 @@ - [#8](https://github.com/zendesk/node-publisher/pull/8) Remove build file naming assumption ([Attila Večerek](mailto:avecerek@zendesk.com))

#### Commits to master
- [v0.2.0](https://github.com/zendesk/node-publisher/commit/623df15fad32384f57002d5f8cc6af8e0e09e920) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update README - Yarn forwards the arguments since 1.0, no -- needed in that case](https://github.com/zendesk/node-publisher/commit/e5c23e4531caeebccf3d473c7247328fd8dea782) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/aaf4a5d684971103a407b14aa01462a6bc7446fe) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v0.1.4 (2018-07-11)
#### Pull requests
- [#6](https://github.com/zendesk/node-publisher/pull/6) Call local package bins directly instead of relying on `yarn` or `npx` ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v0.1.4](https://github.com/zendesk/node-publisher/commit/fada164b5524b488bfe857f9097ca4965c239d89) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/ccf818ed54a1e50a40f7f41b214e30b15e3e2b6c) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v0.1.3 (2018-07-11)
#### Pull requests
- [#5](https://github.com/zendesk/node-publisher/pull/5) Run binaries of local packages either using `yarn` or `npx` ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v0.1.3](https://github.com/zendesk/node-publisher/commit/2bd960baf8b475727f7682c710694170a74854a6) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/7e2eeaddf2a3d115d94720db7ac1ed7d0d3cc2bf) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v0.1.2 (2018-07-10)
#### Pull requests
- [#4](https://github.com/zendesk/node-publisher/pull/4) Extend `package.json` with a binary entry ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v0.1.2](https://github.com/zendesk/node-publisher/commit/610d90b74ef923582db4f0f85f8bb01e632cdf07) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/0aa806ba544544fe663b444520a21e13c0981c5d) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v0.1.1 (2018-07-10)
#### Pull requests
- [#3](https://github.com/zendesk/node-publisher/pull/3) Fix `offline-github-changelog` command not found error ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v0.1.1](https://github.com/zendesk/node-publisher/commit/c5f65c88507f395c135e9d18c1407836a5fed5c7) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Update changelog](https://github.com/zendesk/node-publisher/commit/af24d89677943a089ae2887f93ac263c128ad415) ([Attila Večerek](mailto:avecerek@zendesk.com))
### v0.1.0 (2018-07-10)
#### Pull requests
- [#2](https://github.com/zendesk/node-publisher/pull/2) Fix rollback and own release ([Attila Večerek](mailto:avecerek@zendesk.com))
- [#1](https://github.com/zendesk/node-publisher/pull/1) Initial PR ([Attila Večerek](mailto:avecerek@zendesk.com))
#### Commits to master
- [v0.1.0](https://github.com/zendesk/node-publisher/commit/c868c7d2fa931e9363c4881ebb5b36e55ee3e968) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Fixes syntax error in own release](https://github.com/zendesk/node-publisher/commit/ad3f2c4f7ab31fe5080161609e6094eddf5e14ea) ([Attila Večerek](mailto:avecerek@zendesk.com))
- [Adds empty README](https://github.com/zendesk/node-publisher/commit/6974f0f83969a4ca73c7314efef196e4f5adc8a0) ([Attila Večerek](mailto:avecerek@zendesk.com))

2

package.json

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

},
"version": "1.4.0",
"version": "1.5.0",
"main": "src/index.js",

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

@@ -41,3 +41,2 @@ <p align="center">

- Generates a release script in you `package.json` with a release branch of your choice.
- Checks whether `NVM` is installed.
- Generates a `.nvmrc` file if missing.

@@ -101,2 +100,3 @@ - Checks whether a `build` script is defined in `package.json`.

- A `.nvmrc` file is present in the root of your package. In case it is missing, the release fails in its preparation phase.
- The tool expects the Node version to match the one in `.nvmrc` during the release process. If the expectation is not met, the release fails in its preparation phase.
- The tool expects the build generation script to be called `build`. Otherwise, the build step is skipped.

@@ -103,0 +103,0 @@ - The tool expects the test triggering script to be called `travis` or `ci`. The reason is that many times the standard `test` scripts are implemented to watch the files for changes to re-trigger the tests. This tool relies on the test script to return eventually, hence the choice of the commonly used CI-friendly script names. The list of accepted script names may be extended in the future. If both `travis` and `ci` scripts are present, `travis` will be preferred.

@@ -11,4 +11,2 @@ const fs = require('fs');

const isNvmInstalled = () => fs.existsSync(NVM_PATH);
const nvmrcExists = () => fs.existsSync(NVM_CONFIG_PATH);

@@ -44,11 +42,2 @@

async function nvmrcStep() {
if (!isNvmInstalled()) {
throw new Error(
`Your system does not have NVM installed. \
Install NVM (https://github.com/creationix/nvm#installation) or eject \
by running \`npx node-publisher eject\` and customize the release process \
to skip checking the Node version before release.`
);
}
if (nvmrcExists()) {

@@ -55,0 +44,0 @@ return;

@@ -46,10 +46,5 @@ const fs = require('fs');

describe('when NVM is not installed', () => {
it('throws an error', async () => {
const error = `Your system does not have NVM installed. \
Install NVM (https://github.com/creationix/nvm#installation) or eject \
by running \`npx node-publisher eject\` and customize the release process \
to skip checking the Node version before release.`;
await expect(nvmrcStep()).rejects.toThrow(error);
describe('when .nvmrc file exists', () => {
beforeAll(() => {
MOCKED_FILES.push('.nvmrc');
});

@@ -74,3 +69,3 @@

describe('when NVM is installed', () => {
describe('when .nvmrc file does not exist', () => {
beforeAll(() => {

@@ -80,55 +75,23 @@ MOCKED_FILES = [NVM_PATH];

it('does not throw an error', async () => {
await expect(nvmrcStep()).resolves.not.toThrow();
it('asks for the node version', async () => {
try {
await nvmrcStep();
} catch (_) {
expect(utils.ask).not.toHaveBeenCalledTimes(1);
}
});
describe('and .nvmrc file exists', () => {
beforeAll(() => {
MOCKED_FILES.push('.nvmrc');
});
it('does not ask for the node version', async () => {
try {
await nvmrcStep();
} catch (_) {
expect(utils.ask).not.toHaveBeenCalled();
}
});
it('does not generate a .nvmrc file', async () => {
try {
await nvmrcStep();
} catch (_) {
expect(fs.writeFileSync).not.toHaveBeenCalled();
}
});
it('generates a .nvmrc file', async () => {
try {
await nvmrcStep();
} catch (_) {
expect(fs.writeFileSync).not.toHaveBeenCalledTimes(1);
expect(fs.writeFileSync).not.toHaveBeenCalledWith(
NVM_CONFIG_PATH,
'v9.11.0',
'utf-8'
);
}
});
describe('and .nvmrc file does not exist', () => {
beforeAll(() => {
MOCKED_FILES = [NVM_PATH];
});
it('asks for the node version', async () => {
try {
await nvmrcStep();
} catch (_) {
expect(utils.ask).not.toHaveBeenCalledTimes(1);
}
});
it('generates a .nvmrc file', async () => {
try {
await nvmrcStep();
} catch (_) {
expect(fs.writeFileSync).not.toHaveBeenCalledTimes(1);
expect(fs.writeFileSync).not.toHaveBeenCalledWith(
NVM_CONFIG_PATH,
'v9.11.0',
'utf-8'
);
}
});
});
});
});

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

const {
validateNodeVersion,
validatePkgRoot,

@@ -26,2 +27,3 @@ validateTestRunner,

}) => {
validateNodeVersion();
validatePkgRoot();

@@ -77,3 +79,3 @@

for (let cmd of commands) {
for (const cmd of commands) {
command.exec(cmd);

@@ -80,0 +82,0 @@ }

const fs = require('fs');
const { execSync } = require('child_process');
const { packageJson } = require('../package');

@@ -6,3 +7,2 @@ const {

GIT_PATH,
NVM_PATH,
NVM_CONFIG_PATH,

@@ -13,2 +13,11 @@ PACKAGE_JSON_PATH,

const validateNodeVersion = () => {
const expectedNodeVersion = fs.readFileSync(NVM_CONFIG_PATH, { encoding: 'utf-8' }).trim();
const actualNodeVersion = execSync('node -v', { encoding: 'utf-8' }).trim();
if (expectedNodeVersion !== actualNodeVersion) {
throw new Error(`Expected Node version to be ${expectedNodeVersion} but instead it is ${actualNodeVersion}`);
}
};
const validatePkgRoot = () => {

@@ -38,4 +47,2 @@ if (!fs.existsSync(PACKAGE_JSON_PATH)) {

const isNvmInstalled = () => fs.existsSync(NVM_PATH);
const nvmrcExists = () => fs.existsSync(NVM_CONFIG_PATH);

@@ -62,2 +69,3 @@

module.exports = {
validateNodeVersion,
validatePkgRoot,

@@ -67,3 +75,2 @@ validateTestRunner,

isGitProject,
isNvmInstalled,
nvmrcExists,

@@ -70,0 +77,0 @@ hasBuildScript,

const utils = require('../package');
const { VALID_TEST_RUNNERS, NVM_PATH } = require('../constants');
const { VALID_TEST_RUNNERS } = require('../constants');
const {
validateNodeVersion,
validatePkgRoot,

@@ -8,3 +9,2 @@ validateTestRunner,

isGitProject,
isNvmInstalled,
nvmrcExists,

@@ -16,4 +16,37 @@ hasBuildScript,

jest.mock('fs');
jest.mock('child_process');
jest.mock('../package');
describe('validateNodeVersion', () => {
beforeEach(() => {
require('fs').__setMockFiles(['.nvmrc']);
require('fs').__setReadFileSyncReturnValue('.nvmrc', 'v12.18.0');
require('child_process').__permitCommands(['node']);
});
describe('with incorrect Node version', () => {
beforeEach(() => {
require('child_process').__setReturnValues({
'node -v': 'v10.16.0',
});
});
it('throws an error', () => {
expect(validateNodeVersion).toThrow();
});
});
describe('with correct Node version', () => {
beforeEach(() => {
require('child_process').__setReturnValues({
'node -v': 'v12.18.0',
});
});
it('does not throw an error', () => {
expect(validateNodeVersion).not.toThrow();
});
});
});
describe('validatePkgRoot', () => {

@@ -107,24 +140,2 @@ beforeEach(() => {

describe('isNvmInstalled', () => {
afterEach(() => {
require('fs').__setMockFiles([]);
});
describe('when ~/.nvm directory exists', () => {
const MOCKED_FILES = [NVM_PATH];
it('returns true', () => {
require('fs').__setMockFiles(MOCKED_FILES);
expect(isNvmInstalled()).toBe(true);
});
});
describe('when ~/.nvm directory does not exist', () => {
it('returns false', () => {
expect(isNvmInstalled()).toBe(false);
});
});
});
describe('nvmrcExists', () => {

@@ -131,0 +142,0 @@ afterEach(() => {

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