Skip to content

Commit

Permalink
Feature/#11 windows path issue (#48)
Browse files Browse the repository at this point in the history
* parse root path, add cross-env for windows and unix support

* nromalize paths
  • Loading branch information
StarpTech authored and devongovett committed Dec 6, 2017
1 parent ad5135a commit 67cd3b0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"cross-env": "^5.1.1",
"less": "^2.7.2",
"mocha": "^3.5.0",
"ncp": "^2.0.0",
Expand All @@ -52,7 +53,7 @@
"stylus": "^0.54.5"
},
"scripts": {
"test": "NODE_ENV=test mocha",
"test": "cross-env NODE_ENV=test mocha",
"prepublish": "babel src -d lib"
},
"bin": {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');

const existsCache = new Map;

async function resolve(filepath, filenames, root = '/') {
async function resolve(filepath, filenames, root = path.parse(filepath).root) {
filepath = path.dirname(filepath);

// Don't traverse above the module root
Expand All @@ -25,7 +25,7 @@ async function resolve(filepath, filenames, root = '/') {
return resolve(filepath, filenames, root);
}

async function load(filepath, filenames, root = '/') {
async function load(filepath, filenames, root = path.parse(filepath).root) {
let configFile = await resolve(filepath, filenames, root);
if (configFile) {
if (path.extname(configFile) === '.js') {
Expand Down
6 changes: 3 additions & 3 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ const path = require('path');
const WebSocket = require('ws');

beforeEach(function () {
rimraf.sync(__dirname + '/dist');
rimraf.sync(path.join(__dirname, 'dist'));
});

function bundler(file, opts) {
return new Bundler(file, Object.assign({
outDir: __dirname + '/dist',
outDir: path.join(__dirname, 'dist'),
watch: false,
cache: false,
killWorkers: false,
Expand All @@ -37,7 +37,7 @@ function run(bundle, globals) {
appendChild(el) {
setTimeout(function () {
if (el.tag === 'script') {
vm.runInContext(fs.readFileSync(__dirname + '/dist' + el.src), ctx);
vm.runInContext(fs.readFileSync(path.join(__dirname, 'dist', el.src)), ctx);
}

el.onload();
Expand Down

0 comments on commit 67cd3b0

Please sign in to comment.