@anthonylzq/simba.js 1.4.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.
- package/.eslintrc +64 -0
- package/CHANGELOG.md +68 -0
- package/LICENSE +21 -0
- package/README.md +234 -0
- package/bin/index.js +5 -0
- package/lib/index.js +285 -0
- package/lib/src/functions/changelog.js +15 -0
- package/lib/src/functions/docker.js +25 -0
- package/lib/src/functions/eslint.js +104 -0
- package/lib/src/functions/express.js +1225 -0
- package/lib/src/functions/gitignore.js +140 -0
- package/lib/src/functions/heroku.js +16 -0
- package/lib/src/functions/license.js +85 -0
- package/lib/src/functions/nodemon.js +25 -0
- package/lib/src/functions/packageJson.js +53 -0
- package/lib/src/functions/readme.js +16 -0
- package/lib/src/functions/tsconfig.js +89 -0
- package/lib/src/functions/webpack.js +45 -0
- package/lib/src/installation.js +161 -0
- package/lib/src/utils/titleCase.js +16 -0
- package/lib/src/utils/writeFile.js +15 -0
- package/package.json +56 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const writeFile = require('../utils/writeFile')
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {String} projectName
|
|
5
|
+
* @returns {Promise<void>}
|
|
6
|
+
*/
|
|
7
|
+
module.exports = async projectName => {
|
|
8
|
+
const data = {
|
|
9
|
+
dockerContent: `FROM node:16-alpine
|
|
10
|
+
|
|
11
|
+
WORKDIR /app
|
|
12
|
+
|
|
13
|
+
COPY package.json ./
|
|
14
|
+
|
|
15
|
+
RUN yarn install --prod
|
|
16
|
+
|
|
17
|
+
COPY dist /app/dist
|
|
18
|
+
|
|
19
|
+
CMD [ "yarn", "start" ]
|
|
20
|
+
`,
|
|
21
|
+
dockerFile: 'Dockerfile'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
await writeFile(`${projectName}/${data.dockerFile}`, data.dockerContent)
|
|
25
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
const writeFile = require('../utils/writeFile')
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {String} projectName
|
|
5
|
+
* @returns {Promise<void>}
|
|
6
|
+
*/
|
|
7
|
+
module.exports = async projectName => {
|
|
8
|
+
const data = {
|
|
9
|
+
eslintContent: `module.exports = {
|
|
10
|
+
env: {
|
|
11
|
+
node: true
|
|
12
|
+
},
|
|
13
|
+
root: true,
|
|
14
|
+
parser: '@typescript-eslint/parser',
|
|
15
|
+
plugins: [
|
|
16
|
+
'@typescript-eslint',
|
|
17
|
+
'import',
|
|
18
|
+
'prettier'
|
|
19
|
+
],
|
|
20
|
+
extends: [
|
|
21
|
+
'standard',
|
|
22
|
+
'eslint:recommended',
|
|
23
|
+
'plugin:@typescript-eslint/eslint-recommended',
|
|
24
|
+
'plugin:@typescript-eslint/recommended',
|
|
25
|
+
'prettier'
|
|
26
|
+
],
|
|
27
|
+
rules: {
|
|
28
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
29
|
+
'@typescript-eslint/no-empty-interface': 'off',
|
|
30
|
+
'arrow-parens': [
|
|
31
|
+
'error',
|
|
32
|
+
'as-needed'
|
|
33
|
+
],
|
|
34
|
+
'import/extensions': [
|
|
35
|
+
2,
|
|
36
|
+
{
|
|
37
|
+
ts: 'never',
|
|
38
|
+
js: 'always',
|
|
39
|
+
json: 'always'
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
'import/no-extraneous-dependencies': [
|
|
43
|
+
'error',
|
|
44
|
+
{
|
|
45
|
+
devDependencies: ['**/*.test.js', 'webpack.config.js'],
|
|
46
|
+
optionalDependencies: ['**/*.test.js'],
|
|
47
|
+
peerDependencies: ['**/*.test.js']
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
'max-len': [
|
|
51
|
+
'error',
|
|
52
|
+
{
|
|
53
|
+
code: 80,
|
|
54
|
+
ignoreComments: true,
|
|
55
|
+
ignoreRegExpLiterals: true,
|
|
56
|
+
ignoreTemplateLiterals: true,
|
|
57
|
+
ignoreTrailingComments: true,
|
|
58
|
+
ignoreStrings: true,
|
|
59
|
+
ignoreUrls: true
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
'newline-before-return': 'error',
|
|
63
|
+
'object-curly-spacing': [
|
|
64
|
+
'error',
|
|
65
|
+
'always'
|
|
66
|
+
],
|
|
67
|
+
'prefer-const': 'error',
|
|
68
|
+
'prettier/prettier': [
|
|
69
|
+
'error',
|
|
70
|
+
{
|
|
71
|
+
'arrowParens': 'avoid',
|
|
72
|
+
'bracketSpacing': true,
|
|
73
|
+
'printWidth': 80,
|
|
74
|
+
'quoteProps': 'as-needed',
|
|
75
|
+
'semi': false,
|
|
76
|
+
'singleQuote': true,
|
|
77
|
+
'tabWidth': 2,
|
|
78
|
+
'trailingComma': 'none'
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
radix: [
|
|
82
|
+
'error',
|
|
83
|
+
'as-needed'
|
|
84
|
+
],
|
|
85
|
+
'spaced-comment': ['error', 'always']
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
`,
|
|
89
|
+
eslintFile: '.eslintrc.js',
|
|
90
|
+
eslintIgnoreContent: `/dist
|
|
91
|
+
.eslintrc.js
|
|
92
|
+
webpack.config.js
|
|
93
|
+
`,
|
|
94
|
+
eslintIgnoreFile: '.eslintignore'
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
await Promise.all([
|
|
98
|
+
writeFile(`${projectName}/${data.eslintFile}`, data.eslintContent),
|
|
99
|
+
writeFile(
|
|
100
|
+
`${projectName}/${data.eslintIgnoreFile}`,
|
|
101
|
+
data.eslintIgnoreContent
|
|
102
|
+
)
|
|
103
|
+
])
|
|
104
|
+
}
|