@nachoray/node-init 1.0.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/init.sh +56 -0
- package/package.json +19 -0
package/init.sh
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# ── Dependencies — edit here to add/remove/update packages ──
|
|
4
|
+
DEPS="pino"
|
|
5
|
+
DEV_DEPS="eslint prettier husky lint-staged @eslint/js pino-pretty"
|
|
6
|
+
# ────────────────────────────────────────────────────────────
|
|
7
|
+
|
|
8
|
+
npm init -y && \
|
|
9
|
+
git init && \
|
|
10
|
+
mkdir src && \
|
|
11
|
+
npm pkg set type=module && \
|
|
12
|
+
npm pkg set engines.node=">=21" && \
|
|
13
|
+
npm install $DEPS && \
|
|
14
|
+
npm install -D $DEV_DEPS && \
|
|
15
|
+
npm pkg set scripts.dev="node --watch src/index.js | pino-pretty -c" && \
|
|
16
|
+
npm pkg set scripts.start="node src/index.js" && \
|
|
17
|
+
npm pkg set scripts.lint="eslint ." && \
|
|
18
|
+
npm pkg set scripts.format="prettier --write ." && \
|
|
19
|
+
touch .env && \
|
|
20
|
+
printf "node_modules\n.env\n" > .gitignore && \
|
|
21
|
+
printf "PORT=3000\nLOG_LEVEL=info\n" > .env.example && \
|
|
22
|
+
printf "import process from 'node:process'
|
|
23
|
+
import pino from 'pino'
|
|
24
|
+
|
|
25
|
+
process.loadEnvFile()
|
|
26
|
+
|
|
27
|
+
const logger = pino({
|
|
28
|
+
level: process.env.LOG_LEVEL || 'info'
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const PORT = process.env.PORT || 3000
|
|
32
|
+
|
|
33
|
+
logger.info(\`App running on port \${PORT}\`)
|
|
34
|
+
" > src/index.js && \
|
|
35
|
+
printf '{
|
|
36
|
+
"tabWidth": 2,
|
|
37
|
+
"semi": false,
|
|
38
|
+
"singleQuote": true,
|
|
39
|
+
"trailingComma": "none",
|
|
40
|
+
"printWidth": 100
|
|
41
|
+
}
|
|
42
|
+
' > .prettierrc && \
|
|
43
|
+
printf '{
|
|
44
|
+
"*.{js,jsx,ts,tsx}": [
|
|
45
|
+
"eslint --fix",
|
|
46
|
+
"prettier --write"
|
|
47
|
+
],
|
|
48
|
+
"*.{json,css,md}": [
|
|
49
|
+
"prettier --write"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
' > .lintstagedrc.json && \
|
|
53
|
+
npx eslint --init && \
|
|
54
|
+
npx husky init && \
|
|
55
|
+
echo "lint-staged" > ./.husky/pre-commit && \
|
|
56
|
+
git add . && git commit -m "Initial commit"
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nachoray/node-init",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A simple scaffolding tool for new Node.js projects",
|
|
5
|
+
"bin": {
|
|
6
|
+
"node-init": "./init.sh"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"init.sh"
|
|
10
|
+
],
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=18"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"scaffold",
|
|
16
|
+
"boilerplate",
|
|
17
|
+
"node"
|
|
18
|
+
]
|
|
19
|
+
}
|