本文整理汇总了TypeScript中fs-extra.unlinkSync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript unlinkSync函数的具体用法?TypeScript unlinkSync怎么用?TypeScript unlinkSync使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unlinkSync函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
['tryBlocks2.py'].forEach(file => {
const targetFile = path.join(outPythoFilesPath, file);
if (fs.existsSync(targetFile)) { fs.unlinkSync(targetFile); }
fs.copySync(path.join(srcPythoFilesPath, file), targetFile);
});
示例2: setup
setup(() => {
if (fs.existsSync(refactorTargetFile)) {
fs.unlinkSync(refactorTargetFile);
}
fs.copySync(refactorSourceFile, refactorTargetFile, { clobber: true });
});
示例3:
.finally(() => {
if (tarPath) {
fs.unlinkSync(tarPath);
}
});
示例4: copyDependencies
function copyDependencies() {
const originalPackage: Package = require(path.join(
projectRoot,
'app',
'package.json'
))
const commonConfig = require(path.resolve(__dirname, '../app/webpack.common'))
const externals = commonConfig.externals
const oldDependencies = originalPackage.dependencies
const newDependencies: PackageLookup = {}
for (const name of Object.keys(oldDependencies)) {
const spec = oldDependencies[name]
if (externals.indexOf(name) !== -1) {
newDependencies[name] = spec
}
}
const oldDevDependencies = originalPackage.devDependencies
const newDevDependencies: PackageLookup = {}
if (!isPublishableBuild) {
for (const name of Object.keys(oldDevDependencies)) {
const spec = oldDevDependencies[name]
if (externals.indexOf(name) !== -1) {
newDevDependencies[name] = spec
}
}
}
// The product name changes depending on whether it's a prod build or dev
// build, so that we can have them running side by side.
const updatedPackage = Object.assign({}, originalPackage, {
productName: getProductName(),
dependencies: newDependencies,
devDependencies: newDevDependencies,
})
if (isPublishableBuild) {
delete updatedPackage.devDependencies
}
fs.writeFileSync(
path.join(outRoot, 'package.json'),
JSON.stringify(updatedPackage)
)
fs.removeSync(path.resolve(outRoot, 'node_modules'))
if (
Object.keys(newDependencies).length ||
Object.keys(newDevDependencies).length
) {
console.log(' Installing npm dependencies…')
cp.execSync('npm install', { cwd: outRoot, env: process.env })
}
if (!isPublishableBuild) {
console.log(
' Installing 7zip (dependency for electron-devtools-installer)'
)
const sevenZipSource = path.resolve(projectRoot, 'app/node_modules/7zip')
const sevenZipDestination = path.resolve(outRoot, 'node_modules/7zip')
fs.mkdirpSync(sevenZipDestination)
fs.copySync(sevenZipSource, sevenZipDestination)
}
console.log(' Copying git environment…')
const gitDir = path.resolve(outRoot, 'git')
fs.removeSync(gitDir)
fs.mkdirpSync(gitDir)
fs.copySync(path.resolve(projectRoot, 'app/node_modules/dugite/git'), gitDir)
if (process.platform === 'win32') {
console.log(' Cleaning unneeded Git components…')
const files = [
'Bitbucket.Authentication.dll',
'GitHub.Authentication.exe',
'Microsoft.Alm.Authentication.dll',
'Microsoft.Alm.Git.dll',
'Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll',
'Microsoft.IdentityModel.Clients.ActiveDirectory.dll',
'Microsoft.Vsts.Authentication.dll',
'git-askpass.exe',
'git-credential-manager.exe',
]
const gitCoreDir = path.join(gitDir, 'mingw64', 'libexec', 'git-core')
for (const file of files) {
const filePath = path.join(gitCoreDir, file)
try {
fs.unlinkSync(filePath)
} catch (err) {
// probably already cleaned up
}
}
//.........这里部分代码省略.........
示例5:
.then(() => fs.unlinkSync(tempFilePath))
示例6: afterEach
afterEach((done) => {
fs.unlinkSync(path.join(__dirname, '/../../node_modules/@custom'));
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
tmp.teardown('./tmp').then(() => done());
});
示例7:
[autoPep8FileToFormat, autoPep8FileToAutoFormat, yapfFileToFormat, yapfFileToAutoFormat].forEach(file => {
if (fs.existsSync(file)) {
fs.unlinkSync(file);
}
});
示例8:
[autoPep8FileToFormat, autoPep8FileToAutoFormat, yapfFileToFormat, yapfFileToAutoFormat].forEach(file => {
if (fs.existsSync(file)) { fs.unlinkSync(file); }
fs.copySync(originalUnformattedFile, file);
});