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


TypeScript electron-builder.Platform.WINDOWS类代码示例

本文整理汇总了TypeScript中electron-builder.Platform.WINDOWS的典型用法代码示例。如果您正苦于以下问题:TypeScript Platform.WINDOWS类的具体用法?TypeScript Platform.WINDOWS怎么用?TypeScript Platform.WINDOWS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: appThrows

describe.ifAll("sign", () => {
  const windowsDirTarget = Platform.WINDOWS.createTarget(["dir"])

  test.ifNotWindows("ev", appThrows({
    targets: windowsDirTarget,
    config: {
      win: {
        certificateSubjectName: "ev",
      }
    }
  }))

  test.ifNotWindows("certificateSha1", appThrows({
    targets: windowsDirTarget,
    config: {
      win: {
        certificateSha1: "boo",
      }
    }
  }))

  test.ifNotCiMac("forceCodeSigning", appThrows({
    targets: windowsDirTarget,
    config: {
      forceCodeSigning: true,
    }
  }))

  test.ifNotCiMac("electronDist", appThrows({
    targets: Platform.WINDOWS.createTarget(DIR_TARGET),
    config: {
      electronDist: "foo",
    }
  }))
})
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:35,代码来源:winPackagerTest.ts

示例2: testCustomSign

describe.ifAll("sign", () => {
  const windowsDirTarget = Platform.WINDOWS.createTarget(["dir"])

  function testCustomSign(sign: any) {
    return app({
      targets: Platform.WINDOWS.createTarget(DIR_TARGET),
      platformPackagerFactory: (packager, platform) => new CheckingWinPackager(packager),
      config: {
        win: {
          certificatePassword: "pass",
          certificateFile: "secretFile",
          sign,
          signingHashAlgorithms: ["sha256"],
          // to be sure that sign code will be executed
          forceCodeSigning: true,
        }
      },
    })
  }

  test.ifNotCiMac("certificateFile/password - sign as function", testCustomSign(require("../helpers/customWindowsSign").default))
  test.ifNotCiMac("certificateFile/password - sign as path", testCustomSign(path.join(__dirname, "../helpers/customWindowsSign")))

  test.ifNotCiMac("custom sign if no code sign info", () => {
    let called = false
    return app({
      targets: Platform.WINDOWS.createTarget(DIR_TARGET),
      platformPackagerFactory: (packager, platform) => new CheckingWinPackager(packager),
      config: {
        win: {
          // to be sure that sign code will be executed
          forceCodeSigning: true,
          sign: async () => {
            called = true
          },
        },
      },
    }, {
      packed: async () => {
        expect(called).toBe(true)
      }
    })()
  })

  test.ifNotCiMac("forceCodeSigning", appThrows({
    targets: windowsDirTarget,
    config: {
      forceCodeSigning: true,
    }
  }))

  test.ifNotCiMac("electronDist", appThrows({
    targets: Platform.WINDOWS.createTarget(DIR_TARGET),
    config: {
      electronDist: "foo",
    }
  }))
})
开发者ID:electron-userland,项目名称:electron-builder,代码行数:58,代码来源:winCodeSignTest.ts

示例3: app

test.ifDevOrLinuxCi("win smart unpack", () => {
  // test onNodeModuleFile hook
  const nodeModuleFiles: Array<string> = []
  let p = ""
  return app({
    targets: Platform.WINDOWS.createTarget(DIR_TARGET),
    config: {
      npmRebuild: true,
      onNodeModuleFile: file => {
        const name = path.relative(p, file)
        if (!name.startsWith(".") && !name.endsWith(".dll") && name.includes(".")) {
          nodeModuleFiles.push(name)
        }
      },
    },
  }, {
    projectDirCreated: projectDir => {
      p = projectDir
      return packageJson(it => {
        it.dependencies = {
          debug: "3.1.0",
          "edge-cs": "1.2.1",
          "@electron-builder/test-smart-unpack": "1.0.0",
          "@electron-builder/test-smart-unpack-empty": "1.0.0",
        }
      })(projectDir)
    },
    packed: async context => {
      await verifySmartUnpack(context.getResources(Platform.WINDOWS))
      expect(nodeModuleFiles).toMatchSnapshot()
    }
  })()
})
开发者ID:electron-userland,项目名称:electron-builder,代码行数:33,代码来源:BuildTest.ts

示例4: assertPack

test.ifAll.ifNotCiMac("boring, MUI_HEADER as option", () => {
  let installerHeaderPath: string | null = null
  return assertPack("test-app-one", {
    targets: Platform.WINDOWS.createTarget(["nsis"], Arch.ia32, Arch.x64),
    config: {
      nsis: {
        oneClick: false,
        installerHeader: "foo.bmp"
      }
    },
      effectiveOptionComputed: async (it) => {
        const defines = it[0]
        expect(defines.MUI_HEADERIMAGE).toBeNull()
        expect(defines.MUI_HEADERIMAGE_BITMAP).toEqual(installerHeaderPath)
        expect(defines.MUI_HEADERIMAGE_RIGHT).toBeNull()
        // test that we can build such installer
        return false
      }
    }, {
      projectDirCreated: projectDir => {
        installerHeaderPath = path.join(projectDir, "foo.bmp")
        return copyTestAsset("installerHeader.bmp", installerHeaderPath)
      },
    }
  )
})
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:26,代码来源:installerTest.ts

示例5: assertPack

test.ifAll("detect install-spinner, certificateFile/password", () => {
  let platformPackager: CheckingWinPackager = null
  let loadingGifPath: string = null

  return assertPack("test-app-one", {
    targets: Platform.WINDOWS.createTarget("squirrel"),
    platformPackagerFactory: (packager, platform, cleanupTasks) => platformPackager = new CheckingWinPackager(packager),
    config: {
      win: {
        certificatePassword: "pass",
      }
    }
  }, {
    projectDirCreated: it => {
      loadingGifPath = path.join(it, "build", "install-spinner.gif")
      return BluebirdPromise.all([
        copyTestAsset("install-spinner.gif", loadingGifPath),
        modifyPackageJson(it, data => {
          data.build.win = {
            certificateFile: "secretFile",
            certificatePassword: "mustBeOverridden",
          }
        })])
    },
    packed: async () => {
      expect(platformPackager.effectiveDistOptions.loadingGif).toEqual(loadingGifPath)
      expect(platformPackager.signOptions.cert).toEqual("secretFile")
      expect(platformPackager.signOptions.password).toEqual("pass")
    },
  })
})
开发者ID:djpereira,项目名称:electron-builder,代码行数:31,代码来源:squirrelWindowsTest.ts

示例6: assertPack

test.ifAll("detect install-spinner", () => {
  let platformPackager: CheckingWinPackager | null = null
  let loadingGifPath: string | null = null

  return assertPack("test-app-one", {
    targets: Platform.WINDOWS.createTarget("squirrel"),
    platformPackagerFactory: (packager, platform) => platformPackager = new CheckingWinPackager(packager),
  }, {
    projectDirCreated: it => {
      loadingGifPath = path.join(it, "build", "install-spinner.gif")
      return copyTestAsset("install-spinner.gif", loadingGifPath)
    },
    packed: async () => {
      expect(platformPackager!!.effectiveDistOptions.loadingGif).toEqual(loadingGifPath)
    },
  })
})
开发者ID:electron-userland,项目名称:electron-builder,代码行数:17,代码来源:squirrelWindowsTest.ts

示例7: assertPack

test.ifMac("custom icon", () => {
  let platformPackager: CheckingWinPackager | null = null
  return assertPack("test-app-one", {
    targets: Platform.WINDOWS.createTarget("squirrel"),
    platformPackagerFactory: packager => platformPackager = new CheckingWinPackager(packager),
    config: {
      win: {
        icon: "customIcon",
      },
    },
  }, {
    projectDirCreated: projectDir => rename(path.join(projectDir, "build", "icon.ico"), path.join(projectDir, "customIcon.ico")),
    packed: async context => {
      expect(await platformPackager!!.getIconPath()).toEqual(path.join(context.projectDir, "customIcon.ico"))
    },
  })
})
开发者ID:electron-userland,项目名称:electron-builder,代码行数:17,代码来源:winPackagerTest.ts

示例8: app

 test.ifNotCiMac("custom sign if no code sign info", () => {
   let called = false
   return app({
     targets: Platform.WINDOWS.createTarget(DIR_TARGET),
     platformPackagerFactory: (packager, platform) => new CheckingWinPackager(packager),
     config: {
       win: {
         // to be sure that sign code will be executed
         forceCodeSigning: true,
         sign: async () => {
           called = true
         },
       },
     },
   }, {
     packed: async () => {
       expect(called).toBe(true)
     }
   })()
 })
开发者ID:electron-userland,项目名称:electron-builder,代码行数:20,代码来源:winCodeSignTest.ts

示例9: buildApp

  async function buildApp(version: string) {
    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",
        },
        nsis: {
          differentialPackage: true,
        },
      }
    }, {
      packed: async context => {
        const outDir = context.outDir
        outDirs.push(outDir)
        const targetOutDir = path.join(outDir, "nsis-web")
        const updateInfoFile = path.join(targetOutDir, "latest.yml")

        const updateInfo: UpdateInfo = safeLoad(await readFile(updateInfoFile, "utf-8"))
        const fd = await open(path.join(targetOutDir, `TestApp-${version}-x64.nsis.7z`), "r")
        try {
          const packageInfo = updateInfo.packages!!.x64
          const buffer = Buffer.allocUnsafe(packageInfo.blockMapSize!!)
          await read(fd, buffer, 0, buffer.length, packageInfo.size - buffer.length)
          const inflateRaw: any = BluebirdPromise.promisify(require("zlib").inflateRaw)
          const blockMapData = (await inflateRaw(buffer)).toString()
          await writeFile(path.join(outDir, "win-unpacked", BLOCK_MAP_FILE_NAME), blockMapData)
        }
        finally {
          await close(fd)
        }
      }
    })
  }
开发者ID:jwheare,项目名称:electron-builder,代码行数:41,代码来源:differentialUpdateTest.ts


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