Skip to content

Commit 97b354d

Browse files
committed
Merge branch 'develop'
* develop: windows fix
2 parents cc117d9 + df976e2 commit 97b354d

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

src/server/page.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ const pageData = {};
1212
const getPage = (fileData) => {
1313
if (fileData.dir !== sharedContent) {
1414
const fileDir = fileData.dir.split(output);
15-
const href = fileDir[fileDir.length - 1];
16-
const fileName = fileData.dir.split('/');
15+
const href = process.platform === 'win32' ? fileDir[fileDir.length - 1].replace(/\\/g, '/') : fileDir[fileDir.length - 1];
16+
const fileName = process.platform === 'win32' ? fileData.dir.split('\\') : fileData.dir.split('/');
1717
const pageName = fileName[fileName.length - 1].replace(/-/g, ' ');
1818

1919
const programName = fileName[2] ? fileName[2].replace(/-/g, ' ') : '';

src/tasks/transform.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function _eval(file) {
1717
if (file) {
1818
const stream = [
1919
'import React from \'react\';',
20-
`import Component from '${ path.join(process.cwd(), file) }';`
20+
`import Component from '${ process.platform === 'win32' ? path.join(process.cwd(), file).replace(/\\/g, '\\\\') : path.join(process.cwd(), file) }';`
2121
];
2222

2323
if (file.includes('/block-')) {

src/tasks/watch.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ const { config: { output, source, assets }, createCliArgs } = require('../utils'
66

77
const watch = (linting) => {
88
const exec = [
9-
'./node_modules/.bin/htmplar build',
10-
'./node_modules/.bin/htmplar serve'
9+
'node ./node_modules/htmplar/src/cli/index.js build',
10+
'node ./node_modules/htmplar/src/cli/index.js serve'
1111
];
1212

1313
if (typeof linting !== 'undefined' &&
1414
((linting === true || Array.isArray(linting)) && linting[0] === true)) {
1515
const lintingArgs = Array.isArray(linting) ? createCliArgs(linting[1]) : '';
1616

17-
exec.unshift(`./node_modules/.bin/htmplar lint ${ lintingArgs }`);
17+
exec.unshift(`node ./node_modules/htmplar/src/cli/index.js lint ${ lintingArgs }`);
1818
}
1919

2020
nodemon({
21-
exec: `node ${ exec.join(' && ') }`,
21+
exec: `${ exec.join(' && ') }`,
2222
watch: [ path.join(process.cwd(), source), path.join(process.cwd(), output), path.join(process.cwd(), assets) ],
2323
ext: 'js, jsx, mjs, json, css, scss'
2424
});

src/utils/walker.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ const { exclude } = require('./config');
66

77
const walkSync = (dir, filelist = []) => {
88
let _filelist = filelist;
9+
const dirPath = process.platform === 'win32' ? dir.replace(/\\/g, '/') : dir;
910

10-
if (exclude.length <= 0 || !exclude.includes(dir)) {
11+
if (exclude.length <= 0 || !exclude.includes(dirPath)) {
1112
fs.readdirSync(dir).forEach((file) => {
1213
_filelist = fs.statSync(path.join(dir, file)).isDirectory()
1314
? walkSync(path.join(dir, file), _filelist)

0 commit comments

Comments
 (0)