graphql-compose/graphql-compose-elasticsearch

Project does not build

Closed this issue · 2 comments

Problem

As a developer user, after cloning the project, the steps to build the project should be

  1. yarn install
  2. yarn build

Instead, the developer user is presented with an error when following these steps.

> @bnet/graphql-compose-elasticsearch@0.0.0 build-cjs /Users/michaelflores/Documents/workspace/graphql-compose-elasticsearch
> rimraf lib && BABEL_ENV=cjs babel src --ignore __tests__,__mocks__ -d lib && COPY_TO_FOLDER=lib npm run build-flow

SyntaxError: src/ElasticApiParser.js: Unexpected token, expected , (7:53)
   5 | import fs from 'fs';
   6 | import path from 'path';
>  7 | import { GraphQLJSON, upperFirst, TypeComposer, type ComposeFieldConfigMap } from 'graphql-compose';
     |                                                      ^
   8 | import {
   9 |   GraphQLString,
  10 |   GraphQLFloat,
npm ERR! code ELIFECYCLE
npm ERR! errno 1

Solution

The babel config should be included in the repo. Presumably this runs on the author's system.

Some of the included plugins in the devDependencies may be unnecessary: the following config suffices. Note: the packages for the below plugins are not currently in devDependencies

  "babel": {
    "plugins": [
      "syntax-flow",
      "transform-object-rest-spread"
    ]
  },
nodkz commented

@mflores-verys it's very strange.

What operation system do you use?
Build tested under MacOS on my machine and Ubuntu 14 via CI.

BABEL_ENV=cjs does the trick. Babel should automatically pick up settings from .babelrc file. In the last commit, I repeated global plugins for every babel-env setup. Please check that it works or not.

Thanks.

@nodkz just noticed: while I had git cloned this repo, .babelrc was not included. This was user (my) error! Thanks @nodkz