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


TypeScript electron-builder.Platform.MAC類代碼示例

本文整理匯總了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;未經允許,請勿轉載。