• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

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

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: assertPack

test.ifMac("no Applications link", () => {
  return assertPack("test-app-one", {
    targets: Platform.MAC.createTarget(),
    config: {
      publish: null,
      productName: "NoApplicationsLink",
      dmg: {
        contents: [
          {
            x: 110,
            y: 150
          },
          {
            x: 410,
            y: 440,
            type: "link",
            path: "/Applications/TextEdit.app"
          }
        ],
      },
    },
    effectiveOptionComputed: async it => {
      const volumePath = it.volumePath
      await BluebirdPromise.all([
        assertThat(path.join(volumePath, ".background", "background.tiff")).isFile(),
        assertThat(path.join(volumePath, "Applications")).doesNotExist(),
        assertThat(path.join(volumePath, "TextEdit.app")).isSymbolicLink(),
        assertThat(path.join(volumePath, "TextEdit.app")).isDirectory(),
      ])
      expect(it.specification.contents).toMatchSnapshot()
      return false
    },
  })
})
开发者ID:jwheare,项目名称:electron-builder,代码行数:34,代码来源:dmgTest.ts


示例2: createMacTargetTest

export function createMacTargetTest(target: Array<MacOsTargetName>, config?: Configuration, isSigned = true) {
  return app({
    targets: Platform.MAC.createTarget(),
    config: {
      extraMetadata: {
        repository: "foo/bar",
      } as any,
      mac: {
        target,
      },
      publish: null,
      ...config
    },
  }, {
    signed: isSigned,
    packed: async context => {
      if (!target.includes("tar.gz")) {
        return
      }

      const tempDir = await context.tmpDir.createTempDir({prefix: "mac-target-test"})
      await exec("tar", ["xf", path.join(context.outDir, "Test App ßW-1.1.0-mac.tar.gz")], {cwd: tempDir})
      await assertThat(path.join(tempDir, "Test App ßW.app")).isDirectory()
    }
  })
}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:26,代码来源:packTester.ts


示例3: assertPack

test.ifMac("custom background - new way", () => {
  const customBackground = "customBackground.png"
  return assertPack("test-app-one", {
    targets: Platform.MAC.createTarget(),
    config: {
      publish: null,
      mac: {
        icon: "customIcon",
      },
      dmg: {
        background: customBackground,
        icon: "foo.icns",
      },
    },
    effectiveOptionComputed: async it => {
      expect(it.specification.background).toMatch(new RegExp(`.+${customBackground}$`))
      expect(it.specification.icon).toEqual("foo.icns")
      const packager: PlatformPackager<any> = it.packager
      expect(await packager.getIconPath()).toEqual(path.join(packager.projectDir, "build", "customIcon.icns"))
      return true
    },
  }, {
    projectDirCreated: projectDir => Promise.all([
      copyFile(path.join(getDmgTemplatePath(), "background.tiff"), path.join(projectDir, customBackground)),
      // copy, but not rename to test that default icon is not used
      copyFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "build", "customIcon.icns")),
      copyFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "foo.icns")),
    ]),
  })
})
开发者ID:electron-userland,项目名称:electron-builder,代码行数:30,代码来源:dmgTest.ts


示例4: createMacTargetTest

export function createMacTargetTest(target: Array<MacOsTargetName>) {
  return app({
    targets: Platform.MAC.createTarget(),
    config: {
      extraMetadata: {
        repository: "foo/bar",
      } as any,
      mac: {
        target,
      }
    }
  }, {
    signed: target.includes("mas") || target.includes("pkg") || target.includes("mas-dev"),
    packed: async context => {
      if (!target.includes("tar.gz")) {
        return
      }

      const tempDir = path.join(context.outDir, getTempName())
      await mkdir(tempDir)
      await exec("tar", ["xf", path.join(context.outDir, "Test App ßW-1.1.0-mac.tar.gz")], {cwd: tempDir})
      await assertThat(path.join(tempDir, "Test App ßW.app")).isDirectory()
    }
  })
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:25,代码来源:packTester.ts


示例5: app

test.ifMac.ifAll("png icon small", () => {
  let platformPackager: CheckingMacPackager | null = null
  return app({
    targets: Platform.MAC.createTarget(DIR_TARGET),
    config: {
      mac: {
        icon: "icons/128x128.png",
      },
    },
    platformPackagerFactory: packager => platformPackager = new CheckingMacPackager(packager)
  }, {
    projectDirCreated: projectDir => Promise.all([
      unlink(path.join(projectDir, "build", "icon.icns")),
      unlink(path.join(projectDir, "build", "icon.ico")),
    ]),
    packed: async () => {
      try {
        await platformPackager!!.getIconPath()
      }
      catch (e) {
        if (!e.message.includes("must be at least 512x512")) {
          throw e
        }
        return
      }

      throw new Error("error expected")
    },
  })()
})
开发者ID:electron-userland,项目名称:electron-builder,代码行数:30,代码来源:macIconTest.ts


示例6: async

test.skip("dmg", async () => {
  const outDirs: Array<string> = []
  const tmpDir = new TmpDir("differential-updater-test")
  if (process.env.__SKIP_BUILD == null) {
    await doBuild(outDirs, Platform.MAC.createTarget(), tmpDir, {
      mac: {
        electronUpdaterCompatibility: ">=2.17.0",
      },
    })
  }
  else {
    // todo
  }

  await testBlockMap(outDirs[0], path.join(outDirs[1]), MacUpdater, "mac/Test App ßW.app", Platform.MAC)
})
开发者ID:electron-userland,项目名称:electron-builder,代码行数:16,代码来源:differentialUpdateTest.ts


示例7: async

test.ifAll.ifMac.ifNotCi("dmg", async () => {
  process.env.TEST_UPDATER_PLATFORM = "darwin"

  const outDirs: Array<string> = []
  if (process.env.__SKIP_BUILD == null) {
    await doBuild(outDirs, Platform.MAC.createTarget(), {
      mac: {
        electronUpdaterCompatibility: ">=2.17.0",
      },
    })
  }
  else {
    // todo
  }

  await testBlockMap(outDirs[0], path.join(outDirs[1]), MacUpdater)
})
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:17,代码来源:differentialUpdateTest.ts


示例8: assertPack

test.ifAll("entitlements in build dir", () => {
  let platformPackager: CheckingMacPackager = null
  return assertPack("test-app-one", signed({
    targets: Platform.MAC.createTarget(),
    platformPackagerFactory: (packager, platform) => platformPackager = new CheckingMacPackager(packager),
  }), {
    projectDirCreated: projectDir => BluebirdPromise.all([
      writeFile(path.join(projectDir, "build", "entitlements.mac.plist"), ""),
      writeFile(path.join(projectDir, "build", "entitlements.mac.inherit.plist"), ""),
    ]),
    packed: context => {
      expect(platformPackager.effectiveSignOptions).toMatchObject({
        entitlements: path.join(context.projectDir, "build", "entitlements.mac.plist"),
        "entitlements-inherit": path.join(context.projectDir, "build", "entitlements.mac.inherit.plist"),
      })
      return BluebirdPromise.resolve()
    }
  })
})
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:19,代码来源:masTest.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript electron-builder.Platform.WINDOWS类代码示例发布时间:2022-05-25
下一篇:
TypeScript electron-builder.Platform.LINUX类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap