Class: Dopstick::Generator::NPM::Generator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Dopstick::Generator::NPM::Generator
- Includes:
- Thor::Actions
- Defined in:
- lib/dopstick/generator/npm/generator.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #copy_generic_templates ⇒ Object
- #copy_github_templates ⇒ Object
- #copy_npm_templates ⇒ Object
- #initialize_repo ⇒ Object
- #install_dependencies ⇒ Object
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
12 13 14 |
# File 'lib/dopstick/generator/npm/generator.rb', line 12 def @options end |
Class Method Details
.exit_on_failure? ⇒ Boolean
16 17 18 |
# File 'lib/dopstick/generator/npm/generator.rb', line 16 def self.exit_on_failure? true end |
.source_paths ⇒ Object
20 21 22 23 24 25 |
# File 'lib/dopstick/generator/npm/generator.rb', line 20 def self.source_paths [ source_root, File.join(__dir__, "../base/templates") ] end |
.source_root ⇒ Object
27 28 29 |
# File 'lib/dopstick/generator/npm/generator.rb', line 27 def self.source_root File.join(__dir__, "templates") end |
Instance Method Details
#copy_generic_templates ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/dopstick/generator/npm/generator.rb', line 43 def copy_generic_templates template "license.erb", "LICENSE.md" template "coc.erb", "CODE_OF_CONDUCT.md" template "readme.erb", "README.md" template "changelog.erb", "CHANGELOG.md" template "contributing.erb", "CONTRIBUTING.md" template "gitignore.erb", ".gitignore" end |
#copy_github_templates ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/dopstick/generator/npm/generator.rb', line 52 def copy_github_templates template "tests_workflow.erb", ".github/workflows/js-tests.yml" template "funding.erb", ".github/FUNDING.yml" template "bug_report.erb", ".github/ISSUE_TEMPLATE/bug_report.md" template "feature_request.erb", ".github/ISSUE_TEMPLATE/feature_request.md" template "pull_request.erb", ".github/PULL_REQUEST_TEMPLATE.md" template "issue_template_config.erb", ".github/ISSUE_TEMPLATE/config.yml" template "dependabot.erb", ".github/dependabot.yml" template "codeowners.erb", ".github/CODEOWNERS" end |
#copy_npm_templates ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/dopstick/generator/npm/generator.rb', line 31 def copy_npm_templates template "package.erb", "package.json" template "tsconfig.erb", "tsconfig.json" template "prettier.erb", "prettier.config.js" template "jest.erb", "jest.config.js" template "eslint.erb", ".eslintrc.js" template "webpack.erb", "webpack.config.js" template "babel.erb", "babel.config.json" template "index.erb", "src/index.ts" template "index_test.erb", "src/index.test.ts" end |
#initialize_repo ⇒ Object
94 95 96 97 98 99 |
# File 'lib/dopstick/generator/npm/generator.rb', line 94 def initialize_repo in_root do run "git init --initial-branch=main", capture: true run "git add .", capture: true end end |
#install_dependencies ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/dopstick/generator/npm/generator.rb', line 65 def install_dependencies return if .skip_install? in_root do %w[ @babel/core @babel/preset-env @fnando/codestyle @fnando/eslint-config-codestyle @typescript-eslint/eslint-plugin @typescript-eslint/parser @types/jest babel-loader babel-plugin-module-resolver eslint jest jest-filename-transform prettier ts-jest ts-loader typescript webpack webpack-cli ].each do |dep| run "yarn add --dev #{dep}", capture: true end end end |