本文整理匯總了TypeScript中shelljs.mkdir函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript mkdir函數的具體用法?TypeScript mkdir怎麽用?TypeScript mkdir使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了mkdir函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('codecoverage.publish : publish code coverage files with additional files having same file name', function(done) {
this.timeout(2000);
var additionalFileDirectory = path.join(shell.tempdir(), "files");
var duplicateDirectory = path.join(additionalFileDirectory, "duplicate");
shell.mkdir('-p', additionalFileDirectory);
shell.mkdir('-p', duplicateDirectory);
shell.cp('-f', path.resolve(__dirname, './codecoveragefiles/jacoco.xml'), additionalFileDirectory);
shell.cp('-f', path.resolve(__dirname, './codecoveragefiles/jacoco.xml'), duplicateDirectory);
var properties: { [name: string]: string } = { "summaryfile": coberturaSummaryFile, "codecoveragetool": "Cobertura", "reportdirectory": "", "additionalcodecoveragefiles": path.join(additionalFileDirectory, "jacoco.xml") + "," + path.join(duplicateDirectory, "jacoco.xml") };
var command: cm.ITaskCommand = new tc.TestCommand(null, null, null);
command.properties = properties;
var coberturaSummaryReader = new csr.CoberturaSummaryReader(command);
var jobInfo = new jobInf.TestJobInfo({});
jobInfo.variables = { "agent.workingDirectory": __dirname, "build.buildId": "1" };
testExecutionContext = new tec.TestExecutionContext(jobInfo);
var codeCoveragePublishCommand = new cpc.CodeCoveragePublishCommand(testExecutionContext, command);
codeCoveragePublishCommand.runCommandAsync().then(function(result) {
assert(testExecutionContext.service.jobsCompletedSuccessfully(), 'CodeCoveragePublish Task Failed! Details : ' + testExecutionContext.service.getRecordsString());
assert(testExecutionContext.service.containerItems.length == 3);
assert(testExecutionContext.service.artifactNames.length == 2);
assert(testExecutionContext.service.artifactNames[0] == "Code Coverage Report_1");
assert(testExecutionContext.service.artifactNames[1] == "Code Coverage Files_1");
assert(result);
done();
},
function(err) {
assert(false, 'CodeCoveragePublish Task Failed! Details : ' + err.message);
done();
});
})
示例2: copyFile
function copyFile(file: string, baseDir: string, relative = '.') {
const dir = path.join(baseDir, relative);
shx.mkdir('-p', dir);
shx.cp(file, dir);
// Double-underscore is used to escape forward slash in FESM filenames.
// See ng_package.bzl:
// fesm_output_filename = entry_point.replace("/", "__")
// We need to unescape these.
if (file.indexOf('__') >= 0) {
const outputPath = path.join(dir, ...path.basename(file).split('__'));
shx.mkdir('-p', path.dirname(outputPath));
shx.mv(path.join(dir, path.basename(file)), outputPath);
}
}
示例3: relative
bundle.src.program.getSourceFiles().forEach(sourceFile => {
if (!sourceFile.isDeclarationFile) {
const relativePath = relative(entryPointPath, sourceFile.fileName);
const newFilePath = join(newDir, relativePath);
mkdir('-p', dirname(newFilePath));
cp(sourceFile.fileName, newFilePath);
}
});
示例4: return
return (() => {
this.$logger.trace(`Transferring from ${localFilePath} to ${deviceFilePath}`);
if (this.$fs.getFsStats(localFilePath).wait().isDirectory()) {
shelljs.mkdir(deviceFilePath);
} else {
shelljs.cp("-f", localFilePath, deviceFilePath);
}
}).future<void>()();
示例5: writeFile
writeFile(file: FileInfo): void {
mkdir('-p', dirname(file.path));
const backPath = file.path + '.bak';
if (existsSync(file.path) && !existsSync(backPath)) {
mv(file.path, backPath);
}
writeFileSync(file.path, file.contents, 'utf8');
}
示例6: copyAssets
export function copyAssets(env: BuildEnv): void {
signale.await('Copy assets')
const dir = 'build/dist'
shelljs.rm('-rf', dir)
shelljs.mkdir('-p', dir)
shelljs.cp('-R', 'src/extension/assets/*', dir)
shelljs.cp('-R', 'src/extension/views/*', dir)
signale.success('Assets copied')
}
示例7: constructor
constructor(level: cm.DiagnosticLevel, fullPath: string, fileName: string) {
this.level = level;
shell.mkdir('-p', fullPath);
shell.chmod(775, fullPath);
// TODO: handle failure cases. It throws - Error: ENOENT, open '/nopath/somefile.log'
// we probably shouldn't handle - fail to start with good error - better than silence ...
this._fd = fs.openSync(path.join(fullPath, fileName), 'a'); // append, create if not exist
}
示例8: loadSchema
export async function loadSchema() {
const projectDefinition = JSON.parse(await fs.readFile(`${PROJECT_CWD}/package.json`));
const protoDir = projectDefinition["apiSchema"];
shelljs.mkdir("-p", `${__dirname}/../project`);
await generateSchemaJS(protoDir);
await gtenerateDefinition();
}
示例9: mkdir
fs.readFile(source, (err, data) => {
if (err) reject(err);
mkdir('-p', path.dirname(target));
fs.writeFile(target, data, (err2) => {
if (err2) reject(err2);
console.log('%s -> %s', source, target);
resolve(true);
});
});
示例10: copyFile
function copyFile(file: string, baseDir: string, relative = '.') {
const dir = path.join(baseDir, relative);
shx.mkdir('-p', dir);
shx.cp(file, dir);
// Double-underscore is used to escape forward slash in FESM filenames.
// See ng_package.bzl:
// fesm_output_filename = entry_point.replace("/", "__")
// We need to unescape these.
if (file.indexOf('__') >= 0) {
const outputPath = path.join(dir, ...path.basename(file).split('__'));
shx.mkdir('-p', path.dirname(outputPath));
shx.mv(path.join(dir, path.basename(file)), outputPath);
// if we are renaming the .js file, we'll also need to update the sourceMappingURL in the file
if (file.endsWith('.js')) {
shx.chmod('+w', outputPath);
shx.sed('-i', `${path.basename(file)}.map`, `${path.basename(outputPath)}.map`, outputPath);
}
}
}
示例11: writeFile
protected writeFile(file: FileInfo, entryPointPath: AbsoluteFsPath, newDir: AbsoluteFsPath):
void {
if (isDtsPath(file.path.replace(/\.map$/, ''))) {
// This is either `.d.ts` or `.d.ts.map` file
super.writeFileAndBackup(file);
} else {
const relativePath = relative(entryPointPath, file.path);
const newFilePath = join(newDir, relativePath);
mkdir('-p', dirname(newFilePath));
writeFileSync(newFilePath, file.contents, 'utf8');
}
}
示例12: writeFileAndBackup
protected writeFileAndBackup(file: FileInfo): void {
mkdir('-p', dirname(file.path));
const backPath = file.path + '.__ivy_ngcc_bak';
if (existsSync(backPath)) {
throw new Error(
`Tried to overwrite ${backPath} with an ngcc back up file, which is disallowed.`);
}
if (existsSync(file.path)) {
mv(file.path, backPath);
}
writeFileSync(file.path, file.contents, 'utf8');
}
示例13: constructor
constructor($errors: IErrors,
$staticConfig: IStaticConfig,
$hostInfo: IHostInfo) {
super({
ipa: { type: OptionType.String },
frameworkPath: { type: OptionType.String },
frameworkName: { type: OptionType.String },
framework: { type: OptionType.String },
frameworkVersion: { type: OptionType.String },
copyFrom: { type: OptionType.String },
linkTo: { type: OptionType.String },
symlink: { type: OptionType.Boolean },
forDevice: { type: OptionType.Boolean },
client: { type: OptionType.Boolean, default: true},
production: { type: OptionType.Boolean },
debugTransport: {type: OptionType.Boolean},
keyStorePath: { type: OptionType.String },
keyStorePassword: { type: OptionType.String,},
keyStoreAlias: { type: OptionType.String },
keyStoreAliasPassword: { type: OptionType.String },
ignoreScripts: {type: OptionType.Boolean },
tnsModulesVersion: { type: OptionType.String },
compileSdk: {type: OptionType.Number },
port: { type: OptionType.Number },
copyTo: { type: OptionType.String },
baseConfig: { type: OptionType.String },
platformTemplate: { type: OptionType.String },
ng: {type: OptionType.Boolean },
tsc: {type: OptionType.Boolean },
bundle: {type: OptionType.Boolean },
all: {type: OptionType.Boolean },
teamId: { type: OptionType.String }
},
path.join($hostInfo.isWindows ? process.env.AppData : path.join(osenv.home(), ".local/share"), ".nativescript-cli"),
$errors, $staticConfig);
// On Windows we moved settings from LocalAppData to AppData. Move the existing file to keep the existing settings
// I guess we can remove this code after some grace period, say after 1.7 is out
if ($hostInfo.isWindows) {
try {
let shelljs = require("shelljs"),
oldSettings = path.join(process.env.LocalAppData, ".nativescript-cli", "user-settings.json"),
newSettings = path.join(process.env.AppData, ".nativescript-cli", "user-settings.json");
if (shelljs.test("-e", oldSettings) && !shelljs.test("-e", newSettings)) {
shelljs.mkdir(path.join(process.env.AppData, ".nativescript-cli"));
shelljs.mv(oldSettings, newSettings);
}
} catch (err) {
// ignore the error - it is too early to use $logger here
}
}
}
示例14: return
return () => {
signale.await(`Building the ${title} ${env} bundle`)
copyDist(buildDir)
const zipDest = path.resolve(process.cwd(), `${BUILDS_DIR}/bundles/${browserBundleZips[browser]}`)
if (zipDest) {
shelljs.mkdir('-p', `./${BUILDS_DIR}/bundles`)
shelljs.exec(`cd ${buildDir} && zip -q -r ${zipDest} *`)
}
signale.success(`Done building the ${title} ${env} bundle`)
}
示例15: moveBundleIndex
allsrcs.filter(filter('.d.ts')).forEach((f: string) => {
const content = fs.readFileSync(f, {encoding: 'utf-8'})
// Strip the named AMD module for compatibility with non-bazel users
.replace(/^\/\/\/ <amd-module name=.*\/>\n/, '');
let outputPath: string;
if (f.endsWith('.bundle_index.d.ts')) {
outputPath = moveBundleIndex(f);
} else {
outputPath = path.join(out, path.relative(binDir, f));
}
shx.mkdir('-p', path.dirname(outputPath));
fs.writeFileSync(outputPath, content);
});