@opra/cli 0.19.0 → 0.20.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.
@@ -6,7 +6,7 @@ const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
6
  const node_path_1 = tslib_1.__importDefault(require("node:path"));
7
7
  const common_1 = require("@opra/common");
8
8
  const string_utils_js_1 = require("../utils/string-utils.js");
9
- const internalTypeNames = ['boolean', 'bigint', 'number', 'null', 'string'];
9
+ const internalTypeNames = ['any', 'boolean', 'bigint', 'number', 'null', 'string'];
10
10
  /**
11
11
  *
12
12
  * @param targetDir
@@ -199,11 +199,10 @@ exports.generateUnionTypeDefinition = generateUnionTypeDefinition;
199
199
  * @param forInterface
200
200
  */
201
201
  async function generateMappedTypeDefinition(file, dataType, forInterface) {
202
- return (dataType.pick ? 'Pick<' : 'Omit<') +
203
- (await this.resolveTypeNameOrDef(file, dataType.type, forInterface)) +
204
- ', ' +
205
- (dataType.pick || dataType.omit || [])
206
- .map(x => `'${x}'`).join(' | ') +
207
- '>';
202
+ const typeName = await this.resolveTypeNameOrDef(file, dataType.type, forInterface);
203
+ const keys = (dataType.pick || dataType.omit || []);
204
+ if (!keys.length)
205
+ return typeName;
206
+ return `${dataType.pick ? 'Pick<' : 'Omit<'}${typeName}, ${keys.map(x => `'${x}'`).join(' | ')}>`;
208
207
  }
209
208
  exports.generateMappedTypeDefinition = generateMappedTypeDefinition;
package/cjs/oprimp-cli.js CHANGED
@@ -28,7 +28,7 @@ commander_1.program
28
28
  name: options.name,
29
29
  importExt: options.ext,
30
30
  fileHeader: '/* Generated by OPRA Service Generator, Version ' + pkgJson.version + '*/\n' +
31
- '/* eslint-disable import/extensions,simple-import-sort/imports */\n'
31
+ '/* eslint-disable */\n'
32
32
  });
33
33
  console.log(chalk_1.default.greenBright('Completed'));
34
34
  });
@@ -2,7 +2,7 @@ import chalk from 'chalk';
2
2
  import path from 'node:path';
3
3
  import { ComplexType, EnumType, joinPath, MappedType, SimpleType, UnionType } from '@opra/common';
4
4
  import { wrapJSDocString } from '../utils/string-utils.js';
5
- const internalTypeNames = ['boolean', 'bigint', 'number', 'null', 'string'];
5
+ const internalTypeNames = ['any', 'boolean', 'bigint', 'number', 'null', 'string'];
6
6
  /**
7
7
  *
8
8
  * @param targetDir
@@ -188,10 +188,9 @@ export async function generateUnionTypeDefinition(file, dataType, forInterface)
188
188
  * @param forInterface
189
189
  */
190
190
  export async function generateMappedTypeDefinition(file, dataType, forInterface) {
191
- return (dataType.pick ? 'Pick<' : 'Omit<') +
192
- (await this.resolveTypeNameOrDef(file, dataType.type, forInterface)) +
193
- ', ' +
194
- (dataType.pick || dataType.omit || [])
195
- .map(x => `'${x}'`).join(' | ') +
196
- '>';
191
+ const typeName = await this.resolveTypeNameOrDef(file, dataType.type, forInterface);
192
+ const keys = (dataType.pick || dataType.omit || []);
193
+ if (!keys.length)
194
+ return typeName;
195
+ return `${dataType.pick ? 'Pick<' : 'Omit<'}${typeName}, ${keys.map(x => `'${x}'`).join(' | ')}>`;
197
196
  }
package/esm/oprimp-cli.js CHANGED
@@ -25,7 +25,7 @@ program
25
25
  name: options.name,
26
26
  importExt: options.ext,
27
27
  fileHeader: '/* Generated by OPRA Service Generator, Version ' + pkgJson.version + '*/\n' +
28
- '/* eslint-disable import/extensions,simple-import-sort/imports */\n'
28
+ '/* eslint-disable */\n'
29
29
  });
30
30
  console.log(chalk.greenBright('Completed'));
31
31
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/cli",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Opra CLI tools",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -28,8 +28,8 @@
28
28
  "clean:cover": "rimraf ../../coverage/client"
29
29
  },
30
30
  "dependencies": {
31
- "@opra/client": "^0.19.0",
32
- "chalk": "^5.2.0",
31
+ "@opra/client": "^0.20.0",
32
+ "chalk": "^5.3.0",
33
33
  "commander": "^11.0.0",
34
34
  "js-string-escape": "^1.0.1",
35
35
  "putil-flattentext": "^2.1.1",