当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Platform.fromNodePlatform方法代码示例

本文整理汇总了TypeScript中out.Platform.fromNodePlatform方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Platform.fromNodePlatform方法的具体用法?TypeScript Platform.fromNodePlatform怎么用?TypeScript Platform.fromNodePlatform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在out.Platform的用法示例。


在下文中一共展示了Platform.fromNodePlatform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: 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

示例2: 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


注:本文中的out.Platform.fromNodePlatform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。