Skip to content

Commit

Permalink
Do not generate the users service if it already exists (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl committed Aug 25, 2018
1 parent 6ebe00c commit bb92f0d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 85 deletions.
20 changes: 11 additions & 9 deletions packages/generator-feathers/generators/authentication/index.js
Expand Up @@ -165,15 +165,17 @@ module.exports = class AuthGenerator extends Generator {
dependencies.push(`@feathersjs/authentication-${strategy}`);
}
});

// Create the users service
this.composeWith(require.resolve('../service'), {
props: {
name: context.entity,
path: `/${context.kebabEntity}`,
authentication: context
}
});

if(!this.fs.exists(this.destinationPath(this.libDirectory, 'services', context.kebabEntity, `${context.kebabEntity}.service.js`))) {
// Create the users service
this.composeWith(require.resolve('../service'), {
props: {
name: context.entity,
path: `/${context.kebabEntity}`,
authentication: context
}
});
}

// If the file doesn't exist yet, add it to the app.js
if (!this.fs.exists(this.destinationPath(this.libDirectory, 'authentication.js'))) {
Expand Down
115 changes: 39 additions & 76 deletions packages/generator-feathers/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bb92f0d

Please sign in to comment.