react-query-lightbase-codegen 0.2.1 → 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.
@@ -1,34 +0,0 @@
1
- import chalk from 'chalk';
2
- import { readFileSync, writeFileSync, readdir } from 'fs';
3
- import { join, parse } from 'path';
4
- import { importOpenApi } from './import-open-api';
5
- const log = console.log; // tslint:disable-line:no-console
6
- const createSuccessMessage = (backend) => chalk.green(`🎉 ${backend ? `[${backend}] ` : ''} Your OpenAPI spec has been converted into react query hooks`);
7
- export function importSpecs({ sourceDirectory, exportDirectory, apiDirectory, queryClientDir, headerFilters, }) {
8
- readdir(sourceDirectory, function (err, filenames) {
9
- if (err) {
10
- throw err;
11
- }
12
- filenames.map(async (filename) => {
13
- const data = readFileSync(join(process.cwd(), sourceDirectory + '/' + filename), 'utf-8');
14
- const { ext } = parse(sourceDirectory + '/' + filename);
15
- const format = ['.yaml', '.yml'].includes(ext.toLowerCase()) ? 'yaml' : 'json';
16
- try {
17
- const name = `useQueries${filename.split('.')[0]}.tsx`;
18
- const fileExports = await importOpenApi({
19
- data,
20
- format,
21
- apiDirectory,
22
- headerFilters,
23
- queryClientDir,
24
- });
25
- writeFileSync(join(process.cwd(), `${exportDirectory}/${name}`), fileExports);
26
- log(createSuccessMessage(filename));
27
- }
28
- catch (error) {
29
- log(chalk.red(`[${filename}]:`), chalk.red(error));
30
- // process.exit(1);
31
- }
32
- });
33
- });
34
- }
package/lib/esm/types.js DELETED
@@ -1 +0,0 @@
1
- export {};