本文整理汇总了TypeScript中electron-builder-util.log函数的典型用法代码示例。如果您正苦于以下问题:TypeScript log函数的具体用法?TypeScript log怎么用?TypeScript log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: createSelfSignedCert
export async function createSelfSignedCert(publisher: string) {
const tmpDir = new TmpDir()
const targetDir = process.cwd()
const tempPrefix = path.join(await tmpDir.getTempFile(""), sanitizeFileName(publisher))
const cer = `${tempPrefix}.cer`
const pvk = `${tempPrefix}.pvk`
log(bold('When asked to enter a password ("Create Private Key Password"), please select "None".'))
try {
await ensureDir(path.dirname(tempPrefix))
const vendorPath = path.join(await getSignVendorPath(), "windows-10", process.arch)
await exec(path.join(vendorPath, "makecert.exe"),
["-r", "-h", "0", "-n", `CN=${quoteString(publisher)}`, "-eku", "1.3.6.1.5.5.7.3.3", "-pe", "-sv", pvk, cer])
const pfx = path.join(targetDir, `${sanitizeFileName(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 to 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", ""])
}
finally {
await tmpDir.cleanup()
}
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:28,代码来源:create-self-signed-cert.ts
示例2: rebuild
export async function rebuild(appDir: string, options: RebuildOptions) {
const nativeDeps = await BluebirdPromise.filter(await options.productionDeps!.value, it => exists(path.join(it.path, "binding.gyp")), {concurrency: 8})
if (nativeDeps.length === 0) {
log(`No native production dependencies`)
return
}
const platform = options.platform || process.platform
const arch = options.arch || process.arch
const additionalArgs = options.additionalArgs
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(options.frameworkInfo, platform, arch, options.buildFromSource === true)
if (isYarn) {
execArgs.push("run", "install", "--")
if (additionalArgs != null) {
execArgs.push(...additionalArgs)
}
await BluebirdPromise.map(nativeDeps, dep => {
log(`Rebuilding native dependency ${dep.name}`)
return spawn(execPath!, execArgs, {
cwd: dep.path,
env,
})
.catch(error => {
if (dep.optional) {
warn(`Cannot build optional native dep ${dep.name}`)
}
else {
throw error
}
})
}, {concurrency: process.platform === "win32" ? 1 : 2})
}
else {
execArgs.push("rebuild")
if (additionalArgs != null) {
execArgs.push(...additionalArgs)
}
execArgs.push(...nativeDeps.map(it => it.name))
await spawn(execPath, execArgs, {
cwd: appDir,
env,
})
}
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:58,代码来源:yarn.ts
示例3: 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 getConfig(projectDir, null, null, null)
const muonVersion = config.muonVersion
const results = await BluebirdPromise.all<string>([
computeDefaultAppDirectory(projectDir, use(config.directories, it => it!.app)),
muonVersion == null ? getElectronVersion(projectDir, config) : 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], {
frameworkInfo: {version: results[1], useCustomDist: muonVersion == null},
platform: args.platform,
arch: args.arch,
productionDeps: createLazyProductionDeps(results[0]),
}, results[0] !== projectDir)
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:27,代码来源:install-app-deps.ts
示例4: installDependencies
function installDependencies(appDir: string, options: RebuildOptions): Promise<any> {
const platform = options.platform || process.platform
const arch = options.arch || process.arch
const additionalArgs = options.additionalArgs
log(`Installing app dependencies for arch ${arch} to ${appDir}`)
let execPath = process.env.npm_execpath || process.env.NPM_CLI_JS
const execArgs = ["install", "--production"]
if (!isYarnPath(execPath)) {
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"
}
if (additionalArgs != null) {
execArgs.push(...additionalArgs)
}
return spawn(execPath, execArgs, {
cwd: appDir,
env: getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true),
})
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:32,代码来源:yarn.ts
示例5: 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)
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:8,代码来源:squirrelPack.ts
示例6: rebuildAppNativeCode
async function rebuildAppNativeCode(args: any) {
const projectDir = process.cwd()
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(projectDir), useCustomDist: true}, args.platform, args.arch, true),
})
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:8,代码来源:cli.ts
示例7: log
await BluebirdPromise.map(nativeDeps, dep => {
log(`Rebuilding native dependency ${dep.name}`)
return spawn(execPath!, execArgs, {
cwd: dep.path,
env,
})
.catch(error => {
if (dep.optional) {
warn(`Cannot build optional native dep ${dep.name}`)
}
else {
throw error
}
})
}, {concurrency: process.platform === "win32" ? 1 : 2})
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:15,代码来源:yarn.ts
示例8: checkMetadata
export function checkMetadata(metadata: Metadata, devMetadata: any | null, appPackageFile: string, devAppPackageFile: string): void {
const errors: Array<string> = []
const reportError = (missedFieldName: string) => {
errors.push(`Please specify '${missedFieldName}' in the package.json (${appPackageFile})`)
}
const checkNotEmpty = (name: string, value: string | n) => {
if (isEmptyOrSpaces(value)) {
reportError(name)
}
}
if ((metadata as any).directories != null) {
errors.push(`"directories" in the root is deprecated, please specify in the "build"`)
}
checkNotEmpty("name", metadata.name)
if (isEmptyOrSpaces(metadata.description)) {
warn(`description is missed in the package.json (${appPackageFile})`)
}
if (!metadata.author) {
warn(`author is missed in the package.json (${appPackageFile})`)
}
checkNotEmpty("version", metadata.version)
if (devMetadata != null) {
checkDependencies(devMetadata.dependencies, errors)
}
if (metadata !== devMetadata) {
checkDependencies(metadata.dependencies, errors)
if (metadata.build != null) {
errors.push(`'build' in the application package.json (${appPackageFile}) is not supported since 3.0 anymore. Please move 'build' into the development package.json (${devAppPackageFile})`)
}
}
const devDependencies = (metadata as any).devDependencies
if (devDependencies != null && "electron-rebuild" in devDependencies) {
log('electron-rebuild not required if you use electron-builder, please consider to remove excess dependency from devDependencies\n\nTo ensure your native dependencies are always matched electron version, simply add script `"postinstall": "electron-builder install-app-deps" to your `package.json`')
}
if (errors.length > 0) {
throw new Error(errors.join("\n"))
}
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:46,代码来源:packageMetadata.ts
示例9: compileUsingElectronCompile
async function compileUsingElectronCompile(mainFileSet: FileSet, packager: Packager): Promise<FileSet> {
log("Compiling using electron-compile")
const electronCompileCache = await packager.tempDirManager.getTempFile("electron-compile-cache")
const cacheDir = path.join(electronCompileCache, ".cache")
// clear and create cache dir
await ensureDir(cacheDir)
const compilerHost = await createElectronCompilerHost(mainFileSet.src, cacheDir)
const nextSlashIndex = mainFileSet.src.length + 1
// pre-compute electron-compile to cache dir - we need to process only subdirectories, not direct files of app dir
await BluebirdPromise.map(mainFileSet.files, file => {
if (file.includes(NODE_MODULES_PATTERN) || file.includes(BOWER_COMPONENTS_PATTERN)
|| !file.includes(path.sep, nextSlashIndex) // ignore not root files
|| !mainFileSet.metadata.get(file)!.isFile()) {
return null
}
return compilerHost.compile(file)
.then((it: any) => null)
}, CONCURRENCY)
await compilerHost.saveConfiguration()
const metadata = new Map<string, Stats>()
const cacheFiles = await walk(cacheDir, (file, stat) => !file.startsWith("."), {
consume: (file, fileStat) => {
if (fileStat.isFile()) {
metadata.set(file, fileStat)
}
return null
}
})
// add shim
const shimPath = `${mainFileSet.src}/${ELECTRON_COMPILE_SHIM_FILENAME}`
cacheFiles.push(shimPath)
metadata.set(shimPath, {isFile: () => true, isDirectory: () => false} as any)
const transformedFiles = new Array(cacheFiles.length)
transformedFiles[cacheFiles.length - 1] = `
'use strict';
require('electron-compile').init(__dirname, require('path').resolve(__dirname, '${packager.metadata.main || "index"}'), true);
`
// cache files should be first (better IO)
return {src: electronCompileCache, files: cacheFiles, transformedFiles, metadata, destination: mainFileSet.destination}
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:45,代码来源:AppFileCopierHelper.ts
示例10: unpack
async function unpack(packager: PlatformPackager<any>, out: string, platform: string, options: InternalElectronDownloadOptions) {
let dist: string | null | undefined = packager.config.electronDist
if (dist != null) {
const zipFile = `electron-v${options.version}-${platform}-${options.arch}.zip`
const resolvedDist = path.resolve(packager.projectDir, dist)
if ((await statOrNull(path.join(resolvedDist, zipFile))) != null) {
options.cache = resolvedDist
dist = null
}
}
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.getElectronDestinationDir(out)
log(`Copying Electron from "${source}" to "${destination}"`)
await emptyDir(out)
await copyDir(source, destination, null, null, DO_NOT_USE_HARD_LINKS)
}
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")
])
}
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:36,代码来源:dirPackager.ts
注:本文中的electron-builder-util.log函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论