dev-config-pack 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/README.md +41 -0
- package/bin/cli.js +33 -0
- package/configs/gitignore.txt +36 -0
- package/configs/js/eslintrc.json +22 -0
- package/configs/prettier.config.js +10 -0
- package/configs/react/eslintrc.json +30 -0
- package/configs/tailwind.config.js +18 -0
- package/configs/ts/tsconfig.json +29 -0
- package/configs/vscode/settings.json +18 -0
- package/package.json +35 -0
- package/src/init.js +103 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# ⚡ Dev Config Pack
|
|
2
|
+
|
|
3
|
+
Configurações otimizadas para projetos JavaScript, TypeScript e React.
|
|
4
|
+
|
|
5
|
+
Zero dependências. Um comando e pronto.
|
|
6
|
+
|
|
7
|
+
## Uso
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx dev-config-pack init
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Ou especifique o tipo:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx dev-config-pack init ts
|
|
17
|
+
npx dev-config-pack init react
|
|
18
|
+
npx dev-config-pack init js
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## O que instala
|
|
22
|
+
|
|
23
|
+
| Arquivo | Descrição |
|
|
24
|
+
|---------|-----------|
|
|
25
|
+
| `.eslintrc.json` | ESLint com regras modernas |
|
|
26
|
+
| `.prettierrc` | Prettier formatador consistente |
|
|
27
|
+
| `tsconfig.json` | TypeScript strict + paths |
|
|
28
|
+
| `tailwind.config.js` | Tailwind otimizado |
|
|
29
|
+
| `.vscode/settings.json` | Editor config para formatação automática |
|
|
30
|
+
| `.gitignore` | Gitignore completo |
|
|
31
|
+
|
|
32
|
+
## Premium
|
|
33
|
+
|
|
34
|
+
[Adquira a versão premium →](https://gumroad.com/l/dev-config-pack)
|
|
35
|
+
|
|
36
|
+
- ESLint strict + import sorting
|
|
37
|
+
- Husky + lint-staged
|
|
38
|
+
- Commitlint convencional
|
|
39
|
+
- CI/CD GitHub Actions
|
|
40
|
+
- Dockerfile otimizado
|
|
41
|
+
- Suporte prioritário
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { run } from "../src/init.js";
|
|
3
|
+
|
|
4
|
+
const args = process.argv.slice(2);
|
|
5
|
+
const command = args[0];
|
|
6
|
+
|
|
7
|
+
if (command === "init" || command === "setup") {
|
|
8
|
+
const projectType = args[1] || "auto";
|
|
9
|
+
await run(projectType);
|
|
10
|
+
} else if (command === "--help" || command === "-h" || !command) {
|
|
11
|
+
console.log(`
|
|
12
|
+
dev-config-pack v1.0.0
|
|
13
|
+
|
|
14
|
+
Uso:
|
|
15
|
+
npx dev-config-pack init [tipo] Aplica configs otimizadas ao projeto atual
|
|
16
|
+
npx dev-config-pack --help Mostra esta ajuda
|
|
17
|
+
|
|
18
|
+
Tipos disponiveis:
|
|
19
|
+
auto Detecta automaticamente (padrao)
|
|
20
|
+
js Configs para JavaScript puro
|
|
21
|
+
ts Configs para TypeScript
|
|
22
|
+
react Configs para React/Next.js
|
|
23
|
+
all Aplica todos os tipos
|
|
24
|
+
|
|
25
|
+
Exemplos:
|
|
26
|
+
npx dev-config-pack init
|
|
27
|
+
npx dev-config-pack init ts
|
|
28
|
+
npx dcp init react
|
|
29
|
+
`);
|
|
30
|
+
} else {
|
|
31
|
+
console.error(`Comando desconhecido: "${command}". Use --help para ajuda.`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
|
|
4
|
+
# Build outputs
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
.next/
|
|
8
|
+
out/
|
|
9
|
+
.env.local
|
|
10
|
+
.env.production.local
|
|
11
|
+
|
|
12
|
+
# IDE
|
|
13
|
+
.vscode/settings.json (keep if you want custom)
|
|
14
|
+
.idea/
|
|
15
|
+
*.swp
|
|
16
|
+
*.swo
|
|
17
|
+
|
|
18
|
+
# OS
|
|
19
|
+
.DS_Store
|
|
20
|
+
Thumbs.db
|
|
21
|
+
|
|
22
|
+
# Logs
|
|
23
|
+
*.log
|
|
24
|
+
npm-debug.log*
|
|
25
|
+
|
|
26
|
+
# Environment
|
|
27
|
+
.env
|
|
28
|
+
.env.*.local
|
|
29
|
+
|
|
30
|
+
# Coverage
|
|
31
|
+
coverage/
|
|
32
|
+
.nyc_output/
|
|
33
|
+
|
|
34
|
+
# Misc
|
|
35
|
+
*.tsbuildinfo
|
|
36
|
+
.eslintcache
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"es2024": true,
|
|
4
|
+
"node": true,
|
|
5
|
+
"browser": true
|
|
6
|
+
},
|
|
7
|
+
"parserOptions": {
|
|
8
|
+
"ecmaVersion": "latest",
|
|
9
|
+
"sourceType": "module"
|
|
10
|
+
},
|
|
11
|
+
"extends": ["eslint:recommended"],
|
|
12
|
+
"rules": {
|
|
13
|
+
"no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
|
|
14
|
+
"no-console": "warn",
|
|
15
|
+
"prefer-const": "error",
|
|
16
|
+
"no-var": "error",
|
|
17
|
+
"eqeqeq": ["error", "always"],
|
|
18
|
+
"curly": ["error", "all"],
|
|
19
|
+
"no-throw-literal": "error",
|
|
20
|
+
"prefer-template": "warn"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"es2024": true,
|
|
4
|
+
"browser": true
|
|
5
|
+
},
|
|
6
|
+
"parserOptions": {
|
|
7
|
+
"ecmaVersion": "latest",
|
|
8
|
+
"sourceType": "module",
|
|
9
|
+
"ecmaFeatures": { "jsx": true }
|
|
10
|
+
},
|
|
11
|
+
"extends": [
|
|
12
|
+
"eslint:recommended",
|
|
13
|
+
"plugin:react/recommended",
|
|
14
|
+
"plugin:react-hooks/recommended"
|
|
15
|
+
],
|
|
16
|
+
"plugins": ["react", "react-hooks"],
|
|
17
|
+
"settings": {
|
|
18
|
+
"react": { "version": "detect" }
|
|
19
|
+
},
|
|
20
|
+
"rules": {
|
|
21
|
+
"react/react-in-jsx-scope": "off",
|
|
22
|
+
"react/prop-types": "off",
|
|
23
|
+
"react/jsx-no-target-blank": "error",
|
|
24
|
+
"react-hooks/rules-of-hooks": "error",
|
|
25
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
26
|
+
"no-console": "warn",
|
|
27
|
+
"prefer-const": "error",
|
|
28
|
+
"no-var": "error"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
2
|
+
export default {
|
|
3
|
+
content: ["./src/**/*.{js,jsx,ts,tsx}"],
|
|
4
|
+
theme: {
|
|
5
|
+
extend: {
|
|
6
|
+
screens: {
|
|
7
|
+
xs: "475px",
|
|
8
|
+
},
|
|
9
|
+
maxWidth: {
|
|
10
|
+
"8xl": "1440px",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
future: {
|
|
15
|
+
hoverOnlyWhenSupported: true,
|
|
16
|
+
},
|
|
17
|
+
plugins: [],
|
|
18
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noUncheckedIndexedAccess": true,
|
|
9
|
+
"noUnusedLocals": true,
|
|
10
|
+
"noUnusedParameters": true,
|
|
11
|
+
"exactOptionalPropertyTypes": false,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"allowJs": true,
|
|
18
|
+
"declaration": true,
|
|
19
|
+
"declarationMap": true,
|
|
20
|
+
"sourceMap": true,
|
|
21
|
+
"outDir": "./dist",
|
|
22
|
+
"baseUrl": ".",
|
|
23
|
+
"paths": {
|
|
24
|
+
"@/*": ["./src/*"]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"include": ["src/**/*"],
|
|
28
|
+
"exclude": ["node_modules", "dist"]
|
|
29
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"editor.formatOnSave": true,
|
|
3
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
4
|
+
"editor.codeActionsOnSave": {
|
|
5
|
+
"source.fixAll.eslint": "explicit"
|
|
6
|
+
},
|
|
7
|
+
"editor.tabSize": 2,
|
|
8
|
+
"editor.insertSpaces": true,
|
|
9
|
+
"editor.rulers": [100],
|
|
10
|
+
"files.exclude": {
|
|
11
|
+
"**/node_modules": true,
|
|
12
|
+
"**/dist": true
|
|
13
|
+
},
|
|
14
|
+
"typescript.updateImportsOnFileMove.enabled": "always",
|
|
15
|
+
"javascript.updateImportsOnFileMove.enabled": "always",
|
|
16
|
+
"workbench.colorTheme": "Dracula",
|
|
17
|
+
"workbench.iconTheme": "material-icon-theme"
|
|
18
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dev-config-pack",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Configurações otimizadas para projetos JavaScript/TypeScript/React — ESLint, Prettier, TypeScript, Tailwind, VS Code, Gitignore",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"author": "eusim",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"bin": {
|
|
9
|
+
"dev-config-pack": "bin/cli.js",
|
|
10
|
+
"dcp": "bin/cli.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin/",
|
|
14
|
+
"configs/",
|
|
15
|
+
"src/"
|
|
16
|
+
],
|
|
17
|
+
"keywords": [
|
|
18
|
+
"config",
|
|
19
|
+
"eslint",
|
|
20
|
+
"prettier",
|
|
21
|
+
"typescript",
|
|
22
|
+
"tailwind",
|
|
23
|
+
"vscode",
|
|
24
|
+
"boilerplate",
|
|
25
|
+
"optimized"
|
|
26
|
+
],
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/eusim/dev-config-pack"
|
|
30
|
+
},
|
|
31
|
+
"funding": "https://inovaglow.gumroad.com/l/mvsfrd",
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/src/init.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, copyFileSync } from "node:fs";
|
|
2
|
+
import { join, dirname } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const CONFIGS_DIR = join(__dirname, "..", "configs");
|
|
7
|
+
|
|
8
|
+
const GUMROAD_URL = "https://inovaglow.gumroad.com/l/mvsfrd";
|
|
9
|
+
|
|
10
|
+
const COLORS = {
|
|
11
|
+
reset: "\x1b[0m",
|
|
12
|
+
green: "\x1b[32m",
|
|
13
|
+
cyan: "\x1b[36m",
|
|
14
|
+
yellow: "\x1b[33m",
|
|
15
|
+
dim: "\x1b[2m",
|
|
16
|
+
bold: "\x1b[1m",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function log(msg, color = "") {
|
|
20
|
+
console.log(`${color}${msg}${COLORS.reset}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function detectProjectType() {
|
|
24
|
+
const files = [];
|
|
25
|
+
try {
|
|
26
|
+
const dir = readFileSync(".", "utf8");
|
|
27
|
+
} catch {}
|
|
28
|
+
|
|
29
|
+
const hasTsConfig = existsSync("tsconfig.json");
|
|
30
|
+
const hasNextConfig = existsSync("next.config.js") || existsSync("next.config.mjs");
|
|
31
|
+
const hasViteConfig = existsSync("vite.config.js") || existsSync("vite.config.ts");
|
|
32
|
+
const hasPackageJson = existsSync("package.json");
|
|
33
|
+
|
|
34
|
+
if (!hasPackageJson) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const pkg = JSON.parse(readFileSync("package.json", "utf-8"));
|
|
39
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies } || {};
|
|
40
|
+
|
|
41
|
+
if (deps.next || deps.react || hasNextConfig) return "react";
|
|
42
|
+
if (hasTsConfig || deps.typescript) return "ts";
|
|
43
|
+
if (hasViteConfig) return "react";
|
|
44
|
+
return "js";
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function copyConfig(src, dest) {
|
|
48
|
+
const destPath = join(process.cwd(), dest);
|
|
49
|
+
try {
|
|
50
|
+
copyFileSync(src, destPath);
|
|
51
|
+
log(` ✓ ${dest}`, COLORS.green);
|
|
52
|
+
} catch (err) {
|
|
53
|
+
log(` ✗ ${dest}: ${err.message}`, COLORS.yellow);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export async function run(projectType) {
|
|
58
|
+
log(`\n${COLORS.bold}⚡ Dev Config Pack${COLORS.reset}\n`, COLORS.cyan);
|
|
59
|
+
|
|
60
|
+
if (projectType === "auto") {
|
|
61
|
+
projectType = detectProjectType();
|
|
62
|
+
if (!projectType) {
|
|
63
|
+
log("✗ Nenhum projeto Node.js detectado. Execute este comando na raiz de um projeto.", COLORS.yellow);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
log(` Detectado: ${projectType}\n`, COLORS.dim);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
log(` Aplicando configuracoes otimizadas para ${projectType}...\n`);
|
|
70
|
+
|
|
71
|
+
if (!existsSync(".vscode")) {
|
|
72
|
+
mkdirSync(".vscode", { recursive: true });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Common configs (apply to all)
|
|
76
|
+
copyConfig(join(CONFIGS_DIR, "prettier.config.js"), ".prettierrc");
|
|
77
|
+
copyConfig(join(CONFIGS_DIR, "gitignore.txt"), ".gitignore");
|
|
78
|
+
copyConfig(join(CONFIGS_DIR, "vscode", "settings.json"), ".vscode/settings.json");
|
|
79
|
+
|
|
80
|
+
// Type-specific configs
|
|
81
|
+
if (projectType === "js" || projectType === "all") {
|
|
82
|
+
copyConfig(join(CONFIGS_DIR, "js", "eslintrc.json"), ".eslintrc.json");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (projectType === "ts" || projectType === "all") {
|
|
86
|
+
copyConfig(join(CONFIGS_DIR, "ts", "tsconfig.json"), "tsconfig.json");
|
|
87
|
+
copyConfig(join(CONFIGS_DIR, "js", "eslintrc.json"), ".eslintrc.json");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (projectType === "react" || projectType === "all") {
|
|
91
|
+
copyConfig(join(CONFIGS_DIR, "react", "eslintrc.json"), ".eslintrc.json");
|
|
92
|
+
copyConfig(join(CONFIGS_DIR, "ts", "tsconfig.json"), "tsconfig.json");
|
|
93
|
+
copyConfig(join(CONFIGS_DIR, "tailwind.config.js"), "tailwind.config.js");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
log(`\n${COLORS.green}✔ Configuracoes aplicadas com sucesso!${COLORS.reset}\n`);
|
|
97
|
+
log(`${COLORS.dim}────────────────────────────────────────${COLORS.reset}`);
|
|
98
|
+
log(`${COLORS.bold}🔥 Gostou?${COLORS.reset}`, COLORS.yellow);
|
|
99
|
+
log(` Adquira a versao ${COLORS.bold}PREMIUM${COLORS.reset} com configs avançadas:`);
|
|
100
|
+
log(` ${COLORS.cyan}${GUMROAD_URL}${COLORS.reset}`);
|
|
101
|
+
log(` (ESLint strict, Husky + lint-staged, Commitlint, CI/CD, Dockerfile)`);
|
|
102
|
+
log(`${COLORS.dim}────────────────────────────────────────${COLORS.reset}\n`);
|
|
103
|
+
}
|