本文整理匯總了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`);
});