mulesoft-labs / api-console-cli

A CLI tools for the API console.
Other
14 stars 15 forks source link

Can't build API console with version 0.2.x #4

Closed jenschude closed 6 years ago

jenschude commented 6 years ago

When using api-console-cli version 0.2.x I'm getting following error:

api-console build ./test.raml --json -o build
  Building the API console. This may take a moment.
error:  
error: ENOENT: no such file or directory, open '/tmp-30285xt4EKbGy9i6q/bower_components/api-console/api-console.html'
error: Error: ENOENT: no such file or directory, open '/tmp-30285xt4EKbGy9i6q/bower_components/api-console/api-console.html'
    at ApiConsoleBuilder.errorFn (/usr/local/lib/node_modules/api-console-cli/node_modules/api-console-builder/lib/builder.js:135:16)
    at emitOne (events.js:120:20)
    at ResolveTransform.emit (events.js:210:7)
    at VinylReaderTransform._dependenciesProcessingStream._dependenciesStream.on.pipe.on (/usr/local/lib/node_modules/api-console-cli/node_modules/polymer-build/lib/analyzer.js:180:74)
    at emitOne (events.js:120:20)
    at VinylReaderTransform.emit (events.js:210:7)
    at transformDonePromise.then (/usr/local/lib/node_modules/api-console-cli/node_modules/polymer-build/lib/streams.js:241:30)
    at <anonymous>
error:  

Using following RAML file:

#%RAML 1.0
---
title: Test
baseUri: http://example.com
types:
  Customers:
    properties:
      results:
        type: Customer[]
  Customer:
    properties:
      customerNumber?:
          type: string
      email:
          type: string
      password:
          type: string
      firstName?:
          type: string
      lastName?:
          type: string
      middleName?:
          type: string
      title?:
          type: string
      dateOfBirth?:
          type: date-only
      companyName?:
          type: string
      vatId?:
          type: string
/type:
  get:
    responses:
      200:
        body:
          application/json:
            example: {
               "results": [{
                     "email": "<random>@example.com",
                     "firstName": "John",
                     "id": "some_123_id",
                     "isEmailVerified": false,
                     "lastName": "Doe",
                     "password": "secret123"
               }]
            }
            type: Customers | Customer

With v0.1.4 I don't have this issue.

jarrodek commented 6 years ago

Hi,

Thank you for the issue report. Can you please run the following command in your shell and report back the result?

$ npm list -g api-console-builder
jenschude commented 6 years ago
$ npm list -g api-console-builder
/usr/local/lib
└─┬ api-console-cli@0.2.1
  └── api-console-builder@0.4.0 
jarrodek commented 6 years ago

Do you get this warning message when running the command?

Warning: You are trying to use local RAML file as an input but the --use-json optionis not set. 
Users won't be able to access the RAML file. The CLI will use --use-json to generate a JSON file for build.
jarrodek commented 6 years ago

Never mind. I was able to reproduce it already.

Thanks!

jarrodek commented 6 years ago

@jayS-de So the issue is with the latest release. CLI downloads information about latest release if specific tag is not passed as an option. The source downloader don't actually care about version number of downloaded console and yesterday there was new release of old version v3.x. So the builder is trying to build the old console which is not possible.

As a workaround I suggest to use -t option to use specific release:

$ api-console build ./api.raml -o build -t v4.0.0

I'll fix it in coming days.

jenschude commented 6 years ago

Ah kay. So I will add this to my build script and Dockerfile.

Would be nice to use also only stable tags for the build instead of master by default.

jarrodek commented 6 years ago

Agree. Thanks for letting me know.