当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript glob类代码示例

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


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


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