INNER CODE UNIT · JavaScript

filepath

diegohaz/rest · generators/api/index.js:193

    var filepath = function (filename) {
      return path.join(props.dir, props.kebab, filename);
    };

    copyTpl(tPath('controller.js'), dPath(filepath('controller.js')), props);
    copyTpl(tPath('index.js'), dPath(filepath('index.js')), props);
    copyTpl(tPath('index.test.js'), dPath(filepath('index.test.js')), props);

    if (props.generateModel) {
      copyTpl(tPath('model.js'), dPath(filepath('model.js')), props);
      copyTpl(tPath('model.test.js'), dPath(filepath('model.test.js')), props);
    }

    if (this.fs.exists(routesFile)) {
      var ast = recast.parse(this.fs.read(routesFile));
      var body = ast.program.body;
      var lastImportIndex = _.findLastIndex(body, function (statement) {
        return statement.type === 'ImportDeclaration';

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…