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,41 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.importSpecs = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const fs_1 = require("fs");
9
- const path_1 = require("path");
10
- const import_open_api_1 = require("./import-open-api");
11
- const log = console.log; // tslint:disable-line:no-console
12
- const createSuccessMessage = (backend) => chalk_1.default.green(`🎉 ${backend ? `[${backend}] ` : ''} Your OpenAPI spec has been converted into react query hooks`);
13
- function importSpecs({ sourceDirectory, exportDirectory, apiDirectory, queryClientDir, headerFilters, }) {
14
- (0, fs_1.readdir)(sourceDirectory, function (err, filenames) {
15
- if (err) {
16
- throw err;
17
- }
18
- filenames.map(async (filename) => {
19
- const data = (0, fs_1.readFileSync)((0, path_1.join)(process.cwd(), sourceDirectory + '/' + filename), 'utf-8');
20
- const { ext } = (0, path_1.parse)(sourceDirectory + '/' + filename);
21
- const format = ['.yaml', '.yml'].includes(ext.toLowerCase()) ? 'yaml' : 'json';
22
- try {
23
- const name = `useQueries${filename.split('.')[0]}.tsx`;
24
- const fileExports = await (0, import_open_api_1.importOpenApi)({
25
- data,
26
- format,
27
- apiDirectory,
28
- headerFilters,
29
- queryClientDir,
30
- });
31
- (0, fs_1.writeFileSync)((0, path_1.join)(process.cwd(), `${exportDirectory}/${name}`), fileExports);
32
- log(createSuccessMessage(filename));
33
- }
34
- catch (error) {
35
- log(chalk_1.default.red(`[${filename}]:`), chalk_1.default.red(error));
36
- // process.exit(1);
37
- }
38
- });
39
- });
40
- }
41
- exports.importSpecs = importSpecs;
package/lib/cjs/types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });