Skip to content

Commit

Permalink
fix: use glob named import
Browse files Browse the repository at this point in the history
Signed-off-by: Francisco Buceta <frbuceta@gmail.com>
  • Loading branch information
frbuceta committed Apr 10, 2023
1 parent 4cee63e commit 7daf6fb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
3 changes: 1 addition & 2 deletions packages/boot/src/booters/booter-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import {Constructor} from '@loopback/core';
import debugFactory from 'debug';
import path from 'path';
import {promisify} from 'util';
const glob = promisify(require('glob'));
import {glob} from 'glob';

const debug = debugFactory('loopback:boot:booter-utils');

Expand Down
6 changes: 3 additions & 3 deletions packages/build/bin/compile-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const debug = require('debug')('loopback:build');
const utils = require('./utils');
const path = require('path');
const fs = require('fs');
const glob = require('glob');
const {globSync} = require('glob');
const fse = require('fs-extra');
const buildOptions = require('typescript').buildOpts;
const {buildOpts: buildOptions} = require('typescript');

function run(argv, options) {
if (options === true) {
Expand Down Expand Up @@ -265,7 +265,7 @@ function copyResources(rootDir, packageDir, tsConfigFile, outDir, options) {
(tsConfig.compilerOptions && tsConfig.compilerOptions.rootDir) || '';

const pattern = `@(${dirs})/**/!(*.ts)`;
const files = glob.sync(pattern, {root: packageDir, nodir: true});
const files = globSync(pattern, {root: packageDir, nodir: true});
for (const file of files) {
/**
* Trim path that matches tsConfig.compilerOptions.rootDir
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/generators/copyright/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

const fse = require('fs-extra');
const _ = require('lodash');
const {promisify} = require('util');
const glob = promisify(require('glob'));
const {glob} = require('glob');

const defaultFS = {
write: fse.writeFile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@

'use strict';

const promisify = require('util').promisify;

const downloadAndExtractExample = require('../../../generators/example/downloader');
const expect = require('@loopback/testlab').expect;
const fs = require('fs');
const TestSandbox = require('@loopback/testlab').TestSandbox;
const glob = promisify(require('glob'));
const {expect} = require('@loopback/testlab');
const fs = require('fs/promises');
const {TestSandbox} = require('@loopback/testlab');
const {glob} = require('glob');
const path = require('path');

const readFile = promisify(fs.readFile);
const downloadAndExtractExample = require('../../../generators/example/downloader');

const VALID_EXAMPLE = 'todo';
const sandbox = new TestSandbox(path.resolve(__dirname, '../.sandbox'));
Expand Down Expand Up @@ -49,7 +45,7 @@ describe('cloneExampleFromGitHub (SLOW)', /** @this {Mocha.Suite} */ function ()
'src/index.ts',
]);

const packageJson = JSON.parse(await readFile(`${outDir}/package.json`));
const packageJson = JSON.parse(await fs.readFile(`${outDir}/package.json`));
expect(packageJson).to.have.properties({
name: `@loopback/example-${VALID_EXAMPLE}`,
});
Expand Down

0 comments on commit 7daf6fb

Please sign in to comment.