Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@genql/cli

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@genql/cli - npm Package Compare versions

Comparing version 2.8.0 to 2.9.0

dist/helpers/parse.d.ts

24

dist/cli.js

@@ -14,2 +14,3 @@ #!/usr/bin/env node

const fs_1 = require("fs");
const parse_1 = require("./helpers/parse");
const program = yargs_1.default

@@ -41,3 +42,3 @@ .option('output', {

type: 'array',
// string: true,
string: true,
description: 'header to use in introspection query',

@@ -48,3 +49,3 @@ })

type: 'array',
// string: true,
string: true,
description: 'map a scalar to a type, for example `-S DateTime:string` ',

@@ -91,4 +92,4 @@ })

output: program.output,
headers: parseColonSeparatedStrings(program.header || []),
scalarTypes: parseColonSeparatedStrings(program.scalar || []),
headers: parse_1.parseColonSeparatedStrings(program.header || []),
scalarTypes: parse_1.parseColonSeparatedStrings(program.scalar || []),
onlyEsModules: program.esm,

@@ -115,17 +116,2 @@ onlyCJSModules: !program['esm-and-cjs'] && !program.esm,

});
function parseColonSeparatedStrings(headersArray) {
// console.log(headersArray)
let obj = {};
if (headersArray) {
for (let h of headersArray) {
const parts = String(h).split(':');
if (parts.length !== 2) {
console.error(`cannot parse string '${h}' (multiple or no ':')`);
process.exit(1);
}
obj[parts[0].trim()] = parts[1].trim();
}
}
return obj;
}
function printHelp({ useYarn, dirPath, dependencies }) {

@@ -132,0 +118,0 @@ console.log();

@@ -56,3 +56,3 @@ "use strict";

return enums
.map((type) => `${declaration}${camelCase_1.default('enum' + type.name)} = {\n` +
.map((type) => `${declaration}${camelCase_1.default('enum' + type.name)}${moduleType === 'type' ? ': ' : ' = '}{\n` +
type

@@ -64,6 +64,6 @@ .getValues()

}
return ` ${v.name}: '${v.name}'`;
return ` ${moduleType === 'type' ? 'readonly ' : ''}${v.name}: '${v.name}'`;
})
.join(',\n') +
`\n}${moduleType === 'type' ? ' as const' : ''}\n`)
`\n}\n`)
.join('\n');

@@ -70,0 +70,0 @@ }

{
"name": "@genql/cli",
"_": "[bump]",
"version": "2.8.0",
"version": "2.9.0",
"description": "Generate a client sdk from your GraphQl API",

@@ -54,3 +54,3 @@ "main": "dist/index.js",

"dependencies": {
"@genql/runtime": "^2.8.0",
"@genql/runtime": "^2.9.0",
"@graphql-tools/graphql-file-loader": "^6.0.10",

@@ -98,3 +98,3 @@ "@graphql-tools/load": "^6.0.10",

},
"gitHead": "665d2e53a54a0df664ae94d998d9bb346654fac6"
"gitHead": "a8c71dbc29c1d68083554322866fbec8569c2bc9"
}

@@ -9,2 +9,3 @@ #!/usr/bin/env node

import { existsSync, readFileSync } from 'fs'
import { parseColonSeparatedStrings } from './helpers/parse'

@@ -37,3 +38,3 @@ const program = yargs

type: 'array',
// string: true,
string: true,
description: 'header to use in introspection query',

@@ -44,3 +45,3 @@ })

type: 'array',
// string: true,
string: true,
description:

@@ -125,18 +126,2 @@ 'map a scalar to a type, for example `-S DateTime:string` ',

function parseColonSeparatedStrings(headersArray) {
// console.log(headersArray)
let obj = {}
if (headersArray) {
for (let h of headersArray) {
const parts = String(h).split(':')
if (parts.length !== 2) {
console.error(`cannot parse string '${h}' (multiple or no ':')`)
process.exit(1)
}
obj[parts[0].trim()] = parts[1].trim()
}
}
return obj
}
export function printHelp({ useYarn, dirPath, dependencies }) {

@@ -143,0 +128,0 @@ console.log()

@@ -55,3 +55,3 @@ import { GraphQLEnumType, GraphQLSchema, isEnumType } from 'graphql'

(type) =>
`${declaration}${camelCase('enum' + type.name)} = {\n` +
`${declaration}${camelCase('enum' + type.name)}${moduleType === 'type' ? ': ' : ' = '}{\n` +
type

@@ -63,6 +63,6 @@ .getValues()

}
return ` ${v.name}: '${v.name}'`
return ` ${moduleType === 'type' ? 'readonly ' : ''}${v.name}: '${v.name}'`
})
.join(',\n') +
`\n}${moduleType === 'type' ? ' as const' : ''}\n`,
`\n}\n`,
)

@@ -69,0 +69,0 @@ .join('\n')

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc