Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use a glob to target any nested folders with a certain prefix

I have a project that has mock json data scattered across different modules. I'm trying to get all the json data to appear in the build using the angular.json config file.

Example list of paths I'm trying to target:

/app/app-mock-data/**
/feature-module/feature-module-mock-data/** 
/pages/page-module/page-module-mock-data/**
/other/other-module/other-module-mock-data/**
/nested/nested-module/further-nested-module/futher-nested-module-mock-data/**

Right now I'm just getting the assets file per module in this project with the angular.json.

// --configuration=mock
{
  "assets": [
    "src/assets",
    "src/favicon.ico",
    "src/favicon.png",
    {
      "glob": "**/* ",
      "input": "src/app/app-mock-data",
      "output": "/mock-assets/app-mock-data"
    },
    {
      "glob": "**/*",
      "input": "src/app/feature-module/feature-module-mock-data",
      "output": "/mock-assets/feature-module-mock-data"
    },
    {
      "glob": "**/* ",
      "input": "src/app/pages/page-module/page-module-mock-data",
      "output": "/mock-assets/page-module-mock-data"
    },
    {
      "glob": "**/* ",
      "input": "src/app/other/other-module/other-module-mock-data",
      "output": "/mock-assets/other-module-mock-data"
    },
    {
      "glob": "**/* ",
      "input": "src/app/nested/nested-module/further-nested-module/futher-nested-module-mock-data",
      "output": "/mock-assets/futher-nested-module-mock-data"
    }
  ]
}

Is there any glob pattern that allows me to recursively get all items in folders with *-mock-data as a folder prefix?

// hopefully something like this..
"assets": [
  "src/assets",
  "src/favicon.ico",
  "src/favicon.png",
  {
    "glob": "*-mock-data/**/*",
    "input": "src/app/**/*",
    "output": "/mock-assets"
  }
],
like image 937
Jonathan002 Avatar asked Aug 29 '18 14:08

Jonathan002


1 Answers

Try this pattern

**/*-mock-data/**

You can test it using globster.xyz

like image 178
Domajno Avatar answered Nov 15 '22 00:11

Domajno