|
| 1 | +const url = require('url'); |
| 2 | +const pkg = require('../../package.json'); |
| 3 | + |
| 4 | +const homepage = url.format({...url.parse(pkg.homepage), ...{hash: null}}); |
| 5 | +const linkify = file => `${homepage}/blob/master/${file}`; |
| 6 | + |
| 7 | +module.exports = { |
| 8 | + EINVALIDNPMPUBLISH: ({npmPublish}) => ({ |
| 9 | + message: 'Invalid `npmPublish` option.', |
| 10 | + details: `The [npmPublish option](${linkify('README.md#npmpublish')}) option, if defined, must be a \`Boolean\`. |
| 11 | +
|
| 12 | +Your configuration for the \`npmPublish\` option is \`${npmPublish}\`.`, |
| 13 | + }), |
| 14 | + EINVALIDTARBALLDIR: ({tarballDir}) => ({ |
| 15 | + message: 'Invalid `tarballDir` option.', |
| 16 | + details: `The [tarballDir option](${linkify('README.md#tarballdir')}) option, if defined, must be a \`String\`. |
| 17 | +
|
| 18 | +Your configuration for the \`tarballDir\` option is \`${tarballDir}\`.`, |
| 19 | + }), |
| 20 | + EINVALIDPKGROOT: ({pkgRoot}) => ({ |
| 21 | + message: 'Invalid `pkgRoot` option.', |
| 22 | + details: `The [pkgRoot option](${linkify('README.md#pkgroot')}) option, if defined, must be a \`String\`. |
| 23 | +
|
| 24 | +Your configuration for the \`pkgRoot\` option is \`${pkgRoot}\`.`, |
| 25 | + }), |
| 26 | + EINVALIDNPMTOKEN: ({registry}) => ({ |
| 27 | + message: 'Invalid npm token.', |
| 28 | + details: `The [npm token](${linkify( |
| 29 | + 'README.md#npm-registry-authentication' |
| 30 | + )}) configured in the \`NPM_TOKEN\` environment variable must be a valid [token](https://docs.npmjs.com/getting-started/working_with_tokens) allowing to publish to the registry \`${registry}\`. |
| 31 | +
|
| 32 | +If you are using Two-Factor Authentication, make configure the \`auth-only\` [level](https://docs.npmjs.com/getting-started/using-two-factor-authentication#levels-of-authentication) is supported. **semantic-release** cannot publish with the default \`auth-and-writes\` level. |
| 33 | +
|
| 34 | +Please make sure to set the \`NPM_TOKEN\` environment variable in your CI with the exact value of the npm token.`, |
| 35 | + }), |
| 36 | + |
| 37 | + ENOPKGNAME: () => ({ |
| 38 | + message: 'Missing `name` property in `package.json`.', |
| 39 | + details: `The \`package.json\`'s [name](https://docs.npmjs.com/files/package.json#name) property is required in order to publish a package to the npm registry. |
| 40 | +
|
| 41 | +Please make sure to add a valid \`name\` for your package in your \`package.json\`.`, |
| 42 | + }), |
| 43 | + ENOPKG: () => ({ |
| 44 | + message: 'Missing `package.json` file.', |
| 45 | + details: `A [package.json file](https://docs.npmjs.com/files/package.json) at the root of your project is required to release on npm. |
| 46 | +
|
| 47 | +Please follow the [npm guideline](https://docs.npmjs.com/getting-started/creating-node-modules) to create a valid \`pacakge.json\` file.`, |
| 48 | + }), |
| 49 | +}; |
0 commit comments