Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

feat!: move library to typescript code generation #285

Merged
merged 26 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .jsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ module.exports = {
destination: './docs/'
},
plugins: [
'plugins/markdown',
'jsdoc-region-tag'
'plugins/markdown'
],
source: {
excludePattern: '(^|\\/|\\\\)[._]',
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,16 @@
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-prettier": "^3.0.0",
"execa": "^3.2.0",
"gts": "^1.0.0",
"intelli-espower-loader": "^1.0.1",
"jsdoc": "^3.5.5",
"jsdoc-fresh": "^1.0.1",
"linkinator": "^1.5.0",
"mocha": "^6.1.4",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"null-loader": "^3.0.0",
"pack-n-play": "^1.0.0-2",
"power-assert": "^1.4.4",
"prettier": "^1.11.1",
"tmp": "^0.1.0",
"ts-loader": "^6.2.1",
"typescript": "^3.7.0",
"webpack": "^4.41.2",
Expand Down
6 changes: 3 additions & 3 deletions synth.metadata
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"updateTime": "2019-11-12T20:37:11.600689Z",
"updateTime": "2019-11-13T22:41:44.289221Z",
"sources": [
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "6a8c7914d1b79bd832b5157a09a9332e8cbd16d4",
"internalRef": "279991530"
"sha": "218164b3deba1075979c9dca5f71461379e42dd1",
"internalRef": "280279014"
}
},
{
Expand Down
23 changes: 0 additions & 23 deletions system-test/fixtures/sample/package.json

This file was deleted.

26 changes: 26 additions & 0 deletions system-test/fixtures/sample/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **

const texttospeech = require('texttospeech');

function main() {
const textToSpeechClient = new texttospeech.TextToSpeechClient();
console.log("textToSpeechClient was created!");
}

main();
14 changes: 0 additions & 14 deletions system-test/fixtures/sample/tsconfig.json

This file was deleted.

57 changes: 26 additions & 31 deletions system-test/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,35 @@
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **

import * as execa from 'execa';
import * as mv from 'mv';
import {ncp} from 'ncp';
import * as tmp from 'tmp';
import {promisify} from 'util';
import {packNTest} from 'pack-n-play';
import {readFileSync} from 'fs';

const keep = false;
const mvp = promisify(mv);
const ncpp = promisify(ncp);
const stagingDir = tmp.dirSync({keep, unsafeCleanup: true});
const stagingPath = stagingDir.name;
const pkg = require('../../package.json');

describe('📦 pack and install', () => {
it('should be able use the library from a TypeScript application', async function() {
describe('typescript consumer tests', () => {
it('should have correct type signature for typescript users', async function() {
this.timeout(300000);
await execa('npm', ['pack', '--unsafe-perm']);
const packageName = pkg.name.replace('@', '').replace('/', '-');
const tarball = `${packageName}-${pkg.version}.tgz`;
await mvp(tarball, `${stagingPath}/texttospeech.tgz`);
await ncpp('system-test/fixtures/sample', `${stagingPath}/`);
await execa('npm', ['install', '--unsafe-perm'], {
cwd: `${stagingPath}/`,
stdio: 'inherit',
});
await execa('node', ['--throw-deprecation', 'build/src/index.js'], {
cwd: `${stagingPath}/`,
stdio: 'inherit',
});
const options = {
packageDir: process.cwd(), // path to your module.
sample: {
description: 'typescript based user can use the type definitions',
ts: readFileSync(
'./system-test/fixtures/sample/src/index.ts'
).toString(),
},
};
await packNTest(options); // will throw upon error.
});

after('cleanup staging', () => {
if (!keep) {
stagingDir.removeCallback();
}
it('should have correct type signature for javascript users', async function() {
this.timeout(300000);
const options = {
packageDir: process.cwd(), // path to your module.
sample: {
description: 'typescript based user can use the type definitions',
ts: readFileSync(
'./system-test/fixtures/sample/src/index.js'
).toString(),
},
};
await packNTest(options); // will throw upon error.
});
});
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const path = require('path');
module.exports = {
entry: './src/index.ts',
output: {
library: 'TextToSpeech',
filename: './text-to-speech.js',
library: 'texttospeech',
filename: './texttospeech.js',
},
node: {
child_process: 'empty',
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.