Skip to content

Commit

Permalink
Moves glob to devDependencies (#198589)
Browse files Browse the repository at this point in the history
## Summary

Moves `glob` dependencies to devDependencies.
  • Loading branch information
jeramysoucy authored Nov 5, 2024
1 parent 7e68e2c commit 6ecccd3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@
"get-port": "^5.0.0",
"getopts": "^2.2.5",
"getos": "^3.1.0",
"glob": "^7.1.2",
"glob-all": "^3.2.1",
"globby": "^11.0.3",
"handlebars": "4.7.7",
Expand Down Expand Up @@ -720,6 +719,7 @@
"find-cypress-specs": "^1.35.1",
"form-data": "^4.0.0",
"geckodriver": "^4.5.1",
"glob": "^7.1.2",
"glob-watcher": "5.0.3",
"gulp": "4.0.2",
"gulp-babel": "^8.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-spec-to-console/bin/spec_to_console.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
const fs = require('fs');
const path = require('path');
const program = require('commander');
const glob = require('glob');
const globby = require('globby');
const chalk = require('chalk');

const packageJSON = require('../package.json');
Expand All @@ -26,7 +26,7 @@ if (!program.glob) {
process.exit(1);
}

const files = glob.sync(program.glob);
const files = globby.sync(program.glob);
const totalFilesCount = files.length;
let convertedFilesCount = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
*/

import _, { merge } from 'lodash';
import glob from 'glob';
import globby from 'globby';
import { basename, join, resolve } from 'path';
import { readFileSync } from 'fs';
import normalizePath from 'normalize-path';

import { jsSpecLoaders } from '../lib';

Expand Down Expand Up @@ -115,8 +116,9 @@ export class SpecDefinitionsService {
}

private loadJSONSpecInDir(dirname: string) {
const generatedFiles = glob.sync(join(dirname, 'generated', '*.json'));
const overrideFiles = glob.sync(join(dirname, 'overrides', '*.json'));
// we need to normalize paths otherwise they don't work on windows, see https://github.com/elastic/kibana/issues/151032
const generatedFiles = globby.sync(normalizePath(join(dirname, 'generated', '*.json')));
const overrideFiles = globby.sync(normalizePath(join(dirname, 'overrides', '*.json')));

return generatedFiles.reduce((acc, file) => {
const overrideFile = overrideFiles.find((f) => basename(f) === basename(file));
Expand Down
13 changes: 8 additions & 5 deletions src/plugins/vis_types/timelion/server/lib/load_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*/

import _ from 'lodash';
import glob from 'glob';
import path from 'path';
import globby from 'globby';
import processFunctionDefinition from './process_function_definition';

export default function (directory) {
Expand All @@ -18,8 +17,8 @@ export default function (directory) {

// Get a list of all files and use the filename as the object key
const files = _.map(
glob
.sync(path.resolve(__dirname, '../' + directory + '/*.js'))
globby
.sync('../' + directory + '/*.js', { cwd: __dirname })
.filter((filename) => !filename.includes('.test')),
function (file) {
const name = file.substring(file.lastIndexOf('/') + 1, file.lastIndexOf('.'));
Expand All @@ -28,7 +27,11 @@ export default function (directory) {
);

// Get a list of all directories with an index.js, use the directory name as the key in the object
const directories = _.chain(glob.sync(path.resolve(__dirname, '../' + directory + '/*/index.js')))
const directories = _.chain(
globby.sync('../' + directory + '/*/index.js', {
cwd: __dirname,
})
)
.map(function (file) {
const parts = file.split('/');
const name = parts[parts.length - 2];
Expand Down

0 comments on commit 6ecccd3

Please sign in to comment.