diff --git a/docs/open-in-editor.md b/docs/open-in-editor.md index 7cee0ce3b..2b79972e2 100644 --- a/docs/open-in-editor.md +++ b/docs/open-in-editor.md @@ -6,12 +6,12 @@ Nuxt supports this feature out-of-the-box. Make sure to be in debug mode. ## Webpack -In your Vue project, install the [express-open-in-editor](https://github.com/lahmatiy/express-open-in-editor) package and modifiy your webpack configuration: +In your Vue project, install the [launch-editor-middleware](https://github.com/yyx990803/launch-editor#middleware) package and modifiy your webpack configuration: 1. Import the package: ```js -var openInEditor = require('express-open-in-editor') +var openInEditor = require('launch-editor-middleware') ``` 2. In the `devServer` option, register the `/__open-in-editor` HTTP route: @@ -19,17 +19,21 @@ var openInEditor = require('express-open-in-editor') ```js devServer: { before (app) { - app.use('/__open-in-editor', openInEditor({ - editor: 'code' - })) + app.use('/__open-in-editor', openInEditor()) } } ``` -3. You can change `'code'` with the editor you are using, see the [supported editors list](https://github.com/lahmatiy/open-in-editor#editor). +3. The editor to launch is guessed. You can also specify the editor app with the `editor` option. See the [supported editors list](https://github.com/lahmatiy/open-in-editor#editor). -You can now click on the name of the component in the Component inspector pane (if the devtools knows about its file source, a tooltip will appear). +```js +openInEditor({ + editor: 'code' +}) +``` + +4. You can now click on the name of the component in the Component inspector pane (if the devtools knows about its file source, a tooltip will appear). ## Node.js -You can use the [open-in-editor](https://github.com/lahmatiy/open-in-editor) package to setup an HTTP route with the `/__open-in-editor` path. It will receive `file` as an URL variable. +You can use the [launch-editor](https://github.com/yyx990803/launch-editor#usage) package to setup an HTTP route with the `/__open-in-editor` path. It will receive `file` as an URL variable. diff --git a/package-lock.json b/package-lock.json index 922d6cbc5..f3866e97f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -204,6 +204,12 @@ "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "dev": true }, + "array-filter": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz", + "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=", + "dev": true + }, "array-find-index": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", @@ -226,6 +232,18 @@ "es-abstract": "1.10.0" } }, + "array-map": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", + "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=", + "dev": true + }, + "array-reduce": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz", + "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=", + "dev": true + }, "array-union": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", @@ -2226,15 +2244,6 @@ } } }, - "express-open-in-editor": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/express-open-in-editor/-/express-open-in-editor-3.1.1.tgz", - "integrity": "sha1-oAurveHXHxFtU2UUWfml0acIJuQ=", - "dev": true, - "requires": { - "open-in-editor": "2.2.0" - } - }, "extend": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", @@ -3530,6 +3539,12 @@ "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", "dev": true }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -3563,6 +3578,25 @@ "is-buffer": "1.1.6" } }, + "launch-editor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-1.0.0.tgz", + "integrity": "sha512-6PUyxINdKIplFuiFaWbj1hN8koXqMSEJPUpr215+KWm/Pkkhxp2tIN3vgjH73+H5/J8hwNVWBJM0cG/6PZZlwg==", + "dev": true, + "requires": { + "chalk": "2.3.0", + "shell-quote": "1.6.1" + } + }, + "launch-editor-middleware": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/launch-editor-middleware/-/launch-editor-middleware-1.0.0.tgz", + "integrity": "sha512-dzyrzzprIkmHYEOqeQgzkyUIy+kTdNHNEvawDRlCSRZgeNCeRri/JB8BY+S9s/9mptEayJk0rHqdCpYJV4Bf2w==", + "dev": true, + "requires": { + "launch-editor": "1.0.0" + } + }, "lazy-cache": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", @@ -4516,16 +4550,6 @@ "mimic-fn": "1.1.0" } }, - "open-in-editor": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/open-in-editor/-/open-in-editor-2.2.0.tgz", - "integrity": "sha1-xbIap29qzUy708Oy533MtLdaICA=", - "dev": true, - "requires": { - "clap": "1.2.3", - "os-homedir": "1.0.2" - } - }, "opn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/opn/-/opn-5.1.0.tgz", @@ -6098,6 +6122,18 @@ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, + "shell-quote": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz", + "integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=", + "dev": true, + "requires": { + "array-filter": "0.0.1", + "array-map": "0.0.0", + "array-reduce": "0.0.0", + "jsonify": "0.0.0" + } + }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", diff --git a/package.json b/package.json index c9fb1fa97..930a2d76c 100644 --- a/package.json +++ b/package.json @@ -39,9 +39,9 @@ "css-loader": "^0.28.7", "eslint": "^4.13.1", "eslint-plugin-vue-libs": "^2.0.1", - "express-open-in-editor": "^3.1.1", "file-loader": "^1.1.6", "friendly-errors-webpack-plugin": "^1.6.1", + "launch-editor-middleware": "^1.0.0", "nightwatch": "^0.9.19", "nightwatch-helpers": "^1.2.0", "selenium-server": "2.52.0", diff --git a/shells/dev/webpack.config.js b/shells/dev/webpack.config.js index b1477bbfe..151c93e90 100644 --- a/shells/dev/webpack.config.js +++ b/shells/dev/webpack.config.js @@ -1,8 +1,6 @@ -var path = require('path') -var webpack = require('webpack') var alias = require('../alias') var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') -var openInEditor = require('express-open-in-editor') +var openInEditor = require('launch-editor-middleware') var bubleOptions = { target: { chrome: 52, firefox: 48 }, @@ -19,7 +17,7 @@ module.exports = { output: { path: __dirname + '/build', publicPath: '/build/', - filename: '[name].js', + filename: '[name].js' }, resolve: { alias @@ -28,7 +26,7 @@ module.exports = { rules: [ { test: /\.js$/, - loader: 'buble-loader', + loader: 'buble-loader', exclude: /node_modules|vue\/dist|vuex\/dist/, options: bubleOptions }, @@ -53,10 +51,8 @@ module.exports = { devServer: { quiet: true, before (app) { - app.use('/__open-in-editor', openInEditor({ - editor: 'code' - })) + app.use('/__open-in-editor', openInEditor()) } }, - plugins: process.env.VUE_DEVTOOL_TEST ? [] :[new FriendlyErrorsPlugin()] + plugins: process.env.VUE_DEVTOOL_TEST ? [] : [new FriendlyErrorsPlugin()] }