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


TypeScript shelljs.rm函数代码示例

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


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

示例1: it

  it("Extract File with folders", () => {
    let extractor = unrar.createExtractorFromFile("./testFiles/FolderTest.rar", "./tmp/", "1234");
    let [state, list] = extractor.extractAll();
    assert.deepStrictEqual(state, { state: "SUCCESS" });

    assert.deepStrictEqual(list!.files[0]!.fileHeader.name, "Folder1/Folder Space/long.txt");
    assert.deepStrictEqual(list!.files[1]!.fileHeader.name, "Folder1/Folder 中文/2中文.txt");
    assert.deepStrictEqual(list!.files[2]!.fileHeader.name, "Folder1/Folder Space");
    assert.deepStrictEqual(list!.files[3]!.fileHeader.name, "Folder1/Folder 中文");
    assert.deepStrictEqual(list!.files[4]!.fileHeader.name, "Folder1");

    let long = "", i = 0;
    while (long.length < 1024 * 1024) {
      long += "1" + "0".repeat(i++);
    }
    assert.equal(fs.readFileSync("./tmp/Folder1/Folder Space/long.txt", "utf-8"), long);

    shjs.rm("-rf", "./tmp");

  });
开发者ID:YuJianrong,项目名称:nodejs-unrar,代码行数:20,代码来源:fileExtractor.spec.ts

示例2: done

                fs.stat(candidate, (err, stats) => {
                    if (err) {
                        done(null);
                        return;
                    }

                    if (stats.isDirectory()) {
                        done(null);
                        return;
                    }

                    var fileAgeSeconds = (new Date().getTime() - stats.mtime.getTime()) / 1000;
                    if (fileAgeSeconds > _that.ageSeconds) {
                        ++delCount;
                        _that.emitter.emit('deleted', candidate);
                        shell.rm(candidate);
                    }                    

                    // ignoring errors - log and keep going
                    done(null);
                })
开发者ID:itsananderson,项目名称:vso-agent,代码行数:21,代码来源:diagnostics.ts

示例3: copyTnsModules

	private async copyTnsModules(platform: string, platformData: IPlatformData, projectData: IProjectData, appFilesUpdaterOptions: IAppFilesUpdaterOptions, projectFilesConfig?: IProjectFilesConfig): Promise<void> {
		const appDestinationDirectoryPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME);
		const lastModifiedTime = this.$fs.exists(appDestinationDirectoryPath) ? this.$fs.getFsStats(appDestinationDirectoryPath).mtime : null;

		try {
			const absoluteOutputPath = path.join(appDestinationDirectoryPath, constants.TNS_MODULES_FOLDER_NAME);
			// Process node_modules folder
			await this.$nodeModulesBuilder.prepareJSNodeModules({
				absoluteOutputPath,
				platform,
				lastModifiedTime,
				projectData,
				appFilesUpdaterOptions,
				projectFilesConfig
			});
		} catch (error) {
			this.$logger.debug(error);
			shell.rm("-rf", appDestinationDirectoryPath);
			this.$errors.failWithoutHelp(`Processing node_modules failed. ${error}`);
		}
	}
开发者ID:NathanaelA,项目名称:nativescript-cli,代码行数:21,代码来源:prepare-platform-js-service.ts

示例4: return

		return (() => {
			platform = platform.toLowerCase();
			this.ensurePlatformInstalled(platform).wait();

			let platformData = this.$platformsData.getPlatformData(platform);
			platformData.platformProjectService.ensureConfigurationFileInAppResources().wait();
			let appDestinationDirectoryPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME);
			let lastModifiedTime = this.$fs.exists(appDestinationDirectoryPath).wait() ?
				this.$fs.getFsStats(appDestinationDirectoryPath).wait().mtime : null;

			// Copy app folder to native project
			this.$fs.ensureDirectoryExists(appDestinationDirectoryPath).wait();
			let appSourceDirectoryPath = path.join(this.$projectData.projectDir, constants.APP_FOLDER_NAME);

			// Delete the destination app in order to prevent EEXIST errors when symlinks are used.
			let contents = this.$fs.readDirectory(appDestinationDirectoryPath).wait();

			_(contents)
				.filter(directoryName => directoryName !== constants.TNS_MODULES_FOLDER_NAME)
				.each(directoryName => this.$fs.deleteDirectory(path.join(appDestinationDirectoryPath, directoryName)).wait())
				.value();

			// Copy all files from app dir, but make sure to exclude tns_modules
			let sourceFiles = this.$fs.enumerateFilesInDirectorySync(appSourceDirectoryPath, null, { includeEmptyDirectories: true });

			if (this.$options.release) {
				let testsFolderPath = path.join(appSourceDirectoryPath, 'tests');
				sourceFiles = sourceFiles.filter(source => source.indexOf(testsFolderPath) === -1);
			}

			let hasTnsModulesInAppFolder = this.$fs.exists(path.join(appSourceDirectoryPath, constants.TNS_MODULES_FOLDER_NAME)).wait();
			if (hasTnsModulesInAppFolder && this.$projectData.dependencies && this.$projectData.dependencies[constants.TNS_CORE_MODULES_NAME]) {
				this.$logger.warn("You have tns_modules dir in your app folder and tns-core-modules in your package.json file. Tns_modules dir in your app folder will not be used and you can safely remove it.");
				sourceFiles = sourceFiles.filter(source => !minimatch(source, `**/${constants.TNS_MODULES_FOLDER_NAME}/**`, { nocase: true }));
			}

			// verify .xml files are well-formed
			this.$xmlValidator.validateXmlFiles(sourceFiles).wait();

			// Remove .ts and .js.map files
			constants.LIVESYNC_EXCLUDED_FILE_PATTERNS.forEach(pattern => sourceFiles = sourceFiles.filter(file => !minimatch(file, pattern, { nocase: true })));
			let copyFileFutures = sourceFiles.map(source => {
				let destinationPath = path.join(appDestinationDirectoryPath, path.relative(appSourceDirectoryPath, source));
				if (this.$fs.getFsStats(source).wait().isDirectory()) {
					return this.$fs.createDirectory(destinationPath);
				}
				return this.$fs.copyFile(source, destinationPath);
			});
			Future.wait(copyFileFutures);

			// Copy App_Resources to project root folder
			this.$fs.ensureDirectoryExists(platformData.platformProjectService.getAppResourcesDestinationDirectoryPath().wait()).wait(); // Should be deleted
			let appResourcesDirectoryPath = path.join(appDestinationDirectoryPath, constants.APP_RESOURCES_FOLDER_NAME);
			if (this.$fs.exists(appResourcesDirectoryPath).wait()) {
				platformData.platformProjectService.prepareAppResources(appResourcesDirectoryPath).wait();
				shell.cp("-Rf", path.join(appResourcesDirectoryPath, platformData.normalizedPlatformName, "*"), platformData.platformProjectService.getAppResourcesDestinationDirectoryPath().wait());
				this.$fs.deleteDirectory(appResourcesDirectoryPath).wait();
			}

			platformData.platformProjectService.prepareProject().wait();

			let appDir = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME);
			try {
				let tnsModulesDestinationPath = path.join(appDir, constants.TNS_MODULES_FOLDER_NAME);
				if (!this.$options.bundle) {
					// Process node_modules folder
					this.$broccoliBuilder.prepareNodeModules(tnsModulesDestinationPath, platform, lastModifiedTime).wait();
				} else {
					// Clean target node_modules folder. Not needed when bundling.
					this.$broccoliBuilder.cleanNodeModules(tnsModulesDestinationPath, platform);
				}
			} catch (error) {
				this.$logger.debug(error);
				shell.rm("-rf", appDir);
				this.$errors.failWithoutHelp(`Processing node_modules failed. ${error}`);
			}

			// Process platform specific files
			let directoryPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME);
			let excludedDirs = [constants.APP_RESOURCES_FOLDER_NAME];
			this.$projectFilesManager.processPlatformSpecificFiles(directoryPath, platform, excludedDirs).wait();

			this.applyBaseConfigOption(platformData).wait();

			// Process configurations files from App_Resources
			platformData.platformProjectService.processConfigurationFilesFromAppResources().wait();

			// Replace placeholders in configuration files
			platformData.platformProjectService.interpolateConfigurationFile().wait();

			this.$logger.out("Project successfully prepared");
			return true;
		}).future<boolean>()();
开发者ID:Emat12,项目名称:nativescript-cli,代码行数:93,代码来源:platform-service.ts

示例5: deleteFile

	public async deleteFile(deviceFilePath: string, appIdentifier: string): Promise<void> {
		shelljs.rm("-rf", deviceFilePath);
	}
开发者ID:NativeScript,项目名称:nativescript-cli,代码行数:3,代码来源:ios-simulator-file-system.ts

示例6: rm

 ['index.html', 'foo.js', 'foo/index.html', 'foo'].forEach(relFilePath => {
   const absFilePath = path.join(AIO_BUILDS_DIR, relFilePath);
   rm('-r', absFilePath);
 });
开发者ID:DeepanParikh,项目名称:angular,代码行数:4,代码来源:nginx.e2e.ts

示例7: usage

  console.error(
    `Folder ${folder} not found at ${path.join(process.cwd(), folder)}`
  );
  usage(true);
}

// Define template html, user's first, otherwise default
let template = path.join(folder, templateFilename);
if (!sh.test("-e", template)) {
  template = path.join(__dirname, defaultFolder, templateFilename);
}
const tpl = sh.cat(template);

// Prepare output folder (create, clean, copy sources)
sh.mkdir("-p", output);
sh.rm("-rf", output + "/*");
sh.cp("-R", folder + "/*", output);

// Start processing. Outline:
//
// 1. Get all files
// 2. Sort them
// 3. Group them hierachically
// 4. Parse files and generate output html files

sh.cd(output);
const all = sh.find("*");

const mds = all
  .filter(file => file.match(mdR))
  .sort(sortByPreferences.bind(null, preferences))
开发者ID:joakin,项目名称:markdown-folder-to-html,代码行数:31,代码来源:cli.ts

示例8: afterEach

 afterEach(function() {
     sh.rm("-r", configDir);
 });
开发者ID:textlint,项目名称:textlint,代码行数:3,代码来源:config-initializer-test.ts

示例9: stop

export function stop() {
	if (shell.test('-f', _pidPath)) {
		shell.rm(_pidPath);
	}
}
开发者ID:ElleCox,项目名称:vso-agent,代码行数:5,代码来源:heartbeat.ts

示例10: afterEach

 afterEach(() => shx.rm('-r', tmpDir));
开发者ID:Cammisuli,项目名称:angular,代码行数:1,代码来源:no_template_variable_assignment_rule_spec.ts


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