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


TypeScript glob.default方法代码示例

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


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

示例1: dirname

task('e2e.bundleProd', (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:JackMj,项目名称:ionic,代码行数:30,代码来源:e2e.prod.ts

示例2: run

export function run(testsRoot: string, clb: (error, failures?: number) => void): void {

    // Enable source map support
    require('source-map-support').install();

    // Glob test files
    glob('**/**.test.js', { cwd: testsRoot }, (error, files) => {
        if (error) {
            return clb(error);
        }

        try {

            // Fill into Mocha
            files.forEach(f => mocha.addFile(paths.join(testsRoot, f)));

            // Run the tests
            let failures = 0;
            mocha.run()
                .on('fail', function(test, err) {
                    failures++;
                })
                .on('end', function() {
                    clb(null, failures);
                });
        } catch (error) {
            return clb(error);
        }
    });
}
开发者ID:NaughtyFactory,项目名称:vscode-extension-vscode,代码行数:30,代码来源:testrunner.ts

示例3: Promise

      return new Promise((resolve, reject) => {
        glob('**/tsconfig.json', { ignore: '**/node_modules/**' }, (error: Error | null, tsConfigFiles: string[]) => {
          if (error) {
            reject(error);
          }
          tsConfigFiles.forEach(file => {
            let args = ['-p', file];
            let taskFunction = (callback: TaskFunctionCallback) => {
              let task = taskRunner.runTask(`./node_modules/.bin/tsc`, args, {
                name: `tsc -p ${file}`,
                logger,
                handleOutput
              });
              runningTasks.push(task);
              task.result.then(() => {
                runningTasks.splice(runningTasks.indexOf(task), 1);
              }).then(callback).catch(reject);
            };

            taskFunctions.push(taskFunction);
          });

          let limit = 2;
          parallelLimit(taskFunctions, limit, resolve);
        });
      });
开发者ID:AFASSoftware,项目名称:typescript-assistant,代码行数:26,代码来源:compiler.ts

示例4: buildStyles

export function buildStyles(options: StylesConfig): void {
  const {src, out} = options;
  const scssFiles = path.join(src, '!(+(_))*.scss');

  const iconsPromise = copyOcticons(out);

  glob(scssFiles, (err, scss) => {
    if (err) {
      return console.log(`failed to compile scss in ${src}: ${err}`);
    }

    resourceChecksum.load(src).then(checksums => {
      const scssPromise = Promise.all(scss.map(f => compileScss(f, out, checksums)));

      Promise.all([iconsPromise, scssPromise])
        .then(() => {
          return removeCSSWithNoSCSS(scss, out, checksums);
        })
        .then(() => {
          resourceChecksum.save(checksums, src);
        })
        .catch(buildError => {
          console.error(buildError);
        });
    });
  });
}
开发者ID:cpylua,项目名称:cheli.im,代码行数:27,代码来源:styles.ts

示例5: glob

 return new Promise<string[]>((resolve, reject) => {
   glob(
     g,
     (err: Error | null, files: string[]) =>
       err ? reject(err) : resolve(files)
   );
 });
开发者ID:jeremyrazzano,项目名称:flatpickr,代码行数:7,代码来源:build.ts

示例6: Promise

 return new Promise((resolve, reject) => {
     const pkg = JSON.parse(readFileSync(`${folder}package.json`, "utf8"));
     glob(`${folder}types/**/*.d.ts`, {}, function (err: any, files: any) {
         if (err) throw err;
         let typePath = `${folder}types/index.node.d.ts`;
         if (!existsSync(typePath)) {
             typePath = `${folder}types/index.d.ts`;
         }
         if (existsSync(typePath)) {
             const externals = calcExternals(typePath, `tmp/${pkg.name}`);
             externals.forEach(external => {
                 if (!pkg.dependencies || (!pkg.dependencies[external] && !pkg.dependencies["@types/" + external])) {
                     expect(false, `${pkg.name}:${folder} missing dependency:  ${external}`).to.be.true;
                 }
             });
             for (const key in pkg.dependencies) {
                 const deps = key.indexOf("@types/") === 0 ? key.substr(7) : key;
                 if (NODEJS_DEPENDENCY_EXCEPTIONS.indexOf(deps) < 0 && key.indexOf("@hpcc-js") < 0 && externals.indexOf(deps) < 0) {
                     expect(false, `${pkg.name}:${folder} extraneous dependency:  ${deps}`).to.be.true;
                 }
             }
         }
         resolve();
     });
 });
开发者ID:GordonSmith,项目名称:Visualization,代码行数:25,代码来源:types.spec.ts

示例7: makeZip

function makeZip(target: string): void {
    const zip = new JSZip();
    glob(`${target}/**/*.*`, {cwd: baseDir}, (_error, matches) => {
        Promise.all(matches.map(itemPath => new Promise((resolve, reject) => {
            const itemPathFs = path.normalize(itemPath);
            const itemPathFsWithBase = path.join(baseDir, itemPathFs);
            fs.readFile(itemPathFsWithBase, (err, itemData) => {
                console.log(`including ${itemPath}`);
                if (err) {
                    reject(err);
                    return;
                }
                zip.file(itemPathFs, itemData);
                resolve();
            });
        })))
            .then(() => new Promise((resolve, reject) => {
                const dest = path.join(baseDir, `${target}.zip`);
                zip
                    .generateAsync({ type: "nodebuffer" })
                    .then(content => {
                        fs.writeFile(dest, content, err => {
                            if (err) {
                                reject(err);
                                return;
                            }
                            resolve(dest);
                        });
                    })
                    .catch(err => reject(err));
            }))
            .then(dest => console.log(`${dest} was written.`))
            .catch(e => console.error(e));
    });
}
开发者ID:WWAWing,项目名称:WWAWing,代码行数:35,代码来源:make-zip.ts

示例8: 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

示例9: return

 return (req: express.Request, res: express.Response) => {
     glob(path.join(dir, '**/*.ts'), (err: any, fullPaths: string[]) => {
         if (err) console.log(err);
         let relativePaths = fullPaths.map(f => path.relative(dir, f));
         res.json(JSON.stringify(relativePaths));
     });
 }
开发者ID:panagosg7,项目名称:RefScriptDemo,代码行数:7,代码来源:routes.ts


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