Skip to content

Commit

Permalink
Merge pull request #5 from join-com/new-generator
Browse files Browse the repository at this point in the history
New TS generator: Part 1
  • Loading branch information
castarco authored Mar 17, 2021
2 parents b57da1b + 449595e commit bc29eb6
Show file tree
Hide file tree
Showing 13 changed files with 2,190 additions and 1,467 deletions.
32 changes: 32 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 2.1

docker-auth: &docker-auth
auth:
username: ${DOCKER_LOGIN}
password: ${DOCKER_PASSWORD}

commands:
install_protoc:
description: Install protobuf's protoc generator
steps:
- run:
command: sudo apt install -y protobuf-compiler
do_all:
description: Compile & test protoc-gen-ts
steps:
- checkout
- run:
name: Install test dependencies
command: cd ./integrationTests && yarn
- run:
name: Compile & Run Tests
command: cd ./integrationTests && yarn all

jobs:
build:
docker:
- image: circleci/golang:1.16-node
<<: *docker-auth
steps:
- install_protoc
- do_all
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
indent_style = space

[*.go]
indent_size = 4

[*.{js,json,ts}]
indent_size = 2
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
node_modules/
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"golang.go"
]
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"files.autoSave": "afterDelay",
"editor.formatOnSave": true,
"[go]": {
"editor.tabSize": 4
},
"[javascript]": {
"editor.tabSize": 2
},
"[typescript]": {
"editor.tabSize": 2
},
"[json]": {
"editor.tabSize": 2
}
}
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

go build -o ./dist/protoc-gen-ts
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/join-com/protoc-gen-ts

go 1.14
go 1.16

require github.com/golang/protobuf v1.3.4
require github.com/golang/protobuf v1.4.3
20 changes: 18 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk=
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
6 changes: 3 additions & 3 deletions integrationTests/__tests__/decode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ describe('decode', () => {
describe('timestamp', () => {
it('encodes timestamp', () => {
expect(decoded.timestamp).toBeDefined()
expect(decoded.timestamp).toEqual(new Date('2014-11-01T12:24:33.123'))
expect(decoded.timestamp).toEqual(new Date('2014-11-01T11:24:33.123Z'))
})

it('encodes timestampRepeated', () => {
expect(decoded.timestampRepeated).toBeDefined()
expect(decoded.timestampRepeated).toEqual([
new Date('2014-02-26T12:00:00.234'),
new Date('2013-05-26T12:00:10.221')
new Date('2014-02-26T11:00:00.234Z'),
new Date('2013-05-26T10:00:10.221Z')
])
})
})
Expand Down
27 changes: 14 additions & 13 deletions integrationTests/package.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
{
"name": "itegrationTests",
"version": "1.0.0",
"description": "tests for protoc-gen-ts",
"main": "index.js",
"license": "MIT",
"scripts": {
"test": "jest --runInBand --forceExit",
"proto:prettier": "prettier --write '__tests__/generated/**/*.ts'",
"all": "yarn compile && yarn proto:build && yarn test",
"compile": "cd .. && ./build.sh",
"proto:build": "yarn proto:clean && yarn proto:generate && yarn proto:prettier",
"proto:clean": "find __tests__/generated ! -name 'tslint.json' ! -name '.prettierrc' -type f -exec rm -f {} +",
"proto:build": "yarn proto:clean && protoc __tests__/proto/*.proto -I __tests__/proto --ts_out=/$PWD/__tests__/generated && yarn proto:prettier"
"proto:generate": "export PATH=\"${PWD}/../dist:${PATH}\" && protoc __tests__/proto/*.proto -I __tests__/proto --ts_out=/${PWD}/__tests__/generated",
"proto:prettier": "prettier --write '__tests__/generated/**/*.ts'",
"test": "export PATH=\"${PWD}/../dist:${PATH}\" && jest --runInBand --forceExit"
},
"dependencies": {
"@join-com/gcloud-logger-trace": "^0.1.6",
"@join-com/grpc-ts": "2.0.0",
"@join-com/grpc-ts": "^2.0.2",
"grpc": "^1.24.2",
"protobufjs": "^6.8.8"
"protobufjs": "^6.10.2"
},
"devDependencies": {
"@types/jest": "^25.1.3",
"@types/node": "^13.7.7",
"jest": "^25.1.0",
"@types/jest": "^26.0.20",
"@types/node": "^14.14.35",
"jest": "^26.6.3",
"jest-extended": "^0.11.5",
"jest-watch-typeahead": "^0.4.2",
"prettier": "^1.19.1",
"ts-jest": "^25.2.1",
"tslint": "^6.0.0",
"ts-jest": "^26.5.3",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typescript": "3.8.3"
"typescript": "^4.2.3"
}
}
Loading

0 comments on commit bc29eb6

Please sign in to comment.