Doesn't work with "yarn workspaces"
D10221 opened this issue · comments
Node/npm version(s): N/A
Package(s) version(s): 0.3.3
Description of the issue observed: doesn't work with "yarn workspaces"
Some example to reproduce the issue: try to use it with 'yarn workspaces'
Hi There,
Nice utility,
I Just discovered this project, and I tried it in a "yarn workspaces"driven project
It didn't work at first.
A quick hack to "src/tasks/watch.js" replacing the hardcoded path with a require resolve call seems to fix the problem
// watch
const path = require('path');
const nodemon = require('nodemon');
const { config: { output, source, assets }, createCliArgs } = require('../utils');
const cliPath = path.join(path.dirname(require.resolve("htmplar")), "src/cli/index.js")
const watch = (linting) => {
const exec = [
`node ${cliPath} build`,
`node ${cliPath} serve`
];
if (typeof linting !== 'undefined' &&
((linting === true || Array.isArray(linting)) && linting[0] === true)) {
const lintingArgs = Array.isArray(linting) ? createCliArgs(linting[1]) : '';
exec.unshift(`node ${cliPath} lint ${ lintingArgs }`);
}
nodemon({
exec: `${ exec.join(' && ') }`,
watch: [ path.join(process.cwd(), source), path.join(process.cwd(), output), path.join(process.cwd(), assets) ],
ext: 'js, jsx, mjs, json, css, scss'
});
};
module.exports = watch;
Just wanted to shared the 'hack' in case you find it of any value :)
Thanks
D.
Hello @D10221, thanks for raising the proposal, we have to check it carefully as we are not using yarn by default.
Hi @D10221, I'll be happy to merge if you create a PR for this. Thank you!
@berkandirim
Will do
Thanks
D.
Hi @D10221,
Merged your PR, thanks for the contribution!
My pleasure
Thanks to you