本文整理匯總了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);
});