本文整理汇总了TypeScript中out.Platform类的典型用法代码示例。如果您正苦于以下问题:TypeScript Platform类的具体用法?TypeScript Platform怎么用?TypeScript Platform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Platform类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test("www as default dir", () => assertPack("test-app", {
platform: [Platform.fromString(process.platform)],
}, {
tempDirCreated: projectDir => BluebirdPromise.all([
move(path.join(projectDir, "app"), path.join(projectDir, "www"))
])
}))
示例2: test
test("version from electron-prebuilt dependency", () => assertPack("test-app-one", {
platform: [Platform.fromString(process.platform)],
dist: false
}, {
tempDirCreated: projectDir => BluebirdPromise.all([
outputJson(path.join(projectDir, "node_modules", "electron-prebuilt", "package.json"), {
version: "0.37.8"
}),
modifyPackageJson(projectDir, data => {
data.devDependencies = {}
})
])
}))
示例3: getPossiblePlatforms
export function getPossiblePlatforms(type?: string): Map<Platform, Map<Arch, string[]>> {
const platforms = [Platform.fromString(process.platform)]
if (process.platform === Platform.OSX.nodeName) {
if (process.env.LINUX_SKIP == null) {
platforms.push(Platform.LINUX)
}
if (process.env.CI == null) {
platforms.push(Platform.WINDOWS)
}
}
else if (process.platform === Platform.LINUX.nodeName && process.env.SKIP_WIN == null) {
platforms.push(Platform.WINDOWS)
}
return createTargets(platforms, type)
}
示例4: test
test("copy extra resource", async () => {
const platform = process.platform
const osName = Platform.fromNodePlatform(platform).buildConfigurationKey
await assertPack("test-app", {
platform: [platform],
arch: process.arch,
dist: false
}, true, (projectDir) => {
return BluebirdPromise.all([
modifyPackageJson(projectDir, data => {
if (data.build == null) {
data.build = {}
}
data.build.extraResources = [
"foo",
"bar/hello.txt",
"bar/${arch}.txt",
"${os}/${arch}.txt",
]
data.build[osName] = {
extraResources: [
"platformSpecific"
]
}
}),
mkdirs(path.join(projectDir, "foo")),
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, "platformSpecific"), "platformSpecific"),
outputFile(path.join(projectDir, "ignoreMe.txt"), "ignoreMe"),
])
}, async (projectDir) => {
let resourcesDir = path.join(projectDir, "dist", "TestApp-" + platform + "-" + process.arch)
if (platform === "darwin") {
resourcesDir = path.join(resourcesDir, "TestApp.app", "Contents", "Resources")
}
await assertThat(path.join(resourcesDir, "foo")).isDirectory()
await assertThat(path.join(resourcesDir, "bar/hello.txt")).isFile()
await assertThat(path.join(resourcesDir, `bar/${process.arch}.txt`)).isFile()
await assertThat(path.join(resourcesDir, `${osName}/${process.arch}.txt`)).isFile()
await assertThat(path.join(resourcesDir, "platformSpecific")).isFile()
await assertThat(path.join(resourcesDir, "ignoreMe.txt")).doesNotExist()
})
})
示例5: platform
export function platform(platform: Platform): PackagerOptions {
return {
targets: platform.createTarget()
}
}
示例6: test
test("copy extra resource", async () => {
for (let platform of getPossiblePlatforms()) {
const osName = Platform.fromNodePlatform(platform).buildConfigurationKey
//noinspection SpellCheckingInspection
await assertPack("test-app", {
platform: [platform],
// to check NuGet package
dist: platform === "win32"
}, {
tempDirCreated: (projectDir) => {
return BluebirdPromise.all([
modifyPackageJson(projectDir, data => {
if (data.build == null) {
data.build = {}
}
data.build.extraResources = [
"foo",
"bar/hello.txt",
"bar/${arch}.txt",
"${os}/${arch}.txt",
]
data.build[osName] = {
extraResources: [
"platformSpecific"
]
}
}),
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, "platformSpecific"), "platformSpecific"),
outputFile(path.join(projectDir, "ignoreMe.txt"), "ignoreMe"),
])
},
packed: async(projectDir) => {
let resourcesDir = path.join(projectDir, "dist", "TestApp-" + platform + "-" + process.arch)
if (platform === "darwin") {
resourcesDir = path.join(resourcesDir, "TestApp.app", "Contents", "Resources")
}
await assertThat(path.join(resourcesDir, "foo")).isDirectory()
await assertThat(path.join(resourcesDir, "foo", "nameWithoutDot")).isFile()
await assertThat(path.join(resourcesDir, "bar", "hello.txt")).isFile()
await assertThat(path.join(resourcesDir, "bar", `${process.arch}.txt`)).isFile()
await assertThat(path.join(resourcesDir, osName, `${process.arch}.txt`)).isFile()
await assertThat(path.join(resourcesDir, "platformSpecific")).isFile()
await assertThat(path.join(resourcesDir, "ignoreMe.txt")).doesNotExist()
},
expectedContents: platform === "win32" ? [
"lib/net45/content_resources_200_percent.pak",
"lib/net45/content_shell.pak",
"lib/net45/d3dcompiler_47.dll",
"lib/net45/ffmpeg.dll",
"lib/net45/icudtl.dat",
"lib/net45/libEGL.dll",
"lib/net45/libGLESv2.dll",
"lib/net45/LICENSE",
"lib/net45/msvcp120.dll",
"lib/net45/msvcr120.dll",
"lib/net45/natives_blob.bin",
"lib/net45/node.dll",
"lib/net45/platformSpecific",
"lib/net45/snapshot_blob.bin",
"lib/net45/squirrel.exe",
"lib/net45/TestApp.exe",
"lib/net45/ui_resources_200_percent.pak",
"lib/net45/vccorlib120.dll",
"lib/net45/xinput1_3.dll",
"lib/net45/bar/hello.txt",
"lib/net45/bar/x64.txt",
"lib/net45/foo/nameWithoutDot",
"lib/net45/locales/en-US.pak",
"lib/net45/resources/app.asar",
"lib/net45/resources/atom.asar",
"lib/net45/win/x64.txt",
"TestApp.nuspec",
"[Content_Types].xml",
"_rels/.rels"
] : null,
})
}
})
示例7: currentPlatform
export function currentPlatform(dist: boolean = true): PackagerOptions {
return {
targets: Platform.fromString(process.platform).createTarget(dist ? null : DIR_TARGET),
}
}