Skip to content

Support top-level patterns to external dirs using globstar #77

@TwitchBronBron

Description

@TwitchBronBron

Support using top-level patterns to external directories as long as there's at least 1 globstar. Example:

Consider this pattern:
"../thirdPartySDK/**/*"

For this path: ../thirdPartySDK/source/sdk.brs, its final path would be: ./source/sdk.brs because the globstar indicates the start of the relative path portion.

If there are multiple globstars, the first globstar is where the relative pattern will begin.

Here's a unit test that should get you close.

it('should support external folders with globstar', async () => {
    //write a file outside of rootDir
    fsExtra.outputFileSync(`${tempDir}/thirdPartySDK/alpha/beta/charlie.brs`, '');
    fsExtra.outputFileSync(`${tempDir}/rootDir/manifest`, '');
    fsExtra.outputFileSync(`${tempDir}/rootDir/source/main.brs`, '');
    await rokuDeploy.stage({
        rootDir: `${tempDir}/rootDir`,
        stagingDir: stagingDir,
        files: [
            '../thirdPartySDK/**/*',
            '**/*'
        ]
    });
    const resultFiles = fastGlob.sync(`**/*`, { cwd: stagingDir });
    expect(resultFiles).to.eql([
        'manifest',
        'source/main.brs',
        'alpha/beta/charlie.brs'
    ]);
});

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions