Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/plugins #185

Open
wants to merge 40 commits into
base: dev
Choose a base branch
from
Open

Feature/plugins #185

wants to merge 40 commits into from

Conversation

tjbenton
Copy link
Collaborator

@tjbenton tjbenton commented Feb 9, 2018

Make sure that you merge the other PRs first because this PR is built off of those.

This is complete with tests nyc ava --verbose packages/fakeit-core/test and it's pretty throughly documented.

The way it will work is you import the Api into the cli package at the top then instantiate it and when you do that it will load any configs that have been set, as well as any plugins that have been installed.

Users can define options in a fakeitfile.js, package.json under the fakeit key, as well as pass in arguments to the cli. The only option that the cli will not handle is the plugins option, that's because it's not possible since we have to load the plugins before the cli is rendered so that any plugins that have a cli function are passed in and run correctly. This should not affect a single user since they have 4 other methods of including plugins.

  • fakeitfile.js
    function somefunction() {}
    module.exports = {
      plugins: [ somefunction, './some-relative-file.js', 'some-installed-pacakge']
    }
  • package.json fakeit key
    {
      "fakeit": {
        "plugins": [ "./some-relative-file.js", "some-installed-pacakge" ]
      }
    }
  • package.json dependencies, devDependencies, and peerDependencies are filtered through to find any packages that match @fakeit/(format|plugin)-.*
    {
      "dependencies": {
        "@fakeit/format-json": "*"
      }
    }
  • node_modules does a glob search on the node_modules folder for @fakeit/(format|plugin)-.*

Finally all these ways are combined and reduced to a unique array and then required(if a string) and then run them.

bentonam and others added 30 commits January 17, 2018 09:06
…nto feature/fakeit-core-setup

* 'release/v2.0.0' of https://github.com/bentonam/fakeit:
  Feature/flowtype support (#177)
…am/fakeit into feature/types

* 'feature/fakeit-core-setup' of https://github.com/bentonam/fakeit:
  Refactored input
  trailingComma for all
  Simplified `make deep-clean`
  Added flow-typed npm libdefs to .gitignore
  Removed flow-typed libdefs
  Removed property that shouldn’t be there

# Conflicts:
#	packages/fakeit-core/package.json
…nto feature/types

* 'release/v2.0.0' of https://github.com/bentonam/fakeit:
  Feature/fakeit core setup (#178)
  - Moves gulp to be a dev dependency
  - Fixed issue with `gulp-changed` so now it only compiles files that have actually changed instead of all the files
  - Added sourcemaps so that we can see where errors happen, also so that code coverage tool uses the src files not the dist
… feature/model

* 'hotfix/gulp' of https://github.com/bentonam/fakeit:
  fixed a couple issues with gulp
…/model

* 'dev' of https://github.com/bentonam/fakeit:
  Updated nyc config
  Updated travis to also test node 7, 8, 9
  Updated Tests
  Added streams cli options
  Updated contacts model
  Removed docs and node-sass devDependencies
  Added initial support for streams
  Added docker-compose.yaml file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants