diff --git a/e2e_tests/tests/cli.test.js b/e2e_tests/tests/cli.test.js index e599025a2..1c5da7d92 100644 --- a/e2e_tests/tests/cli.test.js +++ b/e2e_tests/tests/cli.test.js @@ -53,15 +53,16 @@ describe('KYT CLI', () => { expect(scripts.start).toBe('node build/server/main.js'); expect(scripts.build).toBe('kyt build'); expect(scripts.test).toBe('kyt test'); - expect(scripts.lint).toBe('kyt lint'); + expect(scripts.lint).toBe('npm run lint-script && npm run lint-style'); expect(scripts['lint-style']).toBe('kyt lint-style'); + expect(scripts['lint-script']).toBe('kyt lint-script'); expect(scripts.proto).toBe('kyt proto'); expect(scripts['kyt:help']).toBe('kyt --help'); }); it('runs the lint command', () => { expect(true).toBe(true); - const output = shell.exec('npm run lint'); + const output = shell.exec('npm run lint-script'); expect(output.code).toBe(0); const outputArr = output.stdout.split('\n'); expect(outputArr.includes('✅ Your JS looks great ✨')).toBe(true); diff --git a/packages/kyt-cli/cli/actions/setup.js b/packages/kyt-cli/cli/actions/setup.js index 6bf0c78e3..e5783b179 100644 --- a/packages/kyt-cli/cli/actions/setup.js +++ b/packages/kyt-cli/cli/actions/setup.js @@ -124,9 +124,9 @@ module.exports = (flags, args) => { const addPackageJsonScripts = (packageJson) => { if (!packageJson.scripts) packageJson.scripts = {}; let commands = [ - 'dev', 'build', 'start', + 'dev', 'build', 'start', 'proto', 'test', 'test-watch', 'test-coverage', - 'lint', 'lint-style', 'proto', + 'lint', 'lint-script', 'lint-style', ]; // for commands that aren't 1:1 name:script @@ -134,6 +134,7 @@ module.exports = (flags, args) => { start: 'node build/server/main.js', 'test-watch': 'kyt test -- --watch', 'test-coverage': 'kyt test -- --coverage', + lint: 'npm run lint-script && npm run lint-style', }; // Merge the Starter-kyt script names into the list of commands. diff --git a/packages/kyt-core/cli/actions/__tests__/lint.test.js b/packages/kyt-core/cli/actions/__tests__/lintScript.test.js similarity index 96% rename from packages/kyt-core/cli/actions/__tests__/lint.test.js rename to packages/kyt-core/cli/actions/__tests__/lintScript.test.js index 82a4cbd70..550675647 100644 --- a/packages/kyt-core/cli/actions/__tests__/lint.test.js +++ b/packages/kyt-core/cli/actions/__tests__/lintScript.test.js @@ -21,7 +21,7 @@ jest.mock('shelljs', () => ( describe('lint', () => { global.process.exit = jest.fn(); const logger = require('kyt-utils/logger'); - const lint = require('../lint'); + const lint = require('../lintScript'); beforeEach(() => { jest.resetModules(); diff --git a/packages/kyt-core/cli/actions/lint.js b/packages/kyt-core/cli/actions/lintScript.js similarity index 100% rename from packages/kyt-core/cli/actions/lint.js rename to packages/kyt-core/cli/actions/lintScript.js diff --git a/packages/kyt-core/cli/commands.js b/packages/kyt-core/cli/commands.js index e23b71f58..40bee77f4 100755 --- a/packages/kyt-core/cli/commands.js +++ b/packages/kyt-core/cli/commands.js @@ -2,7 +2,7 @@ const program = require('commander'); const shell = require('shelljs'); const devAction = require('./actions/dev'); -const lintAction = require('./actions/lint'); +const lintScriptAction = require('./actions/lintScript'); const testAction = require('./actions/test'); const buildAction = require('./actions/build'); const protoAction = require('./actions/proto'); @@ -32,9 +32,9 @@ const loadConfigAndDo = (action, optionalConfig) => { }; program - .command('lint') + .command('lint-script') .description('lints .js files in the ./src directory.') - .action(() => loadConfigAndDo(lintAction)); + .action(() => loadConfigAndDo(lintScriptAction)); program .command('dev') @@ -85,4 +85,11 @@ program logger.error('kyt start is deprecated. \n Run the server with: node build/server/main.js'); }); +program + .command('lint') + .description('deprecated') + .action(() => { + logger.error('kyt lint is deprecated. \n Run lint-script to lint js files.'); + }); + program.parse(process.argv);