当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript fs-extra-p.remove函数代码示例

本文整理汇总了TypeScript中fs-extra-p.remove函数的典型用法代码示例。如果您正苦于以下问题:TypeScript remove函数的具体用法?TypeScript remove怎么用?TypeScript remove使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了remove函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: buildInstaller

export async function buildInstaller(options: SquirrelOptions, outputDirectory: string, setupExe: string, packager: WinPackager, appOutDir: string) {
  const appUpdate = await packager.getTempFile("Update.exe")
  await BluebirdPromise.all([
    copy(path.join(options.vendorPath, "Update.exe"), appUpdate)
      .then(() => packager.sign(appUpdate)),
    BluebirdPromise.all([remove(`${outputDirectory.replace(/\\/g, "/")}/*-full.nupkg`), remove(path.join(outputDirectory, "RELEASES"))])
      .then(() => ensureDir(outputDirectory))
  ])

  if (options.remoteReleases) {
    await syncReleases(outputDirectory, options)
  }

  const embeddedArchiveFile = await packager.getTempFile("setup.zip")
  const embeddedArchive = archiver("zip", {zlib: {level: options.packageCompressionLevel == null ? 6 : options.packageCompressionLevel}})
  const embeddedArchiveOut = createWriteStream(embeddedArchiveFile)
  const embeddedArchivePromise = new BluebirdPromise(function (resolve, reject) {
    embeddedArchive.on("error", reject)
    embeddedArchiveOut.on("close", resolve)
  })
  embeddedArchive.pipe(embeddedArchiveOut)

  embeddedArchive.file(appUpdate, {name: "Update.exe"})
  embeddedArchive.file(options.loadingGif ? path.resolve(options.loadingGif) : path.join(__dirname, "..", "..", "templates", "install-spinner.gif"), {name: "background.gif"})

  const version = convertVersion(options.version)
  const packageName = `${options.name}-${version}-full.nupkg`
  const nupkgPath = path.join(outputDirectory, packageName)
  const setupPath = path.join(outputDirectory, setupExe || `${options.name || options.productName}Setup.exe`)

  await BluebirdPromise.all<any>([
    pack(options, appOutDir, appUpdate, nupkgPath, version, options.packageCompressionLevel),
    copy(path.join(options.vendorPath, "Setup.exe"), setupPath),
  ])

  embeddedArchive.file(nupkgPath, {name: packageName})

  const releaseEntry = await releasify(options, nupkgPath, outputDirectory, packageName)

  embeddedArchive.append(releaseEntry, {name: "RELEASES"})
  embeddedArchive.finalize()
  await embeddedArchivePromise

  const writeZipToSetup = path.join(options.vendorPath, "WriteZipToSetup.exe")
  await execWine(writeZipToSetup, [setupPath, embeddedArchiveFile])

  await packager.signAndEditResources(setupPath)
  if (options.msi && process.platform === "win32") {
    const outFile = setupExe.replace(".exe", ".msi")
    await msi(options, nupkgPath, setupPath, outputDirectory, outFile)
    // rcedit can only edit .exe resources
    await packager.sign(path.join(outputDirectory, outFile))
  }
}
开发者ID:heinzbeinz,项目名称:electron-builder,代码行数:54,代码来源:squirrelPack.ts

示例2: buildInstaller

  async buildInstaller(outFileNames: OutFileNames, appOutDir: string, outDir: string, arch: Arch) {
    const packager = this.packager
    const dirToArchive = await packager.info.tempDirManager.createTempDir({prefix: "squirrel-windows"})
    const outputDirectory = this.outputDirectory
    const options = this.options
    const appUpdate = path.join(dirToArchive, "Update.exe")
    await Promise.all([
      copyFile(path.join(options.vendorPath, "Update.exe"), appUpdate)
        .then(() => packager.sign(appUpdate)),
      Promise.all([remove(`${outputDirectory.replace(/\\/g, "/")}/*-full.nupkg`), remove(path.join(outputDirectory, "RELEASES"))])
        .then(() => ensureDir(outputDirectory))
    ])

    if (options.remoteReleases) {
      await syncReleases(outputDirectory, options)
    }

    const version = convertVersion(options.version)
    const nupkgPath = path.join(outputDirectory, outFileNames.packageFile)
    const setupPath = path.join(outputDirectory, outFileNames.setupFile)

    await Promise.all<any>([
      pack(options, appOutDir, appUpdate, nupkgPath, version, packager),
      copyFile(path.join(options.vendorPath, "Setup.exe"), setupPath),
      copyFile(options.loadingGif ? path.resolve(packager.projectDir, options.loadingGif) : path.join(options.vendorPath, "install-spinner.gif"), path.join(dirToArchive, "background.gif")),
    ])

    // releasify can be called only after pack nupkg and nupkg must be in the final output directory (where other old version nupkg can be located)
    await this.releasify(nupkgPath, outFileNames.packageFile)
      .then(it => writeFile(path.join(dirToArchive, "RELEASES"), it))

    const embeddedArchiveFile = await this.createEmbeddedArchiveFile(nupkgPath, dirToArchive)

    await execWine(path.join(options.vendorPath, "WriteZipToSetup.exe"), null, [setupPath, embeddedArchiveFile])

    await packager.signAndEditResources(setupPath, arch, outDir)
    if (options.msi && process.platform === "win32") {
      const outFile = outFileNames.setupFile.replace(".exe", ".msi")
      await msi(options, nupkgPath, setupPath, outputDirectory, outFile)
      // rcedit can only edit .exe resources
      await packager.sign(path.join(outputDirectory, outFile))
    }
  }
开发者ID:electron-userland,项目名称:electron-builder,代码行数:43,代码来源:squirrelPack.ts

示例3: async

 })(), async () => {
   if (dirToDelete != null) {
     try {
       await remove(dirToDelete)
     }
     catch (e) {
       console.warn(`Cannot delete temporary directory ${dirToDelete}: ${(e.stack || e)}`)
     }
   }
 })
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:10,代码来源:packTester.ts

示例4: assertPack

export async function assertPack(fixtureName: string, packagerOptions: PackagerOptions, checkOptions?: AssertPackOptions): Promise<void> {
  const tempDirCreated = checkOptions == null ? null : checkOptions.tempDirCreated
  const useTempDir = tempDirCreated != null || packagerOptions.devMetadata != null

  let projectDir = path.join(__dirname, "..", "..", "fixtures", fixtureName)
  // const isDoNotUseTempDir = platform === "darwin"
  const customTmpDir = process.env.TEST_APP_TMP_DIR
  if (useTempDir) {
    // non-osx test uses the same dir as osx test, but we cannot share node_modules (because tests executed in parallel)
    const dir = customTmpDir == null ? path.join(tmpdir(), `${tmpDirPrefix}${fixtureName}-${tmpDirCounter++}}`) : path.resolve(customTmpDir)
    if (customTmpDir != null) {
      console.log("Custom temp dir used: %s", customTmpDir)
    }
    await emptyDir(dir)
    await copy(projectDir, dir, {
      filter: it => {
        const basename = path.basename(it)
        return basename !== outDirName && basename !== "node_modules" && basename[0] !== "."
      }
    })
    projectDir = dir
  }

  try {
    if (tempDirCreated != null) {
      await tempDirCreated(projectDir)
    }

    await packAndCheck(projectDir, Object.assign({
      projectDir: projectDir,
      cscLink: CSC_LINK,
      cscKeyPassword: CSC_KEY_PASSWORD,
      cscInstallerLink: CSC_INSTALLER_LINK,
      cscInstallerKeyPassword: CSC_INSTALLER_KEY_PASSWORD,
      dist: true,
    }, packagerOptions), checkOptions)

    if (checkOptions != null && checkOptions.packed != null) {
      await checkOptions.packed(projectDir)
    }
  }
  finally {
    if (useTempDir && customTmpDir == null) {
      try {
        await remove(projectDir)
      }
      catch (e) {
        console.warn("Cannot delete temporary directory " + projectDir + ": " + (e.stack || e))
      }
    }
  }
}
开发者ID:GabeIsman,项目名称:electron-builder,代码行数:52,代码来源:packTester.ts

示例5: assertPack

export async function assertPack(fixtureName: string,
                                packagerOptions: PackagerOptions,
                                useTempDir?: boolean,
                                tempDirCreated?: (projectDir: string) => Promise<any>,
                                packed?: (projectDir: string) => Promise<any>) {
  let projectDir = path.join(__dirname, "..", "..", "fixtures", fixtureName)
  // const isDoNotUseTempDir = platform === "darwin"
  const customTmpDir = process.env.TEST_APP_TMP_DIR
  if (useTempDir) {
    // non-osx test uses the same dir as osx test, but we cannot share node_modules (because tests executed in parallel)
    const dir = customTmpDir == null ? path.join(tmpdir(), tmpDirPrefix + fixtureName + "-" + tmpDirCounter++) : path.resolve(customTmpDir)
    if (customTmpDir != null) {
      console.log("Custom temp dir used: %s", customTmpDir)
    }
    await emptyDir(dir)
    await copy(projectDir, dir, {
      filter: it => {
        const basename = path.basename(it)
        return basename !== "dist" && basename !== "node_modules" && basename[0] !== "."
      }
    })
    projectDir = dir
  }

  try {
    if (tempDirCreated != null) {
      await tempDirCreated(projectDir)
    }

    await packAndCheck(projectDir, Object.assign({
      projectDir: projectDir,
      cscLink: CSC_LINK,
      cscKeyPassword: CSC_KEY_PASSWORD,
      dist: true,
    }, packagerOptions))

    if (packed != null) {
      await packed(projectDir)
    }
  }
  finally {
    if (useTempDir && customTmpDir == null) {
      try {
        await remove(projectDir)
      }
      catch (e) {
        console.warn("Cannot delete temporary directory " + projectDir + ": " + (e.stack || e))
      }
    }
  }
}
开发者ID:EvgeneOskin,项目名称:electron-builder,代码行数:51,代码来源:packTester.ts

示例6: assertPack

export async function assertPack(fixtureName: string, packagerOptions: PackagerOptions, checkOptions?: AssertPackOptions): Promise<void> {
  const tempDirCreated = checkOptions == null ? null : checkOptions.tempDirCreated
  const useTempDir = tempDirCreated != null || packagerOptions.devMetadata != null || (checkOptions != null && checkOptions.useTempDir) || packagerOptions.targets.values().next().value.values().next().value[0] !== DEFAULT_TARGET

  let projectDir = path.join(__dirname, "..", "..", "fixtures", fixtureName)
  // const isDoNotUseTempDir = platform === "darwin"
  const customTmpDir = process.env.TEST_APP_TMP_DIR
  if (useTempDir) {
    // non-osx test uses the same dir as osx test, but we cannot share node_modules (because tests executed in parallel)
    const dir = customTmpDir == null ? path.join(tmpdir(), `${getTempName("electron-builder-test")}`) : path.resolve(customTmpDir)
    if (customTmpDir != null) {
      log(`Custom temp dir used: ${customTmpDir}`)
    }
    await emptyDir(dir)
    await copy(projectDir, dir, {
      filter: it => {
        const basename = path.basename(it)
        return basename !== outDirName && basename !== "node_modules" && basename[0] !== "."
      }
    })
    projectDir = dir
  }

  try {
    if (tempDirCreated != null) {
      await tempDirCreated(projectDir)
    }

    await packAndCheck(projectDir, Object.assign({
      projectDir: projectDir,
    }, packagerOptions), checkOptions)

    if (checkOptions != null && checkOptions.packed != null) {
      await checkOptions.packed(projectDir)
    }
  }
  finally {
    if (useTempDir && customTmpDir == null) {
      try {
        await remove(projectDir)
      }
      catch (e) {
        console.warn("Cannot delete temporary directory " + projectDir + ": " + (e.stack || e))
      }
    }
  }
}
开发者ID:SimplyAhmazing,项目名称:electron-builder,代码行数:47,代码来源:packTester.ts

示例7: remove

 projectDirCreated: it => remove(path.join(it, "build", "icons")),
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:1,代码来源:linuxPackagerTest.ts

示例8: remove

 projectDirCreated: projectDir => remove(path.join(projectDir, "build")),
开发者ID:electron-userland,项目名称:electron-builder,代码行数:1,代码来源:dmgTest.ts

示例9: remove

 }, {tempDirCreated: (projectDir) => remove(path.join(projectDir, "build", "icons"))})
开发者ID:GabeIsman,项目名称:electron-builder,代码行数:1,代码来源:linuxPackagerTest.ts

示例10: unlink

 projectDirCreated: projectDir => Promise.all([
   unlink(path.join(projectDir, "build", "icon.ico")),
   remove(path.join(projectDir, "build", "icons")),
 ]),
开发者ID:electron-userland,项目名称:electron-builder,代码行数:4,代码来源:winPackagerTest.ts


注:本文中的fs-extra-p.remove函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。