How to use the walk-sync function in walk-sync

To help you get started, we’ve selected a few walk-sync examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github typed-ember / ember-cli-typescript / ts / addon.ts View on Github external
_checkAddonAppFiles() {
    // Emit a warning for addons that are under active development...
    let isDevelopingAddon = !this.app && (this.parent as Addon).isDevelopingAddon();

    // ...and are at the root of the project (i.e. not in-repo)...
    let isRootAddon = this.parent.root === this.project.root;

    // ...and have .ts files in their `app` directory.
    let appDir = `${this.parent.root}/app`;
    if (isDevelopingAddon && isRootAddon && fs.existsSync(appDir)) {
      let tsFilesInApp = walkSync(appDir, { globs: ['**/*.ts'] });
      if (tsFilesInApp.length) {
        this.ui.writeWarnLine(
          `found .ts files in ${appDir}\n` +
            "ember-cli-typescript only compiles files in an addon's `addon` folder; " +
            'see https://github.com/typed-ember/ember-cli-typescript/issues/562'
        );
      }
    }
  },
github embroider-build / embroider / packages / core / src / app-entrypoint.ts View on Github external
private writeAppJS(config: any) {
    let mainModule = join(this.outputPath, this.app.isModuleUnification ? 'src/main' : 'app');
    // standard JS file name, not customizable. It's not final anyway (that is
    // up to the final stage packager). See also updateHTML in app.ts for where
    // we're enforcing this in the HTML.
    let appJS = join(this.outputPath, `assets/${this.app.name}.js`);

    // for the app tree, we take everything
    let lazyModules = walkSync(this.inputPaths[1], {
      globs: ['**/*.{js,hbs}'],
      ignore: ['tests/**'],
      directories: false
    }).map(specifier => {
      let noJS = specifier.replace(/\.js$/, '');
      let noHBS = noJS.replace(/\.hbs$/, '');
      return {
        runtime: `${config.modulePrefix}/${noHBS}`,
        buildtime: `../${noJS}`
      };
    });

    // for the src tree, we can limit ourselves to only known resolvable
    // collections
    todo("app src tree");
github denali-js / core / dist / runtime / container.js View on Github external
registerDir(dirpath, typeName) {
    let paths = walk(dirpath);
    paths.forEach((filepath) => {
      let absolutepath = path.join(dirpath, filepath);
      let moduleName = filepath.replace(JS_EXT, '');
      if (fs.statSync(absolutepath).isFile() && JS_EXT.test(absolutepath)) {
        this.register(typeName + '/' + moduleName, require(absolutepath));
      }
    });
  },
github ryardley / indexr / lib / utils / getFileListSync.js View on Github external
export default (folder, globs) => globs ?
  walkSync(folder, { globs: ensureArray(globs) }) : [folder];
github SpencerCDixon / redux-cli / src / models / blueprint.js View on Github external
files() {
    if (this._files) {
      return this._files;
    }

    let filesPath = this.filesPath();

    if (fileExists(filesPath)) {
      this._files = walkSync(filesPath);
    } else {
      this._files = [];
    }
    return this._files;
  }
github denali-js / core / lib / cli / blueprint.js View on Github external
generate({ params, flags }) {
    let data = this.locals(params, flags);
    let dest = process.cwd();

    walk(this.templateFiles).forEach((relativepath) => {
      let absolutepath = path.resolve(path.join(this.templateFiles, relativepath));
      if (isDir(absolutepath)) {
        return null;
      }

      let filenameTemplate = template(relativepath, {
        interpolate: /__([\S]+)__/g,
        sourceURL: relativepath
      });
      let destRelativepath = filenameTemplate(data);
      let destAbsolutepath = path.join(dest, destRelativepath);

      if (fs.existsSync(destAbsolutepath)) {
        return ui.info(`${ chalk.green('already exists') } ${ destRelativepath }`);
      }
github typed-ember / ember-cli-typescript / ts / lib / utilities / copy-declarations.ts View on Github external
pathRoots: string[],
  destDir: string,
  physicalPaths: string[]
) {
  for (let pathRoot of pathRoots) {
    for (let physicalPath of physicalPaths) {
      if (!physicalPath.endsWith('/*')) {
        throw new Error(`Missing trailing '*' in path mapping: ${physicalPath}`);
      }

      let fullRoot = path.resolve(pathRoot, physicalPath.replace(/\/\*$/, ''));
      if (!fs.existsSync(fullRoot)) {
        continue;
      }

      for (let file of walkSync(fullRoot, { globs: ['**/*.d.ts'] })) {
        let destinationPath = path.join(destDir, file);
        if (!fs.existsSync(destinationPath)) {
          copyFile(output, path.join(fullRoot, file), destinationPath);
        }
      }
    }
  }
}
github embroider-build / embroider / packages / compat / src / v1-addon.ts View on Github external
addonTestSupportTree = new ObserveTree(addonTestSupportTree, outputPath => {
          filenames = walkSync(outputPath, { globs: ['**/*.js', '**/*.hbs'] }).map(f => `./${f.replace(/.js$/i, '')}`);
        });
        built.dynamicMeta.push(() => ({
github sokis / vuex-cli / src / models / blueprint.js View on Github external
files() {
		if (this._files) { return this._files; }

		let filesPath = this.filesPath();

		if (fileExists(filesPath)) {
			this._files = walkSync(filesPath);
		} else {
			this._files = [];
		}
		return this._files;
	}

walk-sync

Get an array of recursive directory contents

MIT
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis

Popular walk-sync functions

Similar packages