New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nuxt/cli

Package Overview
Dependencies
Maintainers
3
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuxt/cli - npm Package Compare versions

Comparing version 2.4.5 to 2.5.0

34

CHANGELOG.md

@@ -6,2 +6,36 @@ # Change Log

# [2.5.0](https://github.com/nuxt/nuxt.js/compare/v2.4.5...v2.5.0) (2019-03-21)
### Bug Fixes
* **cli:** enable server for implicit SPA generate in nuxt build ([c46def7](https://github.com/nuxt/nuxt.js/commit/c46def7))
* **pkg:** add missing dependencies ([665f15a](https://github.com/nuxt/nuxt.js/commit/665f15a))
* default for-exit to false to prevent dev exit ([a347ef9](https://github.com/nuxt/nuxt.js/commit/a347ef9))
* disable "analyze" for nuxt generate ([#4975](https://github.com/nuxt/nuxt.js/issues/4975)) ([574a2eb](https://github.com/nuxt/nuxt.js/commit/574a2eb))
* dont force exit when it was explicitly disabled ([#4973](https://github.com/nuxt/nuxt.js/issues/4973)) ([3e9eee2](https://github.com/nuxt/nuxt.js/commit/3e9eee2))
### Code Refactoring
* **ts:** better DX for typescript support ([#5079](https://github.com/nuxt/nuxt.js/issues/5079)) ([920f444](https://github.com/nuxt/nuxt.js/commit/920f444))
### Features
* loading screen ([#5251](https://github.com/nuxt/nuxt.js/issues/5251)) ([ef41e20](https://github.com/nuxt/nuxt.js/commit/ef41e20))
* **cli:** lock project during build or generate ([#4985](https://github.com/nuxt/nuxt.js/issues/4985)) ([4e51723](https://github.com/nuxt/nuxt.js/commit/4e51723))
* **cli:** option to open the project in the browser ([#4930](https://github.com/nuxt/nuxt.js/issues/4930)) ([4c7bd9c](https://github.com/nuxt/nuxt.js/commit/4c7bd9c))
* **generate:** return non-zero code or page error (fixes [#4991](https://github.com/nuxt/nuxt.js/issues/4991)) ([#5195](https://github.com/nuxt/nuxt.js/issues/5195)) ([c6565c9](https://github.com/nuxt/nuxt.js/commit/c6565c9))
* show warning on forced exit ([#4958](https://github.com/nuxt/nuxt.js/issues/4958)) ([5094d9c](https://github.com/nuxt/nuxt.js/commit/5094d9c))
### BREAKING CHANGES
* **ts:** `build.useForkTsChecker` renamed to `build.typescript.typeCheck`
## [2.4.4](https://github.com/nuxt/nuxt.js/compare/v2.4.3...v2.4.4) (2019-02-26)

@@ -8,0 +42,0 @@

103

dist/cli-chunk.js
/*!
* @nuxt/cli v2.4.5 (c) 2016-2019
* @nuxt/cli v2.5.0 (c) 2016-2019

@@ -16,2 +16,5 @@ * - All the amazing contributors

const __chunk_2 = require('./cli-chunk2.js');
const chalk = _interopDefault(require('chalk'));
const fs = require('fs');
const fs__default = _interopDefault(fs);

@@ -76,4 +79,37 @@ const commands = {

var name = "@nuxt/cli";
var version = "2.4.5";
var version = "2.5.0";
const dependencyNotFoundMessage =
`Please install @nuxt/typescript and rerun the command
${chalk.bold('Using yarn')}
yarn add -D @nuxt/typescript
${chalk.bold('Using npm')}
npm install -D @nuxt/typescript`;
async function detectAndSetupTypeScriptSupport(rootDir, options = {}) {
const tsConfigPath = path.resolve(rootDir, 'tsconfig.json');
if (!fs.existsSync(tsConfigPath)) {
return false
}
consola.info(`${chalk.bold.blue('tsconfig.json')} found, enabling TypeScript runtime support`);
try {
const { setup } = require('@nuxt/typescript');
await setup(tsConfigPath, options);
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
process.stdout.write(__chunk_2.warningBox(dependencyNotFoundMessage, chalk.yellow('An external official dependency is needed to enable TS support')));
process.exit(1);
} else {
throw (e)
}
}
return true
}
class NuxtCommand {

@@ -101,6 +137,6 @@ constructor(cmd = { name: '', usage: '', description: '' }, argv = process.argv.slice(2)) {

run() {
async run() {
if (this.argv.help) {
this.showHelp();
return Promise.resolve()
return
}

@@ -110,17 +146,35 @@

this.showVersion();
return Promise.resolve()
return
}
if (typeof this.cmd.run !== 'function') {
return Promise.resolve()
return
}
const runResolve = Promise.resolve(this.cmd.run(this));
let cmdError;
try {
await this.cmd.run(this);
} catch (e) {
cmdError = e;
}
if (this.argv.lock) {
await this.releaseLock();
}
if (this.argv['force-exit']) {
const forceExitByUser = this.isUserSuppliedArg('force-exit');
runResolve.then(() => __chunk_2.forceExit(this.cmd.name, forceExitByUser ? false : __chunk_2.forceExitTimeout));
if (cmdError) {
consola.fatal(cmdError);
}
__chunk_2.forceExit(this.cmd.name, forceExitByUser ? false : __chunk_2.forceExitTimeout);
if (forceExitByUser) {
return
}
}
return runResolve
if (cmdError) {
throw cmdError
}
}

@@ -144,5 +198,8 @@

async getNuxtConfig(extraOptions) {
async getNuxtConfig(extraOptions = {}) {
const rootDir = path.resolve(this.argv._[0] || '.');
extraOptions._typescript = await detectAndSetupTypeScriptSupport(rootDir, { transpileOnly: this.cmd.name === 'start' });
const config = await __chunk_2.loadNuxtConfig(this.argv);
const options = Object.assign(config, extraOptions || {});
const options = Object.assign(config, extraOptions);

@@ -158,4 +215,6 @@ for (const name of Object.keys(this.cmd.options)) {

const { Nuxt } = await core();
const nuxt = new Nuxt(options);
await nuxt.ready();
return nuxt

@@ -176,2 +235,22 @@ }

async setLock(lockRelease) {
if (lockRelease) {
if (this._lockRelease) {
consola.warn(`A previous unreleased lock was found, this shouldn't happen and is probably an error in 'nuxt ${this.cmd.name}' command. The lock will be removed but be aware of potential strange results`);
await this.releaseLock();
this._lockRelease = lockRelease;
} else {
this._lockRelease = lockRelease;
}
}
}
async releaseLock() {
if (this._lockRelease) {
await this._lockRelease();
this._lockRelease = undefined;
}
}
isUserSuppliedArg(option) {

@@ -253,5 +332,5 @@ return this._argv.includes(`--${option}`) || this._argv.includes(`--no-${option}`)

exports.getCommand = getCommand;
exports.NuxtCommand = NuxtCommand;
exports._commands = _commands;
exports._imports = _imports;
exports.getCommand = getCommand;
/*!
* @nuxt/cli v2.4.5 (c) 2016-2019
* @nuxt/cli v2.5.0 (c) 2016-2019

@@ -90,3 +90,12 @@ * - All the amazing contributors

const locking = {
lock: {
type: 'boolean',
default: true,
description: 'Do not set a lock on the project when building'
}
};
exports.common = common;
exports.locking = locking;
exports.server = server;

4

dist/cli-chunk4.js
/*!
* @nuxt/cli v2.4.5 (c) 2016-2019
* @nuxt/cli v2.5.0 (c) 2016-2019

@@ -12,3 +12,2 @@ * - All the amazing contributors

require('consola');
require('fs');
require('esm');

@@ -18,2 +17,3 @@ require('exit');

require('@nuxt/config');
require('@nuxt/utils');
require('chalk');

@@ -20,0 +20,0 @@ require('pretty-bytes');

/*!
* @nuxt/cli v2.4.5 (c) 2016-2019
* @nuxt/cli v2.5.0 (c) 2016-2019

@@ -14,3 +14,2 @@ * - All the amazing contributors

const consola = _interopDefault(require('consola'));
require('fs');
require('esm');

@@ -20,2 +19,3 @@ require('exit');

require('@nuxt/config');
require('@nuxt/utils');
const chalk = _interopDefault(require('chalk'));

@@ -27,2 +27,3 @@ require('pretty-bytes');

const __chunk_3 = require('./cli-chunk3.js');
const opener = _interopDefault(require('opener'));

@@ -35,3 +36,8 @@ const dev = {

...__chunk_3.common,
...__chunk_3.server
...__chunk_3.server,
open: {
alias: 'o',
type: 'boolean',
description: 'Opens the server listeners url in the default browser'
}
},

@@ -41,3 +47,4 @@

const { argv } = cmd;
await this.startDev(cmd, argv);
await this.startDev(cmd, argv, argv.open);
},

@@ -47,3 +54,5 @@

try {
await this._startDev(cmd, argv);
const nuxt = await this._startDev(cmd, argv);
return nuxt
} catch (error) {

@@ -62,5 +71,18 @@ consola.error(error);

// Wait for nuxt to be ready
await nuxt.ready();
// Start listening
await nuxt.server.listen();
// Show banner when listening
__chunk_2.showBanner(nuxt);
// Opens the server listeners url in the default browser (only once)
if (argv.open) {
argv.open = false;
const openerPromises = nuxt.server.listeners.map(listener => opener(listener.url));
await Promise.all(openerPromises);
}
// Create builder instance

@@ -72,5 +94,2 @@ const builder = await cmd.getBuilder(nuxt);

// Show banner after build
__chunk_2.showBanner(nuxt);
// Return instance

@@ -77,0 +96,0 @@ return nuxt

/*!
* @nuxt/cli v2.4.5 (c) 2016-2019
* @nuxt/cli v2.5.0 (c) 2016-2019

@@ -12,7 +12,7 @@ * - All the amazing contributors

require('consola');
require('fs');
require('esm');
require('exit');
require('./cli-chunk2.js');
const __chunk_2 = require('./cli-chunk2.js');
require('@nuxt/config');
require('@nuxt/utils');
require('chalk');

@@ -31,2 +31,3 @@ require('pretty-bytes');

...__chunk_3.common,
...__chunk_3.locking,
analyze: {

@@ -88,2 +89,10 @@ alias: 'a',

if (cmd.argv.lock) {
await cmd.setLock(await __chunk_2.createLock({
id: 'build',
dir: nuxt.options.buildDir,
root: config.rootDir
}));
}
if (nuxt.options.mode !== 'spa' || cmd.argv.generate === false) {

@@ -93,7 +102,8 @@ // Build only

await builder.build();
} else {
// Build + Generate for static deployment
const generator = await cmd.getGenerator(nuxt);
await generator.generate({ build: true });
return
}
// Build + Generate for static deployment
const generator = await cmd.getGenerator(nuxt);
await generator.generate({ build: true });
}

@@ -100,0 +110,0 @@ };

/*!
* @nuxt/cli v2.4.5 (c) 2016-2019
* @nuxt/cli v2.5.0 (c) 2016-2019

@@ -12,3 +12,2 @@ * - All the amazing contributors

require('consola');
require('fs');
require('esm');

@@ -18,2 +17,3 @@ require('exit');

require('@nuxt/config');
require('@nuxt/utils');
require('chalk');

@@ -32,2 +32,3 @@ require('pretty-bytes');

...__chunk_3.common,
...__chunk_3.locking,
build: {

@@ -58,2 +59,7 @@ type: 'boolean',

}
},
'fail-on-error': {
type: 'boolean',
default: false,
description: 'Exit with non-zero status code if there are errors when generating pages'
}

@@ -63,9 +69,39 @@ },

const config = await cmd.getNuxtConfig({ dev: false });
// Disable analyze if set by the nuxt config
if (!config.build) {
config.build = {};
}
config.build.analyze = false;
const nuxt = await cmd.getNuxt(config);
if (cmd.argv.lock) {
await cmd.setLock(await __chunk_2.createLock({
id: 'build',
dir: nuxt.options.buildDir,
root: config.rootDir
}));
nuxt.hook('build:done', async () => {
await cmd.releaseLock();
await cmd.setLock(await __chunk_2.createLock({
id: 'generate',
dir: nuxt.options.generate.dir,
root: config.rootDir
}));
});
}
const generator = await cmd.getGenerator(nuxt);
await generator.generate({
const { errors } = await generator.generate({
init: true,
build: cmd.argv.build
});
if (cmd.argv['fail-on-error'] && errors.length > 0) {
throw new Error('Error generating pages, exiting with non-zero code')
}
}

@@ -72,0 +108,0 @@ };

/*!
* @nuxt/cli v2.4.5 (c) 2016-2019
* @nuxt/cli v2.5.0 (c) 2016-2019

@@ -16,3 +16,2 @@ * - All the amazing contributors

require('minimist');
require('fs');
require('esm');

@@ -22,2 +21,3 @@ require('exit');

require('@nuxt/config');
require('@nuxt/utils');
const chalk = _interopDefault(require('chalk'));

@@ -28,2 +28,3 @@ require('pretty-bytes');

require('boxen');
require('fs');
const __chunk_3 = require('./cli-chunk3.js');

@@ -76,7 +77,9 @@

const command = await __chunk_1.getCommand(name);
if (command) {
__chunk_1.NuxtCommand.from(command).showHelp();
} else {
if (!command) {
consola.info(`Unknown command: ${name}`);
return
}
__chunk_1.NuxtCommand.from(command).showHelp();
}

@@ -83,0 +86,0 @@ };

/*!
* @nuxt/cli v2.4.5 (c) 2016-2019
* @nuxt/cli v2.5.0 (c) 2016-2019

@@ -18,4 +18,2 @@ * - All the amazing contributors

require('minimist');
const fs = require('fs');
const fs__default = _interopDefault(fs);
require('esm');

@@ -25,2 +23,3 @@ const exit = _interopDefault(require('exit'));

require('@nuxt/config');
require('@nuxt/utils');
require('chalk');

@@ -31,2 +30,4 @@ require('pretty-bytes');

require('boxen');
const fs = require('fs');
const fs__default = _interopDefault(fs);
const execa = _interopDefault(require('execa'));

@@ -100,5 +101,4 @@

throw String(`Command not found: nuxt-${argv[0]}`)
} else {
throw String(`Failed to run command \`nuxt-${argv[0]}\`:\n${error}`)
}
throw String(`Failed to run command \`nuxt-${argv[0]}\`:\n${error}`)
}

@@ -114,3 +114,3 @@ }

exports.imports = imports;
exports.run = run;
exports.setup = setup;
exports.run = run;
{
"name": "@nuxt/cli",
"version": "2.4.5",
"version": "2.5.0",
"repository": "nuxt/nuxt.js",

@@ -15,13 +15,15 @@ "license": "MIT",

"dependencies": {
"@nuxt/config": "2.4.5",
"@nuxt/config": "2.5.0",
"@nuxt/utils": "2.5.0",
"boxen": "^3.0.0",
"chalk": "^2.4.2",
"consola": "^2.3.2",
"esm": "^3.2.3",
"consola": "^2.5.7",
"esm": "^3.2.18",
"execa": "^1.0.0",
"exit": "^0.1.2",
"minimist": "^1.2.0",
"opener": "1.5.1",
"pretty-bytes": "^5.1.0",
"std-env": "^2.2.1",
"wrap-ansi": "^4.0.0"
"wrap-ansi": "^5.0.0"
},

@@ -28,0 +30,0 @@ "publishConfig": {

Sorry, the diff of this file is too big to display

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