本文整理汇总了TypeScript中electron-builder-util/out/log.log函数的典型用法代码示例。如果您正苦于以下问题:TypeScript log函数的具体用法?TypeScript log怎么用?TypeScript log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: main
async function main() {
const args: any = yargs
.option("publisher", {
alias: ["p"],
}).argv
const tmpDir = new TmpDir()
const targetDir = process.cwd()
const tempPrefix = path.join(await tmpDir.getTempFile(""), sanitizeFileName(args.publisher))
const cer = `${tempPrefix}.cer`
const pvk = `${tempPrefix}.pvk`
log('When asked to enter a password ("Create Private Key Password"), please select "None".')
const vendorPath = path.join(await getSignVendorPath(), "windows-10", process.arch)
await exec(path.join(vendorPath, "makecert.exe"),
["-r", "-h", "0", "-n", `CN=${args.publisher}`, "-eku", "1.3.6.1.5.5.7.3.3", "-pe", "-sv", pvk, cer])
const pfx = path.join(targetDir, `${sanitizeFileName(args.publisher)}.pfx`)
await unlinkIfExists(pfx)
await exec(path.join(vendorPath, "pvk2pfx.exe"), ["-pvk", pvk, "-spc", cer, "-pfx", pfx])
log(`${pfx} created. Please see https://github.com/electron-userland/electron-builder/wiki/Code-Signing how do use it to sign.`)
const certLocation = "Cert:\\LocalMachine\\TrustedPeople"
log(`${pfx} will be imported into ${certLocation} Operation will be succeed only if runned from root. Otherwise import file manually.`)
await spawn("powershell.exe", ["Import-PfxCertificate", "-FilePath", `"${pfx}"`, "-CertStoreLocation", ""])
tmpDir.cleanup()
}
示例2: rebuild
export async function rebuild(appDir: string, frameworkInfo: DesktopFrameworkInfo, platform: string = process.platform, arch: string = process.arch, additionalArgs: Array<string>, buildFromSource: boolean) {
const pathToDep = await readInstalled(appDir)
const nativeDeps = await BluebirdPromise.filter(pathToDep.values(), it => it.extraneous ? false : exists(path.join(it.path, "binding.gyp")), {concurrency: 8})
if (nativeDeps.length === 0) {
log(`No native production dependencies`)
return
}
log(`Rebuilding native production dependencies for ${platform}:${arch}`)
let execPath = process.env.npm_execpath || process.env.NPM_CLI_JS
const isYarn = isYarnPath(execPath)
const execArgs: Array<string> = []
if (execPath == null) {
execPath = getPackageToolPath()
}
else {
execArgs.push(execPath)
execPath = process.env.npm_node_execpath || process.env.NODE_EXE || "node"
}
const env = getGypEnv(frameworkInfo, platform, arch, buildFromSource)
if (isYarn) {
execArgs.push("run", "install", "--")
execArgs.push(...additionalArgs)
await BluebirdPromise.each(nativeDeps, dep => {
log(`Rebuilding native dependency ${dep.name}`)
return spawn(execPath, execArgs, {
cwd: dep.path,
env: env,
})
.catch(error => {
if (dep.optional) {
warn(`Cannot build optional native dep ${dep.name}`)
}
else {
throw error
}
})
})
}
else {
execArgs.push("rebuild")
execArgs.push(...additionalArgs)
execArgs.push(...nativeDeps.map(it => it.name))
await spawn(execPath, execArgs, {
cwd: appDir,
env: env,
})
}
}
示例3: installDependencies
function installDependencies(appDir: string, electronVersion: string, platform: string = process.platform, arch: string = process.arch, additionalArgs: Array<string>, buildFromSource: boolean): Promise<any> {
log(`Installing app dependencies for arch ${arch} to ${appDir}`)
let execPath = process.env.npm_execpath || process.env.NPM_CLI_JS
const execArgs = ["install", "--production"]
const isYarn = isYarnPath(execPath)
if (!isYarn) {
if (process.env.NPM_NO_BIN_LINKS === "true") {
execArgs.push("--no-bin-links")
}
execArgs.push("--cache-min", "999999999")
}
if (execPath == null) {
execPath = getPackageToolPath()
}
else {
execArgs.unshift(execPath)
execPath = process.env.npm_node_execpath || process.env.NODE_EXE || "node"
}
execArgs.push(...additionalArgs)
return spawn(execPath, execArgs, {
cwd: appDir,
env: getGypEnv(electronVersion, platform, arch, buildFromSource),
})
}
示例4: build
async build(appOutDir: string, arch: Arch): Promise<any> {
const packager = this.packager
const isMac = packager.platform === Platform.MAC
const outDir = this.outDir
const format = this.name
log(`Building ${isMac ? "macOS " : ""}${format}`)
// we use app name here - see https://github.com/electron-userland/electron-builder/pull/204
const outFile = (() => {
switch (packager.platform) {
case Platform.MAC:
return path.join(appOutDir, packager.generateName2(format, "mac", false))
case Platform.WINDOWS:
return path.join(outDir, packager.generateName(format, arch, false, "win"))
case Platform.LINUX:
return path.join(outDir, packager.generateName(format, arch, true))
default:
throw new Error(`Unknown platform: ${packager.platform}`)
}
})()
const dirToArchive = isMac ? path.join(appOutDir, `${packager.appInfo.productFilename}.app`) : appOutDir
if (format.startsWith("tar.")) {
await tar(packager.config.compression, format, outFile, dirToArchive, isMac)
}
else {
await archive(packager.config.compression, format, outFile, dirToArchive)
}
packager.dispatchArtifactCreated(outFile, this, isMac ? packager.generateName2(format, "mac", true) : packager.generateName(format, arch, true, packager.platform === Platform.WINDOWS ? "win" : null))
}
示例5: unpack
async function unpack(packager: PlatformPackager<any>, out: string, platform: string, options: any) {
const dist = packager.config.electronDist
if (dist == null) {
const zipPath = (await BluebirdPromise.all<any>([
downloadElectron(options),
emptyDir(out)
]))[0]
await spawn(path7za, debug7zArgs("x").concat(zipPath, `-o${out}`))
}
else {
const source = packager.getElectronSrcDir(dist)
const destination = packager.getElectronDestDir(out)
log(`Copying Electron from "${source}" to "${destination}"`)
await emptyDir(out)
await copyDir(source, destination)
}
if (platform === "linux") {
// https://github.com/electron-userland/electron-builder/issues/786
// fix dir permissions â opposite to extract-zip, 7za creates dir with no-access for other users, but dir must be readable for non-root users
await BluebirdPromise.all([
chmod(path.join(out, "locales"), "0755"),
chmod(path.join(out, "resources"), "0755")
])
}
}
示例6: syncReleases
function syncReleases(outputDirectory: string, options: SquirrelOptions) {
log("Sync releases to build delta package")
const args = prepareArgs(["-u", options.remoteReleases!, "-r", outputDirectory], path.join(options.vendorPath, "SyncReleases.exe"))
if (options.remoteToken) {
args.push("-t", options.remoteToken)
}
return spawn(process.platform === "win32" ? path.join(options.vendorPath, "SyncReleases.exe") : "mono", args)
}
示例7: main
async function main() {
const projectDir = process.cwd()
const config = await loadConfig(projectDir)
log(`Execute node-gyp rebuild for ${args.platform}:${args.arch}`)
await exec(process.platform === "win32" ? "node-gyp.cmd" : "node-gyp", ["rebuild"], {
env: getGypEnv(await getElectronVersion(config, projectDir), args.platform, args.arch, true),
})
}
示例8: main
async function main() {
const projectDir = process.cwd()
const config = await loadConfig(projectDir)
log(`Execute node-gyp rebuild for ${args.platform}:${args.arch}`)
// this script must be used only for electron
await exec(process.platform === "win32" ? "node-gyp.cmd" : "node-gyp", ["rebuild"], {
env: getGypEnv({version: await getElectronVersion(config, projectDir), useCustomDist: true}, args.platform, args.arch, true),
})
}
示例9: log
await BluebirdPromise.each(nativeDeps, dep => {
log(`Rebuilding native dependency ${dep.name}`)
return spawn(execPath, execArgs, {cwd: dep.path, env: env})
.catch(error => {
if (dep.optional) {
warn(`Cannot build optional native dep ${dep.name}`)
}
else {
throw error
}
})
})
示例10: installAppDeps
export async function installAppDeps(args: any) {
try {
log("electron-builder " + PACKAGE_VERSION)
}
catch (e) {
// error in dev mode without babel
if (!(e instanceof ReferenceError)) {
throw e
}
}
const projectDir = process.cwd()
const config = (await loadConfig(projectDir)) || {}
const muonVersion = config.muonVersion
const results = await BluebirdPromise.all<string>([
computeDefaultAppDirectory(projectDir, use(config.directories, it => it!.app)),
muonVersion == null ? getElectronVersion(config, projectDir) : BluebirdPromise.resolve(muonVersion),
])
// if two package.json â force full install (user wants to install/update app deps in addition to dev)
await installOrRebuild(config, results[0], {version: results[1], useCustomDist: muonVersion == null}, args.platform, args.arch, results[0] !== projectDir)
}