本文整理匯總了TypeScript中fs-extra-p.move函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript move函數的具體用法?TypeScript move怎麽用?TypeScript move使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了move函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: async
test.ifAll.ifDevOrWinCi("web installer", async () => {
let outDirs: Array<string> = []
async function buildApp(version: string, tmpDir: TmpDir) {
await assertPack("test-app-one", {
targets: Platform.WINDOWS.createTarget(["nsis-web"], Arch.x64),
config: {
extraMetadata: {
version,
},
// package in any case compressed, customization is explicitly disabled - "do not allow to change compression level to avoid different packages"
compression: process.env.COMPRESSION as any || "store",
publish: {
provider: "s3",
bucket: "develar",
path: "test",
},
},
}, {
signedWin: true,
packed: async context => {
outDirs.push(context.outDir)
},
tmpDir,
})
}
if (process.env.__SKIP_BUILD == null) {
const tmpDir = new TmpDir("differential-updater-test")
try {
await buildApp(OLD_VERSION_NUMBER, tmpDir)
// move dist temporarily out of project dir
const oldDir = await tmpDir.getTempDir()
await move(outDirs[0], oldDir)
outDirs[0] = oldDir
await buildApp("1.0.1", tmpDir)
}
catch (e) {
await tmpDir.cleanup()
throw e
}
// move old dist to new project as oldDist - simplify development (no need to guess where old dist located in the temp fs)
const oldDir = path.join(outDirs[1], "..", "oldDist")
await move(outDirs[0], oldDir)
outDirs[0] = oldDir
await move(path.join(oldDir, "nsis-web", `TestApp-${OLD_VERSION_NUMBER}-x64.nsis.7z`), path.join(getTestUpdaterCacheDir(oldDir), testAppCacheDirName, "package.7z"))
}
else {
nsisWebDifferentialUpdateTestFakeSnapshot()
outDirs = [
path.join(process.env.TEST_APP_TMP_DIR!!, "oldDist"),
path.join(process.env.TEST_APP_TMP_DIR!!, "dist"),
]
}
await testBlockMap(outDirs[0], path.join(outDirs[1], "nsis-web"), NsisUpdater, "win-unpacked", Platform.WINDOWS)
})
示例2: pack
async pack(outDir: string, arch: string, postAsyncTasks: Array<Promise<any>>): Promise<any> {
if (arch === "ia32") {
warn("For windows consider only distributing 64-bit, see https://github.com/electron-userland/electron-builder/issues/359#issuecomment-214851130")
}
// we must check icon before pack because electron-packager uses icon and it leads to cryptic error message "spawn wine ENOENT"
await this.iconPath
let appOutDir = this.computeAppOutDir(outDir, arch)
const packOptions = this.computePackOptions(outDir, arch)
if (!this.options.dist) {
await this.doPack(packOptions, outDir, appOutDir, arch, this.customBuildOptions)
return
}
const unpackedDir = path.join(outDir, `win${arch === "x64" ? "" : `-${arch}`}-unpacked`)
const finalAppOut = path.join(unpackedDir, "lib", "net45")
const installerOut = computeDistOut(outDir, arch)
log("Removing %s and %s", path.relative(this.projectDir, installerOut), path.relative(this.projectDir, unpackedDir))
await BluebirdPromise.all([
this.packApp(packOptions, appOutDir),
emptyDir(installerOut),
emptyDir(unpackedDir)
])
await move(appOutDir, finalAppOut)
appOutDir = finalAppOut
await this.copyExtraResources(appOutDir, arch, this.customBuildOptions)
if (this.options.dist) {
postAsyncTasks.push(this.packageInDistributableFormat(outDir, appOutDir, arch, packOptions))
}
}
示例3: modifyPackageJson
tempDirCreated: projectDir => BluebirdPromise.all([
modifyPackageJson(projectDir, data => {
data.directories = {
buildResources: "custom"
}
}),
move(path.join(projectDir, "build"), path.join(projectDir, "custom"))
])
示例4: move
tempDirCreated: projectDir => BluebirdPromise.all([
move(path.join(projectDir, "build", "icon.ico"), path.join(projectDir, "customIcon.ico")),
modifyPackageJson(projectDir, data => {
data.build.win = {
icon: "customIcon"
}
})
]),
示例5: move
tempDirCreated: projectDir => BluebirdPromise.all([
move(path.join(projectDir, "build", "background.png"), path.join(projectDir, customBackground)),
modifyPackageJson(projectDir, data => {
data.build.osx = {
background: customBackground,
icon: "foo.icns",
}
})
]),
示例6: assertPack
await assertPack("test-app-one", allPlatformsAndCurrentArch(), true, (projectDir) => {
return BluebirdPromise.all([
modifyPackageJson(projectDir, data => {
data.directories = {
buildResources: "custom"
}
}),
move(path.join(projectDir, "build"), path.join(projectDir, "custom"))
])
})
示例7: move
tempDirCreated: projectDir => {
return BluebirdPromise.all([
move(path.join(projectDir, "app", "index.js"), path.join(projectDir, "app", "main.js")),
modifyPackageJson(projectDir, data => {
data.main = "main.js"
}, true),
modifyPackageJson(projectDir, data => {
data.build.asar = false
})
])
}
示例8: doBuild
async function doBuild(outDirs: Array<string>, targets: Map<Platform, Map<Arch, Array<string>>>, tmpDir: TmpDir, extraConfig?: Configuration | null) {
await buildApp("1.0.0", outDirs, targets, tmpDir, extraConfig)
try {
// move dist temporarily out of project dir
const oldDir = await tmpDir.getTempDir()
await move(outDirs[0], oldDir)
outDirs[0] = oldDir
await buildApp("1.0.1", outDirs, targets, tmpDir, extraConfig)
}
catch (e) {
await tmpDir.cleanup()
throw e
}
// move old dist to new project as oldDist - simplify development (no need to guess where old dist located in the temp fs)
const oldDir = path.join(outDirs[1], "..", "oldDist")
await move(outDirs[0], oldDir)
outDirs[0] = oldDir
}
示例9: async
}, true, async (projectDir) => {
const file = path.join(projectDir, "package.json")
const data = await readJson(file)
data.directories = {
buildResources: "custom"
}
return await BluebirdPromise.all([
writeJson(file, data),
move(path.join(projectDir, "build"), path.join(projectDir, "custom"))
])
})