From 332ee0060ae60eade8a184197e4205423cb0ebfc Mon Sep 17 00:00:00 2001 From: Alberto Sola Date: Mon, 21 Oct 2019 22:43:11 +0200 Subject: [PATCH] v0.2.0 (#2) v0.2.0: Markdown support, TravisCI, test coverage and code refactor. --- .travis.yml | 17 +++ CHANGELOG.md | 16 +- README.md | 73 +++++---- jest.config.js | 11 +- package-lock.json | 142 ++++++++++++------ package.json | 14 +- src/domain/builder/builder.ts | 34 ++++- src/domain/builder/builders/css.builder.ts | 4 +- src/domain/builder/builders/html.builder.ts | 28 ++-- src/domain/builder/builders/index.ts | 1 + .../builder/builders/markdown.builder.ts | 27 ++++ src/domain/{filler => loader}/index.ts | 1 - src/domain/{filler => loader}/loader.ts | 20 +-- src/domain/storer/index.ts | 1 + .../{filler/filler.ts => storer/storer.ts} | 41 ++--- src/index.ts | 21 ++- src/interfaces/builder.interface.ts | 4 +- ...{store.interface.ts => cache.interface.ts} | 2 +- src/interfaces/index.ts | 2 +- src/lib/cache/index.ts | 1 + src/lib/{store/store.ts => cache/memory.ts} | 4 +- src/lib/filler/filler.ts | 86 ----------- src/lib/store/index.ts | 1 - src/use-cases/build/build.ts | 22 +-- test/unit/builder.css.test.ts | 6 +- test/unit/builder.html.test.ts | 84 +++++------ test/unit/builder.markdown.test.ts | 58 +++++++ test/unit/builder.test.ts | 16 +- test/unit/loader.test.ts | 48 +++--- test/unit/memory.cache.test.ts | 9 ++ test/unit/store.test.ts | 9 -- 31 files changed, 467 insertions(+), 336 deletions(-) create mode 100644 .travis.yml create mode 100644 src/domain/builder/builders/markdown.builder.ts rename src/domain/{filler => loader}/index.ts (50%) rename src/domain/{filler => loader}/loader.ts (80%) create mode 100644 src/domain/storer/index.ts rename src/domain/{filler/filler.ts => storer/storer.ts} (58%) rename src/interfaces/{store.interface.ts => cache.interface.ts} (73%) create mode 100644 src/lib/cache/index.ts rename src/lib/{store/store.ts => cache/memory.ts} (67%) delete mode 100644 src/lib/filler/filler.ts delete mode 100644 src/lib/store/index.ts create mode 100644 test/unit/builder.markdown.test.ts create mode 100644 test/unit/memory.cache.test.ts delete mode 100644 test/unit/store.test.ts diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..454d6cd --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: node_js +node_js: + - "12.12" +cache: + directories: + - node_modules +branches: + only: + - master +before_install: + - npm update +install: + - npm ci +script: + - npm run test + - npm run coveralls + - npm run build diff --git a/CHANGELOG.md b/CHANGELOG.md index cd81f1f..cab3e57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,26 @@ # Changelog + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.0] - 21-10-2019 + +### Added + +- Markdown support. +- Build command supports output folder option and args validation. +- Travis CI integration. +- Test coverage. + ## [0.1.0] - 20-10-2019 + ### Added + - Uses generic file types only. - Template system. +- Template system. - Snippet system. - Progressive builds. - CSS minification. -- Blog post, recent posts and archive. \ No newline at end of file +- Blog post, recent posts and archive. diff --git a/README.md b/README.md index c43dbd0..8cfcb20 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,29 @@ +[![TravisCI](https://travis-ci.com/pirobtumen/filler.svg?branch=master)](https://travis-ci.com/pirobtumen/filler) +[![Coverage Status](https://coveralls.io/repos/github/pirobtumen/filler/badge.svg?branch=master)](https://coveralls.io/github/pirobtumen/filler?branch=master) + # Filler -1. Description -2. Features & Roadmap -3. Installation -4. Commands -5. Folder structure -6. Template system -7. Snippet system -8. Blog system -9. Contribute -10. License +Static web sites made easy. + +**Table of content** + +- [Filler](#filler) + - [Objective](#objective) + - [Features and Roadmap](#features-and-roadmap) +- [Installation](#installation) + - [Commands](#commands) + - [Folder structure](#folder-structure) + - [Template system](#template-system) + - [Snippet system](#snippet-system) + - [Blog system](#blog-system) +- [Contribute](#contribute) +- [License](#license) -## Static web sites made easy. +## Objective Filler is a tool to create a static website using templates, reusing code and saving time. Its main purpose is to be as simple as possible to use. -## Features & Roadmap +## Features and Roadmap - [x] Uses generic file types only. [v0.1.0] - [x] Template system. [v0.1.0] @@ -23,19 +31,26 @@ Filler is a tool to create a static website using templates, reusing code and sa - [x] Progressive builds (it only builds files that have changed, but you can `--force` it). [v0.1.0] - [x] CSS minification. [v0.1.0] - [x] Blog post, recent posts and archive. [v0.1.0] -- [ ] Markdown support. +- [x] Markdown support. +- [ ] Improve logging system. +- [ ] Improve error system. +- [ ] Serve project: build in memory and watch for file changes. +- [ ] Support saving into cloud storage (AWS S3, Google Cloud Storage...). +- [ ] Example templates. +- [ ] "init" command. +- [ ] Multilingual sites. - [ ] Webpack support. - [ ] React support. -- [ ] Serve project (build in memory and watch for file changes). - [ ] Server Side Rendering. - [ ] SEO features. - [ ] Any proposal? Contribute! -## Installation +# Installation -Install node [[Download link](https://nodejs.org/en/download/)] [Tested version 12.12] +Install node [[Download link](https://nodejs.org/en/download/)][tested version 12.12] Install filler: + ``` git clone https://github.com/pirobtumen/filler.git cd filler @@ -47,11 +62,12 @@ node filler --help ## Commands - build \ [OPTIONS] + - folder: project folder path. E.g.: "~/Projects/myweb". - - --force: force build all files. - - --mode [dev, prod]: build mode. Replace specifi snippets. - - --recentPosts [number]: number of recent posts rendered. - + - --output: output folder path. Default: ./dist + - --force: force build all files. Default: false + - --mode [dev, prod]: build mode. Replace specific snippets. Default: dev + - --recentPosts [number]: number of recent posts rendered. Default: 5 ## Folder structure @@ -74,13 +90,14 @@ Create the following file structure: - /styles - styles.css ``` + Build command for development: `node filler ~/Projects/myweb` Build command for production (injects analytics): -`node filler ~/Projects/myweb` +`node filler ~/Projects/myweb --mode prod` The output folder will contain: @@ -98,7 +115,7 @@ The output folder will contain: ## Template system -The files inside the public folder can use any template created inside the `/templates` folder. The idea is to set the property `@template