clases 1.1.14 → 1.1.15
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/package.json +2 -6
- package/src/scripts/init.js +0 -34
package/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clases",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
|
-
"bin": {
|
|
8
|
-
"clases-init": "./scripts/init.js"
|
|
9
|
-
},
|
|
10
7
|
"exports": {
|
|
11
8
|
".": {
|
|
12
9
|
"types": "./dist/index.d.ts",
|
|
@@ -19,7 +16,6 @@
|
|
|
19
16
|
},
|
|
20
17
|
"scripts": {
|
|
21
18
|
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
22
|
-
"dev": "tsup src/index.ts --format cjs,esm --dts --watch"
|
|
23
|
-
"postinstall": "node scripts/init.js"
|
|
19
|
+
"dev": "tsup src/index.ts --format cjs,esm --dts --watch"
|
|
24
20
|
}
|
|
25
21
|
}
|
package/src/scripts/init.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
// Intentamos INIT_CWD (npm/pnpm), si no, el directorio actual
|
|
6
|
-
const projectRoot = process.env.INIT_CWD || process.cwd();
|
|
7
|
-
const hasSrc = fs.existsSync(path.join(projectRoot, 'src'));
|
|
8
|
-
const targetDir = hasSrc ? path.join(projectRoot, 'src') : projectRoot;
|
|
9
|
-
const configPath = path.join(targetDir, 'clases.config.ts');
|
|
10
|
-
|
|
11
|
-
const template = `import { createCl } from 'clases';
|
|
12
|
-
|
|
13
|
-
export const cl = createCl({});
|
|
14
|
-
`;
|
|
15
|
-
|
|
16
|
-
function init() {
|
|
17
|
-
if (fs.existsSync(configPath)) {
|
|
18
|
-
// Si el usuario lo corre manualmente con npx, avisamos.
|
|
19
|
-
// Si es postinstall, mejor callar.
|
|
20
|
-
if (!process.env.INIT_CWD) {
|
|
21
|
-
console.log('⚠️ El archivo clases.config.ts ya existe.');
|
|
22
|
-
}
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
fs.writeFileSync(configPath, template, 'utf8');
|
|
28
|
-
console.log('\x1b[32m%s\x1b[0m', '✅ clases.config.ts generado con éxito.');
|
|
29
|
-
} catch (e) {
|
|
30
|
-
console.error('❌ Error al crear la configuración:', e.message);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
init();
|