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

add yarn.lock and use engine fields in package.json #16

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vscode
.DS_Store
node_modules
node-debug.log
.idea/
Expand Down
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ deploy:
secure: NHvQwwkB8FBFXIXHsDmk/34XAmQAxpe7zDvJMuvNN8S8G8dLOH5dN6Cv01eZ6m2KpTwDh76uSrVo1eJv9ljAV0Fj99O3JzwQ6U+N74eZPKwm4MIf2kmnyYC4sJtgbQTurnrZFrixC8lFuEPeZbBM8xD17lg+h1BgOxusaA+QtX3XLT14GZMKrezp9OtuGxyftIlNbc8knt+zvdF9npyb4E6uyRM5cnkyLrxz/JawehtynKv1eD60MvC4jQ3JLDPlaAM7Kx09zpLrgkbZd3jneYG0EHEuEEvFnOwyQfJJDnp9G9dxSv6rzjY+givzlT3XiGmuVTj6N9AT7lFobUySQGMxq5xiH8h4GfQhxPqMfFsqZaIWRuH5VLH+fPsjgmBHnrfyuipkGAkcxrKpu72yKxyQq0rATjyVoHgrfVf4hHxTvogjReK3/nAnpVKEgFxi6i9RTblkVddmuwhfauLT5pmbCU/YL0Wc2vu0RIU3NQTm9AoJvX/dSBfQFixVBWom5aphyYeZMxpGnjnZGVYYNcCMVBN5alqqnmTt9w/tTsYdiX4N11MN0cUScOvIZarY2JdvEwIE+h+r988/MuUCXF4IrRBzRKdp1ncA1nqalwKS8sJMMr4q2jCf9I33zMu/J42M2MIwYKmITijLyq0ue02n37w1egG438yRImC/f4Y=
on:
branch: master
cache:
directories:
- node_modules
cache: yarn
before_install:
- BAZEL_VERSION=0.11.0
- BAZEL_DEB="bazel_${BAZEL_VERSION}-linux-x86_64.deb"
- wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/${BAZEL_DEB} -O "${BAZEL_DEB}"
- sudo dpkg -i ${BAZEL_DEB}
- rm ${BAZEL_DEB}
install:
- npm install
- YARN_VERSION=$(node -p "require('./package.json').engines.yarn")
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version ${YARN_VERSION}
- export PATH="$HOME/.yarn/bin:$PATH"
script:
- "./travis-ci-build.sh"
17 changes: 15 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ http_archive(
"https://github.com/bazelbuild/rules_webtesting/archive/master.tar.gz",
],
)
load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories")
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
web_test_repositories()

git_repository(
Expand All @@ -26,7 +26,20 @@ git_repository(
commit = "d334fd8e2274fb939cf447106dced97472534e80",
)
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories")
node_repositories(package_json = ["//:package.json"])

node_repositories(
package_json = ["//:package.json"],
yarn_version = "1.12.3",
node_version = "10.15.1",
node_repositories = {
"10.15.1-darwin_amd64": ("node-v10.15.1-darwin-x64.tar.gz", "node-v10.15.1-darwin-x64", "327dcef4b61dead1ae04d2743d3390a2b7e6cc6c389c62cfcfeb0486c5a9f181"),
"10.15.1-linux_amd64": ("node-v10.15.1-linux-x64.tar.xz", "node-v10.15.1-linux-x64", "77db68544c7812e925b82ccc41cd4669fdeb191cea8e20053e3f0e86889c4fce"),
"10.15.1-windows_amd64": ("node-v10.15.1-win-x64.zip", "node-v10.15.1-win-x64", "bb5bdc9363e4050c94b3f82888141b81630230f86e520abb7dde49081f1292b9"),
},
yarn_repositories = {
"1.12.3": ("yarn-v1.12.3.tar.gz", "yarn-v1.12.3", "02cd4b589ec22c4bdbd2bc5ebbfd99c5e99b07242ad68a539cb37896b93a24f2"),
},
)

load("@ts_protoc_gen//:defs.bzl", "typescript_proto_dependencies")
typescript_proto_dependencies()
Expand Down
8 changes: 4 additions & 4 deletions defs.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@build_bazel_rules_nodejs//:defs.bzl", "npm_install")
load("@build_bazel_rules_nodejs//:defs.bzl", "yarn_install")


def declare_file(ctx, filename, file_modifications):
Expand Down Expand Up @@ -114,8 +114,8 @@ def typescript_proto_dependencies():
"""To be run in user's WORKSPACE to install ts-protoc-gen dependencies.
"""

npm_install(
yarn_install(
name = "deps",
package_json = "@ts_protoc_gen//:package.json",
package_lock_json = "@ts_protoc_gen//:package-lock.json",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
22 changes: 17 additions & 5 deletions generate.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -x
# Generate typescript definitions and service definitions from proto files

set -e
set +e

EXAMPLES_GENERATED_DIR=examples/generated
EXAMPLES_FLOW_GENERATED_DIR=examples/flow/generated
Expand All @@ -15,11 +15,23 @@ case "${unameOut}" in
esac
echo "You appear to be running on ${platform}"

echo "Ensuring we have NPM packages installed..."
npm install
# Installing yarn
requiredYarnVersion="$(node -p "require('./package.json').engines.yarn")"
if [[ "${requiredYarnVersion}" != "$(yarn --version)" ]]; then
echo "Installing yarn@${requiredYarnVersion}"
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version ${requiredYarnVersion}
fi
if [[ "$(which yarn)" == "" ]]; then
echo "Please follow instructions to setting path for ${requiredYarnVersion}"
export PATH="$HOME/.yarn/bin:$PATH"
fi


echo "Ensuring we have Npm packages installed..."
yarn

echo "Compiling ts-protoc-gen..."
npm run build
yarn build

PROTOC_VERSION="3.5.1"
echo "Downloading protoc v${PROTOC_VERSION} for ${platform}..."
Expand All @@ -33,7 +45,7 @@ else
exit 1
fi

wget ${PROTOC_URL} --output-document="protoc-${PROTOC_VERSION}.zip"
curl -sSL ${PROTOC_URL} -o "protoc-${PROTOC_VERSION}.zip"
unzip "protoc-${PROTOC_VERSION}.zip" -d protoc
rm "protoc-${PROTOC_VERSION}.zip"

Expand Down
Loading