@bagelink/sdk 1.4.174 → 1.4.178
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/bin/index.ts +1 -1
- package/bin/utils.ts +47 -10
- package/package.json +5 -2
package/bin/index.ts
CHANGED
|
@@ -21,7 +21,7 @@ export async function loadTypes() {
|
|
|
21
21
|
await formatAndWriteCode(typesPath, types)
|
|
22
22
|
|
|
23
23
|
const apiPath = join(bagelinkDir, 'api.ts')
|
|
24
|
-
await formatAndWriteCode(apiPath,
|
|
24
|
+
await formatAndWriteCode(apiPath, code)
|
|
25
25
|
|
|
26
26
|
const indexPath = join(bagelinkDir, 'index.ts')
|
|
27
27
|
await formatAndWriteCode(indexPath, `export * from './api'\nexport * from './types.d'`)
|
package/bin/utils.ts
CHANGED
|
@@ -46,21 +46,44 @@ export async function formatAndWriteCode(outPath: string, code: string) {
|
|
|
46
46
|
fs.writeFileSync(outPath, prettyCode)
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Check if ESLint is available in the project
|
|
51
|
+
*/
|
|
52
|
+
function findEslintConfig(): string | null {
|
|
53
|
+
const possibleConfigs = [
|
|
54
|
+
'eslint.config.js',
|
|
55
|
+
'eslint.config.mjs',
|
|
56
|
+
'eslint.config.cjs',
|
|
57
|
+
'.eslintrc.js',
|
|
58
|
+
'.eslintrc.cjs',
|
|
59
|
+
'.eslintrc.yaml',
|
|
60
|
+
'.eslintrc.yml',
|
|
61
|
+
'.eslintrc.json',
|
|
62
|
+
'.eslintrc'
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
for (const config of possibleConfigs) {
|
|
66
|
+
const configPath = join(cwd, config)
|
|
67
|
+
if (fs.existsSync(configPath)) {
|
|
68
|
+
return config
|
|
69
|
+
}
|
|
54
70
|
}
|
|
55
71
|
|
|
72
|
+
return null
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export async function runEsLintOnDir(dir: string) {
|
|
76
|
+
const eslintConfig = findEslintConfig()
|
|
77
|
+
|
|
56
78
|
try {
|
|
57
|
-
const
|
|
79
|
+
const eslintOptions: any = {
|
|
58
80
|
fix: true,
|
|
59
|
-
overrideConfigFile: join(cwd, 'eslint.config.js'),
|
|
60
81
|
cwd,
|
|
61
|
-
// Override specific problematic rules
|
|
82
|
+
// Override specific problematic rules that often cause issues with generated code
|
|
62
83
|
overrideConfig: {
|
|
63
84
|
rules: {
|
|
85
|
+
'no-null': 'off',
|
|
86
|
+
'@typescript-eslint/no-null': 'off',
|
|
64
87
|
'import/default': 'off',
|
|
65
88
|
'import/named': 'off',
|
|
66
89
|
'import/namespace': 'off',
|
|
@@ -68,12 +91,26 @@ export async function runEsLintOnDir(dir: string) {
|
|
|
68
91
|
'import/export': 'off',
|
|
69
92
|
}
|
|
70
93
|
}
|
|
71
|
-
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (eslintConfig) {
|
|
97
|
+
console.log(`Found project ESLint config: ${eslintConfig}`)
|
|
98
|
+
// Only set overrideConfigFile for flat config (eslint.config.*)
|
|
99
|
+
if (eslintConfig.startsWith('eslint.config.')) {
|
|
100
|
+
eslintOptions.overrideConfigFile = join(cwd, eslintConfig)
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
console.log('No project ESLint config found, using default formatting')
|
|
104
|
+
// Use a minimal default config for basic formatting
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const eslint = new ESLint(eslintOptions)
|
|
72
108
|
const results = await eslint.lintFiles(`${dir}/**/*.ts`)
|
|
73
109
|
|
|
74
110
|
await ESLint.outputFixes(results)
|
|
111
|
+
console.log('ESLint formatting completed successfully')
|
|
75
112
|
} catch (error: any) {
|
|
76
113
|
console.warn('ESLint formatting failed, but files were generated successfully:', error.message)
|
|
77
|
-
console.log('
|
|
114
|
+
console.log('Files have been formatted with Prettier')
|
|
78
115
|
}
|
|
79
116
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bagelink/sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.178",
|
|
5
5
|
"description": "Bagel core sdk packages",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Neveh Allon",
|
|
@@ -50,7 +50,10 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"axios": "^1.9.0"
|
|
53
|
+
"axios": "^1.9.0",
|
|
54
|
+
"eslint": "^9.28.0",
|
|
55
|
+
"prettier": "^3.5.3",
|
|
56
|
+
"vite": "^5.0.0"
|
|
54
57
|
},
|
|
55
58
|
"devDependencies": {
|
|
56
59
|
"@typescript-eslint/typescript-estree": "^8.34.0"
|