@opra/cli 1.22.3 → 1.22.5

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/oprimp-cli.js CHANGED
@@ -7,7 +7,9 @@ import colors from 'ansi-colors';
7
7
  import { program } from 'commander';
8
8
  import { TsGenerator } from './ts-generator/ts-generator.js';
9
9
  const dirname = path.dirname(getStackFileName());
10
- const pkgJson = JSON.parse(fs.readFileSync(path.resolve(dirname, '../package.json'), 'utf-8'));
10
+ const pkgJson = fs.existsSync(path.resolve(dirname, './package.json'))
11
+ ? JSON.parse(fs.readFileSync(path.resolve(dirname, './package.json'), 'utf-8'))
12
+ : JSON.parse(fs.readFileSync(path.resolve(dirname, '../package.json'), 'utf-8'));
11
13
  program
12
14
  .version(pkgJson.version)
13
15
  .argument('<serviceUrl>', 'OPRA service url')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/cli",
3
- "version": "1.22.3",
3
+ "version": "1.22.5",
4
4
  "description": "Opra CLI tools",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -14,8 +14,8 @@
14
14
  "tslib": "^2.8.1"
15
15
  },
16
16
  "peerDependencies": {
17
- "@opra/client": "^1.22.3",
18
- "@opra/common": "^1.22.3"
17
+ "@opra/client": "^1.22.5",
18
+ "@opra/common": "^1.22.5"
19
19
  },
20
20
  "type": "module",
21
21
  "module": "./index.js",
@@ -174,13 +174,10 @@ export async function _generateComplexTypeCode(currentFile, dataType, codeBlock,
174
174
  }
175
175
  fieldCode.header_end = ' */\n';
176
176
  if (field.type instanceof SimpleType && field.type.properties) {
177
- let s = '';
178
177
  for (const [k, v] of Object.entries(field.type.properties)) {
179
178
  if (v != null)
180
- s += ` * ${k}: ${v}\n`;
179
+ fieldCode.header += ` * @attribute ${k} ${v}\n`;
181
180
  }
182
- if (s)
183
- fieldCode.header += ' * Attributes:\n' + s;
184
181
  }
185
182
  // Print field name
186
183
  fieldCode.def = '';
@@ -327,14 +324,11 @@ export async function _generateMixinTypeCode(currentFile, dataType, codeBlock, i
327
324
  *
328
325
  */
329
326
  export async function _generateSimpleTypeCode(currentFile, dataType, codeBlock, intent) {
330
- let s = '';
331
- if (dataType.properties) {
327
+ if (intent !== 'typeDef' && dataType.properties) {
332
328
  for (const [k, v] of Object.entries(dataType.properties)) {
333
329
  if (v != null)
334
- s += ` * ${k}: ${v}\n`;
330
+ codeBlock.header += ` * @attribute ${k} ${v}\n`;
335
331
  }
336
- if (s)
337
- codeBlock.header += ' * Attributes:\n' + s;
338
332
  }
339
333
  let out = intent === 'root' ? `type ${dataType.name} = ` : '';
340
334
  const nameMapping = dataType.nameMappings.js || 'any';