GithubHelp home page GithubHelp logo

component-targetables's Introduction

Hi there,

I develop Adobe Commerce Projects as a Technical Architect at Adobe

Languages ๐Ÿ“

Contribution Graph ๐Ÿ“Š

component-targetables's People

Contributors

codacy-badger avatar dependabot[bot] avatar larsroettig avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

nmalecki

component-targetables's Issues

targetablesSearchPaths only support paths with 2 levels

Current Behavior:

When I change targetablesSearchPaths and add a path with 3 or more levels it doesn't work.

This is my local-intercept.js

const { ExtendLocalIntercept } = require('@larsroettig/component-targetables');

function localIntercept(targets) {
    const { Targetables } = require('@magento/pwa-buildpack');
    const targetables = Targetables.using(targets);
    const extendLocalIntercept = new ExtendLocalIntercept(targetables);
    extendLocalIntercept.allowCustomTargetables('*.js', [
        'src/targets/components',
        'src/targets/rootComponents'
    ]);
    extendLocalIntercept.allowCssOverwrites('*.module.css', [
        'src/targets/components',
        'src/targets/rootComponents'
    ]);
}

module.exports = localIntercept;

And checking the source code, the problem is in the buildRegex function

private buildRegex = (targetablesSearchPaths: string[]): RegExp => {
    const componentPaths: string[] = [];
    const rootPaths: string[] = [];

    targetablesSearchPaths.forEach((tmpPath: string) => {
      const [rootPath, componentPath] = tmpPath.split('/', 2);
      componentPaths.push(componentPath);
      rootPaths.push(rootPath);
    });

    return new RegExp(
      `(${rootPaths.join('|')})/(?<type>${componentPaths.join('|')})`,
      '',
    );
  };

Expected Behavior:

Be able to set targetablesSearchPaths without limitations

Steps To Reproduce:

steps to reproduce the behavior:

  1. add https://github.com/larsroettig/component-targetables to yout proyect
  2. modify local-intercept.js and change the targetablesSearchPaths with a path with three o more levels
  3. yarn watch

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.