nuxt-openapi-hyperfetch 0.2.7-alpha.1 → 0.3.0-beta
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/.editorconfig +26 -26
- package/.prettierignore +17 -17
- package/CONTRIBUTING.md +291 -291
- package/INSTRUCTIONS.md +327 -327
- package/LICENSE +202 -202
- package/README.md +309 -231
- package/dist/cli/config.d.ts +9 -2
- package/dist/cli/config.js +1 -1
- package/dist/cli/logo.js +5 -5
- package/dist/cli/messages.d.ts +1 -0
- package/dist/cli/messages.js +2 -0
- package/dist/cli/prompts.d.ts +5 -0
- package/dist/cli/prompts.js +12 -0
- package/dist/cli/types.d.ts +1 -1
- package/dist/generators/components/connector-generator/templates.js +68 -19
- package/dist/generators/shared/runtime/useFormConnector.js +8 -1
- package/dist/generators/shared/runtime/useListConnector.js +13 -6
- package/dist/generators/use-async-data/generator.js +4 -0
- package/dist/generators/use-async-data/runtime/useApiAsyncData.js +4 -4
- package/dist/generators/use-async-data/runtime/useApiAsyncDataRaw.js +4 -4
- package/dist/generators/use-async-data/templates.js +17 -17
- package/dist/generators/use-fetch/generator.js +4 -0
- package/dist/generators/use-fetch/templates.js +14 -14
- package/dist/index.js +40 -27
- package/dist/module/index.js +19 -0
- package/dist/module/types.d.ts +7 -0
- package/docs/API-REFERENCE.md +886 -886
- package/docs/generated-components.md +615 -615
- package/docs/headless-composables-ui.md +569 -569
- package/eslint.config.js +85 -85
- package/package.json +1 -1
- package/src/cli/config.ts +147 -140
- package/src/cli/logger.ts +124 -124
- package/src/cli/logo.ts +25 -25
- package/src/cli/messages.ts +4 -0
- package/src/cli/prompts.ts +14 -1
- package/src/cli/types.ts +50 -50
- package/src/generators/components/connector-generator/generator.ts +138 -138
- package/src/generators/components/connector-generator/templates.ts +307 -254
- package/src/generators/components/connector-generator/types.ts +34 -34
- package/src/generators/components/schema-analyzer/index.ts +44 -44
- package/src/generators/components/schema-analyzer/intent-detector.ts +187 -187
- package/src/generators/components/schema-analyzer/openapi-reader.ts +96 -96
- package/src/generators/components/schema-analyzer/resource-grouper.ts +166 -166
- package/src/generators/components/schema-analyzer/schema-field-mapper.ts +268 -268
- package/src/generators/components/schema-analyzer/types.ts +177 -177
- package/src/generators/nuxt-server/generator.ts +272 -272
- package/src/generators/shared/runtime/apiHelpers.ts +535 -535
- package/src/generators/shared/runtime/pagination.ts +323 -323
- package/src/generators/shared/runtime/useDeleteConnector.ts +109 -109
- package/src/generators/shared/runtime/useDetailConnector.ts +64 -64
- package/src/generators/shared/runtime/useFormConnector.ts +147 -139
- package/src/generators/shared/runtime/useListConnector.ts +158 -148
- package/src/generators/shared/runtime/zod-error-merger.ts +119 -119
- package/src/generators/shared/templates/api-callbacks-plugin.ts +399 -399
- package/src/generators/shared/templates/api-pagination-plugin.ts +158 -158
- package/src/generators/use-async-data/generator.ts +213 -205
- package/src/generators/use-async-data/runtime/useApiAsyncData.ts +329 -329
- package/src/generators/use-async-data/runtime/useApiAsyncDataRaw.ts +324 -324
- package/src/generators/use-async-data/templates.ts +257 -257
- package/src/generators/use-fetch/generator.ts +178 -170
- package/src/generators/use-fetch/runtime/useApiRequest.ts +354 -354
- package/src/generators/use-fetch/templates.ts +214 -214
- package/src/index.ts +306 -303
- package/src/module/index.ts +158 -133
- package/src/module/types.ts +39 -31
- package/dist/generators/tanstack-query/generator.d.ts +0 -5
- package/dist/generators/tanstack-query/generator.js +0 -11
|
@@ -1,205 +1,213 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
import fs from 'fs-extra';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import { format } from 'prettier';
|
|
5
|
-
import {
|
|
6
|
-
getApiFiles as getApiFilesOfficial,
|
|
7
|
-
parseApiFile as parseApiFileOfficial,
|
|
8
|
-
} from './parser.js';
|
|
9
|
-
import {
|
|
10
|
-
getApiFiles as getApiFilesHeyApi,
|
|
11
|
-
parseApiFile as parseApiFileHeyApi,
|
|
12
|
-
} from '../shared/parsers/heyapi-parser.js';
|
|
13
|
-
import {
|
|
14
|
-
generateComposableFile,
|
|
15
|
-
generateRawComposableFile,
|
|
16
|
-
generateIndexFile,
|
|
17
|
-
type GenerateOptions,
|
|
18
|
-
} from './templates.js';
|
|
19
|
-
import type { MethodInfo } from './types.js';
|
|
20
|
-
import { type Logger, createClackLogger } from '../../cli/logger.js';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Main function to generate useAsyncData composables
|
|
24
|
-
*/
|
|
25
|
-
export async function generateUseAsyncDataComposables(
|
|
26
|
-
inputDir: string,
|
|
27
|
-
outputDir: string,
|
|
28
|
-
options?: GenerateOptions,
|
|
29
|
-
logger: Logger = createClackLogger()
|
|
30
|
-
): Promise<void> {
|
|
31
|
-
const mainSpinner = logger.spinner();
|
|
32
|
-
|
|
33
|
-
// Select parser based on chosen backend
|
|
34
|
-
const getApiFiles = options?.backend === 'heyapi' ? getApiFilesHeyApi : getApiFilesOfficial;
|
|
35
|
-
const parseApiFile = options?.backend === 'heyapi' ? parseApiFileHeyApi : parseApiFileOfficial;
|
|
36
|
-
|
|
37
|
-
// 1. Get all API files
|
|
38
|
-
mainSpinner.start('Scanning API files');
|
|
39
|
-
const apiFiles = getApiFiles(inputDir);
|
|
40
|
-
mainSpinner.stop(`Found ${apiFiles.length} API file(s)`);
|
|
41
|
-
|
|
42
|
-
if (apiFiles.length === 0) {
|
|
43
|
-
throw new Error('No API files found in the input directory');
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// 2. Parse each API file
|
|
47
|
-
mainSpinner.start('Parsing API files');
|
|
48
|
-
const allMethods: MethodInfo[] = [];
|
|
49
|
-
|
|
50
|
-
for (const file of apiFiles) {
|
|
51
|
-
const fileName = path.basename(file);
|
|
52
|
-
try {
|
|
53
|
-
const apiInfo = parseApiFile(file);
|
|
54
|
-
allMethods.push(...apiInfo.methods);
|
|
55
|
-
} catch (error) {
|
|
56
|
-
logger.log.error(`Error parsing ${fileName}: ${String(error)}`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
mainSpinner.stop(`Found ${allMethods.length} methods to generate`);
|
|
61
|
-
|
|
62
|
-
if (allMethods.length === 0) {
|
|
63
|
-
logger.log.warn('No methods found to generate');
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// 3. Clean and create output directories
|
|
68
|
-
mainSpinner.start('Preparing output directories');
|
|
69
|
-
const composablesDir = path.join(outputDir, 'composables');
|
|
70
|
-
const runtimeDir = path.join(outputDir, 'runtime');
|
|
71
|
-
const sharedRuntimeDir = path.join(path.dirname(outputDir), 'shared', 'runtime');
|
|
72
|
-
await fs.emptyDir(composablesDir);
|
|
73
|
-
await fs.ensureDir(runtimeDir);
|
|
74
|
-
await fs.ensureDir(sharedRuntimeDir);
|
|
75
|
-
mainSpinner.stop('Output directories ready');
|
|
76
|
-
|
|
77
|
-
// 4. Copy runtime helpers
|
|
78
|
-
mainSpinner.start('Copying runtime files');
|
|
79
|
-
// Derive __dirname equivalent for ESM
|
|
80
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
81
|
-
// When compiled, __dirname points to dist/generators/use-async-data/
|
|
82
|
-
// We need to go back to src/ to get the original .ts files
|
|
83
|
-
|
|
84
|
-
// Copy useApiAsyncData.ts
|
|
85
|
-
const runtimeSource = path.resolve(
|
|
86
|
-
__dirname,
|
|
87
|
-
'../../../src/generators/use-async-data/runtime/useApiAsyncData.ts'
|
|
88
|
-
);
|
|
89
|
-
const runtimeDest = path.join(runtimeDir, 'useApiAsyncData.ts');
|
|
90
|
-
await fs.copyFile(runtimeSource, runtimeDest);
|
|
91
|
-
|
|
92
|
-
// Copy useApiAsyncDataRaw.ts
|
|
93
|
-
const runtimeRawSource = path.resolve(
|
|
94
|
-
__dirname,
|
|
95
|
-
'../../../src/generators/use-async-data/runtime/useApiAsyncDataRaw.ts'
|
|
96
|
-
);
|
|
97
|
-
const runtimeRawDest = path.join(runtimeDir, 'useApiAsyncDataRaw.ts');
|
|
98
|
-
await fs.copyFile(runtimeRawSource, runtimeRawDest);
|
|
99
|
-
|
|
100
|
-
// Copy shared apiHelpers.ts
|
|
101
|
-
const sharedHelpersSource = path.resolve(
|
|
102
|
-
__dirname,
|
|
103
|
-
'../../../src/generators/shared/runtime/apiHelpers.ts'
|
|
104
|
-
);
|
|
105
|
-
const sharedHelpersDest = path.join(sharedRuntimeDir, 'apiHelpers.ts');
|
|
106
|
-
await fs.copyFile(sharedHelpersSource, sharedHelpersDest);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
//
|
|
183
|
-
relativePath = relativePath.replace(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { format } from 'prettier';
|
|
5
|
+
import {
|
|
6
|
+
getApiFiles as getApiFilesOfficial,
|
|
7
|
+
parseApiFile as parseApiFileOfficial,
|
|
8
|
+
} from './parser.js';
|
|
9
|
+
import {
|
|
10
|
+
getApiFiles as getApiFilesHeyApi,
|
|
11
|
+
parseApiFile as parseApiFileHeyApi,
|
|
12
|
+
} from '../shared/parsers/heyapi-parser.js';
|
|
13
|
+
import {
|
|
14
|
+
generateComposableFile,
|
|
15
|
+
generateRawComposableFile,
|
|
16
|
+
generateIndexFile,
|
|
17
|
+
type GenerateOptions,
|
|
18
|
+
} from './templates.js';
|
|
19
|
+
import type { MethodInfo } from './types.js';
|
|
20
|
+
import { type Logger, createClackLogger } from '../../cli/logger.js';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Main function to generate useAsyncData composables
|
|
24
|
+
*/
|
|
25
|
+
export async function generateUseAsyncDataComposables(
|
|
26
|
+
inputDir: string,
|
|
27
|
+
outputDir: string,
|
|
28
|
+
options?: GenerateOptions,
|
|
29
|
+
logger: Logger = createClackLogger()
|
|
30
|
+
): Promise<void> {
|
|
31
|
+
const mainSpinner = logger.spinner();
|
|
32
|
+
|
|
33
|
+
// Select parser based on chosen backend
|
|
34
|
+
const getApiFiles = options?.backend === 'heyapi' ? getApiFilesHeyApi : getApiFilesOfficial;
|
|
35
|
+
const parseApiFile = options?.backend === 'heyapi' ? parseApiFileHeyApi : parseApiFileOfficial;
|
|
36
|
+
|
|
37
|
+
// 1. Get all API files
|
|
38
|
+
mainSpinner.start('Scanning API files');
|
|
39
|
+
const apiFiles = getApiFiles(inputDir);
|
|
40
|
+
mainSpinner.stop(`Found ${apiFiles.length} API file(s)`);
|
|
41
|
+
|
|
42
|
+
if (apiFiles.length === 0) {
|
|
43
|
+
throw new Error('No API files found in the input directory');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 2. Parse each API file
|
|
47
|
+
mainSpinner.start('Parsing API files');
|
|
48
|
+
const allMethods: MethodInfo[] = [];
|
|
49
|
+
|
|
50
|
+
for (const file of apiFiles) {
|
|
51
|
+
const fileName = path.basename(file);
|
|
52
|
+
try {
|
|
53
|
+
const apiInfo = parseApiFile(file);
|
|
54
|
+
allMethods.push(...apiInfo.methods);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
logger.log.error(`Error parsing ${fileName}: ${String(error)}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
mainSpinner.stop(`Found ${allMethods.length} methods to generate`);
|
|
61
|
+
|
|
62
|
+
if (allMethods.length === 0) {
|
|
63
|
+
logger.log.warn('No methods found to generate');
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 3. Clean and create output directories
|
|
68
|
+
mainSpinner.start('Preparing output directories');
|
|
69
|
+
const composablesDir = path.join(outputDir, 'composables');
|
|
70
|
+
const runtimeDir = path.join(outputDir, 'runtime');
|
|
71
|
+
const sharedRuntimeDir = path.join(path.dirname(outputDir), 'shared', 'runtime');
|
|
72
|
+
await fs.emptyDir(composablesDir);
|
|
73
|
+
await fs.ensureDir(runtimeDir);
|
|
74
|
+
await fs.ensureDir(sharedRuntimeDir);
|
|
75
|
+
mainSpinner.stop('Output directories ready');
|
|
76
|
+
|
|
77
|
+
// 4. Copy runtime helpers
|
|
78
|
+
mainSpinner.start('Copying runtime files');
|
|
79
|
+
// Derive __dirname equivalent for ESM
|
|
80
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
81
|
+
// When compiled, __dirname points to dist/generators/use-async-data/
|
|
82
|
+
// We need to go back to src/ to get the original .ts files
|
|
83
|
+
|
|
84
|
+
// Copy useApiAsyncData.ts
|
|
85
|
+
const runtimeSource = path.resolve(
|
|
86
|
+
__dirname,
|
|
87
|
+
'../../../src/generators/use-async-data/runtime/useApiAsyncData.ts'
|
|
88
|
+
);
|
|
89
|
+
const runtimeDest = path.join(runtimeDir, 'useApiAsyncData.ts');
|
|
90
|
+
await fs.copyFile(runtimeSource, runtimeDest);
|
|
91
|
+
|
|
92
|
+
// Copy useApiAsyncDataRaw.ts
|
|
93
|
+
const runtimeRawSource = path.resolve(
|
|
94
|
+
__dirname,
|
|
95
|
+
'../../../src/generators/use-async-data/runtime/useApiAsyncDataRaw.ts'
|
|
96
|
+
);
|
|
97
|
+
const runtimeRawDest = path.join(runtimeDir, 'useApiAsyncDataRaw.ts');
|
|
98
|
+
await fs.copyFile(runtimeRawSource, runtimeRawDest);
|
|
99
|
+
|
|
100
|
+
// Copy shared apiHelpers.ts
|
|
101
|
+
const sharedHelpersSource = path.resolve(
|
|
102
|
+
__dirname,
|
|
103
|
+
'../../../src/generators/shared/runtime/apiHelpers.ts'
|
|
104
|
+
);
|
|
105
|
+
const sharedHelpersDest = path.join(sharedRuntimeDir, 'apiHelpers.ts');
|
|
106
|
+
await fs.copyFile(sharedHelpersSource, sharedHelpersDest);
|
|
107
|
+
|
|
108
|
+
// Copy shared pagination.ts
|
|
109
|
+
const sharedPaginationSource = path.resolve(
|
|
110
|
+
__dirname,
|
|
111
|
+
'../../../src/generators/shared/runtime/pagination.ts'
|
|
112
|
+
);
|
|
113
|
+
const sharedPaginationDest = path.join(sharedRuntimeDir, 'pagination.ts');
|
|
114
|
+
await fs.copyFile(sharedPaginationSource, sharedPaginationDest);
|
|
115
|
+
mainSpinner.stop('Runtime files copied');
|
|
116
|
+
|
|
117
|
+
// 5. Calculate relative import path from composables to APIs
|
|
118
|
+
const relativePath = calculateRelativeImportPath(composablesDir, inputDir);
|
|
119
|
+
|
|
120
|
+
// 6. Generate each composable (normal + Raw if available)
|
|
121
|
+
mainSpinner.start('Generating composables');
|
|
122
|
+
let successCount = 0;
|
|
123
|
+
let errorCount = 0;
|
|
124
|
+
const generatedComposableNames: string[] = [];
|
|
125
|
+
|
|
126
|
+
for (const method of allMethods) {
|
|
127
|
+
// Generate normal version
|
|
128
|
+
try {
|
|
129
|
+
const code = generateComposableFile(method, relativePath, options);
|
|
130
|
+
const formattedCode = await formatCode(code, logger);
|
|
131
|
+
const composableName = method.composableName.replace(/^useFetch/, 'useAsyncData');
|
|
132
|
+
const fileName = `${composableName}.ts`;
|
|
133
|
+
const filePath = path.join(composablesDir, fileName);
|
|
134
|
+
|
|
135
|
+
await fs.writeFile(filePath, formattedCode, 'utf-8');
|
|
136
|
+
generatedComposableNames.push(composableName);
|
|
137
|
+
successCount++;
|
|
138
|
+
} catch (error) {
|
|
139
|
+
logger.log.error(`Error generating ${method.composableName}: ${String(error)}`);
|
|
140
|
+
errorCount++;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Generate Raw version if available
|
|
144
|
+
if (method.hasRawMethod && method.rawMethodName) {
|
|
145
|
+
try {
|
|
146
|
+
const code = generateRawComposableFile(method, relativePath, options);
|
|
147
|
+
const formattedCode = await formatCode(code, logger);
|
|
148
|
+
const composableName = `useAsyncData${method.rawMethodName.replace(/Raw$/, '')}Raw`;
|
|
149
|
+
const fileName = `${composableName}.ts`;
|
|
150
|
+
const filePath = path.join(composablesDir, fileName);
|
|
151
|
+
|
|
152
|
+
await fs.writeFile(filePath, formattedCode, 'utf-8');
|
|
153
|
+
generatedComposableNames.push(composableName);
|
|
154
|
+
successCount++;
|
|
155
|
+
} catch (error) {
|
|
156
|
+
logger.log.error(`Error generating ${method.composableName} (Raw): ${String(error)}`);
|
|
157
|
+
errorCount++;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// 7. Generate index.ts
|
|
163
|
+
const indexCode = generateIndexFile(generatedComposableNames);
|
|
164
|
+
const formattedIndex = await formatCode(indexCode, logger);
|
|
165
|
+
await fs.writeFile(path.join(outputDir, 'index.ts'), formattedIndex, 'utf-8');
|
|
166
|
+
mainSpinner.stop(`Generated ${successCount} composables`);
|
|
167
|
+
|
|
168
|
+
// 8. Summary
|
|
169
|
+
if (errorCount > 0) {
|
|
170
|
+
logger.log.warn(`Completed with ${errorCount} error(s)`);
|
|
171
|
+
}
|
|
172
|
+
logger.log.success(`Generated ${successCount} useAsyncData composable(s) in ${outputDir}`);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Calculate relative import path from composables to APIs
|
|
177
|
+
*/
|
|
178
|
+
function calculateRelativeImportPath(composablesDir: string, inputDir: string): string {
|
|
179
|
+
// Import from the root index.ts which exports apis, models, and runtime
|
|
180
|
+
let relativePath = path.relative(composablesDir, inputDir);
|
|
181
|
+
|
|
182
|
+
// Convert Windows paths to Unix-style
|
|
183
|
+
relativePath = relativePath.replace(/\\/g, '/');
|
|
184
|
+
|
|
185
|
+
// Ensure it starts with './' or '../'
|
|
186
|
+
if (!relativePath.startsWith('.')) {
|
|
187
|
+
relativePath = './' + relativePath;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Remove .ts extension and trailing /
|
|
191
|
+
relativePath = relativePath.replace(/\.ts$/, '').replace(/\/$/, '');
|
|
192
|
+
|
|
193
|
+
return relativePath;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Format code with Prettier
|
|
198
|
+
*/
|
|
199
|
+
async function formatCode(code: string, logger: Logger): Promise<string> {
|
|
200
|
+
try {
|
|
201
|
+
return await format(code, {
|
|
202
|
+
parser: 'typescript',
|
|
203
|
+
semi: true,
|
|
204
|
+
singleQuote: true,
|
|
205
|
+
trailingComma: 'es5',
|
|
206
|
+
printWidth: 80,
|
|
207
|
+
tabWidth: 2,
|
|
208
|
+
});
|
|
209
|
+
} catch {
|
|
210
|
+
logger.log.warn('Could not format code with Prettier');
|
|
211
|
+
return code;
|
|
212
|
+
}
|
|
213
|
+
}
|