Class: Makit::Cli::Generators::Templates::Node::Readme

Inherits:
Object
  • Object
show all
Defined in:
lib/makit/cli/generators/templates/node_templates.rb

Overview

Template generator for Node.js project README.md files

Generates a standard README.md file with project name, description, and common npm commands (install, run, test). Provides documentation structure for Node.js projects.

Examples:

readme = Readme.new("MyNodeApp")
markdown_content = readme.render

Instance Method Summary collapse

Constructor Details

#initialize(project_name) ⇒ Readme

Initialize a new README.md template generator

Parameters:

  • project_name (String)

    the name of the Node.js project



94
95
96
# File 'lib/makit/cli/generators/templates/node_templates.rb', line 94

def initialize(project_name)
  @project_name = project_name
end

Instance Method Details

#renderString

Render the README.md markdown content

Returns:

  • (String)

    the complete README.md content with npm instructions



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/makit/cli/generators/templates/node_templates.rb', line 101

def render
  "    # \#{@project_name}\n\n    A Node.js project.\n\n    ## Installation\n\n    ```bash\n    npm install\n    ```\n\n    ## Running\n\n    ```bash\n    node index.js\n    ```\n\n    ## Testing\n\n    ```bash\n    npm test\n    ```\n  README\nend\n"