Skip to content

Commit

Permalink
1.0.0 (#125)
Browse files Browse the repository at this point in the history
* Release/1.0.0/cleanup (#91)

* updated linting to use `lint-rules`

* General cleanup

- Fixed a few linting errors
  - Updated all main functions to use `function` instead of arrow functions. This improves readability so you can tell the difference between helper functions declared in a main function and global functions.
  - Updated all functions to be camel case, this also improves readability to tell the difference between functions and everything else.
  - Updated the way some functions were exported to make the be exported where they were declared instead of at the bottom of the files.
  - Removed instances of `'use strict';` because babel already adds this in for you automatically
  - Updated all if statements that have `&&` or `||` to have line breaks between them to improve readability

* Added helper libraries, and test settings

  - `async-array-methods`
  - `es6-promisify`
  - ` fs-extra-promisify`
  - `globby `

* updated `output.js` to use helper libaries

* Updated util functions

  - Replaced `readDirectory` with `findFiles` which is a much faster way to recursively get all the files in a directory
  - Removed `isDirectory` because it's not being used.
  - Removed `readFile`, and `makeDirectory` because `fs-extra-promisify` handles these.
  - Added `readFiles`. This is useful because it also supports `zip` files

* reworked `input.js`

This update removes several functions that weren't necessary. Also made the code easier to read by reworking the functions by using helper libraries that are doing the redundant part of this file.

* reworked `models.js`

This update removes several functions that aren't needed and aslo removes the `async` from functions that don't actually need it. It simplifies the overall purpose of the file by using existing helpers, and reworks other functions that were to verbose.

* updated `index.js` to return full error instead of just the message.

* updated to only import the util that's being used

* added `parsers` to utils

This update normalizes the way the parsers are used so it doesn't have to be done on a file by file basis. It should reduce the amount of code around converting the functionality of these other parsers significantly

* updated `output.js` to export functions correctly

* simplified `output.js`

* cleaned up `documents.js`

* Feature/1.0.0/structure (#99)

* added the ability to add documentation

This will allow us to document the api to make it easier to know what's avaiable and what's actually going on.

* removed Yarn for now

This is because yarn doesn't handle binaries correctly, and also doesn't handle things like couchbase which have node-gyp and that have to compile when it's being installed.

* Moved the cli to to be under `cli.js`

* Renamed `generator.js` to be `index.js`

This is so that the main file will  be the `index.js` file. This way we can export it and get the same functionality.

* added the Logger to the utils

This will be the base logger that is used throughout the application

* added documentation to the other util functions

* added support for ci testing

* added unit tests and bug fixes for `utils.js`

* syntax update

* Feature/1.0.0/main structure (#103)

* added the ability to add documentation

This will allow us to document the api to make it easier to know what's avaiable and what's actually going on.

* removed Yarn for now

This is because yarn doesn't handle binaries correctly, and also doesn't handle things like couchbase which have node-gyp and that have to compile when it's being installed.

* Moved the cli to to be under `cli.js`

* Renamed `generator.js` to be `index.js`

This is so that the main file will  be the `index.js` file. This way we can export it and get the same functionality.

* added the Logger to the utils

This will be the base logger that is used throughout the application

* added documentation to the other util functions

* added support for ci testing

* added unit tests and bug fixes for `utils.js`

* syntax update

* added `base.js` which will be the base for all the classes

This will allow you to run each of the functionalities separately without having to depend on each other. It will also allow the logging to be consistent throught the app.

* added ability to pass a glob to `utils.findFiles`

* updated the way models were parsed

This update removed global variables that were being used in those functions, in favor of passing in the model that is being manipulated.

Also removes the logic that was being used to resolve dependencies in favor of using `dependency-resolver` that already handles this functionality. This will reduce the amount of testing that we have to do around this file.

* added babel-external-helpers

* Updated input to be a class

* updated models to be a class

Also drastically simplified the exisitng code by reworking a few functions and using dependency-resolver to resolve the different dependencies for each model

* updated the main fakit function to be a class

This main function extends Inputs, Models, and the Base

* Updated the cli to only pass valid options.

* Updated documents to be a class

Also updated to generate documents in documents instead of in models

* Updated to return models as an array

This update is to remove the need for `this.model_order` by ordering them to begin with.

* Cleaned up the cli

Also added several todo items to help the various changes that need to take place before the release.

* replaced `--format` with `--spacing`

* Added the base for the new Output class

This also adds tests for validation and options that have been passed.

* Added the base functionality to the outputters

* Finished folder output

Complete with tests

* added a pool utility function

This is a function that is similar to `map` but it will limit the concurrancy of the functions that're running.

* updated archive option to be a filename

* added the zip output type

complete with tests

* general cleanup

* removed the need for output document

* added the `key` generated document

* updated the way the setup function determins the outputter

This update is to accomidate the `return` option

* update the file generation for the zip test

This just updates the location as to where the files get created.

* added the base for `Output.output`

This also adds test cases for the different types and languages.

* added a few prepare tests for output

* added the finalize function

* added the timeout option that's used for servers

* setup the rest of the sync-gateway output

* setup the rest of couchbase output

* removed `object-path` in favor of lodash `set` and `get`

* cleaned up dependencies

* fixed bug with the verbose logging option

* Updated couchbase output to use `couchbase-promises`

Also added test cases for them to ensure it's working correctly

* Added a few tests for sync-gateway

* remove the Documents class because it's no longer needed

* Updated the main fakit class

* added nyc code coverage

* added the basis for testing the data generation

* 🗑removed the `output.js`

* Feature/1.0.0/model structure (#104)

* made a smarter todo list

* Updated models

This is complete with tests

* added the ability to include input files in the model it's self

* Added better error messaging for failed pre/post functions

* improved the test utils

* added a way to get the users babel config

* updated the make file to have documentation

* Finished up`parseModelInputs`

* Updated model functions to use `|` instead of `>`

This is because of issue #84

* Finished up `parseModelFunctions`

Babel support now exists

* Removed `return` from single line functions

Also updated other js standards

* Finished up `parseModelReferences`

* Finished up `parseModelTypes`

* added a json diff checker for testing

* Finished up `parseModelDefaults`

* Finished up `parseModelCount`

* Finished up `filterModelFiles`

* Finished up `parseModelDependencies`

This update makes data.dependencies an array of urls so you don't have to pass them in anymore

* Finished up `resolveDependenciesOrder`

* Finished up `registerModels`

* Finished up code coverage for models

* Feature/1.0.0/data (#105)

* Setup base for data tests

* Finished up `getPaths`

* Finished up `typeToValue`

* Finished up Document `init`

* Finished up `initializeDocument`

* Finished up `buildObject`

* Finished up `buildValue`

* Finished up `postProcess`

* Finished up `transformValueToType`

* Moved `postProcessCallback` to be inside `postProcess`

There's no reason for this to be a seperate function so it was moved to be inside of the only place it was being used.

* Finished up `runData`

* Finished up `buildDocument`

* Finished up `build`

* Removed the testing `utils.string` function

Found out it's not needed since you can just pass in the exact string instead

* cleanup validation

* bugfix for `parseModelCount`

* Updated `index.test.js` so only 1-6 documents will get created

This required me to use proxyquire to overwrite the document build function so that I could overwrite the functions count and the pre_run functions for each model

* Finished up Fakeit.generate

* renamed travis file (#106)

* Feature/1.0.0/code coverage (#107)

* added tests for `Logger.time` and `Logger.timeEnd`

* removed unused functions in Logger

* added more tests for `Logger.log`

* ignore a few parts of the parser tests that are too hard to mock

* added more test cases for `objectSearch`

* added a test for `findFiles`

* improved output/couchbase code coverage

* Updated tests for sync-gateway

this doesn't add many tests but it improves the code coverage.

* improved code coverage for `output/index`

* Feature/1.0.0/cli (#110)

* bugfix display options count if it exists or the model.count

* added the highlight option and csv tables

* added the cli complete with tests

* bugfix for the way dependencies are set

This update ensures that the dependency is always set correctly

* Updated the main readme file to be more up to date

* Bugfix/1.0.0/arrays (#111)

* Updated the max count to be 0 if it wasn't defined already

* Removed the parsing of `items.data.count` in `parseModelCount`

This has to be handled by the document generation so that all the documents to have arrays that're the same length.

* Moved the logic for min and max for items to the documents

* Feature/1.0.0/seed (#112)

* Added `parseModelSeed`

* fixed make coverage command

It was building the files every time instead of running the check for source files correctly

* added documentation for it in the readme file

* added support for seeds during document generation

* added support for seed to the cli

* Added a note about `faker.date` not working with seeds

* updated readme (#113)

* Feature/1.0.0/logger (#114)

* Moved Logger into it's own file

* fixed missed code coverage line for cli

* added missed code coverage for logger

* updated make codecoverage to fail test if not it's not in the threshold

* Check for a typeof number instead of this.optionsoptions

* added exit codes to the make test

* Bugfix/1.0.0/package json (#116)

* added missing dependency of `cli-table`

* removed coverage check

* Bugfix/1.0.0/babel (#117)

* bugfix for babel config

Babel config wasn't being found correctly and this fixes the issue. Also added a test case for it.

* removed dob from cli test

This is because dates won't generate the same thing when using seeds.

* added in code coverage check to `make ci`

* added `babel-plugin-array-includes`

* added `babel-plugin-transform-runtime`

* removed es6 instances from test/utils.js

* Fixed testing issues with older versions of node

* Feature/1.0.0/progress (#118)

* added spinner support to help show progression

* added spinners to base

* updated tests for documents, and index remove pre_run overwrites

These files were overwriting models `pre_run` function if it had `this.data.count` referenced to reduce the amount of time it took for unit tests to run for certain models. This is no longer needed because of a simple update to documents

* added spinners to models

* added spinners to documents

* added spinners to cli

This update also had to update the output to the console to match the new way of showing documents being generated.

* updated index tests to reflect the spinner update

* added spinners to output

Had to make a few updates around the console because the spinner output should go before the console output so the console outputter only prepares the output for the console and the main output function handles outputting it to the console

* fixed typo for cli and spinners

* updated documents to handle the spinners better by making it async

* Updated social models to output a smaller set of data

* updated logger to use format-seconds

This way when long processes happen it will display in min and not sec

* added a timer for the main generator

This way it will display the total number of documents that were created and how long it took.

* bugfix for base to turn off spinners if log is false

* added `require` to the arguments to pass the model functions

* updated cli to parse models better and updated help verbage

* added example and updated verbage

also added a changelog note about the progress indicator

* bugfix for older versions of node

* added post to coveralls after successful build (#119)

* Feature/1.0.0/examples (#120)

* moved model defaults to up ensure they're set

* fixed typo in cli

* updated install docs to include --save-dev and --global

* added better description for `type` complete with examples

* relocated `key` to be lower and added a better description with examples

* relocated `seed`

* updated examples

* updated badges to use img.shields.io

* Fixed Spacing in Model

* Removed username validation from couchbase

* Ensured cli arguments are assigned to variables

* Updated cli to show help when no models are passed

* Updated output tests

The output tests have been updated to account for the username not being required when outputting to couchbase

* Feature/1.0.0/fork (#121)

* updated dependencies

* fixed models spinner to be correct

* bugfix `parseModelDependencies`

Fixes a bug where if two files required the same dependency the second model passed would have it's dependencies removed which causes issues when trying to make the document generation smarter.

* updated to exit if lint fails

* bugfix for memory leak

* added `resolveDependants`

This adds an array of model files that are dependent on each model

* added `events-async`

* Created a `Documents` class that runs the models in a more efficient way

* pr fixes

* if the model that's passed is `flight-data` make it run serial

This is to improve performance on all tests since the flight-data tests are the most cpu intensive. It increases the speed of the tests, and decreases the cpu usage

* updated to `events-async@1.1.0`

* fixed error with `make lint` on node v4

* pr fixes
  • Loading branch information
tjbenton authored and bentonam committed Feb 16, 2017
1 parent 802518c commit f0ef37d
Show file tree
Hide file tree
Showing 202 changed files with 137,918 additions and 6,277 deletions.
4 changes: 3 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"stage-0"
],
"plugins": [
"transform-runtime"
"transform-runtime",
"external-helpers",
"array-includes"
]
}
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules
test
test/**/!(*.test.js)
195 changes: 0 additions & 195 deletions .eslintrc

This file was deleted.

2 changes: 2 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extends:
- './node_modules/lint-rules/eslint/index.js'
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
*.log
*.DS_Store
*.bak
*.csv
export/
.TemporaryItems
dist/
Thumbs.db
thumbs.db
.vagrant/
node_modules/
temp/
.nyc*
.nyc*
coverage
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ app/
examples
test
.eslint*
Makefile
Makefile
.nyc*
coverage
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sudo: false
language: node_js

node_js:
- "4"
- "5"
- "6"

cache:
directories:
- $HOME/.node-gyp
- $HOME/.npm
- node_modules

install: make install
script: make ci
after_success: make post-coverage
66 changes: 59 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,103 @@ MAKEFLAGS = -j1
PATH := ./node_modules/.bin:$(PATH)
SHELL := /bin/bash
args = $(filter-out $@, $(MAKECMDGOALS))
.PHONY: install clean deep-clean reinstall setup build compile watch lint test ci publish release
.PHONY: all install clean deep-clean reinstall setup build compile build-source-maps compile-source-maps docs docs-server docs-build docs-compile watch lint test coverage test-coverage code-coverage report-coverage report-code-coverage ci prepatch patch minor major publish release

all: build test

install:
type yarn 2>/dev/null && yarn install || npm install
npm install

# remove the build and log folders
clean:
rm -rf dist logs

# remove all files that are ignored by git
deep-clean:
make clean
rm -rf node_modules/ dist/ .nyc_output/ npm-debug.log yarn-error.log

# reinstall the node_modules and start with a fresh node build
reinstall setup:
make deep-clean
make install

# build the source files
build compile:
make clean
babel app --out-dir dist $(args)

# makes it easier to build files with source maps without errors
# from other make commands
build-source-maps compile-source-maps:
make clean
babel app --out-dir dist --source-maps $(args)

# start the server for the documentation
docs docs-server:
docs server

# compile the documentation
docs-build docs-compile:
docs compile docs-public

# When watching for changes we can assume it's a development env
# so build files with source maps
watch:
make build -- --watch
make build-source-maps -- --watch $(args)

# lint test files
lint:
eslint 'app' 'test'
command -v eslint >/dev/null 2>&1 && eslint 'app' 'test' || ./node_modules/lint-rules/node_modules/.bin/eslint 'app' 'test';

# run unit tests
test:
ava $(args)

# run coverage for the tests
coverage test-coverage code-coverage:
# if there's no instance source maps files then build the files with source maps
@[ -f ./dist/index.js.map ] || (echo "building files with source maps" && make build-source-maps)
NODE_ENV="test" nyc --silent -- ava --verbose --no-cache


# These commands only run the report of the code coverage
report-coverage report-code-coverage:
@[ -d ./.nyc_output ] && NODE_ENV="test" nyc report || make test-coverage report-coverage

# posts code coverage to coveralls
post-coverage:
@[ -d ./.nyc_output ] && nyc report --reporter=text-lcov | coveralls || make test-coverage post-coverage

# The command the ci server runs
ci:
make lint
make build
make test
make lint || exit 1
# if the tests fail then it will exit with an error
make coverage || exit 1
# show the coverage report
nyc report
# check check-coverage and if it fails then exit
nyc check-coverage --statements 95 --functions 95 --lines 95 || exit 1

# "patch", "minor", "major", "prepatch",
VERS ?= "patch"

# "preminor", "premajor", "prerelease"
TAG ?= "latest"

# Release a prepatch version
prepatch:
export VERS="prepatch" && make release

# Release a patch version
patch:
export VERS="patch" && make release

# Release a minor version
minor:
export VERS="minor" && make release

# Release a major version
major:
export VERS="major" && make release

Expand Down
Loading

0 comments on commit f0ef37d

Please sign in to comment.