當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript out.Platform類代碼示例

本文整理匯總了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"))
  ])
}))
開發者ID:nickhudkins,項目名稱:electron-builder,代碼行數:7,代碼來源:BuildTest.ts

示例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 = {}
    })
  ])
}))
開發者ID:MatthijsvandenBosch,項目名稱:electron-builder,代碼行數:13,代碼來源:BuildTest.ts

示例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)
}
開發者ID:silenio,項目名稱:electron-builder,代碼行數:15,代碼來源:packTester.ts

示例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()
  })
})
開發者ID:EvgeneOskin,項目名稱:electron-builder,代碼行數:47,代碼來源:BuildTest.ts

示例5: platform

export function platform(platform: Platform): PackagerOptions {
  return {
    targets: platform.createTarget()
  }
}
開發者ID:lcpo,項目名稱:electron-builder,代碼行數:5,代碼來源:packTester.ts

示例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,
    })
  }
})
開發者ID:dennyferra,項目名稱:electron-builder,代碼行數:84,代碼來源:BuildTest.ts

示例7: currentPlatform

export function currentPlatform(dist: boolean = true): PackagerOptions {
  return {
    targets: Platform.fromString(process.platform).createTarget(dist ? null : DIR_TARGET),
  }
}
開發者ID:silenio,項目名稱:electron-builder,代碼行數:5,代碼來源:packTester.ts


注:本文中的out.Platform類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。