Skip to content

Commit

Permalink
chore: change generated filename to snake_case (#67)
Browse files Browse the repository at this point in the history
* change filename to snake_case

* change import filename
  • Loading branch information
xiaozhenliu-gg5 authored Oct 23, 2019
1 parent 5aaa5d1 commit 8f6db5e
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from 'path';

import * as packageJson from '../../package.json';
import * as protosTypes from '../../protos/protos';
import * as gapicConfig from './{{ service.name.toLowerCase() }}_client_config.json';
import * as gapicConfig from './{{ service.name.toSnakeCase() }}_client_config.json';

const version = packageJson.version;

Expand Down
2 changes: 1 addition & 1 deletion templates/typescript_gapic/src/$version/index.ts.njk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% import "./license.njk" as license %}{{license.license()}}
{% for service in api.services -%}
export {{ '{' + service.name.toPascalCase() + 'Client}' }} from './{{ service.name.toLowerCase() }}_client';
export {{ '{' + service.name.toPascalCase() + 'Client}' }} from './{{ service.name.toSnakeCase() }}_client';
{%- endfor %}
3 changes: 2 additions & 1 deletion typescript/src/templater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as util from 'util';
import * as plugin from '../../pbjs-genfiles/plugin';

import { API } from './schema/api';
import { commonPrefix } from './util';

const commonParameters: { [name: string]: string } = {
copyrightYear: new Date().getFullYear().toString(),
Expand Down Expand Up @@ -68,7 +69,7 @@ function processOneTemplate(
for (const service of api.services) {
result.push(
renderFile(
outputFilename.replace(/\$service/, service.name!.toLowerCase()),
outputFilename.replace(/\$service/, service.name!.toSnakeCase()),
relativeTemplateName,
{ api, commonParameters, service }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **

export {KeyManagementServiceClient} from './keymanagementservice_client';
export {KeyManagementServiceClient} from './key_management_service_client';
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import * as path from 'path';

import * as packageJson from '../../package.json';
import * as protosTypes from '../../protos/protos';
import * as gapicConfig from './keymanagementservice_client_config.json';
import * as gapicConfig from './key_management_service_client_config.json';

const version = packageJson.version;

Expand Down

0 comments on commit 8f6db5e

Please sign in to comment.