[timelion] Fix glob path on windows (#152866)

Fixes a bug introduced in #138571. Paths need to be normalized before
being passed to our current version of globby.

Closes #150396
This commit is contained in:
Jon 2023-03-09 15:39:05 -06:00 committed by GitHub
parent 7a5264b53f
commit f134d2e44c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,7 @@
import _ from 'lodash';
import globby from 'globby';
import path from 'path';
import normalizePath from 'normalize-path';
import processFunctionDefinition from './process_function_definition';
export default function (directory) {
@ -19,7 +20,7 @@ export default function (directory) {
// Get a list of all files and use the filename as the object key
const files = _.map(
globby
.sync(path.resolve(__dirname, '../' + directory + '/*.js'))
.sync(normalizePath(path.resolve(__dirname, '../' + directory + '/*.js')))
.filter((filename) => !filename.includes('.test')),
function (file) {
const name = file.substring(file.lastIndexOf('/') + 1, file.lastIndexOf('.'));
@ -29,7 +30,7 @@ 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(
globby.sync(path.resolve(__dirname, '../' + directory + '/*/index.js'))
globby.sync(normalizePath(path.resolve(__dirname, '../' + directory + '/*/index.js')))
)
.map(function (file) {
const parts = file.split('/');