Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@transformation/glob

sunesimonsen9.9kMIT7.0.2

Expand glob patterns in a transformation pipeline

transformation,automation,pipeline,glob

readme

@transformation/glob

A package used to find paths matching glob patterns.

glob

Glob for file paths using globby and emit the paths as items.

const { glob } = require("@transformation/glob");

The simplest example is to just glob for a pattern. You can also provide an array of patterns as well.

await expect(
  pipeline(glob("reports/20*/report.txt"), sort()),
  "to yield items",
  [
    "reports/2020/report.txt",
    "reports/2021/report.txt",
    "reports/2022/report.txt",
  ]
);

If you need more control you can provide an options object that supports all of the options of globby. Notice that also provide the patterns as options.

await expect(
  pipeline(glob({ cwd: "reports", pattern: "2020/*.txt" }), sort()),
  "to yield items",
  ["2020/report.txt", "2020/transactions.txt"]
);

globEach

Run a glob for incoming glob patterns and emit the paths.

const { globEach } = require("@transformation/glob");
await expect(
  pipeline(
    emitItems("reports/20*/report.txt", "reports/2020/*.txt", [
      "reports/2020/report.txt",
      "reports/2021/report.txt",
    ]),
    globEach({ cwd: testDir }),
    sort()
  ),
  "to yield items",
  [
    "reports/2020/report.txt",
    "reports/2020/report.txt",
    "reports/2020/report.txt",
    "reports/2020/transactions.txt",
    "reports/2021/report.txt",
    "reports/2021/report.txt",
    "reports/2022/report.txt",
  ]
);

You can also consume glob options and overlay options or patterns from the globEach transformation.

await expect(
  pipeline(
    emitItems("2020", "2021"),
    map((year) => ({ cwd: path.join(testDir, year) })),
    globEach({ pattern: "*.txt", absolute: true }),
    map((path) => path.replace(/.*\/examples\//, "examples/")),
    sort()
  ),
  "to yield items",
  [
    "examples/reports/2020/report.txt",
    "examples/reports/2020/transactions.txt",
    "examples/reports/2021/report.txt",
    "examples/reports/2021/transactions.txt",
  ]
);

changelog

v7.0.1 (2022-12-06)

Pull requests

Commits to master

v7.0.0 (2022-12-06)

Pull requests

Commits to master

v6.1.0 (2022-12-06)

Pull requests

Commits to master

v6.0.1 (2022-11-23)

Pull requests

Commits to master

v6.0.0 (2022-05-31)

Pull requests

Commits to master

v5.1.1 (2022-05-31)

Pull requests

Commits to master

v5.1.0 (2022-05-31)

Pull requests

Commits to master

v5.0.0 (2022-05-30)

Pull requests

Commits to master

v4.3.0 (2022-02-08)

Pull requests

Commits to master

v4.2.0 (2022-01-17)

Pull requests

Commits to master

v4.1.2 (2021-10-07)

Pull requests

Commits to master

v4.1.1 (2021-09-17)

v4.1.0 (2021-09-17)

Pull requests

Commits to master

v4.0.1 (2021-08-18)

Pull requests

Commits to master

v4.0.0 (2021-03-16)

Pull requests

Commits to master

v3.8.0 (2020-11-12)

Pull requests

Commits to master

v3.7.0 (2020-11-10)

Pull requests

Commits to master

v3.6.0 (2020-11-08)

Pull requests

Commits to master

v3.5.3 (2020-11-08)

v3.5.2 (2020-11-07)

Pull requests

Commits to master

v3.5.1 (2020-11-06)

Pull requests

Commits to master

v3.5.0 (2020-11-06)

Pull requests

Commits to master

v3.4.0 (2020-11-05)

Pull requests

Commits to master

v3.3.0 (2020-11-04)

Pull requests

Commits to master

v3.2.0 (2020-11-03)

Pull requests

Commits to master

v3.1.0 (2020-11-01)

Pull requests

Commits to master

v3.0.0 (2020-11-01)

Pull requests

  • #47 Default to map instead of flatMap for plain functions in a pipeline (Major) (Sune Simonsen)

Commits to master

v2.3.0 (2020-11-01)

Pull requests

Commits to master

v2.2.0 (2020-10-31)

Pull requests

Commits to master

v2.1.0 (2020-10-31)

Pull requests

Commits to master

v2.0.0 (2020-10-31)

Pull requests

Commits to master

v1.34.0 (2020-10-28)

Pull requests

Commits to master

v1.33.0 (2020-09-11)

v1.32.0 (2020-08-11)

Pull requests

Commits to master

v1.31.0 (2020-07-12)

Pull requests

Commits to master

v1.30.2 (2020-07-10)

Pull requests

Commits to master

v1.30.1 (2020-07-08)

Pull requests

Commits to master

v1.30.0 (2020-07-03)

Pull requests

Commits to master

v1.29.1 (2020-07-02)

v1.29.0 (2020-07-02)

Pull requests

Commits to master

v1.28.0 (2020-07-02)

Pull requests

Commits to master

v1.27.1 (2020-06-21)

v1.27.0 (2020-06-21)

Pull requests

Commits to master

v1.26.0 (2020-06-14)

Pull requests

Commits to master

v1.25.0 (2020-06-13)

Pull requests

Commits to master

v1.24.0 (2020-06-12)

Pull requests

Commits to master

v1.23.0 (2020-06-10)

Pull requests

Commits to master

v1.22.0 (2020-06-09)

v1.21.0 (2020-06-08)

Pull requests

Commits to master

v1.20.2 (2020-06-07)

v1.20.1 (2020-06-07)

v1.20.0 (2020-06-07)

Pull requests

Commits to master

v1.19.0 (2020-06-05)

Pull requests

Commits to master

v1.18.2 (2020-06-01)

v1.18.1 (2020-06-01)

v1.18.0 (2020-06-01)

Pull requests

Commits to master

v1.17.0 (2020-05-30)

Pull requests

Commits to master

v1.16.0 (2020-05-29)

Pull requests

Commits to master

v1.15.0 (2020-05-09)

Pull requests

Commits to master

v1.14.1 (2020-04-10)

v1.14.0 (2020-02-10)

v1.13.0 (2020-02-10)

v1.12.3 (2020-02-03)

v1.12.2 (2020-01-18)

v1.12.1 (2020-01-17)

v1.12.0 (2020-01-17)

v1.11.0 (2020-01-17)

v1.10.0 (2020-01-15)

v1.9.1 (2020-01-04)

v1.9.0 (2020-01-04)

v1.8.0 (2020-01-03)

v1.7.1 (2019-12-29)

v1.7.0 (2019-12-29)

v1.6.0 (2019-12-25)

v1.5.0 (2019-12-23)

v1.4.1 (2019-12-23)

v1.4.0 (2019-12-23)

v1.3.1 (2019-12-21)

v1.3.0 (2019-12-21)

v1.2.0 (2019-12-21)

v1.1.1 (2019-12-18)

v1.1.0 (2019-12-18)