From 8cbbaeaf838e33bb6e23f06e15724b39042c5206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Sun, 20 Nov 2016 11:37:53 +0100 Subject: [PATCH] Fix path on windows --- lib/build/index.js | 22 ++++++++++++++++------ package.json | 6 +++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/lib/build/index.js b/lib/build/index.js index f1b7eddf24..a07d2d544e 100644 --- a/lib/build/index.js +++ b/lib/build/index.js @@ -10,17 +10,27 @@ const hash = require('hash-sum') const pify = require('pify') const webpack = require('webpack') const { createBundleRenderer } = require('vue-server-renderer') -const { join, resolve } = require('path') +const { join, resolve, sep } = require('path') const remove = pify(fs.remove) const readFile = pify(fs.readFile) const writeFile = pify(fs.writeFile) const mkdirp = pify(fs.mkdirp) -const r = function () { - const args = Array.from(arguments) - if (_.last(args).includes('~')) { - return _.last(args) +const reqSep = /\//g +const sysSep = _.escapeRegExp(sep) +const normalize = string => string.replace(reqSep, sysSep) +const wp = function (p) { + if (/^win/.test(process.platform)) { + p = p.replace(/\\/g, '\\\\') } - return resolve.apply(null, arguments) + return p +} +const r = function () { + let args = Array.from(arguments) + args = args.map(normalize) + if (_.last(args).includes('~')) { + return wp(_.last(args)) + } + return wp(resolve.apply(null, args)) } const defaults = { diff --git a/package.json b/package.json index 4cafcf2366..b24b2aa051 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuxt", - "version": "0.5.0", + "version": "0.5.1", "description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)", "main": "index.js", "license": "MIT", @@ -41,11 +41,11 @@ "serialize-javascript": "^1.3.0", "serve-static": "^1.11.1", "url-loader": "^0.5.7", - "vue": "^2.0.7", + "vue": "^2.0.8", "vue-loader": "^9.9.5", "vue-meta": "^0.4.4", "vue-router": "^2.0.3", - "vue-server-renderer": "^2.0.7", + "vue-server-renderer": "^2.0.8", "vuex": "^2.0.0", "webpack": "2.1.0-beta.26", "webpack-dev-middleware": "^1.8.4",