- Work in a fork of this repository
- Work in a branch on your fork
- Write all of your code in a directory named
lab-
+<your name>
e.g.lab-susan
- Open a pull request to this repository
- Submit on canvas a question and observation, how long you spent, and a link to your pull request
Configure the root of your repository with the following files and directories. Thoughtfully name and organize any additional configuration or module files.
- README.md - contains documentation
- .gitignore - contains a robust
.gitignore
file - .eslintrc - contains the course linter configuratoin
- .eslintignore - contains the course linter ignore configuration
- package.json - contains npm package config
- create a
lint
script for running eslint - create a
test
script for running tests
- create a
- lib/ - contains module definitions
- __test__/data/ - contains bitmaps for testing
- __test__/ - contains unit tests
For this assignment, you will be building a bitmap (.bmp
) transformer CLI. It will read a bitmap in from disk, run one or more color or raster transforms and then write it out to a new file. This project will require the use of node buffers in order to manipulate binary data. Your solution should be composed of small tested modules that solve specific problems. Your modules should be thoughtfully named and well documented. The entry point to your CLI should be an index.js
file in the root of your application, and all helper modules should be placed in the lib/ directory. Your bitmap transformer modules should not use any third party libraries.
- The CLI should be architected using best modularization practices
- The CLI should require at least three arguments
input-file-path output-file-path transfrom-name
- The CLI should support a minimum of three transforms
- The CLI should log useful
Error
messages if used incorrectly - The CLI should log a success message on completion
- Use
describe
andit
methods to define descriptive tests and increase readability - Each
it
callback should aim to test a small, well defined, feature of a function - Write tests to ensure that each function behaves correctly with valid and invalid inputs
- Note: The CLI should be tested without using
child_process
or any equivalent third party libraries
In your README.md
, describe the exported values of each module you have defined. Every function description should include it's airty (expected number of parameters), the expected data for each parameter (data-type and limitations), and it's behavior (for both valid and invalid use). Feel free to write any additional information in your README.md
that you deem relavent.
You will want to define a strategy for solving the problem before you begin to code. Once you have a strategy defined, you can break it into steps that can be split into helper modules. Each helper module should solve a small specific problem. The main module should utilize the helper modules to execute your original stratagy.
- Gather user input (infile, outfile, and transform)
- Read the input bitmap file using the
fs
module - Parse the bitmap's buffer into an object representing a bitmap (using a constructor)
- Using metadata from the parsed bitmap object, run a transform on the buffer directly (mutate the color or raster data)
- Write the mutated buffer to the output file path
-
Color Pallet Transforms
- Invert
- Randomize
- Black and White
- Darken or Lighten
- Add or Mutiply a Hue
- Add or Subtract Contrast
-
Raster Data Transforms
- Pixilate
- Add a Border
- Add a Watermark
- Vertically or Horizontally Flip
- Vertically or Horizontally Mirror
- Vertically or Horizontally Stretch