Skip to content

Commit

Permalink
chore: update dmg-licence to 1.0.9 (#5890)
Browse files Browse the repository at this point in the history
  • Loading branch information
develar authored May 14, 2021
1 parent ef981ab commit c623279
Show file tree
Hide file tree
Showing 23 changed files with 188 additions and 401 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"///": "All dependencies for all packages (hoisted)",
"////": "All typings are added into root `package.json` to avoid duplication errors in the IDE compiler (several `node.d.ts` files).",
"dependencies": {
"dmg-license": "~1.0.8"
"dmg-license": "~1.0.9"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.23.0",
Expand All @@ -47,7 +47,7 @@
"eslint-plugin-prettier": "^3.4.0",
"fs-extra": "^10.0.0",
"globby": "^11.0.3",
"husky": "5.2.0",
"husky": "~6.0.0",
"jest-cli": "^26.6.3",
"jsdoc-to-markdown": "^7.0.1",
"lint-staged": "^11.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/app-builder-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"is-ci": "^3.0.0",
"isbinaryfile": "^4.0.8",
"js-yaml": "^4.1.0",
"lazy-val": "^1.0.4",
"lazy-val": "^1.0.5",
"minimatch": "^3.0.4",
"read-config-file": "6.2.0",
"sanitize-filename": "^1.6.3",
Expand Down Expand Up @@ -94,7 +94,7 @@
"@types/hosted-git-info": "^3.0.1",
"@types/is-ci": "^3.0.0",
"@types/js-yaml": "^4.0.1",
"@types/semver": "^7.3.5",
"@types/semver": "^7.3.6",
"dmg-builder": "workspace:*",
"electron-builder-squirrel-windows": "workspace:*"
},
Expand Down
10 changes: 5 additions & 5 deletions packages/app-builder-lib/src/asar/asarUtil.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AsyncTaskManager, log } from "builder-util"
import { FileCopier, Filter, MAX_FILE_REQUESTS } from "builder-util/out/fs"
import { symlink } from "fs"
import { createReadStream, createWriteStream, ensureDir, readFile, Stats, writeFile } from "fs-extra"
import { symlink, createReadStream, createWriteStream, Stats } from "fs"
import { writeFile, readFile, mkdir } from "fs/promises"
import * as path from "path"
import { AsarOptions } from "../options/PlatformSpecificBuildOptions"
import { Packager } from "../packager"
Expand Down Expand Up @@ -30,7 +30,7 @@ export class AsarPackager {
// ordering doesn't support transformed files, but ordering is not used functionality - wait user report to fix it
await order(fileSets[0].files, this.options.ordering, fileSets[0].src)
}
await ensureDir(path.dirname(this.outFile))
await mkdir(path.dirname(this.outFile), { recursive: true })
const unpackedFileIndexMap = new Map<ResolvedFileSet, Set<number>>()
for (const fileSet of fileSets) {
unpackedFileIndexMap.set(fileSet, await this.createPackageFromFiles(fileSet, packager.info))
Expand All @@ -57,7 +57,7 @@ export class AsarPackager {
unpackedDirs.add(filePathInArchive)
// not all dirs marked as unpacked after first iteration - because node module dir can be marked as unpacked after processing node module dir content
// e.g. node-notifier/example/advanced.js processed, but only on process vendor/terminal-notifier.app module will be marked as unpacked
await ensureDir(path.join(this.unpackedDest, filePathInArchive))
await mkdir(path.join(this.unpackedDest, filePathInArchive), { recursive: true })
break
}
}
Expand Down Expand Up @@ -118,7 +118,7 @@ export class AsarPackager {
if (isUnpacked) {
if (!dirNode.unpacked && !dirToCreateForUnpackedFiles.has(fileParent)) {
dirToCreateForUnpackedFiles.add(fileParent)
await ensureDir(path.join(this.unpackedDest, fileParent))
await mkdir(path.join(this.unpackedDest, fileParent), { recursive: true })
}

const unpackedFile = path.join(this.unpackedDest, pathInArchive)
Expand Down
8 changes: 4 additions & 4 deletions packages/app-builder-lib/src/asar/unpackDetector.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BluebirdPromise from "bluebird-lst"
import { log } from "builder-util"
import { CONCURRENCY } from "builder-util/out/fs"
import { ensureDir } from "fs-extra"
import { mkdir } from "fs-extra"
import * as path from "path"
import { NODE_MODULES_PATTERN } from "../fileTransformer"
import { getDestinationPath, ResolvedFileSet } from "../util/appFileCopier"
Expand Down Expand Up @@ -98,19 +98,19 @@ export async function detectUnpackedDirs(fileSet: ResolvedFileSet, autoUnpackDir
}

if (dirToCreate.size > 0) {
await ensureDir(unpackedDest + path.sep + "node_modules")
await mkdir(`${unpackedDest + path.sep}node_modules`, { recursive: true })
// child directories should be not created asynchronously - parent directories should be created first
await BluebirdPromise.map(
dirToCreate.keys(),
async parentDir => {
const base = unpackedDest + path.sep + parentDir
await ensureDir(base)
await mkdir(base, { recursive: true })
await BluebirdPromise.each(dirToCreate.get(parentDir)!, (it): any => {
if (dirToCreate.has(parentDir + path.sep + it)) {
// already created
return null
} else {
return ensureDir(base + path.sep + it)
return mkdir(base + path.sep + it, { recursive: true })
}
})
},
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/codeSign/macCodeSign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { exec, InvalidConfigurationError, isEmptyOrSpaces, isEnvTrue, isPullRequ
import { copyFile, unlinkIfExists } from "builder-util/out/fs"
import { Fields, Logger } from "builder-util/out/log"
import { randomBytes, createHash } from "crypto"
import { rename } from "fs-extra"
import { rename } from "fs/promises"
import { Lazy } from "lazy-val"
import { homedir, tmpdir } from "os"
import * as path from "path"
Expand Down
4 changes: 2 additions & 2 deletions packages/app-builder-lib/src/fileMatcher.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BluebirdPromise from "bluebird-lst"
import { asArray, log } from "builder-util"
import { copyDir, copyOrLinkFile, Filter, statOrNull, FileTransformer, USE_HARD_LINKS } from "builder-util/out/fs"
import { ensureDir } from "fs-extra"
import { mkdir } from "fs/promises"
import { Minimatch } from "minimatch"
import * as path from "path"
import { Configuration, FileSet, Packager, PlatformSpecificBuildOptions } from "./index"
Expand Down Expand Up @@ -338,7 +338,7 @@ export function copyFiles(matchers: Array<FileMatcher> | null, transformer: File
return await copyOrLinkFile(matcher.from, path.join(matcher.to, path.basename(matcher.from)), fromStat, isUseHardLink)
}

await ensureDir(path.dirname(matcher.to))
await mkdir(path.dirname(matcher.to), { recursive: true })
return await copyOrLinkFile(matcher.from, matcher.to, fromStat)
}

Expand Down
7 changes: 4 additions & 3 deletions packages/app-builder-lib/src/frameworks/LibUiFramework.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { chmod, emptyDir, ensureDir, rename, writeFile } from "fs-extra"
import { emptyDir } from "fs-extra"
import { mkdir, chmod, rename, writeFile } from "fs/promises"
import * as path from "path"
import { executeAppBuilder } from "builder-util"
import { AfterPackContext } from "../configuration"
Expand Down Expand Up @@ -57,8 +58,8 @@ export class LibUiFramework implements Framework {

private async prepareMacosApplicationStageDirectory(packager: MacPackager, options: PrepareApplicationStageDirectoryOptions) {
const appContentsDir = path.join(options.appOutDir, this.distMacOsAppName, "Contents")
await ensureDir(path.join(appContentsDir, "Resources"))
await ensureDir(path.join(appContentsDir, "MacOS"))
await mkdir(path.join(appContentsDir, "Resources"), { recursive: true })
await mkdir(path.join(appContentsDir, "MacOS"), { recursive: true })
await executeAppBuilder(["proton-native", "--node-version", this.version, "--platform", "darwin", "--stage", path.join(appContentsDir, "MacOS")])

const appPlist: any = {
Expand Down
4 changes: 2 additions & 2 deletions packages/app-builder-lib/src/publish/s3/BaseS3Publisher.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { log, executeAppBuilder } from "builder-util"
import { BaseS3Options } from "builder-util-runtime"
import { PublishContext, Publisher, UploadTask } from "electron-publish"
import { ensureDir, symlink } from "fs-extra"
import { mkdir, symlink } from "fs/promises"
import * as path from "path"

export abstract class BaseS3Publisher extends Publisher {
Expand Down Expand Up @@ -30,7 +30,7 @@ export abstract class BaseS3Publisher extends Publisher {

if (process.env.__TEST_S3_PUBLISHER__ != null) {
const testFile = path.join(process.env.__TEST_S3_PUBLISHER__!, target)
await ensureDir(path.dirname(testFile))
await mkdir(path.dirname(testFile), { recursive: true })
await symlink(task.file, testFile)
return
}
Expand Down
5 changes: 3 additions & 2 deletions packages/app-builder-lib/src/targets/fpm.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { path7za } from "7zip-bin"
import { Arch, executeAppBuilder, log, TmpDir, toLinuxArchString, use } from "builder-util"
import { unlinkIfExists } from "builder-util/out/fs"
import { ensureDir, outputFile, readFile } from "fs-extra"
import { outputFile } from "fs-extra"
import { mkdir, readFile } from "fs/promises"
import * as path from "path"
import { smarten } from "../appInfo"
import { Target } from "../core"
Expand Down Expand Up @@ -117,7 +118,7 @@ export default class FpmTarget extends Target {

await unlinkIfExists(artifactPath)
if (packager.packagerOptions.prepackaged != null) {
await ensureDir(this.outDir)
await mkdir(this.outDir, { recursive: true })
}

const scripts = await this.scriptFiles
Expand Down
7 changes: 4 additions & 3 deletions packages/app-builder-lib/src/util/appFileCopier.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import BluebirdPromise from "bluebird-lst"
import { AsyncTaskManager, log } from "builder-util"
import { CONCURRENCY, FileCopier, FileTransformer, Link, MAX_FILE_REQUESTS, statOrNull, walk } from "builder-util/out/fs"
import { ensureDir, readlink, Stats, symlink } from "fs-extra"
import { Stats } from "fs"
import { mkdir, readlink, symlink } from "fs/promises"
import * as path from "path"
import { isLibOrExe } from "../asar/unpackDetector"
import { Platform } from "../core"
Expand Down Expand Up @@ -68,7 +69,7 @@ export async function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager,
const fileParent = path.dirname(destinationFile)
if (!createdParentDirs.has(fileParent)) {
createdParentDirs.add(fileParent)
await ensureDir(fileParent)
await mkdir(fileParent, { recursive: true })
}

taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat))
Expand Down Expand Up @@ -218,7 +219,7 @@ async function compileUsingElectronCompile(mainFileSet: ResolvedFileSet, package
const electronCompileCache = await packager.tempDirManager.getTempDir({ prefix: "electron-compile-cache" })
const cacheDir = path.join(electronCompileCache, ".cache")
// clear and create cache dir
await ensureDir(cacheDir)
await mkdir(cacheDir, { recursive: true })
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
Expand Down
5 changes: 3 additions & 2 deletions packages/app-builder-lib/src/util/cacheManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { Arch, log } from "builder-util"
import { copyFile } from "builder-util/out/fs"
import { orNullIfFileNotExist } from "builder-util/out/promise"
import { Hash } from "crypto"
import { ensureDir, readFile, readJson, writeJson } from "fs-extra"
import { readJson, writeJson } from "fs-extra"
import { mkdir, readFile } from "fs/promises"
import * as path from "path"

export interface BuildCacheInfo {
Expand Down Expand Up @@ -63,7 +64,7 @@ export class BuildCacheManager {
}

try {
await ensureDir(this.cacheDir)
await mkdir(this.cacheDir, { recursive: true })
await Promise.all([writeJson(this.cacheInfoFile, this.cacheInfo), copyFile(this.executableFile, this.cacheFile, false)])
} catch (e) {
log.warn({ error: e.stack || e }, `cannot save build cache`)
Expand Down
8 changes: 5 additions & 3 deletions packages/builder-util/src/fs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import BluebirdPromise from "bluebird-lst"
import { access, chmod, copyFile as _nodeCopyFile, ensureDir, link, lstat, readdir, readlink, stat, Stats, symlink, unlink, writeFile } from "fs-extra"
import { copyFile as _nodeCopyFile } from "fs-extra"
import { Stats } from "fs"
import { access, chmod, mkdir, link, lstat, readdir, readlink, stat, symlink, unlink, writeFile } from "fs/promises"
import * as path from "path"
import { Mode } from "stat-mode"
import { log } from "./log"
Expand Down Expand Up @@ -137,7 +139,7 @@ export async function walk(initialDirPath: string, filter?: Filter | null, consu
const _isUseHardLink = process.platform !== "win32" && process.env.USE_HARD_LINKS !== "false" && (isCI || process.env.USE_HARD_LINKS === "true")

export function copyFile(src: string, dest: string, isEnsureDir = true) {
return (isEnsureDir ? ensureDir(path.dirname(dest)) : Promise.resolve()).then(() => copyOrLinkFile(src, dest, null, false))
return (isEnsureDir ? mkdir(path.dirname(dest), { recursive: true }) : Promise.resolve()).then(() => copyOrLinkFile(src, dest, null, false))
}

/**
Expand Down Expand Up @@ -288,7 +290,7 @@ export function copyDir(src: string, destination: string, options: CopyDirOption
}

if (!createdSourceDirs.has(parent)) {
await ensureDir(parent.replace(src, destination))
await mkdir(parent.replace(src, destination), { recursive: true })
createdSourceDirs.add(parent)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/dmg-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"js-yaml": "^4.1.0"
},
"optionalDependencies": {
"dmg-license": "^1.0.8"
"dmg-license": "^1.0.9"
},
"devDependencies": {
"@types/fs-extra": "^9.0.11",
Expand Down
6 changes: 3 additions & 3 deletions packages/electron-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@
"dmg-builder": "workspace:*",
"fs-extra": "^10.0.0",
"is-ci": "^3.0.0",
"lazy-val": "^1.0.4",
"lazy-val": "^1.0.5",
"read-config-file": "6.2.0",
"update-notifier": "^5.1.0",
"yargs": "^17.0.1"
},
"devDependencies": {
"@types/update-notifier": "^5.0.0",
"@types/fs-extra": "^9.0.11",
"@types/is-ci": "^3.0.0"
"@types/is-ci": "^3.0.0",
"@types/update-notifier": "^5.0.0"
},
"typings": "./out/index.d.ts",
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions packages/electron-builder/src/cli/create-self-signed-cert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { exec, log, spawn, TmpDir } from "builder-util"
import { unlinkIfExists } from "builder-util/out/fs"
import * as chalk from "chalk"
import { getSignVendorPath } from "app-builder-lib/out/codeSign/windowsCodeSign"
import { ensureDir } from "fs-extra"
import { mkdir } from "fs/promises"
import * as path from "path"

/** @internal */
Expand All @@ -17,7 +17,7 @@ export async function createSelfSignedCert(publisher: string) {
log.info(chalk.bold('When asked to enter a password ("Create Private Key Password"), please select "None".'))

try {
await ensureDir(path.dirname(tempPrefix))
await mkdir(path.dirname(tempPrefix), { recursive: true })
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])

Expand Down
2 changes: 1 addition & 1 deletion packages/electron-publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"builder-util-runtime": "workspace:*",
"chalk": "^4.1.1",
"fs-extra": "^10.0.0",
"lazy-val": "^1.0.4",
"lazy-val": "^1.0.5",
"mime": "^2.5.2"
},
"typings": "./out/publisher.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/electron-updater/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"out"
],
"dependencies": {
"@types/semver": "^7.3.5",
"@types/semver": "^7.3.6",
"builder-util-runtime": "workspace:*",
"fs-extra": "^10.0.0",
"js-yaml": "^4.1.0",
"lazy-val": "^1.0.4",
"lazy-val": "^1.0.5",
"lodash.escaperegexp": "^4.1.2",
"lodash.isequal": "^4.5.0",
"semver": "^7.3.5"
Expand Down
5 changes: 3 additions & 2 deletions packages/electron-updater/src/AppUpdater.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { AllPublishOptions, asArray, CancellationToken, newError, PublishConfiguration, UpdateInfo, UUID, DownloadOptions, CancellationError } from "builder-util-runtime"
import { randomBytes } from "crypto"
import { EventEmitter } from "events"
import { ensureDir, outputFile, readFile, rename, unlink } from "fs-extra"
import { outputFile } from "fs-extra"
import { mkdir, readFile, rename, unlink } from "fs/promises"
import { OutgoingHttpHeaders } from "http"
import { load } from "js-yaml"
import { Lazy } from "lazy-val"
Expand Down Expand Up @@ -581,7 +582,7 @@ export abstract class AppUpdater extends EventEmitter {

const downloadedUpdateHelper = await this.getOrCreateDownloadHelper()
const cacheDir = downloadedUpdateHelper.cacheDirForPendingUpdate
await ensureDir(cacheDir)
await mkdir(cacheDir, { recursive: true })
const updateFileName = getCacheUpdateFileName()
let updateFile = path.join(cacheDir, updateFileName)
const packageFile = packageInfo == null ? null : path.join(cacheDir, `package-${version}${path.extname(packageInfo.path) || ".7z"}`)
Expand Down
Loading

0 comments on commit c623279

Please sign in to comment.