本文整理汇总了TypeScript中bluebird-lst-c.all函数的典型用法代码示例。如果您正苦于以下问题:TypeScript all函数的具体用法?TypeScript all怎么用?TypeScript all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了all函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: buildInstaller
export async function buildInstaller(options: SquirrelOptions, outputDirectory: string, setupExe: string, packager: WinPackager, appOutDir: string) {
const appUpdate = await packager.getTempFile("Update.exe")
await BluebirdPromise.all([
copy(path.join(options.vendorPath, "Update.exe"), appUpdate)
.then(() => packager.sign(appUpdate)),
BluebirdPromise.all([remove(`${outputDirectory.replace(/\\/g, "/")}/*-full.nupkg`), remove(path.join(outputDirectory, "RELEASES"))])
.then(() => ensureDir(outputDirectory))
])
if (options.remoteReleases) {
await syncReleases(outputDirectory, options)
}
const embeddedArchiveFile = await packager.getTempFile("setup.zip")
const embeddedArchive = archiver("zip", {zlib: {level: options.packageCompressionLevel == null ? 6 : options.packageCompressionLevel}})
const embeddedArchiveOut = createWriteStream(embeddedArchiveFile)
const embeddedArchivePromise = new BluebirdPromise(function (resolve, reject) {
embeddedArchive.on("error", reject)
embeddedArchiveOut.on("close", resolve)
})
embeddedArchive.pipe(embeddedArchiveOut)
embeddedArchive.file(appUpdate, {name: "Update.exe"})
embeddedArchive.file(options.loadingGif ? path.resolve(options.loadingGif) : path.join(__dirname, "..", "..", "templates", "install-spinner.gif"), {name: "background.gif"})
const version = convertVersion(options.version)
const packageName = `${options.name}-${version}-full.nupkg`
const nupkgPath = path.join(outputDirectory, packageName)
const setupPath = path.join(outputDirectory, setupExe || `${options.name || options.productName}Setup.exe`)
await BluebirdPromise.all<any>([
pack(options, appOutDir, appUpdate, nupkgPath, version, options.packageCompressionLevel),
copy(path.join(options.vendorPath, "Setup.exe"), setupPath),
])
embeddedArchive.file(nupkgPath, {name: packageName})
const releaseEntry = await releasify(options, nupkgPath, outputDirectory, packageName)
embeddedArchive.append(releaseEntry, {name: "RELEASES"})
embeddedArchive.finalize()
await embeddedArchivePromise
const writeZipToSetup = path.join(options.vendorPath, "WriteZipToSetup.exe")
await execWine(writeZipToSetup, [setupPath, embeddedArchiveFile])
await packager.signAndEditResources(setupPath)
if (options.msi && process.platform === "win32") {
const outFile = setupExe.replace(".exe", ".msi")
await msi(options, nupkgPath, setupPath, outputDirectory, outFile)
// rcedit can only edit .exe resources
await packager.sign(path.join(outputDirectory, outFile))
}
}
示例2: assertThat
packed: context => {
const resources = path.join(context.getResources(Platform.LINUX))
return BluebirdPromise.all([
assertThat(path.join(resources, "app", "foo", "old")).doesNotExist(),
assertThat(path.join(resources, "foo", "new")).isFile(),
])
},
示例3: outputFile
projectDirCreated: projectDir => BluebirdPromise.all([
outputFile(path.join(projectDir, ".svn", "foo"), "data"),
outputFile(path.join(projectDir, ".git", "foo"), "data"),
outputFile(path.join(projectDir, "foo", "bar", "f.o"), "data"),
outputFile(path.join(projectDir, "node_modules", ".bin", "f.txt"), "data"),
outputFile(path.join(projectDir, "node_modules", ".bin2", "f.txt"), "data"),
]),
示例4: modifyPackageJson
projectDirCreated: projectDir => {
return BluebirdPromise.all([
modifyPackageJson(projectDir, data => {
data.build.extraResources = [
"foo",
"bar/hello.txt",
"bar/${arch}.txt",
"${os}/${arch}.txt",
]
data.build[osName] = {
extraResources: [
"platformSpecificR"
],
extraFiles: [
"platformSpecificF"
],
}
}),
outputFile(path.join(projectDir, "foo/nameWithoutDot"), "nameWithoutDot"),
outputFile(path.join(projectDir, "bar/hello.txt"), "data"),
outputFile(path.join(projectDir, `bar/${process.arch}.txt`), "data"),
outputFile(path.join(projectDir, `${osName}/${process.arch}.txt`), "data"),
outputFile(path.join(projectDir, "platformSpecificR"), "platformSpecificR"),
outputFile(path.join(projectDir, "ignoreMe.txt"), "ignoreMe"),
])
},
示例5: prepareWine
async prepareWine(wineDir: string) {
await emptyDir(wineDir)
//noinspection SpellCheckingInspection
const env = Object.assign({}, process.env, {
WINEDLLOVERRIDES: "winemenubuilder.exe=d",
WINEPREFIX: wineDir
})
await exec("wineboot", ["--init"], {env: env})
// regedit often doesn't modify correctly
let systemReg = await readFile(path.join(wineDir, "system.reg"), "utf8")
systemReg = systemReg.replace('"CSDVersion"="Service Pack 3"', '"CSDVersion"=" "')
systemReg = systemReg.replace('"CurrentBuildNumber"="2600"', '"CurrentBuildNumber"="10240"')
systemReg = systemReg.replace('"CurrentVersion"="5.1"', '"CurrentVersion"="10.0"')
systemReg = systemReg.replace('"ProductName"="Microsoft Windows XP"', '"ProductName"="Microsoft Windows 10"')
systemReg = systemReg.replace('"CSDVersion"=dword:00000300', '"CSDVersion"=dword:00000000')
await writeFile(path.join(wineDir, "system.reg"), systemReg)
// remove links to host OS
const desktopDir = path.join(this.userDir, "Desktop")
await BluebirdPromise.all([
unlinkIfExists(desktopDir),
unlinkIfExists(path.join(this.userDir, "My Documents")),
unlinkIfExists(path.join(this.userDir, "My Music")),
unlinkIfExists(path.join(this.userDir, "My Pictures")),
unlinkIfExists(path.join(this.userDir, "My Videos")),
])
await ensureDir(desktopDir)
return env
}
示例6: deleteOldElectronVersion
async function deleteOldElectronVersion(): Promise<any> {
if (!process.env.CI) {
return
}
const cacheDir = path.join(homedir(), ".electron")
try {
const deletePromises: Array<Promise<any>> = []
for (let file of (await readdir(cacheDir))) {
if (file.endsWith(".zip") && !file.includes(ELECTRON_VERSION)) {
console.log(`Remove old electron ${file}`)
deletePromises.push(unlink(path.join(cacheDir, file)))
}
}
return await BluebirdPromise.all(deletePromises)
}
catch (e) {
if (e.code === "ENOENT") {
return []
}
else {
throw e
}
}
}
示例7: assertThat
packed: async context => {
const base = path.join(context.outDir, platform.buildConfigurationKey + `${platform === Platform.MAC ? "" : "-unpacked"}`)
let resourcesDir = path.join(base, "resources")
if (platform === Platform.MAC) {
resourcesDir = path.join(base, "TestApp.app", "Contents", "Resources")
}
const appDir = path.join(resourcesDir, "app")
await BluebirdPromise.all([
assertThat(path.join(resourcesDir, "foo")).isDirectory(),
assertThat(path.join(appDir, "foo")).doesNotExist(),
assertThat(path.join(resourcesDir, "foo", "nameWithoutDot")).isFile(),
assertThat(path.join(appDir, "foo", "nameWithoutDot")).doesNotExist(),
assertThat(path.join(resourcesDir, "bar", "hello.txt")).isFile(),
assertThat(path.join(resourcesDir, "bar", `${process.arch}.txt`)).isFile(),
assertThat(path.join(appDir, "bar", `${process.arch}.txt`)).doesNotExist(),
assertThat(path.join(resourcesDir, osName, `${process.arch}.txt`)).isFile(),
assertThat(path.join(resourcesDir, "platformSpecificR")).isFile(),
assertThat(path.join(resourcesDir, "ignoreMe.txt")).doesNotExist(),
allCan(path.join(resourcesDir, "executable"), true),
allCan(path.join(resourcesDir, "executableOnlyOwner"), true),
allCan(path.join(resourcesDir, "bar", "hello.txt"), false),
])
expect(await readFile(path.join(resourcesDir, "bar", "hello.txt"), "utf-8")).toEqual("data")
},
示例8: assertDirs
function assertDirs(context: PackedContext) {
return BluebirdPromise.all([
assertThat(path.join(context.getResources(Platform.LINUX), "app.asar.unpacked", "assets")).isDirectory(),
assertThat(path.join(context.getResources(Platform.LINUX), "app.asar.unpacked", "b2")).isDirectory(),
assertThat(path.join(context.getResources(Platform.LINUX), "app.asar.unpacked", "do-not-unpack-dir", "file.json")).isFile(),
assertThat(path.join(context.getResources(Platform.LINUX), "app.asar.unpacked", "do-not-unpack-dir", "must-be-not-unpacked")).doesNotExist(),
assertThat(path.join(context.getResources(Platform.LINUX), "app.asar.unpacked", "do-not-unpack-dir", "dir-2")).doesNotExist(),
])
}
示例9: modifyPackageJson
projectDirCreated: projectDir => {
return BluebirdPromise.all([
modifyPackageJson(projectDir, data => {
data.main = "path/app.asar/index.js"
}, true),
modifyPackageJson(projectDir, data => {
data.build.asar = false
})
])
}