-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: pack and install test * circle * improve * gts fix * use gax ^1.9.0
- Loading branch information
1 parent
94b3a25
commit b910471
Showing
36 changed files
with
608 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{#- | ||
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 | ||
http://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. | ||
-#} | ||
--- | ||
env: | ||
mocha: true | ||
rules: | ||
no-console: off |
40 changes: 40 additions & 0 deletions
40
templates/typescript_gapic/system-test/fixtures/sample/package.json.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{#- | ||
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 | ||
http://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. | ||
-#} | ||
{ | ||
"name": "{{ api.naming.productName.toKebabCase() }}-sample-fixture", | ||
"description": "An app we're using to test the {{ api.naming.productName }} library.", | ||
"scripts": { | ||
"check": "gts check", | ||
"clean": "gts clean", | ||
"compile": "tsc -p .", | ||
"fix": "gts fix", | ||
"prepare": "npm run compile", | ||
"pretest": "npm run compile", | ||
"posttest": "npm run check", | ||
"start": "node build/src/index.js" | ||
}, | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"{{ api.naming.productName.toKebabCase() }}": "file:./{{ api.naming.productName.toKebabCase() }}.tgz" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^12.0.0", | ||
"typescript": "^3.0.0", | ||
"gts": "^1.0.0" | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
templates/typescript_gapic/system-test/fixtures/sample/src/index.ts.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{#- | ||
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 | ||
http://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. | ||
-#} | ||
{% import "../../../../_license.njk" as license -%} | ||
|
||
{%- for service in api.services %} | ||
import { {{- service.name.toPascalCase() + 'Client' -}} } from '{{ api.naming.productName.toKebabCase() }}'; | ||
{%- endfor %} | ||
|
||
function main() { | ||
{%- for service in api.services %} | ||
const {{ service.name.toCamelCase() -}}Client = new {{ service.name.toPascalCase() + 'Client' -}}(); | ||
console.log("{{- service.name.toCamelCase() -}}Client was created!"); | ||
{%- endfor %} | ||
} | ||
|
||
main(); |
29 changes: 29 additions & 0 deletions
29
templates/typescript_gapic/system-test/fixtures/sample/tsconfig.json.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{#- | ||
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 | ||
http://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. | ||
-#} | ||
{ | ||
"extends": "./node_modules/gts/tsconfig-google.json", | ||
"compilerOptions": { | ||
"rootDir": ".", | ||
"outDir": "build", | ||
"types": ["node"], | ||
"skipLibCheck": false | ||
}, | ||
"include": [ | ||
"src/*.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{#- | ||
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 | ||
http://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. | ||
-#} | ||
{% import "../_license.njk" as license -%} | ||
|
||
import * as execa from 'execa'; | ||
import * as mv from 'mv'; | ||
import {ncp} from 'ncp'; | ||
import * as tmp from 'tmp'; | ||
import {promisify} from 'util'; | ||
|
||
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() { | ||
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}/{{ api.naming.productName.toKebabCase() }}.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', | ||
}); | ||
}); | ||
|
||
after('cleanup staging', () => { | ||
if (!keep) { | ||
stagingDir.removeCallback(); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
typescript/test/testdata/keymanager/system-test/.eslintrc.yml.baseline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
env: | ||
mocha: true | ||
rules: | ||
no-console: off |
23 changes: 23 additions & 0 deletions
23
typescript/test/testdata/keymanager/system-test/fixtures/sample/package.json.baseline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "kms-sample-fixture", | ||
"description": "An app we're using to test the Kms library.", | ||
"scripts": { | ||
"check": "gts check", | ||
"clean": "gts clean", | ||
"compile": "tsc -p .", | ||
"fix": "gts fix", | ||
"prepare": "npm run compile", | ||
"pretest": "npm run compile", | ||
"posttest": "npm run check", | ||
"start": "node build/src/index.js" | ||
}, | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"kms": "file:./kms.tgz" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^12.0.0", | ||
"typescript": "^3.0.0", | ||
"gts": "^1.0.0" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
typescript/test/testdata/keymanager/system-test/fixtures/sample/src/index.ts.baseline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
import {KeyManagementServiceClient} from 'kms'; | ||
|
||
function main() { | ||
const keyManagementServiceClient = new KeyManagementServiceClient(); | ||
console.log("keyManagementServiceClient was created!"); | ||
} | ||
|
||
main(); |
14 changes: 14 additions & 0 deletions
14
typescript/test/testdata/keymanager/system-test/fixtures/sample/tsconfig.json.baseline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"extends": "./node_modules/gts/tsconfig-google.json", | ||
"compilerOptions": { | ||
"rootDir": ".", | ||
"outDir": "build", | ||
"types": [ | ||
"node" | ||
], | ||
"skipLibCheck": false | ||
}, | ||
"include": [ | ||
"src/*.ts" | ||
] | ||
} |
Oops, something went wrong.