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


TypeScript Platform.LINUX.createTarget方法代碼示例

本文整理匯總了TypeScript中electron-builder.Platform.LINUX.createTarget方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Platform.LINUX.createTarget方法的具體用法?TypeScript Platform.LINUX.createTarget怎麽用?TypeScript Platform.LINUX.createTarget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在electron-builder.Platform.LINUX的用法示例。


在下文中一共展示了Platform.LINUX.createTarget方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: async

test.ifAll.ifDevOrLinuxCi("default stagePackages", async () => {
  for (const p of [["default"], ["default", "custom"], ["custom", "default"], ["foo1", "default", "foo2"]]) {
    await assertPack("test-app-one", {
      targets: Platform.LINUX.createTarget("snap"),
      config: {
        extraMetadata: {
          name: "sep",
        },
        productName: "Sep",
        snap: {
          stagePackages: p,
          plugs: p,
          confinement: "classic",
          // otherwise "parts" will be removed
          useTemplateApp: false,
        }
      },
      effectiveOptionComputed: async ({snap}) => {
        delete snap.parts.app.source
        expect(snap).toMatchSnapshot()
        return true
      },
    })
  }
})
開發者ID:electron-userland,項目名稱:electron-builder,代碼行數:25,代碼來源:snapTest.ts

示例2: createExtraMetadataTest

function createExtraMetadataTest(asar: boolean) {
  return app({
    targets: Platform.LINUX.createTarget(DIR_TARGET),
    extraMetadata: {
      foo: {
        bar: 12,
      },
      build: {
        asar: asar,
        linux: {
          executableName: "new-name",
        },
      }
    },
  }, {
    projectDirCreated: projectDir => modifyPackageJson(projectDir, data => {
      data.scripts = {}
      data.devDependencies = {"foo": "boo"}
      data.foo = {
        bar: 42,
        existingProp: 22,
      }
    }),
    packed: async context => {
      await assertThat(path.join(context.getContent(Platform.LINUX), "new-name")).isFile()
      if (asar) {
        expect(await readAsarJson(path.join(context.getResources(Platform.LINUX), "app.asar"), "package.json")).toMatchSnapshot()
      }
      else {
        expect(await readJson(path.join(context.getResources(Platform.LINUX), "app", "package.json"))).toMatchSnapshot()
      }
    }
  })
}
開發者ID:djpereira,項目名稱:electron-builder,代碼行數:34,代碼來源:extraMetadataTest.ts

示例3: testLinux

async function testLinux(arch: Arch) {
  process.env.TEST_UPDATER_PLATFORM = "linux"
  process.env.TEST_UPDATER_ARCH = Arch[arch]

  const outDirs: Array<string> = []
  await doBuild(outDirs, Platform.LINUX.createTarget(["appimage"], arch))

  process.env.APPIMAGE = path.join(outDirs[0], `TestApp-1.0.0-${arch === Arch.x64 ? "x86_64" : "i386"}.AppImage`)
  await testBlockMap(outDirs[0], path.join(outDirs[1]), AppImageUpdater)
}
開發者ID:ledinhphuong,項目名稱:electron-builder,代碼行數:10,代碼來源:differentialUpdateTest.ts

示例4: assertPack

test.ifDevOrLinuxCi("unpackDir", () => {
  return assertPack("test-app", {
    targets: Platform.LINUX.createTarget(DIR_TARGET),
    config: {
      asarUnpack: ["assets", "b2", "do-not-unpack-dir/file.json"],
    }
  }, {
    projectDirCreated: projectDir => createFiles(path.join(projectDir, "app")),
    packed: assertDirs,
  })
})
開發者ID:yuya-oc,項目名稱:electron-builder,代碼行數:11,代碼來源:globTest.ts

示例5: rename

  packed: async context => {
    // test https://github.com/electron-userland/electron-builder/issues/1102
    const projectDir = context.getResources(Platform.LINUX)

    await rename(path.join(projectDir, "electron.asar"), path.join(projectDir, "someAsarFile.asar"))

    await build({
      targets: Platform.LINUX.createTarget(),
      projectDir: projectDir,
    })

    await assertThat(path.join(projectDir, "dist")).isDirectory()
    await assertThat(path.join(projectDir, "dist", "linux-unpacked", "resources", "someAsarFile.asar")).isFile()
  },
開發者ID:mbrainiac,項目名稱:electron-builder,代碼行數:14,代碼來源:linuxPackagerTest.ts

示例6: testLinux

async function testLinux(arch: Arch) {
  process.env.TEST_UPDATER_ARCH = Arch[arch]

  const outDirs: Array<string> = []
  const tmpDir = new TmpDir("differential-updater-test")
  try {
    await doBuild(outDirs, Platform.LINUX.createTarget(["appimage"], arch), tmpDir)

    process.env.APPIMAGE = path.join(outDirs[0], `TestApp-1.0.0-${arch === Arch.x64 ? "x86_64" : "i386"}.AppImage`)
    await testBlockMap(outDirs[0], path.join(outDirs[1]), AppImageUpdater, `__appImage-${Arch[arch]}`, Platform.LINUX)
  }
  finally {
    await tmpDir.cleanup()
  }
}
開發者ID:electron-userland,項目名稱:electron-builder,代碼行數:15,代碼來源:differentialUpdateTest.ts

示例7: rename

  packed: async context => {
    const projectDir = context.getResources(Platform.LINUX)

    await rename(path.join(projectDir, "electron.asar"), path.join(projectDir, "someAsarFile.asar"))

    await build({
      targets: Platform.LINUX.createTarget(),
      projectDir,
      publish: "never",
      config: {
        electronVersion: ELECTRON_VERSION,
        compression: "store",
        npmRebuild: false,
      }
    })

    await assertThat(path.join(projectDir, "dist")).isDirectory()
    await assertThat(path.join(projectDir, "dist", "linux-unpacked", "resources", "someAsarFile.asar")).isFile()
  },
開發者ID:yuya-oc,項目名稱:electron-builder,代碼行數:19,代碼來源:linuxPackagerTest.ts

示例8: assertPack

test.ifDevOrLinuxCi("asarUnpack and files ignore", () => {
  return assertPack("test-app", {
    targets: Platform.LINUX.createTarget(DIR_TARGET),
    config: {
      asarUnpack: [
        "!**/ffprobe-static/bin/darwin/x64/ffprobe"
      ],
    }
  }, {
    projectDirCreated: projectDir => outputFile(path.join(projectDir, "node_modules/ffprobe-static/bin/darwin/x64/ffprobe"), "data"),
    packed: async context => {
      const resourceDir = context.getResources(Platform.LINUX)
      await Promise.all([
        assertThat(path.join(resourceDir, "app.asar.unpacked", "node_modules/ffprobe-static/bin/darwin/x64/ffprobe")).doesNotExist(),
      ])

      await verifyAsarFileTree(context.getResources(Platform.LINUX))
    },
  })
})
開發者ID:electron-userland,項目名稱:electron-builder,代碼行數:20,代碼來源:globTest.ts

示例9: createExtraMetadataTest

function createExtraMetadataTest(asar: boolean) {
  return app({
    targets: Platform.LINUX.createTarget(DIR_TARGET),
    config: coerceTypes({
      asar,
      linux: {
        executableName: "new-name",
      },
      extraMetadata: {
        version: "1.0.0-beta.19",
        foo: {
          bar: 12,
          updated: "true",
          disabled: "false",
        },
        rootKey: "false",
        rootKeyT: "true",
        rootKeyN: "null",
      },
    }),
  }, {
    projectDirCreated: projectDir => modifyPackageJson(projectDir, data => {
      data.scripts = {}
      data.devDependencies = {foo: "boo"}
      data.foo = {
        bar: 42,
        existingProp: 22,
      }
    }),
    packed: async context => {
      await assertThat(path.join(context.getContent(Platform.LINUX), "new-name")).isFile()
      if (asar) {
        expect(await readAsarJson(path.join(context.getResources(Platform.LINUX), "app.asar"), "package.json")).toMatchSnapshot()
      }
      else {
        expect(await readJson(path.join(context.getResources(Platform.LINUX), "app", "package.json"))).toMatchSnapshot()
      }
    }
  })
}
開發者ID:jwheare,項目名稱:electron-builder,代碼行數:40,代碼來源:extraMetadataTest.ts


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