How to use the sync function from fast-glob

Find comprehensive JavaScript fast-glob.sync code examples handpicked from public code repositorys.

60
61
62
63
64
65
66
67
68
  .mockReturnValue('serviceAcc')
  .mockReturnValue(file);

core.getBooleanInput.mockReturnValue(dryRun);

fg.sync.mockReturnValue([file]);

mockFs({ [file]: configFixtures.valid });
loadSecrets.mockResolvedValue(secrets);
fork icon10
star icon28
watch icon37

+ 9 other calls in file

79
80
81
82
83
84
85
86
87
88

let fileContent = '';
const csvArray = [];

// Get files list
let files = fg.sync([iconsPath], options);

// Do postprocessing on files
if (filesFilter) {
	files = filesFilter(files);
fork icon2
star icon21
watch icon1

+ 8 other calls in file

36
37
38
39
40
41
42
43
44
45
46
47
};


var Loader = function () {};


Loader.loadFiles = async function (glob) {
  const files = fastGlob.sync(glob);
  const results = await loadFiles(files);
  return results.filter((result) => result.data !== undefined);
};

fork icon3
star icon6
watch icon2

+ 4 other calls in file

117
118
119
120
121
122
123
124
125
126
        this.loadCommand(file)
    }
}

loadEvents() {
    for (const path of fg.sync('./events/**/*.js')) {
        const file = require(`.${path}`);
        this.loadEvent(file);
    }
}
fork icon0
star icon5
watch icon2

+ 14 other calls in file

145
146
147
148
149
150
151
152
153
154
155
156
157


	const filter = getFilterSync(options);


	let matches = [];
	for (const task of tasks) {
		matches = arrayUnion(matches, fastGlob.sync(task.pattern, task.options));
	}


	return matches.filter(path_ => !filter(path_));
};
fork icon0
star icon3
watch icon0

235
236
237
238
239
240
241
242
243
    .setPackageId(androidPkgName)
    .write();

// Java file paths shouldn't be hard coded
const javaDirectory = path.join(locations.javaSrc, manifestId.replace(/\./g, '/'));
const java_files = glob.sync('**/*.java', { cwd: javaDirectory, absolute: true }).filter(f => {
    const contents = fs.readFileSync(f, 'utf-8');
    return /extends\s+CordovaActivity/.test(contents);
});
fork icon0
star icon2
watch icon0

+ 2 other calls in file

362
363
364
365
366
367
368
369
370
371
372
function scssToScssConfig({ mode, watch }, { getTuiDirs }) {
  const tuiDirs = getTuiDirs();


  const scssEntry = tuiDirs.reduce((acc, dir) => {
    if (fs.existsSync(path.join(rootDir, dir, 'global_styles'))) {
      fg.sync('global_styles/**/*.scss', { cwd: dir }).forEach(x => {
        if (x == 'global_styles/static.scss') {
          // already included in bundle (see tui_json_loader)
          return;
        }
fork icon0
star icon0
watch icon0

+ 7 other calls in file

14
15
16
17
18
19
20
21
22
23
) => {
  try {
    const pattern = `${path.normalize(folder).replace(/\\/g, '/')}/**/${
      opts.name || '*'
    }${opts.extension || ''}`;
    const files = glob.sync(pattern, {
      onlyFiles: true,
      absolute: true,
      suppressErrors: true,
      ignore: '**/node_modules/**'
fork icon0
star icon0
watch icon1

+ 4 other calls in file

222
223
224
225
226
227
228
229
230
231
232
233


  log('Archiving releases to', cyan(ARTIFACT_FILE_NAME));
  timedExecOrDie(`cd ${DEST_DIR} && tar -czf ${ARTIFACT_FILE_NAME} *`);


  log('Persisting AMP version number to workspace');
  const [versionsFile] = fastGlob.sync(
    path.join(DEST_DIR, 'org-cdn/rtv/01*/version.txt')
  );
  fs.copySync(versionsFile, '/tmp/workspace/AMP_VERSION');
});
fork icon0
star icon0
watch icon0