Skip to content

Commit

Permalink
Fix glob import
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulAdamDavis committed Oct 3, 2023
1 parent 775938c commit f682e9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions tasks/zip-create.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {parse, dirname, join, basename} from 'node:path';
import fs from 'fs-extra';
import {globSync} from 'glob';
import glob from 'glob';
import fsUtils from '@tryghost/mg-fs-utils';
import {makeTaskRunner} from '@tryghost/listr-smart-renderer';

Expand Down Expand Up @@ -98,7 +98,7 @@ const getFullTaskList = (options) => {
task: async (ctx) => {
// 2. Get the size for each image that was just copied
try {
let filePaths = globSync(`${ctx.fileCache.tmpDir}/**/*`, {
let filePaths = glob.globSync(`${ctx.fileCache.tmpDir}/**/*`, {
dot: false,
nodir: true
});
Expand Down Expand Up @@ -155,7 +155,7 @@ const getFullTaskList = (options) => {
task: async (ctx) => {
// 5. Zip each of those new chunk directories
try {
let chunkDirs = globSync(`${ctx.fileCache.zipDir}/chunks/*`);
let chunkDirs = glob.globSync(`${ctx.fileCache.zipDir}/chunks/*`);

// This does not work properly, and is still trying to create the zip file when the tmp dir has been deleted
// When resolved, re-enable the 'Cleaning up' task
Expand All @@ -173,7 +173,7 @@ const getFullTaskList = (options) => {
task: async (ctx) => {
// 6. Move each new zip to the desired destination path
try {
let filePaths = globSync(`${ctx.fileCache.zipDir}/*.zip`);
let filePaths = glob.globSync(`${ctx.fileCache.zipDir}/*.zip`);

await Promise.all(filePaths.map(async (filePath) => {
let fileName = basename(filePath);
Expand Down
6 changes: 3 additions & 3 deletions tasks/zip-split.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {dirname, basename, parse, join} from 'node:path';
import fsUtils from '@tryghost/mg-fs-utils';
import zip from '@tryghost/zip';
import fs from 'fs-extra';
import {globSync} from 'glob';
import glob from 'glob';
import {makeTaskRunner} from '@tryghost/listr-smart-renderer';
import superbytes from 'superbytes';

Expand Down Expand Up @@ -102,7 +102,7 @@ const getFullTaskList = (options) => {
task: async (ctx, task) => {
// 2. Get the size for each image that was just unzipped
try {
let filePaths = globSync(`${ctx.fileCache.tmpDir}/**/*`, {
let filePaths = glob.globSync(`${ctx.fileCache.tmpDir}/**/*`, {
dot: false,
nodir: true
});
Expand Down Expand Up @@ -163,7 +163,7 @@ const getFullTaskList = (options) => {
task: async (ctx) => {
// 5. Zip each of those new chunk directories
let tasks = [];
let chunkDirs = globSync(`${ctx.fileCache.zipDir}/chunks/*`);
let chunkDirs = glob.globSync(`${ctx.fileCache.zipDir}/chunks/*`);

chunkDirs.forEach((dir, index) => {
const zipFileParts = parse(ctx.args.zipFile);
Expand Down

0 comments on commit f682e9e

Please sign in to comment.