• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript glob类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: glob

env.app.dirs.subscribers.forEach((pattern) => {
    glob(pattern, (err: any, files: Array<string>) => {
        for (const file of files) {
            require(file);
        }
    });
});
开发者ID:LogansUA,项目名称:jest-import-error,代码行数:7,代码来源:app.ts


示例2: task

task('e2e.bundle', (done) => {
  let includeGlob = `${DIST_E2E_ROOT}/components/*/test/*/entry.js`;
  let folderInfo = getFolderInfo();
  if (folderInfo.componentName && folderInfo.componentTest) {
    includeGlob = `${DIST_E2E_ROOT}/components/${folderInfo.componentName}/test/${folderInfo.componentTest}/entry.js`;
  }
  glob(includeGlob, {}, function(er, files) {
    var directories = files.map(function(file) {
      return dirname(file);
    });

    let indexFileContents = directories.map(function(dir) {
      let testName = dir.replace(`${DIST_E2E_ROOT}/components/`, '');
      let fileName = dir.replace(`${PROJECT_ROOT}`, '');
      return `<p><a href="${fileName}/index.html">${testName}</a></p>`;
    }, []);

    writeFileSync(`${DIST_E2E_ROOT}/index.html`,
      '<!DOCTYPE html><html lang="en"><head></head><body style="width: 500px; margin: 100px auto">\n' +
      indexFileContents.join('\n') +
      '</center></body></html>'
    );

    createBundles(files).then(() => {
      done();
    }).catch(err => {
      done(err);
    });
  });
});
开发者ID:dioxmio,项目名称:ionic,代码行数:30,代码来源:e2e.ts


示例3: constructor

 constructor() {
     this._basename = basename(module.filename).toLowerCase();
     let db = DbConfig;
     // let dbConfig = configs.getDatabaseConfig();
     // if (dbConfig.logging) {
     //     dbConfig.logging = logger.info;
     // }
     //(SequelizeStatic as any).cls = cls.createNamespace("sequelize-transaction");
     this._sequelize = new SequelizeStatic(db.Database, db.UserName, db.Password, db.Options);
     this._models = ({} as any);
     let modelPattern = join(__dirname, '../Modules', '/**/*.Model.js');
     console.log(modelPattern);
     glob(modelPattern, (err: Error, files: string[]): void => {
         if (err) {
             console.error(err);
         }
         console.log(files);
         files.forEach((file: string) => {
             let model = this._sequelize.import(file);
             (this._models as any)[(model as any).name] = model;
         });
         Object.keys(this._models)
             .forEach((modelName: string) => {
                 if (typeof (this._models as any)[modelName].associate === 'function') {
                     (this._models as any)[modelName].associate(this._models);
                 }
             });
     });
     //this._sequelize.sync(); //TODO: Creating Table -  RND required.
 }
开发者ID:mission-io,项目名称:mission.api,代码行数:30,代码来源:Repository.ts


示例4: Promise

 return new Promise((resolve, reject) => {
   glob(pattern, options, function (err, files) {
     if (err) {
       return reject(err);
     }
     return resolve(files);
   });
 });
开发者ID:douglascvas,项目名称:springify,代码行数:8,代码来源:FileScanner.ts


示例5: Promise

 return new Promise((resolve, reject) => {
     glob(titleData.finalGlob, { silent: true, dot: true, cwd: directory, cache: cache || {} }, (err, files) => {
         if (err)
             reject(err);
         else
             resolve(files);
     });
 }).then((files: string[]) => {
开发者ID:kencinder,项目名称:steam-rom-manager,代码行数:8,代码来源:glob.parser.ts


示例6: Promise

 return new Promise((resolve, reject) => {
     glob(`${paths.sourceRoot}tasks/**/index.ts`, (err, matches) => {
         if(err){
             reject(err);
         }
         resolve(matches);
     });
 })
开发者ID:OctopusDeploy,项目名称:OctoTFS,代码行数:8,代码来源:webpack.config.ts


示例7: globMod

	return new Promise<string[]>((resolve: (result: string[]) => void, reject: (error: any) => void) => {
		globMod(pattern, opts || {}, (err: Error, files: string[]) => {
			if (err) {
				reject(err);
			} else {
				resolve(files);
			}
		});
	});
开发者ID:DefinitelyTyped,项目名称:definition-tester,代码行数:9,代码来源:util.ts


示例8: Promise

 return new Promise((resolve, reject) => {
   glob('**/*.ts', { ignore: blacklist }, (error, matches) => {
     if (error) {
       reject(error);
     } else {
       resolve(matches);
     }
   });
 });
开发者ID:AFASSoftware,项目名称:typescript-assistant,代码行数:9,代码来源:git.ts


示例9: Promise

 return new Promise((resolve, reject) => {
     glob(pattern, (err, matches) => {
         if(err){
             reject(err);
             return;
         }
         resolve(matches);
     })
 });
开发者ID:OctopusDeploy,项目名称:OctoTFS,代码行数:9,代码来源:inputs.ts


示例10: Promise

 return new Promise((resolve, reject) => {
   const mainGlob = join(DEMOS_SRC_ROOT, '**', 'main.ts');
   glob(mainGlob, (err: Error, matches: string[]) => {
     if (err) {
       return reject(err);
     }
     resolve(matches);
   });
 });
开发者ID:aggarwalankush,项目名称:ionic,代码行数:9,代码来源:demos.prod.ts


示例11: Promise

 return new Promise((resolve, reject) => {
   const mainGlob = join(SRC_COMPONENTS_ROOT, '*', 'test', '*', 'e2e.ts');
   glob(mainGlob, (err: Error, matches: string[]) => {
     if (err) {
       return reject(err);
     }
     resolve(matches);
   });
 });
开发者ID:Artfloriani,项目名称:ionic,代码行数:9,代码来源:e2e.prod.ts


示例12: Promise

 return new Promise((resolve, reject) => {
   glob(path, {
     cwd: cwd ? cwd: process.cwd()
   }, (err, paths) => {
     if (err) {
       return reject(err);
     }
     return resolve(paths);
   })
 });
开发者ID:tbtimes,项目名称:ledeTwo,代码行数:10,代码来源:Es6Compiler.ts


示例13: Promise

  return new Promise((resolve, reject) => {
    const options = exclude ? { ignore: exclude } : {};

    glob(globPath, options, (error, matches) => {
      if (error) {
        return reject(error);
      }

      resolve(matches);
    });
  });
开发者ID:rjokelai,项目名称:platform,代码行数:11,代码来源:util.ts


示例14: glob

 async.reduce( args.entry_points, new Array<{name:string,signature:string}>(), ( cns, entry_point, cb_reduce ) => {
     glob( entry_point, { cwd: args.launch_dir }, ( err, matches ) => {
         if ( err ) { this.error( err.toString() ); return cb_reduce( new Error, null ); }
         async.map( matches, ( x, cb_map ) => {
             const my_cb_map = ( err: boolean, val ) => { cb_map( err ? new Error : null, val ) };
             this.get_filtered_target( path.resolve( args.launch_dir, x ), args.launch_dir, my_cb_map );
         }, ( err, lst: Array<{name:string,signature:string}> ) => {
             cb_reduce( null, cns.concat( lst ) );
         } );
     } );
 }, ( err, cns ) => {
开发者ID:hleclerc,项目名称:nsmake,代码行数:11,代码来源:Gtest.ts


示例15: glob

const run = (): void => {
  glob('./src/app/**/*.vue', (err: any, files: string[]) => {
    const basePath: string = path.resolve(process.cwd());
    const packageJSON: any = JSON.parse(fs.readFileSync(path.join(basePath, 'package.json')).toString());
    const supportedLocales: string[] = packageJSON.config['supported-locales'];
    const defaultLocale: string = packageJSON.config['default-locale'];
    let translations: any = {};

    /**
     * go through all *.vue files end extract the translation object $t('foo') -> {id: 'foo'}
     */
    files.forEach((file: string) => {
      const content = fs.readFileSync(file).toString();
      const matches: string[] = getTranslationsFromString(content);

      if (matches) {
        translations = { ...translations, ...getTranslationObject(matches) };
      }
    });

    /**
     * analyze and write languages files
     */
    supportedLocales.forEach((locale: string) => {
      const i18nFilePath: string = path.join(basePath, 'i18n', `${locale}.json`);
      const i18nFileContent: string = fs.existsSync(i18nFilePath) ? fs.readFileSync(i18nFilePath).toString() : null;
      const i18nFileObject: any = i18nFileContent ? JSON.parse(i18nFileContent) : {};

      (Object as any).keys(i18nFileObject).forEach((key: string) => {
        i18nFileObject[key] = i18nFileObject[key].replace(/\n/g, '\\n').replace(/"/g, '\\"');
      });

      const newI18nObject: any = locale === defaultLocale
                                 ? (Object as any).assign({}, i18nFileObject, translations)
                                 : (Object as any).assign({}, translations, i18nFileObject);

      /**
       * sort entries
       */
      const sortedKeys: string[] = (Object as any).keys(newI18nObject).sort();
      const sortedEntries: string[] = sortedKeys.map((key: string) => {
        return `"${key}": "${newI18nObject[key]}"`;
      });

      fs.writeFileSync(path.join(basePath, 'i18n', `${locale}.json`), `{\n  ${sortedEntries.join(',\n  ')}\n}\n`);

      console.info(`wrote i18n/${locale}.json`);
    });

    console.info('i18n extraction finished');
  });
};
开发者ID:trungx,项目名称:vue-starter,代码行数:52,代码来源:extract-i18n-messages.ts


示例16: Promise

 return new Promise((resolve, reject) => {
   glob(`${DEMOS_SRC_ROOT}/**/main.js`, null, (err: Error, files: string[]) => {
     if (err) {
       reject(err);
     } else {
       recursiveRollupHelper(files).then(() => {
         resolve();
       }).catch(err => {
         reject(err);
       });
     }
   });
 });
开发者ID:JackMj,项目名称:ionic,代码行数:13,代码来源:demos.ts


示例17: task

task('build-develop:client-scripts', ['copy:client-templates', 'compile:client-scripts'], done => {
	glob('./tmp/**/*.js', (err: Error, files: string[]) => {
		const tasks = files.map((entry: string) => {
			return browserify({ entries: [entry] })
				.bundle()
				.pipe(source(entry.replace('tmp', 'resources')))
				.pipe(dest('./built'));
		});
		src('./tmp/common/scripts/*.js')
			.pipe(dest('./built/sites/common/scripts/'));
		es.merge(tasks).on('end', done);
	});
});
开发者ID:armchair-philosophy,项目名称:Misskey-Web,代码行数:13,代码来源:gulpfile.ts


示例18: Promise

 return new Promise((resolve, reject) => {
   globFunction(task.pattern, task.opts, (err: Error, files: string[]) => {
     if (err) {
       return reject(err);
     }
     const globResults = files.map(file => {
       return {
         absolutePath: normalize(pathResolve(file)),
         base: normalize(pathResolve(getBasePath(task.pattern)))
       };
     });
     return resolve(globResults);
   });
 });
开发者ID:Kode-Kitchen,项目名称:ionic-app-scripts,代码行数:14,代码来源:glob-util.ts


示例19: glob

 return new Promise<ParsedData>((resolve, reject) => {
     let validationText = this.validate(inputs['glob-regex']);
     if (validationText === null) {
         let titleData = this.extractTitleTag(inputs['glob-regex']);
         glob(titleData.finalGlob, { silent: true, dot: true, cwd: directory, cache: cache || {} }, (err, files) => {
             if (err)
                 reject(err);
             else
                 resolve(this.extractTitles(titleData, directory, files));
         });
     }
     else
         throw new Error(validationText);
 });
开发者ID:kencinder,项目名称:steam-rom-manager,代码行数:14,代码来源:glob-regex.parser.ts


示例20: glob

 return new Promise<Array<string>>(resolve => {
     glob(globPattern, (err, matches) => {
         if (err) {
             console.error(err.message);
         } else {
             if (matches.length > 0) {
                 resolve(matches);
             } else {
                 console.warn(`[WARNING] Didn't find any file by glob pattern '${globPattern}'`);
                 process.exit(1);
             }
         }
     });
 });
开发者ID:QuatroCode,项目名称:dts-bundle-append,代码行数:14,代码来源:append.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript globby类代码示例发布时间:2022-05-28
下一篇:
TypeScript get-port类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap