diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..dc9d64e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +# tabs 4 spaces for makefiles +[Makefile] +indent_size = 4 +indent_style = tab +[*.mk] +indent_size = 4 +indent_style = tab \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..310c160 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# phpstorm/netbeans/eclipse project files +.idea +.vscode +nbproject +.buildpath +.project +.settings + +# windows/Mac thumbnail cache +Thumbs.db +.DS_Store \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b29fd98 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,24 @@ + +# 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.1.0](https://github.com/justcoded/dockerize-plop-js/compare/c11fb61e0409ea1d33490caa0d420a7768bd1286...v1.0.0) (2024-10-18) +### Features + +* :building_construction: add docker & plop files +* :memo: add changelog-config + +### Bug Fixes + +* :memo: plop console info + + +--- + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c75698f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:22.6.0 + +RUN mkdir /plop +RUN mkdir /codebase +RUN npm install -g plop tsx cross-env typescript +COPY ./plop/* /plop + + +CMD ['npm', 'run', 'plop'] +SHELL ["/bin/bash", "-c"] + +WORKDIR /plop + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e6e1cac --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +.PHONY: default chl chl-first + +default: + @echo 'Plop helper from JustCoded' + +## +# CHANGELOG vars and targets +## +CONV_CHL_IMAGE := justcoded/php-conventional-changelog:latest +CONV_CHL_DR := docker run -it --rm --volume "$$PWD":/codebase ${CONV_CHL_IMAGE} bash +CONV_CHL_CMD := conventional-changelog --config changelog-config.php + +## +# @command chl Generate changelog based on conventional commits +## +chl: + ${CONV_CHL_DR} \ + -c "${CONV_CHL_CMD}" + +## +# @command chl-first Generate changelog based on conventional commits, first version +## +chl-first: + ${CONV_CHL_DR} \ + -c "${CONV_CHL_CMD} --first-release" diff --git a/README.md b/README.md index b1f8052..ace2b48 100644 --- a/README.md +++ b/README.md @@ -1 +1,21 @@ -# dockerize-plop-js \ No newline at end of file +# Dockerized Plop Repository + +This repository provides a Dockerized setup for [Plop.js](https://plopjs.com/), a micro-generator framework that helps you automate the creation of files and components in your projects. + +## Features + +- **Dockerized Environment**: Run Plop.js in a containerized environment. + +## Getting Started + +### Prerequisites + +- Docker installed on your machine. + +### Usage + +1. **Run the Docker image**: + You can use the local image name for now, or once finalized, use the public image URL provided by GitHub Actions: + ```bash + docker run --rm -it plop_plop + ``` diff --git a/changelog-config.php b/changelog-config.php new file mode 100644 index 0000000..33d2d6a --- /dev/null +++ b/changelog-config.php @@ -0,0 +1,18 @@ + 'CHANGELOG.md', + 'headerTitle' => 'Changelog', + 'headerDescription' => '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). + +---', + 'ignoreTypes' => ['build', 'chore', 'ci', 'docs', 'perf', 'refactor', 'revert', 'style', 'test', 'bug'], + + 'hiddenHash' => true, +]; \ No newline at end of file diff --git a/plop/package.json b/plop/package.json new file mode 100644 index 0000000..17d765c --- /dev/null +++ b/plop/package.json @@ -0,0 +1,5 @@ +{ + "scripts": { + "plop": "cross-env NODE_OPTIONS='--import tsx' plop --plopfile=plopfile.ts" + } +} diff --git a/plop/plopfile.ts b/plop/plopfile.ts new file mode 100644 index 0000000..ddb13b4 --- /dev/null +++ b/plop/plopfile.ts @@ -0,0 +1,16 @@ +import { NodePlopAPI } from 'plop'; + + +export default function (plop: NodePlopAPI) { + plop.setGenerator('Show README', { + description: 'Show the content of README.md', + actions: [ + () => { + console.log(` + No real generators available. \n + To use docker image, mount your plopfile sources in /plop directory.` + ); + } + ] + }); +}