Use import for klaw-sync module

This commit is contained in:
Rafael Oleza 2020-07-14 14:53:27 +02:00
parent 6c1320a7cf
commit 61e3be18af
No known key found for this signature in database
GPG key ID: 559647D09ED485D1
3 changed files with 11 additions and 12 deletions

View file

@ -1,22 +1,13 @@
/* eslint-disable no-sync */
import * as Path from 'path'
import * as FSE from 'fs-extra'
import { mkdirSync } from './temp'
const klawSync = require('klaw-sync')
import klawSync, { Item } from 'klaw-sync'
import { Repository } from '../../src/models/repository'
import { GitProcess } from 'dugite'
import { makeCommit, switchTo } from './repository-scaffolding'
import { writeFile } from 'fs-extra'
import { git } from '../../src/lib/git'
type KlawEntry = {
path: string
}
/**
* Set up the named fixture repository to be used in a test.
*
@ -39,12 +30,12 @@ export async function setupFixtureRepository(
Path.join(testRepoPath, '.git')
)
const ignoreHiddenFiles = function (item: KlawEntry) {
const ignoreHiddenFiles = function (item: Item) {
const basename = Path.basename(item.path)
return basename === '.' || basename[0] !== '.'
}
const entries: ReadonlyArray<KlawEntry> = klawSync(testRepoPath)
const entries = klawSync(testRepoPath)
const visiblePaths = entries.filter(ignoreHiddenFiles)
const submodules = visiblePaths.filter(
entry => Path.basename(entry.path) === '_git'

View file

@ -138,6 +138,7 @@
"@types/html-webpack-plugin": "^2.30.3",
"@types/jest": "^23.3.1",
"@types/keytar": "^4.0.0",
"@types/klaw-sync": "^6.0.0",
"@types/legal-eagle": "^0.15.0",
"@types/memoize-one": "^3.1.1",
"@types/mini-css-extract-plugin": "^0.2.0",

View file

@ -439,6 +439,13 @@
resolved "https://registry.yarnpkg.com/@types/keytar/-/keytar-4.0.1.tgz#e2cf6405dc33861424e59b67516c66d2cf7bc21b"
integrity sha512-loKBID6UL4QjhD2scuvv6oAPlQ/WAY7aYTDyKlKo7fIgriLS8EZExqT567cHL5CY6si51MRoX1+r3mitD3eYrA==
"@types/klaw-sync@^6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@types/klaw-sync/-/klaw-sync-6.0.0.tgz#ff0b36601efaaa109d513c4ced109311fd06ba36"
integrity sha512-Ibfb2jgpjYUxnl7RSVvUzOrv/vhkTVKEfPwQf9ZlDDsSyWVDp/2JtTBxO4eRrKBYtxc3cZQabdR38i8R0o1uww==
dependencies:
"@types/node" "*"
"@types/legal-eagle@^0.15.0":
version "0.15.0"
resolved "https://registry.yarnpkg.com/@types/legal-eagle/-/legal-eagle-0.15.0.tgz#3a3cf08edca425ffaf9518304c4f1efddea36e42"