當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。