本文整理汇总了TypeScript中shelljs.cd函数的典型用法代码示例。如果您正苦于以下问题:TypeScript cd函数的具体用法?TypeScript cd怎么用?TypeScript cd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cd函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: withAfterEach
withAfterEach(async t => {
shell.cd('test/assets');
shell.ln('-s', 'foo.txt', 'bar.txt');
shell.cd('../..');
const { stderr } = shell.exec('node dist/src/cp-cli -d test/assets out');
t.equal(stderr, '');
let stats = await fse.stat('out/foo.txt');
t.true(stats.isFile());
stats = await fse.stat('out/bar.txt');
t.true(stats.isFile());
t.false(stats.isSymbolicLink());
}),
示例2: constructor
constructor (public name) {
shell.exec(`git clone git@github.com:vecbralis/meants-public.git ${name}`);
shell.cd(name);
shell.exec('npm install');
}
示例3: function
function (plugin, done) {
ctx.info('Running beforeJob for : ' + plugin.pluginName() + ', ' + plugin.beforeId);
ctx.writeConsoleSection('Running ' + plugin.pluginName());
var logDescr = 'Plugin beforeJob:' + plugin.pluginName();
var pluginCtx: ctxm.PluginContext = new ctxm.PluginContext(ctx.job,
ctx.authHandler,
plugin.beforeId,
ctx.service,
wkCtx);
pluginCtx.on('message', function (message) {
ctx.service.queueConsoleLine(message);
});
shell.cd(pluginCtx.buildDirectory);
ctx.setTaskStarted(plugin.beforeId, plugin.pluginName());
plugin.beforeJob(pluginCtx, function (err) {
if (err) {
ctx.setTaskResult(plugin.beforeId, plugin.pluginName(), ifm.TaskResult.Failed);
ctx.error(err);
pluginCtx.end();
done(err);
return;
}
ctx.setTaskResult(plugin.beforeId, plugin.pluginName(), ifm.TaskResult.Succeeded);
ctx.info('Done beforeJob for : ' + plugin.pluginName());
pluginCtx.end();
done(null);
});
},
示例4: beforeEach
beforeEach(() => {
runner = new SchematicTestRunner('test', require.resolve('../migrations.json'));
host = new TempScopedNodeJsSyncHost();
tree = new UnitTestTree(new HostTree(host));
writeFile('/tsconfig.json', JSON.stringify({
compilerOptions: {
lib: ['es2015'],
}
}));
warnOutput = [];
runner.logger.subscribe(logEntry => {
if (logEntry.level === 'warn') {
warnOutput.push(logEntry.message);
}
});
previousWorkingDir = shx.pwd();
tmpDirPath = getSystemPath(host.root);
// Switch into the temporary directory path. This allows us to run
// the schematic against our custom unit test tree.
shx.cd(tmpDirPath);
});
示例5: beforeEach
beforeEach(() => {
runner = new SchematicTestRunner('test', require.resolve('../migrations.json'));
host = new TempScopedNodeJsSyncHost();
tree = new UnitTestTree(new HostTree(host));
writeFile('/tsconfig.json', JSON.stringify({
compilerOptions: {
lib: ['es2015'],
}
}));
writeFile('/angular.json', JSON.stringify({
projects: {t: {architect: {build: {options: {tsConfig: './tsconfig.json'}}}}}
}));
previousWorkingDir = shx.pwd();
tmpDirPath = getSystemPath(host.root);
// Switch into the temporary directory path. This allows us to run
// the schematic against our custom unit test tree.
shx.cd(tmpDirPath);
});
示例6: p
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {fixmeIvy, ivyEnabled, obsoleteInIvy} from '@angular/private/testing';
import * as path from 'path';
import * as shx from 'shelljs';
// Resolve the "npm_package" directory by using the runfile resolution. Note that we need to
// resolve the "package.json" of the package since otherwise NodeJS would resolve the "main"
// file, which is not necessarily at the root of the "npm_package".
shx.cd(path.dirname(require.resolve('angular/packages/core/npm_package/package.json')));
/**
* Utility functions that allows me to create fs paths
* p`${foo}/some/${{bar}}/path` rather than path.join(foo, 'some',
*/
function p(templateStringArray: TemplateStringsArray) {
const segments = [];
for (const entry of templateStringArray) {
segments.push(...entry.split('/').filter(s => s !== ''));
}
return path.join(...segments);
}
describe('@angular/core ng_package', () => {
describe('misc root files', () => {
示例7: describe
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import * as fs from 'fs';
import * as path from 'path';
import * as shx from 'shelljs';
shx.cd(path.join(process.env['TEST_SRCDIR'] !, 'angular', 'packages', 'common', 'npm_package'));
describe('@angular/common ng_package', () => {
describe('should have the locales files', () => {
it('/locales', () => {
const files = shx.ls('locales').stdout.split('\n');
expect(files.some(n => n.endsWith('.d.ts'))).toBe(true, `.d.ts files don't exist`);
expect(files.some(n => n.endsWith('.js'))).toBe(true, `.js files don't exist`);
});
it('/locales/extra', () => {
const files = shx.ls('locales/extra').stdout.split('\n');
expect(files.some(n => n.endsWith('.d.ts'))).toBe(true, `.d.ts files don't exist`);
expect(files.some(n => n.endsWith('.js'))).toBe(true, `.js files don't exist`);
});
// regression test for https://github.com/angular/angular/issues/23217
// Note, we don't have an e2e test that covers this
it('doesn\'t pass require in a way that breaks webpack static analysis',
() => { expect(shx.cat('locales/fr.js')).not.toContain('factory(require, exports)'); });
});
示例8: require
const { readFileSync } = require("fs")
const url = require("url")
let repoUrl
let pkg = JSON.parse(readFileSync("package.json") as any)
if (typeof pkg.repository === "object") {
if (!pkg.repository.hasOwnProperty("url")) {
throw new Error("URL does not exist in repository section")
}
repoUrl = pkg.repository.url
} else {
repoUrl = pkg.repository
}
let parsedUrl = url.parse(repoUrl)
let repository = (parsedUrl.host || "") + (parsedUrl.path || "")
let ghToken = process.env.GH_TOKEN
echo("Deploying docs!!!")
cd("dist/docs")
touch(".nojekyll")
exec("git init")
exec("git add .")
exec('git config user.name "adnan1994"')
exec('git config user.email "adnan.naeem@blueeast.com"')
exec('git commit -m "docs(docs): update gh-pages"')
exec(
`git push --force --quiet "https://${ghToken}@${repository}" master:gh-pages`
)
echo("Docs deployed!!")