Class: Makit::Cli::Generators::Templates::Node::Gitignore

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

Overview

Template generator for Node.js project .gitignore files

Generates a .gitignore file with common Node.js artifacts and log files that should not be committed to version control. Includes node_modules/, npm debug logs, and yarn error logs.

Examples:

gitignore = Gitignore.new("MyProject")
ignore_content = gitignore.render

Instance Method Summary collapse

Constructor Details

#initialize(project_name) ⇒ Gitignore

Initialize a new .gitignore template generator

Parameters:

  • project_name (String)

    the name of the Node.js project (unused but kept for consistency)



141
142
143
# File 'lib/makit/cli/generators/templates/node_templates.rb', line 141

def initialize(project_name)
  @project_name = project_name
end

Instance Method Details

#renderString

Render the .gitignore file content

Returns:

  • (String)

    the complete .gitignore content for Node.js projects



148
149
150
151
152
153
154
155
# File 'lib/makit/cli/generators/templates/node_templates.rb', line 148

def render
  "    node_modules/\n    npm-debug.log*\n    yarn-debug.log*\n    yarn-error.log*\n  GITIGNORE\nend\n"