init-boilerplate 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/init-boilerplate.rb +50 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21289984f7d632e0a02b5d747b05c1d47af50db7116fcc5bf132383dc22d4eab
|
4
|
+
data.tar.gz: aed3c1e14b6041403a05bed188b11cc9b2f55ef7fefe925fa7ccbf8939ab40ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a13df2bafe825abf45243b857c27e86ac48a49b61f329c4180926f8ed820b734e51347280a8af06348c3d920d1e77770df6dad1d1630c54153853750ae286066
|
7
|
+
data.tar.gz: 9b0d1873d37dcdb5e5c74385dfa841deeb50d880815afea47bb50677bb357fcec4e61af4fa5101e6fb781bca7f1088709fa78069927da16a0de6ba19e8a56f92
|
data/lib/init-boilerplate.rb
CHANGED
@@ -139,9 +139,42 @@ module InitBoilerplate
|
|
139
139
|
puts 'Installing and configuring ESLint...'.colorize(:green)
|
140
140
|
system('npm install --save-dev eslint eslint-plugin-prettier eslint-config-prettier')
|
141
141
|
system('npx eslint --init')
|
142
|
+
if File.exist?(ES_LINT)
|
143
|
+
eslint_json_exists(react)
|
144
|
+
else
|
145
|
+
hash = {
|
146
|
+
plugins: [
|
147
|
+
'prettier'
|
148
|
+
],
|
149
|
+
rules: {
|
150
|
+
'prettier/prettier': 'error',
|
151
|
+
'no-console': 1
|
152
|
+
},
|
153
|
+
extends: [
|
154
|
+
'prettier',
|
155
|
+
'plugin:prettier/recommended'
|
156
|
+
]
|
157
|
+
}
|
158
|
+
if react
|
159
|
+
hash['plugins'] << 'react'
|
160
|
+
hash['extends'] << 'plugin:react/recommended'
|
161
|
+
hash['extends'] << 'prettier/react'
|
162
|
+
end
|
163
|
+
File.open(ES_LINT, 'w+') do |file|
|
164
|
+
file.write(JSON.pretty_generate(hash))
|
165
|
+
file.close
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def self.eslint_json_exists(react)
|
142
171
|
es_lint = File.read(ES_LINT)
|
143
172
|
es_lint_hash = JSON.parse(es_lint)
|
144
|
-
es_lint_hash
|
173
|
+
if es_lint_hash.key?('plugins')
|
174
|
+
es_lint_hash['plugins'] << 'prettier'
|
175
|
+
else
|
176
|
+
es_lint_hash['plugins'] = 'prettier'
|
177
|
+
end
|
145
178
|
es_lint_hash['rules']['prettier/prettier'] = 'error'
|
146
179
|
es_lint_hash['rules']['no-console'] = 1
|
147
180
|
es_lint_hash['extends'] << 'prettier'
|
@@ -174,7 +207,7 @@ module InitBoilerplate
|
|
174
207
|
end
|
175
208
|
|
176
209
|
def self.configure_commitlint
|
177
|
-
puts 'Installing and configuring commitlint...'
|
210
|
+
puts 'Installing and configuring commitlint...'.colorize(:green)
|
178
211
|
system('npm install --save-dev @commitlint/{config-conventional,cli} stylefmt')
|
179
212
|
hash = {
|
180
213
|
extends: ['@commitlint/config-conventional']
|
@@ -186,7 +219,8 @@ module InitBoilerplate
|
|
186
219
|
end
|
187
220
|
|
188
221
|
def self.configure_husky
|
189
|
-
|
222
|
+
system('git init') unless Dir.exist?('.git')
|
223
|
+
puts 'Installing and configuring husky with lint-staged...'.colorize(:green)
|
190
224
|
system('npx mrm lint-staged')
|
191
225
|
package_json = File.read(PACKAGE)
|
192
226
|
package_hash = JSON.parse(package_json)
|
@@ -220,11 +254,11 @@ module InitBoilerplate
|
|
220
254
|
|
221
255
|
def self.create_node_project
|
222
256
|
puts 'Does your project use TypeScript? (y/n)'.colorize(:yellow)
|
223
|
-
input = STDIN.gets.strip.chomp
|
257
|
+
input = STDIN.gets.strip.chomp.downcase
|
224
258
|
typescript = input == 'y'
|
225
259
|
puts 'Make sure this is where you want to create your project (y/n)'.colorize(:magenta)
|
226
260
|
display_pwd
|
227
|
-
confirm = STDIN.gets.strip.chomp
|
261
|
+
confirm = STDIN.gets.strip.chomp.downcase
|
228
262
|
exit(0) if confirm != 'y'
|
229
263
|
puts 'Creating node.js project'.colorize(:green)
|
230
264
|
puts 'With TypeScript' if typescript
|
@@ -242,11 +276,11 @@ module InitBoilerplate
|
|
242
276
|
|
243
277
|
def self.create_react_project
|
244
278
|
puts 'Does your project use TypeScript? (y/n)'.colorize(:yellow)
|
245
|
-
input = STDIN.gets.strip.chomp
|
279
|
+
input = STDIN.gets.strip.chomp.downcase
|
246
280
|
typescript = input == 'y'
|
247
281
|
puts 'Make sure this is where you want to create your project (y/n)'.colorize(:magenta)
|
248
282
|
display_pwd
|
249
|
-
confirm = STDIN.gets.strip.chomp
|
283
|
+
confirm = STDIN.gets.strip.chomp.downcase
|
250
284
|
exit(0) if confirm != 'y'
|
251
285
|
puts 'Creating react.js project'.colorize(:green)
|
252
286
|
puts 'With TypeScript' if typescript
|
@@ -272,15 +306,15 @@ module InitBoilerplate
|
|
272
306
|
FileUtils.mkdir_p pull_request_template_dir
|
273
307
|
|
274
308
|
issue_templates = [
|
275
|
-
'https://github.com/
|
276
|
-
'https://github.com/
|
277
|
-
'https://github.com/
|
278
|
-
'https://github.com/
|
279
|
-
'https://github.com/
|
309
|
+
'https://github.com/gordonpn/git-conventions-guide/raw/master/docs/ISSUE_TEMPLATE/bug.md'.freeze,
|
310
|
+
'https://github.com/gordonpn/git-conventions-guide/raw/master/docs/ISSUE_TEMPLATE/epic.md'.freeze,
|
311
|
+
'https://github.com/gordonpn/git-conventions-guide/raw/master/docs/ISSUE_TEMPLATE/story.md'.freeze,
|
312
|
+
'https://github.com/gordonpn/git-conventions-guide/raw/master/docs/ISSUE_TEMPLATE/sub-task.md'.freeze,
|
313
|
+
'https://github.com/gordonpn/git-conventions-guide/raw/master/docs/ISSUE_TEMPLATE/task.md'.freeze
|
280
314
|
].freeze
|
281
315
|
|
282
|
-
pull_request_template = 'https://github.com/
|
283
|
-
readme_template = 'https://github.com/
|
316
|
+
pull_request_template = 'https://github.com/gordonpn/git-conventions-guide/raw/master/docs/PULL_REQUEST_TEMPLATE/pull_request_template.md'.freeze
|
317
|
+
readme_template = 'https://github.com/gordonpn/git-conventions-guide/raw/master/docs/README_template.md'.freeze
|
284
318
|
|
285
319
|
issue_templates.each do |issue_template|
|
286
320
|
tempfile = Down.download(issue_template)
|
@@ -291,7 +325,7 @@ module InitBoilerplate
|
|
291
325
|
FileUtils.mv tempfile.path, "./#{pull_request_template_dir}/#{tempfile.original_filename}"
|
292
326
|
|
293
327
|
tempfile = Down.download(readme_template)
|
294
|
-
FileUtils.mv tempfile.path,
|
328
|
+
FileUtils.mv tempfile.path, "./#{tempfile.original_filename}"
|
295
329
|
|
296
330
|
end
|
297
331
|
|
@@ -326,4 +360,4 @@ module InitBoilerplate
|
|
326
360
|
clean_directory if ARGV[0] == 'clean'
|
327
361
|
display_menu
|
328
362
|
end
|
329
|
-
end
|
363
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: init-boilerplate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gordon Pham-Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|