本文整理汇总了TypeScript中out.getProductName函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getProductName函数的具体用法?TypeScript getProductName怎么用?TypeScript getProductName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getProductName函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: checkLinuxResult
async function checkLinuxResult(projectDir: string, packager: Packager, packagerOptions: PackagerOptions) {
const productName = getProductName(packager.metadata, packager.devMetadata)
const expectedContents = expectedLinuxContents.map(it => {
if (it === "/opt/TestApp/TestApp") {
return "/opt/" + productName + "/" + productName
}
else if (it === "/usr/share/applications/TestApp.desktop") {
return `/usr/share/applications/${productName}.desktop`
}
else {
return it.replace(new RegExp("/opt/TestApp/", "g"), `/opt/${productName}/`)
}
})
// console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-amd64.deb", productName), null, 2))
// console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-i386.deb", productName), null, 2))
const packageFile = `${projectDir}/${outDirName}/TestApp-1.1.0-amd64.deb`
assertThat(await getContents(packageFile, productName)).deepEqual(expectedContents)
if (packagerOptions.arch === "all" || packagerOptions.arch === "ia32") {
assertThat(await getContents(`${projectDir}/${outDirName}/TestApp-1.1.0-i386.deb`, productName)).deepEqual(expectedContents)
}
assertThat(parseDebControl((await exec("dpkg", ["--info", packageFile])).toString())).has.properties({
License: "MIT",
Homepage: "http://foo.example.com",
Maintainer: "Foo Bar <[email protected]>",
Vendor: "Foo Bar <[email protected]>",
Package: "testapp",
Description: " \n Test Application",
})
}
开发者ID:alatzidis,项目名称:electron-builder,代码行数:32,代码来源:packTester.ts
示例2: checkOsXResult
async function checkOsXResult(packager: Packager, packagerOptions: PackagerOptions, checkOptions: AssertPackOptions, artifacts: Array<ArtifactCreated>) {
const productName = getProductName(packager.metadata, packager.devMetadata)
const packedAppDir = path.join(path.dirname(artifacts[0].file), (productName || packager.metadata.name) + ".app")
const info = parsePlist(await readFile(path.join(packedAppDir, "Contents", "Info.plist"), "utf8"))
assertThat2(info).has.properties({
CFBundleDisplayName: productName,
CFBundleIdentifier: "your.id",
LSApplicationCategoryType: "your.app.category.type",
CFBundleVersion: "1.1.0" + "." + (process.env.TRAVIS_BUILD_NUMBER || process.env.CIRCLE_BUILD_NUM)
})
if (packagerOptions.cscLink != null) {
const result = await exec("codesign", ["--verify", packedAppDir])
assertThat2(result).not.match(/is not signed at all/)
}
const actualFiles = artifacts.map(it => path.basename(it.file)).sort()
if (checkOptions != null && checkOptions.expectedContents != null) {
assertThat(actualFiles).isEqualTo(checkOptions.expectedContents)
}
else {
assertThat(actualFiles).isEqualTo([
`${productName}-1.1.0-mac.zip`,
`${productName}-1.1.0.dmg`,
].sort())
assertThat(artifacts.map(it => it.artifactName).sort()).isEqualTo([
"TestApp-1.1.0-mac.zip",
"TestApp-1.1.0.dmg",
].sort())
}
}
开发者ID:lcpo,项目名称:electron-builder,代码行数:32,代码来源:packTester.ts
示例3: checkWindowsResult
async function checkWindowsResult(packager: Packager, packagerOptions: PackagerOptions, artifacts: Array<ArtifactCreated>) {
const productName = getProductName(packager.metadata, packager.devMetadata)
function getWinExpected(archSuffix: string) {
return [
`RELEASES${archSuffix}`,
`${productName}Setup-1.0.0${archSuffix}.exe`,
`TestApp-1.0.0${archSuffix}-full.nupkg`,
]
}
const archSuffix = packagerOptions != null && packagerOptions.arch === "x64" ? "" : "-ia32"
const expected = archSuffix == "" ? getWinExpected(archSuffix) : getWinExpected(archSuffix).concat(getWinExpected(""))
const filenames = artifacts.map(it => path.basename(it.file))
assertThat(filenames.slice().sort()).deepEqual(expected.slice().sort())
let i = filenames.indexOf("RELEASES-ia32")
if (i !== -1) {
assertThat((await readText(artifacts[i].file)).indexOf("ia32")).not.equal(-1)
}
if (archSuffix == "") {
const expectedArtifactNames = expected.slice()
expectedArtifactNames[1] = `TestAppSetup-1.0.0${archSuffix}.exe`
assertThat(artifacts.map(it => it.artifactName).filter(it => it != null)).deepEqual([`TestAppSetup-1.0.0${archSuffix}.exe`])
}
}
开发者ID:bundyo,项目名称:electron-builder,代码行数:28,代码来源:packTester.ts
示例4: packAndCheck
async function packAndCheck(projectDir: string, platforms: string[], packagerOptions?: PackagerOptions) {
const packager = new Packager(Object.assign({
projectDir: projectDir,
cscLink: CSC_LINK,
cscKeyPassword: CSC_KEY_PASSWORD,
dist: true,
platform: platforms,
}, packagerOptions))
const artifacts: Map<Platform, Array<string>> = new Map()
packager.artifactCreated((file, platform) => {
let list = artifacts.get(platform)
if (list == null) {
list = []
artifacts.set(platform, list)
}
list.push(file)
})
await packager.build()
for (let key of artifacts.keys()) {
artifacts.set(key, pathSorter(artifacts.get(key)))
}
const expandedPlatforms = normalizePlatforms(platforms)
if (expandedPlatforms.includes("darwin")) {
await checkOsXResult(packager, artifacts.get(Platform.OSX))
}
else if (expandedPlatforms.includes("linux")) {
const productName = getProductName(packager.metadata)
const expectedContents = expectedLinuxContents.map(it => {
if (it === "/opt/TestApp/TestApp") {
return "/opt/" + productName + "/" + productName
}
else if (it === "/usr/share/applications/TestApp.desktop") {
return `/usr/share/applications/${productName}.desktop`
}
else {
return it.replace(new RegExp("/opt/TestApp/", "g"), `/opt/${productName}/`)
}
})
// let normalizedAppName = getProductName(packager.metadata).toLowerCase().replace(/ /g, '-')
// expectedContents[expectedContents.indexOf("/usr/share/doc/testapp/")] = "/usr/share/doc/" + normalizedAppName + "/"
// expectedContents[expectedContents.indexOf("/usr/share/doc/testapp/changelog.Debian.gz")] = "/usr/share/doc/" + normalizedAppName + "/changelog.Debian.gz"
assertThat(await getContents(projectDir + "/dist/TestApp-1.0.0-amd64.deb", productName)).deepEqual(expectedContents)
if (packagerOptions == null || packagerOptions.arch === null || packagerOptions.arch === "ia32") {
assertThat(await getContents(projectDir + "/dist/TestApp-1.0.0-i386.deb", productName)).deepEqual(expectedContents)
}
// console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-amd64.deb"), null, 2))
// console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-i386.deb"), null, 2))
}
else if (expandedPlatforms.includes("win32") && (packagerOptions == null || packagerOptions.target == null)) {
await checkWindowsResult(packagerOptions, artifacts.get(Platform.WINDOWS))
}
}
开发者ID:TakT,项目名称:electron-builder,代码行数:57,代码来源:packTester.ts
示例5: packAndCheck
async function packAndCheck(projectDir: string, packagerOptions: PackagerOptions): Promise<void> {
const packager = new Packager(packagerOptions)
const artifacts: Map<Platform, Array<ArtifactCreated>> = new Map()
packager.artifactCreated(event => {
assertThat(path.isAbsolute(event.file)).true()
let list = artifacts.get(event.platform)
if (list == null) {
list = []
artifacts.set(event.platform, list)
}
list.push(event)
})
await packager.build()
if (!packagerOptions.dist) {
return
}
for (let platform of normalizePlatforms(packagerOptions.platform)) {
if (platform === "darwin") {
await checkOsXResult(packager, artifacts.get(Platform.OSX))
}
else if (platform === "linux") {
const productName = getProductName(packager.metadata, packager.devMetadata)
const expectedContents = expectedLinuxContents.map(it => {
if (it === "/opt/TestApp/TestApp") {
return "/opt/" + productName + "/" + productName
}
else if (it === "/usr/share/applications/TestApp.desktop") {
return `/usr/share/applications/${productName}.desktop`
}
else {
return it.replace(new RegExp("/opt/TestApp/", "g"), `/opt/${productName}/`)
}
})
// console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-amd64.deb", productName), null, 2))
// console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-i386.deb", productName), null, 2))
assertThat(await getContents(projectDir + "/dist/TestApp-1.0.0-amd64.deb", productName)).deepEqual(expectedContents)
if (packagerOptions == null || packagerOptions.arch === null || packagerOptions.arch === "ia32") {
assertThat(await getContents(projectDir + "/dist/TestApp-1.0.0-i386.deb", productName)).deepEqual(expectedContents)
}
}
else if (platform === "win32" && (packagerOptions == null || packagerOptions.target == null)) {
await checkWindowsResult(packager, packagerOptions, artifacts.get(Platform.WINDOWS))
}
}
}
开发者ID:bundyo,项目名称:electron-builder,代码行数:51,代码来源:packTester.ts
示例6: checkLinuxResult
async function checkLinuxResult(projectDir: string, packager: Packager, packagerOptions: PackagerOptions, checkOptions: AssertPackOptions, artifacts: Array<ArtifactCreated>) {
const customBuildOptions = packager.devMetadata.build.linux
const targets = customBuildOptions == null || customBuildOptions.target == null ? ["default"] : customBuildOptions.target
function getExpected(): Array<string> {
const result: Array<string> = []
for (let target of targets) {
result.push(`TestApp-1.1.0.${target === "default" ? "deb" : target}`)
}
return result
}
assertThat(getFileNames(artifacts)).deepEqual((checkOptions == null || checkOptions.expectedArtifacts == null ? getExpected() : checkOptions.expectedArtifacts.slice()).sort())
if (!targets.includes("deb") || !targets.includes("default")) {
return
}
const productName = getProductName(packager.metadata, packager.devMetadata)
const expectedContents = expectedLinuxContents.map(it => {
if (it === "/opt/TestApp/TestApp") {
return "/opt/" + productName + "/" + productName
}
else if (it === "/usr/share/applications/TestApp.desktop") {
return `/usr/share/applications/${productName}.desktop`
}
else {
return it.replace(new RegExp("/opt/TestApp/", "g"), `/opt/${productName}/`)
}
})
// console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-amd64.deb", productName), null, 2))
// console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-i386.deb", productName), null, 2))
const packageFile = `${projectDir}/${outDirName}/TestApp-1.1.0-amd64.deb`
assertThat(await getContents(packageFile, productName)).deepEqual(expectedContents)
if (packagerOptions.arch === "all" || packagerOptions.arch === "ia32") {
assertThat(await getContents(`${projectDir}/${outDirName}/TestApp-1.1.0-i386.deb`, productName)).deepEqual(expectedContents)
}
assertThat(parseDebControl(await exec("dpkg", ["--info", packageFile]))).has.properties({
License: "MIT",
Homepage: "http://foo.example.com",
Maintainer: "Foo Bar <[email protected]>",
Vendor: "Foo Bar <[email protected]>",
Package: "testapp",
Description: " \n Test Application (test quite â #378)",
Depends: checkOptions == null || checkOptions.expectedDepends == null ? "libappindicator1, libnotify-bin" : checkOptions.expectedDepends,
})
}
开发者ID:is00hcw,项目名称:electron-builder,代码行数:50,代码来源:packTester.ts
示例7: checkWindowsResult
async function checkWindowsResult(packager: Packager, packagerOptions: PackagerOptions, checkOptions: AssertPackOptions, artifacts: Array<ArtifactCreated>) {
const productName = getProductName(packager.metadata, packager.devMetadata)
function getWinExpected(archSuffix: string) {
return [
`RELEASES${archSuffix}`,
`${productName}Setup-1.0.0${archSuffix}.exe`,
`TestApp-1.0.0${archSuffix}-full.nupkg`,
]
}
const archSuffix = (packagerOptions.arch || process.arch) === "x64" ? "" : "-ia32"
const expected = archSuffix == "" ? getWinExpected(archSuffix) : getWinExpected(archSuffix).concat(getWinExpected(""))
const filenames = artifacts.map(it => path.basename(it.file))
assertThat(filenames.slice().sort()).deepEqual(expected.slice().sort())
let i = filenames.indexOf("RELEASES-ia32")
if (i !== -1) {
assertThat((await readText(artifacts[i].file)).indexOf("ia32")).not.equal(-1)
}
if (archSuffix == "") {
const expectedArtifactNames = expected.slice()
expectedArtifactNames[1] = `TestAppSetup-1.0.0${archSuffix}.exe`
assertThat(artifacts.map(it => it.artifactName).filter(it => it != null)).deepEqual([`TestAppSetup-1.0.0${archSuffix}.exe`])
}
const files = pathSorter((await new BluebirdPromise<Array<string>>((resolve, reject) => {
const unZipper = new DecompressZip(path.join(path.dirname(artifacts[0].file), `TestApp-1.0.0${archSuffix}-full.nupkg`))
unZipper.on("list", resolve)
unZipper.on('error', reject)
unZipper.list()
})).map(it => it.replace(/\\/g, "/")).filter(it => (!it.startsWith("lib/net45/locales/") || it === "lib/net45/locales/en-US.pak") && !it.endsWith(".psmdcp")))
// console.log(JSON.stringify(files, null, 2))
const expectedContents = checkOptions == null || checkOptions.expectedContents == null ? expectedWinContents : checkOptions.expectedContents
assertThat(files).deepEqual(expectedContents.map(it => {
if (it === "lib/net45/TestApp.exe") {
return `lib/net45/${productName.replace(/ /g, "%20")}.exe`
}
else {
return it
}
}))
}
开发者ID:dennyferra,项目名称:electron-builder,代码行数:46,代码来源:packTester.ts
示例8: checkOsXResult
async function checkOsXResult(packager: Packager, artifacts: Array<string>) {
const productName = getProductName(packager.metadata)
const packedAppDir = path.join(path.dirname(artifacts[0]), (productName || packager.metadata.name) + ".app")
const info = parsePlist(await readText(path.join(packedAppDir, "Contents", "Info.plist")))
assertThat(info).has.properties({
CFBundleDisplayName: productName,
CFBundleIdentifier: "your.id",
LSApplicationCategoryType: "your.app.category.type",
CFBundleVersion: "1.0.0" + "." + (process.env.TRAVIS_BUILD_NUMBER || process.env.CIRCLE_BUILD_NUM)
})
const result = await exec("codesign", ["--verify", packedAppDir])
assertThat(result[0].toString()).not.match(/is not signed at all/)
assertThat(artifacts.map(it => path.basename((it))).sort()).deepEqual([
"TestApp-1.0.0-mac.zip",
"TestApp-1.0.0.dmg"
].sort())
}
开发者ID:TakT,项目名称:electron-builder,代码行数:19,代码来源:packTester.ts
示例9: checkLinuxResult
async function checkLinuxResult(projectDir: string, packager: Packager, packagerOptions: PackagerOptions) {
const productName = getProductName(packager.metadata, packager.devMetadata)
const expectedContents = expectedLinuxContents.map(it => {
if (it === "/opt/TestApp/TestApp") {
return "/opt/" + productName + "/" + productName
}
else if (it === "/usr/share/applications/TestApp.desktop") {
return `/usr/share/applications/${productName}.desktop`
}
else {
return it.replace(new RegExp("/opt/TestApp/", "g"), `/opt/${productName}/`)
}
})
// console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-amd64.deb", productName), null, 2))
// console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-i386.deb", productName), null, 2))
const packageFile = projectDir + "/dist/TestApp-1.0.0-amd64.deb"
assertThat(await getContents(packageFile, productName)).deepEqual(expectedContents)
if (packagerOptions.arch === "all" || packagerOptions.arch === "ia32") {
assertThat(await getContents(projectDir + "/dist/TestApp-1.0.0-i386.deb", productName)).deepEqual(expectedContents)
}
const regexp = /^ *(\w+): *(.+)$/gm
const info = (await exec("dpkg", ["--info", packageFile])).toString()
let match: Array<string>
const metadata: any = {}
while ((match = regexp.exec(info)) !== null) {
metadata[match[1]] = match[2]
}
assertThat(metadata).has.properties({
License: "MIT",
Homepage: "http://foo.example.com",
Maintainer: "Foo Bar <[email protected]>",
Package: "testapp",
Description: "Test Application",
})
}
开发者ID:atietje,项目名称:electron-builder,代码行数:38,代码来源:packTester.ts
示例10: checkWindowsResult
async function checkWindowsResult(packager: Packager, packagerOptions: PackagerOptions, checkOptions: AssertPackOptions, artifacts: Array<ArtifactCreated>) {
const productName = getProductName(packager.metadata, packager.devMetadata)
function getWinExpected(archSuffix: string) {
return [
`RELEASES${archSuffix}`,
`${productName}Setup-1.1.0${archSuffix}.exe`,
`TestApp-1.1.0${archSuffix}-full.nupkg`,
]
}
const archSuffix = (packagerOptions.arch || process.arch) === "x64" ? "" : "-ia32"
const expected = archSuffix == "" ? getWinExpected(archSuffix) : getWinExpected(archSuffix).concat(getWinExpected(""))
const filenames = artifacts.map(it => path.basename(it.file))
assertThat(filenames.slice().sort()).deepEqual(expected.slice().sort())
let i = filenames.indexOf("RELEASES-ia32")
if (i !== -1) {
assertThat((await readFile(artifacts[i].file, "utf8")).indexOf("ia32")).not.equal(-1)
}
if (archSuffix == "") {
const expectedArtifactNames = expected.slice()
expectedArtifactNames[1] = `TestAppSetup-1.1.0${archSuffix}.exe`
assertThat(artifacts.map(it => it.artifactName).filter(it => it != null)).deepEqual([`TestAppSetup-1.1.0${archSuffix}.exe`])
}
const packageFile = path.join(path.dirname(artifacts[0].file), `TestApp-1.1.0${archSuffix}-full.nupkg`)
const unZipper = new DecompressZip(packageFile)
const fileDescriptors = await unZipper.getFiles()
const files = pathSorter(fileDescriptors.map(it => it.path.replace(/\\/g, "/")).filter(it => (!it.startsWith("lib/net45/locales/") || it === "lib/net45/locales/en-US.pak") && !it.endsWith(".psmdcp")))
// console.log(JSON.stringify(files, null, 2))
const expectedContents = checkOptions == null || checkOptions.expectedContents == null ? expectedWinContents : checkOptions.expectedContents
assertThat(files).deepEqual(expectedContents.map(it => {
if (it === "lib/net45/TestApp.exe") {
return `lib/net45/${productName.replace(/ /g, "%20")}.exe`
}
else {
return it
}
}))
if (checkOptions == null || checkOptions.expectedContents == null) {
await unZipper.extractFile(fileDescriptors.filter(it => it.path === "TestApp.nuspec")[0], {
path: path.dirname(packageFile),
})
const expectedSpec = await readFile(path.join(path.dirname(packageFile), "TestApp.nuspec"), "utf8")
assertThat((expectedSpec).replace(/\r\n/g, "\n")).equal(`<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>TestApp</id>
<title>${productName}</title>
<version>1.1.0</version>
<authors>Foo Bar</authors>
<owners>Foo Bar</owners>
<iconUrl>https://raw.githubusercontent.com/szwacz/electron-boilerplate/master/resources/windows/icon.ico</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Test Application</description>
<copyright>Copyright Š ${new Date().getFullYear()} Foo Bar</copyright>
<projectUrl>http://foo.example.com</projectUrl>
</metadata>
</package>`)
}
}
开发者ID:GabeIsman,项目名称:electron-builder,代码行数:67,代码来源:packTester.ts
注:本文中的out.getProductName函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论