本文整理汇总了TypeScript中shelljs.grep函数的典型用法代码示例。如果您正苦于以下问题:TypeScript grep函数的具体用法?TypeScript grep怎么用?TypeScript grep使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了grep函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should have its module resolution mappings defined in the nested package.json', () => {
const packageJson = p `testing/package.json`;
expect(shx.grep('"main":', packageJson)).toContain(`../bundles/core-testing.umd.js`);
expect(shx.grep('"module":', packageJson)).toContain(`../esm5/testing.js`);
expect(shx.grep('"es2015":', packageJson)).toContain(`../esm2015/testing.js`);
expect(shx.grep('"typings":', packageJson)).toContain(`./testing.d.ts`);
});
示例2: replaceVersionPlaceholders
function replaceVersionPlaceholders(filePath: string) {
if (stampData) {
const version = shx.grep('BUILD_SCM_VERSION', stampData).split(' ')[1].trim();
return shx.sed(/0.0.0-PLACEHOLDER/, version, filePath);
}
return shx.cat(filePath);
}
示例3: replaceVersionPlaceholders
function replaceVersionPlaceholders(filePath: string, content: string) {
if (stampData) {
const version = shx.grep('BUILD_SCM_VERSION', stampData).split(' ')[1].trim();
// Split the replacement into separate strings so we don't match it while publishing
return content.replace(
new RegExp(
'0.0.0' +
'-PLACEHOLDER',
'g'),
version);
}
return content;
}
示例4: it
it('should have the correct source map paths', () => {
expect(shx.grep('sourceMappingURL', 'fesm5/common.js'))
.toMatch('//# sourceMappingURL=common.js.map');
expect(shx.grep('sourceMappingURL', 'fesm2015/common.js'))
.toMatch('//# sourceMappingURL=common.js.map');
expect(shx.grep('sourceMappingURL', 'fesm5/http.js'))
.toMatch('//# sourceMappingURL=http.js.map');
expect(shx.grep('sourceMappingURL', 'fesm2015/http.js'))
.toMatch('//# sourceMappingURL=http.js.map');
expect(shx.grep('sourceMappingURL', 'fesm5/http/testing.js'))
.toMatch('//# sourceMappingURL=testing.js.map');
expect(shx.grep('sourceMappingURL', 'fesm2015/http/testing.js'))
.toMatch('//# sourceMappingURL=testing.js.map');
expect(shx.grep('sourceMappingURL', 'fesm5/testing.js'))
.toMatch('//# sourceMappingURL=testing.js.map');
expect(shx.grep('sourceMappingURL', 'fesm2015/testing.js'))
.toMatch('//# sourceMappingURL=testing.js.map');
expect(shx.grep('sourceMappingURL', 'fesm5/upgrade.js'))
.toMatch('//# sourceMappingURL=upgrade.js.map');
expect(shx.grep('sourceMappingURL', 'fesm2015/upgrade.js'))
.toMatch('//# sourceMappingURL=upgrade.js.map');
});
示例5: it
it('should contain correct version number with the PLACEHOLDER string replaced', () => {
expect(shx.grep('"version":', packageJson)).toMatch(/\d+\.\d+\.\d+(?!-PLACEHOLDER)/);
});
示例6: expect
() => { expect(shx.grep('"name":', packageJson)).toContain(`@angular/core`); });
示例7: it
it('should contain module resolution mappings', () => {
expect(shx.grep('"main":', packageJson)).toContain(`dist/zone-node.js`);
});