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

Fix build on Windows #381

Merged
merged 1 commit into from
Jan 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/server/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function execute() {

// create the folder path for a file if it does not exist, then write the file
function writeFileAndCreateFolder(file, content) {
mkdirp.sync(file.replace(new RegExp('/[^/]*$'), ''));
mkdirp.sync(path.dirname(file));

fs.writeFileSync(file, content);
}
Expand Down Expand Up @@ -346,10 +346,10 @@ function execute() {
codeColor
);

mkdirp.sync(targetFile.replace(new RegExp('/[^/]*$'), ''));
mkdirp.sync(path.dirname(targetFile));
fs.writeFileSync(targetFile, cssContent);
} else if (!fs.lstatSync(file).isDirectory()) {
mkdirp.sync(targetFile.replace(new RegExp('/[^/]*$'), ''));
mkdirp.sync(path.dirname(targetFile));
fs.copySync(file, targetFile);
}
});
Expand All @@ -372,7 +372,7 @@ function execute() {
} else if (!fs.lstatSync(file).isDirectory()) {
let parts = file.split('/static/');
let targetFile = join(buildDir, parts[1]);
mkdirp.sync(targetFile.replace(new RegExp('/[^/]*$'), ''));
mkdirp.sync(path.dirname(targetFile));
fs.copySync(file, targetFile);
}
});
Expand All @@ -390,7 +390,7 @@ function execute() {
path.basename(file),
'temp' + path.basename(file)
);
mkdirp.sync(tempFile.replace(new RegExp('/[^/]*$'), ''));
mkdirp.sync(path.dirname(tempFile));
fs.copySync(file, tempFile);

const ReactComp = require(tempFile);
Expand Down Expand Up @@ -465,7 +465,7 @@ function execute() {
// copy other non .js files
let parts = file.split('pages');
let targetFile = join(buildDir, parts[1]);
mkdirp.sync(targetFile.replace(new RegExp('/[^/]*$'), ''));
mkdirp.sync(path.dirname(targetFile));
fs.copySync(file, targetFile);
}
});
Expand Down
2 changes: 1 addition & 1 deletion lib/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ function execute(port) {
path.basename(file),
'temp' + path.basename(file)
);
mkdirp.sync(tempFile.replace(new RegExp('/[^/]*$'), ''));
mkdirp.sync(path.dirname(tempFile));
fs.copySync(userFile, tempFile);

// render into a string
Expand Down