Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: generate webpack config js #131

Merged
merged 5 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 8 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
npm run browser-test
trap stop_showcase EXIT
- run:
name: Run unit tests, system tests, jsdoc generation, and gts fix of the generated Showcase library
name: Run unit tests, system tests, jsdoc generation, gts fix and generate webpack of the generated Showcase library
command: |
cd .test-out-showcase
npm install
Expand All @@ -73,8 +73,9 @@ jobs:
npm run system-test
npm run docs
npm run docs-test
npx webpack
- run:
name: Run unit tests, system tests, jsdoc generation, and gts fix of the generated KMS library
name: Run unit tests, system tests, jsdoc generation, gts fix and generate webpack of the generated KMS library
command: |
cp -r typescript/test/protos ./.test-out-keymanager
cd .test-out-keymanager
Expand All @@ -85,8 +86,9 @@ jobs:
npm run system-test
npm run docs
npm run docs-test
npx webpack
- run:
name: Run unit tests, system tests, jsdoc generation, and gts fix of the generated Translate library
name: Run unit tests, system tests, jsdoc generation, gts fix and generate webpack of the generated Translate library
command: |
cp -r typescript/test/protos ./.test-out-translate
cd .test-out-translate
Expand All @@ -97,8 +99,9 @@ jobs:
npm run system-test
npm run docs
npm run docs-test
npx webpack
- run:
name: Run unit tests, system tests, jsdoc generation, and gts fix of the generated Text-to-Speech library
name: Run unit tests, system tests, jsdoc generation, gts fix and generate webpack of the generated Text-to-Speech library
command: |
cp -r typescript/test/protos ./.test-out-texttospeech
cd .test-out-texttospeech
Expand All @@ -109,6 +112,7 @@ jobs:
npm run system-test
npm run docs
npm run docs-test
npx webpack
- run:
name: Run linting
command: |
Expand Down
6 changes: 5 additions & 1 deletion templates/typescript_gapic/package.json.njk
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ limitations under the License.
"mocha": "^6.0.0",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"null-loader": "^3.0.0",
"tmp": "^0.1.0",
"typescript": "^3.7.0"
"ts-loader": "^6.2.1",
"typescript": "^3.7.0",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10"
},
"engines": {
"node": ">=8.13.0"
Expand Down
64 changes: 64 additions & 0 deletions templates/typescript_gapic/webpack.config.js.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// 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.

const path = require('path');

module.exports = {
entry: './src/index.ts',
output: {
library: '{{ api.naming.name.toCamelCase() }}',
filename: './{{ api.naming.name.toKebabCase() }}.js',
},
node: {
child_process: 'empty',
fs: 'empty',
crypto: 'empty',
},
resolve: {
alias: {
'../../../package.json': path.resolve(__dirname, 'package.json'),
},
extensions: ['.js', '.json', '.ts'],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /node_modules[\\\/]@grpc[\\\/]grpc-js/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]grpc/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]retry-request/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]https-proxy-agent/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]gtoken/,
use: 'null-loader'
},
],
},
mode: 'production',
};
6 changes: 5 additions & 1 deletion typescript/test/testdata/keymanager/package.json.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@
"mocha": "^6.0.0",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"null-loader": "^3.0.0",
"tmp": "^0.1.0",
"typescript": "^3.7.0"
"ts-loader": "^6.2.1",
"typescript": "^3.7.0",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10"
},
"engines": {
"node": ">=8.13.0"
Expand Down
64 changes: 64 additions & 0 deletions typescript/test/testdata/keymanager/webpack.config.js.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// 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.

const path = require('path');

module.exports = {
entry: './src/index.ts',
output: {
library: 'kms',
filename: './kms.js',
},
node: {
child_process: 'empty',
fs: 'empty',
crypto: 'empty',
},
resolve: {
alias: {
'../../../package.json': path.resolve(__dirname, 'package.json'),
},
extensions: ['.js', '.json', '.ts'],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /node_modules[\\\/]@grpc[\\\/]grpc-js/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]grpc/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]retry-request/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]https-proxy-agent/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]gtoken/,
use: 'null-loader'
},
],
},
mode: 'production',
};
6 changes: 5 additions & 1 deletion typescript/test/testdata/showcase/package.json.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@
"mocha": "^6.0.0",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"null-loader": "^3.0.0",
"tmp": "^0.1.0",
"typescript": "^3.7.0"
"ts-loader": "^6.2.1",
"typescript": "^3.7.0",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10"
},
"engines": {
"node": ">=8.13.0"
Expand Down
64 changes: 64 additions & 0 deletions typescript/test/testdata/showcase/webpack.config.js.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// 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.

const path = require('path');

module.exports = {
entry: './src/index.ts',
output: {
library: 'showcase',
filename: './showcase.js',
},
node: {
child_process: 'empty',
fs: 'empty',
crypto: 'empty',
},
resolve: {
alias: {
'../../../package.json': path.resolve(__dirname, 'package.json'),
},
extensions: ['.js', '.json', '.ts'],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /node_modules[\\\/]@grpc[\\\/]grpc-js/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]grpc/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]retry-request/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]https-proxy-agent/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]gtoken/,
use: 'null-loader'
},
],
},
mode: 'production',
};
6 changes: 5 additions & 1 deletion typescript/test/testdata/texttospeech/package.json.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@
"mocha": "^6.0.0",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"null-loader": "^3.0.0",
"tmp": "^0.1.0",
"typescript": "^3.7.0"
"ts-loader": "^6.2.1",
"typescript": "^3.7.0",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10"
},
"engines": {
"node": ">=8.13.0"
Expand Down
64 changes: 64 additions & 0 deletions typescript/test/testdata/texttospeech/webpack.config.js.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// 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.

const path = require('path');

module.exports = {
entry: './src/index.ts',
output: {
library: 'texttospeech',
filename: './texttospeech.js',
},
node: {
child_process: 'empty',
fs: 'empty',
crypto: 'empty',
},
resolve: {
alias: {
'../../../package.json': path.resolve(__dirname, 'package.json'),
},
extensions: ['.js', '.json', '.ts'],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /node_modules[\\\/]@grpc[\\\/]grpc-js/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]grpc/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]retry-request/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]https-proxy-agent/,
use: 'null-loader'
},
{
test: /node_modules[\\\/]gtoken/,
use: 'null-loader'
},
],
},
mode: 'production',
};
6 changes: 5 additions & 1 deletion typescript/test/testdata/translate/package.json.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@
"mocha": "^6.0.0",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"null-loader": "^3.0.0",
"tmp": "^0.1.0",
"typescript": "^3.7.0"
"ts-loader": "^6.2.1",
"typescript": "^3.7.0",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10"
},
"engines": {
"node": ">=8.13.0"
Expand Down
Loading