Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test windows support #8

Open
alexisvincent opened this issue Apr 20, 2017 · 9 comments
Open

Test windows support #8

alexisvincent opened this issue Apr 20, 2017 · 9 comments

Comments

@alexisvincent
Copy link
Owner

Make sure this works with windows

@jhholm
Copy link

jhholm commented Jul 13, 2017

Doesn't work out of the box in Windows. Seems to be a problem with directory handling (\ or double \ instead of /). I managed to get stuff working (serve + live reload) with a dirty hack though.

Had to modify dist/config.js (line 40)
configs.file = require(path.join.apply(path, ['/'].concat(_toConsumableArray(dir), ['systemjs-tools.js']))).config;

and dist/index.js (line 331)
_.fileChanged = function (absolutePath) {
_.events.next({
type: 'file-changed',
absolutePath: absolutePath,
relativePath: _path2.default.relative(config.directories.root, absolutePath),
url: _path2.default.relative(config.directories.baseURL, absolutePath)
});
};

The url parameter didn't work. I just hardcoded those values for now.

@jhholm
Copy link

jhholm commented Oct 10, 2017

This issue still persists in the new version, tested with NPM 6 and 8.
The path created for require comes now as e.g /C:/GIT/project/systemjs-tools.js, which doesn't work in Windows. So the problem seems to be that Windows also has drive letters. For now I just do a dirty .slice(1) to the _toConsumableArray(dir) to get the systemjs-tools.js location working.

I'll try to test if I can find a solution that works across all environments.

@alexisvincent
Copy link
Owner Author

Awesome thanks, realistically I won’t be able to test windows support so if you are able to that would be awesome!

@jhholm
Copy link

jhholm commented Oct 10, 2017

For now it seems that if I change the following (config.js line 26 and 30):
configs.file = require(path.join('/', ...dir, 'systemjs-tools.js')).config

to
configs.file = require(path.join(...dir, 'systemjs-tools.js')).config

directory handling seems to work within Windows. Is the preceding '/' required? The variable dir contains initially process.cwd(), which should already contain the preceding / within Unix environments.

@aluanhaddad
Copy link

Thank you for this awesome tool. I want to use it.

My team works on windows.

I tried making the changes discussed but I was unable to get it working. When I run systemjs serve, I get

:: exiting :: couldn't find a valid systemjs-tools config

I am using the config file sample from the README.

@jhholm
Copy link

jhholm commented Oct 17, 2017

I created a fork with the aforementioned fixes
https://github.com/jhholm/systemjs-tools

You can try that if you want.

@aluanhaddad
Copy link

Trying it, thank you!

@aluanhaddad
Copy link

@jhholm thanks for creating that fork. Unfortunately, I still receive the same error

:: exiting :: couldn't find a valid systemjs-tools config

It is possible I am doing something incredibly bone-headed.

I am running Windows 10 pro 64bit under NodeJS 8.7.0 and npm@5.5.1.

I installed the package using

npm install --global jhholm/systemjs-tools#master

I then created the configuration file mentioned in README
systemjs-tools.js

fs = require('fs');

// Specify keys for localhost
module.exports.config.serve.keys = {
  key: fs.readFileSync('localhost.key', 'utf-8'),
  cert: fs.readFileSync('localhost.crt', 'utf-8'),
  ca: fs.readFileSync('localhost.key', 'utf-8'),
};
module.exports.config.channel = {
  keys: module.exports.config.serve.keys
};

Then from the that file's containing directory, I ran

~C:\Source\project> systemjs serve

Thanks for your assistance.

@jhholm
Copy link

jhholm commented Oct 19, 2017

I tested with your config file, and I get the same error. I suppose the config file might be the issue. E.g. this should work.

var fs = require("fs");

module.exports.config = {
    serve: {
        port: 8080,
        keys: {
            key: fs.readFileSync('localhost.key', 'utf-8'),
            cert: fs.readFileSync('localhost.crt', 'utf-8'),
            ca: fs.readFileSync('localhost.key', 'utf-8'),
        }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants