foobara-empty-typescript-react-project-generator 0.1.0 → 0.2.0
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/CHANGELOG.md +4 -0
- data/src/write_empty_typescript_react_project_to_disk.rb +12 -27
- data/templates/.github/workflows/tests.yml +8 -7
- data/templates/eslint.config.js +30 -0
- metadata +2 -3
- data/templates/.eslintrc.js +0 -45
- data/templates/tsconfig.json +0 -26
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5766d1ac0b265272cc62b2da7fa015890bceb2cce99f9def87d71e7b2eb102a4
|
|
4
|
+
data.tar.gz: 773f8ead5b569f765f9018e0c69b9131cdc55d6cc606f2cdbf8c951508952fc4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c6bb08aa04721d807cfc8af0d19d03d88000d752e62e190becb20737dfd416cc05a31a2faf12305117c0c5766fd8e7e82fb70b7b320ba74a9754a948a53e8505
|
|
7
|
+
data.tar.gz: b7ea9b1d7f2a04e4e18b8c866ab1148cdeed2fb07a920332fb2a6608d985be7e926c6b5c1acff3211e1ccc9ce44edd8a44767e932ba60ffdb9310317808ad2b2
|
data/CHANGELOG.md
CHANGED
|
@@ -54,19 +54,18 @@ module Foobara
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def run_pre_generation_tasks
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
fix_uncorrectable_lint_violations
|
|
57
|
+
run_npm_create_vite
|
|
58
|
+
npm_install
|
|
60
59
|
eslint_fix
|
|
61
60
|
git_init
|
|
62
61
|
git_add_all
|
|
63
|
-
|
|
62
|
+
git_commit_initial_setup
|
|
64
63
|
end
|
|
65
64
|
|
|
66
|
-
def
|
|
67
|
-
puts "
|
|
65
|
+
def run_npm_create_vite
|
|
66
|
+
puts "creating empty project with Vite..."
|
|
68
67
|
|
|
69
|
-
cmd = "
|
|
68
|
+
cmd = "npm create vite@latest #{empty_typescript_react_project_config.project_dir} -- --template react-ts"
|
|
70
69
|
|
|
71
70
|
FileUtils.mkdir_p output_parent_directory
|
|
72
71
|
|
|
@@ -75,16 +74,10 @@ module Foobara
|
|
|
75
74
|
end
|
|
76
75
|
end
|
|
77
76
|
|
|
78
|
-
def
|
|
79
|
-
puts "
|
|
77
|
+
def npm_install
|
|
78
|
+
puts "installing dependencies..."
|
|
80
79
|
|
|
81
|
-
cmd = "npm install
|
|
82
|
-
"@babel/plugin-proposal-private-property-in-object@^7.21.11 " \
|
|
83
|
-
"@eslint/create-config@^0.4.6 " \
|
|
84
|
-
"eslint-config-standard-with-typescript@^37.0.0 " \
|
|
85
|
-
"eslint-plugin-n@^16.5.0 " \
|
|
86
|
-
"eslint-plugin-promise@^6.1.1 " \
|
|
87
|
-
"typescript@^4.0.0 "
|
|
80
|
+
cmd = "npm install"
|
|
88
81
|
|
|
89
82
|
Dir.chdir project_directory do
|
|
90
83
|
run_cmd_and_write_output(cmd)
|
|
@@ -104,18 +97,10 @@ module Foobara
|
|
|
104
97
|
end
|
|
105
98
|
end
|
|
106
99
|
|
|
107
|
-
def fix_uncorrectable_lint_violations
|
|
108
|
-
Dir.chdir(project_directory) do
|
|
109
|
-
web_vitals_contents = File.read("src/reportWebVitals.ts")
|
|
110
|
-
web_vitals_contents.gsub!("if (onPerfEntry && ", "if (onPerfEntry != null && ")
|
|
111
|
-
File.write("src/reportWebVitals.ts", web_vitals_contents)
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
|
|
115
100
|
def eslint_fix
|
|
116
101
|
puts "linting..."
|
|
117
102
|
|
|
118
|
-
cmd = "npx eslint
|
|
103
|
+
cmd = "npx eslint . --fix"
|
|
119
104
|
Dir.chdir project_directory do
|
|
120
105
|
run_cmd_and_write_output(cmd)
|
|
121
106
|
end
|
|
@@ -137,8 +122,8 @@ module Foobara
|
|
|
137
122
|
end
|
|
138
123
|
end
|
|
139
124
|
|
|
140
|
-
def
|
|
141
|
-
cmd = "git commit -m '
|
|
125
|
+
def git_commit_initial_setup
|
|
126
|
+
cmd = "git commit -m 'Initial Vite project with react-ts template'"
|
|
142
127
|
|
|
143
128
|
Dir.chdir project_directory do
|
|
144
129
|
run_cmd_and_write_output(cmd, raise_if_fails: false)
|
|
@@ -3,16 +3,17 @@ on: push
|
|
|
3
3
|
jobs:
|
|
4
4
|
tests:
|
|
5
5
|
runs-on: ubuntu-latest
|
|
6
|
-
name:
|
|
6
|
+
name: build and lint
|
|
7
7
|
steps:
|
|
8
|
-
- uses: actions/checkout@
|
|
8
|
+
- uses: actions/checkout@v4
|
|
9
9
|
- name: Use Node.js
|
|
10
10
|
if: always()
|
|
11
|
-
uses: actions/setup-node@
|
|
11
|
+
uses: actions/setup-node@v4
|
|
12
12
|
with:
|
|
13
|
-
|
|
14
|
-
node-version: "20.9"
|
|
13
|
+
node-version: "20"
|
|
15
14
|
- name: Install dependencies
|
|
16
15
|
run: npm install
|
|
17
|
-
- name:
|
|
18
|
-
run: npm run
|
|
16
|
+
- name: Lint
|
|
17
|
+
run: npm run lint
|
|
18
|
+
- name: Build
|
|
19
|
+
run: npm run build
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
|
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
|
+
import tseslint from 'typescript-eslint'
|
|
6
|
+
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
7
|
+
|
|
8
|
+
export default defineConfig([
|
|
9
|
+
globalIgnores(['dist']),
|
|
10
|
+
{
|
|
11
|
+
files: ['**/*.{ts,tsx}'],
|
|
12
|
+
extends: [
|
|
13
|
+
js.configs.recommended,
|
|
14
|
+
tseslint.configs.recommended,
|
|
15
|
+
reactHooks.configs.flat.recommended,
|
|
16
|
+
reactRefresh.configs.vite,
|
|
17
|
+
],
|
|
18
|
+
languageOptions: {
|
|
19
|
+
ecmaVersion: 2020,
|
|
20
|
+
globals: globals.browser,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
files: ['src/domains/**/*.{ts,tsx}'],
|
|
25
|
+
rules: {
|
|
26
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
27
|
+
'@typescript-eslint/prefer-as-const': 'off',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
])
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foobara-empty-typescript-react-project-generator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Miles Georgi
|
|
@@ -60,9 +60,8 @@ files:
|
|
|
60
60
|
- src/generate_empty_typescript_react_project.rb
|
|
61
61
|
- src/write_empty_typescript_react_project_to_disk.rb
|
|
62
62
|
- templates/.env
|
|
63
|
-
- templates/.eslintrc.js
|
|
64
63
|
- templates/.github/workflows/tests.yml
|
|
65
|
-
- templates/
|
|
64
|
+
- templates/eslint.config.js
|
|
66
65
|
homepage: https://github.com/foobara/generators-empty-typescript-react-project-generator
|
|
67
66
|
licenses:
|
|
68
67
|
- Apache-2.0
|
data/templates/.eslintrc.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es2021": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"standard-with-typescript",
|
|
8
|
-
"plugin:react/recommended"
|
|
9
|
-
],
|
|
10
|
-
"overrides": [
|
|
11
|
-
{
|
|
12
|
-
"env": {
|
|
13
|
-
"node": true
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
".eslintrc.{js,cjs}"
|
|
17
|
-
],
|
|
18
|
-
"parserOptions": {
|
|
19
|
-
"sourceType": "script"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
parser: '@typescript-eslint/parser',
|
|
24
|
-
"parserOptions": {
|
|
25
|
-
"ecmaVersion": "latest",
|
|
26
|
-
project: ['./tsconfig.json'],
|
|
27
|
-
"sourceType": "module"
|
|
28
|
-
},
|
|
29
|
-
"plugins": [
|
|
30
|
-
"react"
|
|
31
|
-
],
|
|
32
|
-
settings: {
|
|
33
|
-
react: {
|
|
34
|
-
version: "detect"
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
"rules": {
|
|
38
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
39
|
-
"@typescript-eslint/triple-slash-reference": "off",
|
|
40
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
41
|
-
"@typescript-eslint/no-floating-promises": "off",
|
|
42
|
-
"react/jsx-indent" : ["error", 2],
|
|
43
|
-
"react/jsx-indent-props": ["error", 2]
|
|
44
|
-
}
|
|
45
|
-
}
|
data/templates/tsconfig.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es6",
|
|
4
|
-
"lib": [
|
|
5
|
-
"dom",
|
|
6
|
-
"dom.iterable",
|
|
7
|
-
"esnext"
|
|
8
|
-
],
|
|
9
|
-
"allowJs": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"allowSyntheticDefaultImports": true,
|
|
13
|
-
"strict": true,
|
|
14
|
-
"forceConsistentCasingInFileNames": true,
|
|
15
|
-
"noFallthroughCasesInSwitch": true,
|
|
16
|
-
"module": "CommonJS",
|
|
17
|
-
"moduleResolution": "node",
|
|
18
|
-
"resolveJsonModule": true,
|
|
19
|
-
"isolatedModules": true,
|
|
20
|
-
"noEmit": true,
|
|
21
|
-
"jsx": "react-jsx"
|
|
22
|
-
},
|
|
23
|
-
"include": [
|
|
24
|
-
"src"
|
|
25
|
-
]
|
|
26
|
-
}
|