diff --git a/bin/semantic-release.js b/bin/semantic-release.js index 9c8e2561..eb258962 100755 --- a/bin/semantic-release.js +++ b/bin/semantic-release.js @@ -23,6 +23,6 @@ npx is bundled with npm >= 5.4, or available via npm. More info: npm.im/npx` } // node 8+ from this point on -require('../src/cli')().catch(() => { +require('../cli')().catch(() => { process.exitCode = 1; }); diff --git a/src/cli.js b/cli.js similarity index 100% rename from src/cli.js rename to cli.js diff --git a/src/index.js b/index.js similarity index 100% rename from src/index.js rename to index.js diff --git a/src/lib/debug.js b/lib/debug.js similarity index 100% rename from src/lib/debug.js rename to lib/debug.js diff --git a/src/lib/get-commits.js b/lib/get-commits.js similarity index 100% rename from src/lib/get-commits.js rename to lib/get-commits.js diff --git a/src/lib/get-config.js b/lib/get-config.js similarity index 100% rename from src/lib/get-config.js rename to lib/get-config.js diff --git a/src/lib/get-next-version.js b/lib/get-next-version.js similarity index 100% rename from src/lib/get-next-version.js rename to lib/get-next-version.js diff --git a/src/lib/get-registry.js b/lib/get-registry.js similarity index 100% rename from src/lib/get-registry.js rename to lib/get-registry.js diff --git a/src/lib/get-version-head.js b/lib/get-version-head.js similarity index 100% rename from src/lib/get-version-head.js rename to lib/get-version-head.js diff --git a/src/lib/github-release.js b/lib/github-release.js similarity index 100% rename from src/lib/github-release.js rename to lib/github-release.js diff --git a/src/lib/logger.js b/lib/logger.js similarity index 100% rename from src/lib/logger.js rename to lib/logger.js diff --git a/src/lib/plugin-noop.js b/lib/plugin-noop.js similarity index 100% rename from src/lib/plugin-noop.js rename to lib/plugin-noop.js diff --git a/src/lib/plugins.js b/lib/plugins.js similarity index 100% rename from src/lib/plugins.js rename to lib/plugins.js diff --git a/src/lib/publish-npm.js b/lib/publish-npm.js similarity index 100% rename from src/lib/publish-npm.js rename to lib/publish-npm.js diff --git a/src/lib/verify-auth.js b/lib/verify-auth.js similarity index 100% rename from src/lib/verify-auth.js rename to lib/verify-auth.js diff --git a/src/lib/verify-pkg.js b/lib/verify-pkg.js similarity index 100% rename from src/lib/verify-pkg.js rename to lib/verify-pkg.js diff --git a/package.json b/package.json index 358b2ccf..475b5a7e 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,9 @@ }, "files": [ "bin", - "src" + "lib", + "index.js", + "cli.js" ], "homepage": "https://github.com/semantic-release/semantic-release#readme", "keywords": [ @@ -101,7 +103,9 @@ "main": "index.js", "nyc": { "include": [ - "src/**/*.js" + "lib/**/*.js", + "index.js", + "cli.js" ], "reporter": [ "json", @@ -130,7 +134,7 @@ "clean": "rimraf coverage && rimraf .nyc_output", "cm": "git-cz", "codecov": "codecov -f coverage/coverage-final.json", - "lint": "eslint .", + "lint": "eslint index.js cli.js lib test", "pretest": "npm run clean && npm run lint", "semantic-release": "./bin/semantic-release.js", "test": "nyc ava -v" diff --git a/test/get-commits.test.js b/test/get-commits.test.js index 1d082d3b..0ab3fb48 100644 --- a/test/get-commits.test.js +++ b/test/get-commits.test.js @@ -19,7 +19,7 @@ test.beforeEach(t => { // Stub the logger functions t.context.log = stub(); t.context.error = stub(); - t.context.getCommits = proxyquire('../src/lib/get-commits', { + t.context.getCommits = proxyquire('../lib/get-commits', { './logger': {log: t.context.log, error: t.context.error}, }); }); diff --git a/test/get-config.test.js b/test/get-config.test.js index 063665bd..37f5b69e 100644 --- a/test/get-config.test.js +++ b/test/get-config.test.js @@ -12,7 +12,7 @@ test.beforeEach(t => { // Save the current working diretory t.context.cwd = process.cwd(); t.context.plugins = stub().returns({}); - t.context.getConfig = proxyquire('../src/lib/get-config', {'./plugins': t.context.plugins}); + t.context.getConfig = proxyquire('../lib/get-config', {'./plugins': t.context.plugins}); }); test.afterEach.always(t => { diff --git a/test/get-next-version.test.js b/test/get-next-version.test.js index 5b70327d..26c6470e 100644 --- a/test/get-next-version.test.js +++ b/test/get-next-version.test.js @@ -6,7 +6,7 @@ import SemanticReleaseError from '@semantic-release/error'; test.beforeEach(t => { // Stub the logger functions t.context.log = stub(); - t.context.getNextVersion = proxyquire('../src/lib/get-next-version', {'./logger': {log: t.context.log}}); + t.context.getNextVersion = proxyquire('../lib/get-next-version', {'./logger': {log: t.context.log}}); }); test('Increase version for patch release', t => { diff --git a/test/get-registry.test.js b/test/get-registry.test.js index 44e39248..ac109dac 100644 --- a/test/get-registry.test.js +++ b/test/get-registry.test.js @@ -1,6 +1,6 @@ import test from 'ava'; import {stub} from 'sinon'; -const getRegistry = require('../src/lib/get-registry'); +const getRegistry = require('../lib/get-registry'); test('Get registry from package.json', t => { // Retrieve the registry with the get-registry module and verify it returns the one from the package.json in parameter diff --git a/test/github-release.test.js b/test/github-release.test.js index 2956f0b7..77f9bbdb 100644 --- a/test/github-release.test.js +++ b/test/github-release.test.js @@ -2,7 +2,7 @@ import test from 'ava'; import {gitRepo, gitCommits, gitHead} from './helpers/git-utils'; import nock from 'nock'; import {authenticate} from './helpers/mock-github'; -import githubRelease from '../src/lib/github-release'; +import githubRelease from '../lib/github-release'; test.beforeEach(t => { // Save the current working diretory diff --git a/test/index.test.js b/test/index.test.js index 7937de59..0d748eac 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -59,7 +59,7 @@ test('Plugins are called with expected values', async t => { npm, }); - const semanticRelease = proxyquire('../src/index', { + const semanticRelease = proxyquire('../index', { './lib/logger': logger, './lib/verify-auth': verifyAuth, './lib/get-config': getConfig, @@ -152,7 +152,7 @@ test('Dry-run skips verifyAuth, verifyConditions, publishNpm and githubRelease', npm, }); - const semanticRelease = proxyquire('../src/index', { + const semanticRelease = proxyquire('../index', { './lib/logger': logger, './lib/verify-auth': verifyAuth, './lib/get-config': getConfig, @@ -243,7 +243,7 @@ test('Throw SemanticReleaseError if there is no release to be done', async t => npm, }); - const semanticRelease = proxyquire('../src/index', { + const semanticRelease = proxyquire('../index', { './lib/logger': logger, './lib/verify-auth': verifyAuth, './lib/get-config': getConfig, diff --git a/test/integration.test.js b/test/integration.test.js index 2d42af57..9b0a737d 100644 --- a/test/integration.test.js +++ b/test/integration.test.js @@ -5,7 +5,7 @@ import execa from 'execa'; import {gitRepo, gitCommits, gitHead, gitTagVersion, gitPackRefs, gitAmmendCommit} from './helpers/git-utils'; import registry from './helpers/registry'; import mockServer from './helpers/mockserver'; -import semanticRelease from '../src'; +import semanticRelease from '..'; // Environment variables used with cli const env = { @@ -15,7 +15,7 @@ const env = { NPM_EMAIL: 'integration@test.com', }; const cli = require.resolve('../bin/semantic-release'); -const noop = require.resolve('../src/lib/plugin-noop'); +const noop = require.resolve('../lib/plugin-noop'); const pluginError = require.resolve('./fixtures/plugin-error-a'); const pluginInheritedError = require.resolve('./fixtures/plugin-error-inherited'); diff --git a/test/logger.test.js b/test/logger.test.js index 3ea564cc..77c66802 100644 --- a/test/logger.test.js +++ b/test/logger.test.js @@ -1,6 +1,6 @@ import test from 'ava'; import {stub, match} from 'sinon'; -import logger from '../src/lib/logger'; +import logger from '../lib/logger'; test.beforeEach(t => { t.context.log = stub(console, 'log'); diff --git a/test/plugins.test.js b/test/plugins.test.js index 3551e1ca..1938e463 100644 --- a/test/plugins.test.js +++ b/test/plugins.test.js @@ -6,7 +6,7 @@ import {stub, match} from 'sinon'; test.beforeEach(t => { // Stub the logger functions t.context.log = stub(); - t.context.plugins = proxyquire('../src/lib/plugins', {'./logger': {log: t.context.log}}); + t.context.plugins = proxyquire('../lib/plugins', {'./logger': {log: t.context.log}}); }); test('Export plugins', t => { @@ -24,7 +24,7 @@ test('Export plugins', t => { test('Pipeline - Get all results', async t => { // Call the plugin module with a verifyRelease plugin pipeline const pipelinePlugins = t.context.plugins({ - verifyRelease: ['./src/lib/plugin-noop', './test/fixtures/plugin-result-a', './test/fixtures/plugin-result-b'], + verifyRelease: ['./lib/plugin-noop', './test/fixtures/plugin-result-a', './test/fixtures/plugin-result-b'], }); // Call the verifyRelease pipeline @@ -33,7 +33,7 @@ test('Pipeline - Get all results', async t => { // Verify the pipeline return the expected result for each plugin, in order t.deepEqual(results, [undefined, 'a', 'b']); // Verify the logger has been called with the plugins path - t.true(t.context.log.calledWith(match.string, './src/lib/plugin-noop')); + t.true(t.context.log.calledWith(match.string, './lib/plugin-noop')); t.true(t.context.log.calledWith(match.string, './test/fixtures/plugin-result-a')); t.true(t.context.log.calledWith(match.string, './test/fixtures/plugin-result-b')); }); @@ -60,34 +60,34 @@ test('Pipeline - Pass pluginConfig and options to each plugins', async t => { test('Pipeline - Get first error', async t => { // Call the plugin module with a verifyRelease plugin pipeline const pipelinePlugins = t.context.plugins({ - verifyRelease: ['./src/lib/plugin-noop', './test/fixtures/plugin-error-a', './test/fixtures/plugin-error-b'], + verifyRelease: ['./lib/plugin-noop', './test/fixtures/plugin-error-a', './test/fixtures/plugin-error-b'], }); // Call the verifyRelease pipeline and verify it returns the error thrown by './test/fixtures/plugin-error-a' await t.throws(pipelinePlugins.verifyRelease({}), 'a'); // Verify the logger has been called with the plugins path - t.true(t.context.log.calledWith(match.string, './src/lib/plugin-noop')); + t.true(t.context.log.calledWith(match.string, './lib/plugin-noop')); t.true(t.context.log.calledWith(match.string, './test/fixtures/plugin-error-a')); }); test('Normalize and load plugin from string', t => { // Call the normalize function with a path - const plugin = t.context.plugins.normalize('./src/lib/plugin-noop'); + const plugin = t.context.plugins.normalize('./lib/plugin-noop'); // Verify the plugin is loaded t.is(typeof plugin, 'function'); // Verify the logger has been called with the plugins path - t.true(t.context.log.calledWith(match.string, './src/lib/plugin-noop')); + t.true(t.context.log.calledWith(match.string, './lib/plugin-noop')); }); test('Normalize and load plugin from object', t => { // Call the normalize function with an object (with path property) - const plugin = t.context.plugins.normalize({path: './src/lib/plugin-noop'}); + const plugin = t.context.plugins.normalize({path: './lib/plugin-noop'}); // Verify the plugin is loaded t.is(typeof plugin, 'function'); // Verify the logger has been called with the plugins path - t.true(t.context.log.calledWith(match.string, './src/lib/plugin-noop')); + t.true(t.context.log.calledWith(match.string, './lib/plugin-noop')); }); test('Load from fallback', t => { @@ -116,7 +116,7 @@ test('Always pass a defined "pluginConfig" for plugin defined with path', async test('Always pass a defined "pluginConfig" for fallback plugin', async t => { // Call the normalize function with the path of a plugin that returns its config - const plugin = t.context.plugins.normalize(null, '../../test/fixtures/plugin-result-config'); + const plugin = t.context.plugins.normalize(null, '../test/fixtures/plugin-result-config'); const pluginResult = await promisify(plugin)({}); t.deepEqual(pluginResult.pluginConfig, {}); diff --git a/test/verify-auth.test.js b/test/verify-auth.test.js index 0133f69f..71e1dda1 100644 --- a/test/verify-auth.test.js +++ b/test/verify-auth.test.js @@ -1,6 +1,6 @@ import test from 'ava'; import SemanticReleaseError from '@semantic-release/error'; -import verify from '../src/lib/verify-auth'; +import verify from '../lib/verify-auth'; test('Verify npm and github auth', t => { // Call the verify module with options and env diff --git a/test/verify-pkg.test.js b/test/verify-pkg.test.js index 06c70b61..1c58fa8d 100644 --- a/test/verify-pkg.test.js +++ b/test/verify-pkg.test.js @@ -1,6 +1,6 @@ import test from 'ava'; import SemanticReleaseError from '@semantic-release/error'; -import verify from '../src/lib/verify-pkg'; +import verify from '../lib/verify-pkg'; test('Verify name and repository', t => { // Call the verify module with package