adidas / htmplar

Templar is a React to HTML converter. It is created for developer friendly e-mail template development. By leveraging the component structure with React, it composes a reusable and maintainable pipeline for the projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't work with "yarn workspaces"

D10221 opened this issue · comments

commented

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!

commented

@berkandirim
Will do
Thanks
D.

commented

pull request [created] (#18)
Also created a quick demo illustrating the purpose/usage
Let me know if I missing something :)
Regards
D.

commented

Added extra branch on my fork with basic testing, it might be overdoing it for #18
I didn't see testing framework , and that is why I didn't include in the original PR,

Hi @D10221,
Merged your PR, thanks for the contribution!

commented

My pleasure
Thanks to you