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

Download binaries #4

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Download binaries #4

wants to merge 14 commits into from

Conversation

tscpp
Copy link

@tscpp tscpp commented Oct 4, 2020

Update all binaries to v2.0.0-beta.5.

@tscpp
Copy link
Author

tscpp commented Oct 15, 2020

2.0.0 released!

I'm updating the binaries once again!

@tscpp
Copy link
Author

tscpp commented Oct 15, 2020

I also removed the arch folders from the binaries, because 2.0.0 has support for both x64 and x86.

@tscpp
Copy link
Author

tscpp commented Oct 16, 2020

The plugin will now download the latest binary on installation, but a release tag can also be specified to install another version. Documentation is not implemented for version handling.

@tscpp tscpp changed the title Update binaries to release v2 WIP: Download binaries Oct 16, 2020
@tscpp
Copy link
Author

tscpp commented Oct 16, 2020

TypeScript documentation implemented. (TSDoc)

@tscpp
Copy link
Author

tscpp commented Oct 16, 2020

README.md example implemented.

@tscpp tscpp changed the title WIP: Download binaries Download binaries Oct 16, 2020
@tscpp
Copy link
Author

tscpp commented Oct 16, 2020

Ready 2b merged!

@tscpp
Copy link
Author

tscpp commented Oct 16, 2020

Even more ready to be merged!

@tscpp
Copy link
Author

tscpp commented Oct 16, 2020

README.md : 17-30

Installing a release of the openapi generator

Settings version of grpc-gateway/protoc-gen-openapi to v1.15.0.
Only works with >=1.5.1!

# PowerShell
$env:RELEASETAG="v1.15.0"
npm install -D @accility/protoc-tools
# CMD
set RELEASETAG="v1.15.0"
npm install -D @accility/protoc-tools
# Unix
RELEASETAG="v1.15.0" npm install -D @accility/protoc-tools

@tscpp
Copy link
Author

tscpp commented Oct 17, 2020

No support for <=1.5.0 has been made because no assets are attached to the release. Therefore you need to download the zip, unzip it and then build the binaries. This could be implemented; though it would be a struggle, it would be possible.

@tscpp
Copy link
Author

tscpp commented Oct 17, 2020

The description of this GitHub repository should be changed from "Convert .proto files to OpenAPI v2 (swagger) files" to "Convert .proto files to OpenAPI v2 and v3 (swagger) files".

'.proto' could also be changed to 'protocol buffers'


if (!latest)
throw new Error('Latest binary was not found. Install the latest binary or specify a custom binary path.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if I provide the binPath then?

src/lib/installer.ts Outdated Show resolved Hide resolved
src/lib/installer.ts Outdated Show resolved Hide resolved

if (exists)
return binpath
else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary 'else'

src/lib/installer.ts Outdated Show resolved Hide resolved
*
* @param tag Optional release tag. E.g. `v1.15.0`
*/
export async function downloadAsync(tag?: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declare return type.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export async function downloadAsync(tag?: string) {
export async function downloadAsync(tag?: string): Promise<{ bin: Buffer, tag: string, exe: boolean }> {

src/lib/installer.ts Outdated Show resolved Hide resolved
*/
export function installAsync(bin: Buffer, tag: string, exe: string): Promise<string>
export function installAsync(bin: { bin: Buffer, tag: string, exe: boolean }): Promise<string>
export function installAsync(...args: any[]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we just provide one install method (the async version preferably)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For synchronous function. Often used by CLI's.


return new Promise<string>((resolve, reject) => {

fs.access(path.join(__dirname, '../../bin'), (err) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use utils.promisify on the fs-methods instead?

tscpp and others added 4 commits November 2, 2020 15:02
Co-authored-by: Martin Skogevall <martin.skogevall@accility.se>
Co-authored-by: Martin Skogevall <martin.skogevall@accility.se>
Co-authored-by: Martin Skogevall <martin.skogevall@accility.se>
Co-authored-by: Martin Skogevall <martin.skogevall@accility.se>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants