mdittmer / mdn-confluence

2 stars 5 forks source link

Couldn't run `generate` on Ubuntu 17.10 #23

Closed SphinxKnight closed 6 years ago

SphinxKnight commented 6 years ago

Hi there :) After @jpmedley 's relevant suggestion, I've decided to install and run mdn-confluence to enrich the data I had manually scraped from MDN about the HTMLIFrameElement.

However, on my Ubuntu 17.10, after successfully retrieving the repo and running npm install && npm run build, when I run npm run generate -- --interfaces=HTMLIFrameElement, I get the following log :/

core boot time:  43
Unknown property foam.core.Class.javaInfoType: foam.core.AbstractObjectPropertyInfo
Unknown property foam.core.Property.javaInfoType: foam.core.AbstractObjectPropertyInfo
Change of Axiom org.chromium.apis.web.LocalJsonDAO.error type from foam.core.Method to foam.core.Import
Import "error" already exists in ancestor class of org.chromium.apis.web.LocalJsonDAO.
Change of Axiom org.chromium.apis.web.HttpJsonDAO.error type from foam.core.Method to foam.core.Import
Import "error" already exists in ancestor class of org.chromium.apis.web.HttpJsonDAO.
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: classId,opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: classId,opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: classId,opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: classId,opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
**** Boxes are running in UNSAFE mode.  Turn this off before you go to production!
**** Boxes are running in UNSAFE mode.  Turn this off before you go to production!
Property org.mozilla.mdn.BaseImporter.dataClass_ "value" hidden by "getter"
Change of Axiom org.chromium.apis.web.SerializableIndexedDAO.delegate type from foam.core.Proxy to foam.dao.DAOProperty
Unsupported change of property type fromfoam.core.Proxytofoam.dao.DAOProperty
org.chromium.apis.web.HttpJsonDAO of org.chromium.apis.web.Release created from https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.Release.json
Promised org.chromium.apis.web.HttpJsonDAO of org.chromium.apis.web.Release from https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.Release.json resolved as org.chromium.apis.web.MDAO
Change of Axiom org.chromium.apis.web.GridDAO.warn type from foam.core.Method to foam.core.Import
Import "warn" already exists in ancestor class of org.chromium.apis.web.GridDAO.
org.chromium.apis.web.HttpJsonDAO of org.chromium.apis.web.GridRow created from https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.GridRow.json
Promised org.chromium.apis.web.HttpJsonDAO of org.chromium.apis.web.GridRow from https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.GridRow.json resolved as org.chromium.apis.web.MDAO
**** Boxes are running in UNSAFE mode.  Turn this off before you go to production!

And I cannot find any newly created file. Is there something I've done wrong? What info could I provide to help diagnose this? Thanks :)

mdittmer commented 6 years ago

IIUC, your PR introduces a new file. generate won't create new files unless you specify --from-confluence. You could specify that, or you could copy HTMLIFrameElement.json into place in /path/to/mdn-confluence/node_modules/mdn-browser-compat-data. (This is assuming you have a checkout of mdn-confluence, rather than using it as a npm dependency).

Let me know whether either of those approaches yield results!

SphinxKnight commented 6 years ago

Thanks for the swift reply :) 1st attempt with npm run generate -- --from-confluence --interfaces=HTMLIFrameElement &> log_from_confluence.log gives the same error (I've tried both with and without the two dashes before the --from-confluence option)

> mdn-confluence@0.0.2 generate /home/julieng/mdn-confluence
> node ./main/generate.es6.js "--from-confluence" "--interfaces=HTMLIFrameElement"

core boot time:  35
Unknown property foam.core.Class.javaInfoType: foam.core.AbstractObjectPropertyInfo
Unknown property foam.core.Property.javaInfoType: foam.core.AbstractObjectPropertyInfo
Change of Axiom org.chromium.apis.web.LocalJsonDAO.error type from foam.core.Method to foam.core.Import
Import "error" already exists in ancestor class of org.chromium.apis.web.LocalJsonDAO.
Change of Axiom org.chromium.apis.web.HttpJsonDAO.error type from foam.core.Method to foam.core.Import
Import "error" already exists in ancestor class of org.chromium.apis.web.HttpJsonDAO.
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: classId,opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: classId,opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: classId,opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: classId,opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
**** Boxes are running in UNSAFE mode.  Turn this off before you go to production!
**** Boxes are running in UNSAFE mode.  Turn this off before you go to production!
Property org.mozilla.mdn.BaseImporter.dataClass_ "value" hidden by "getter"
Change of Axiom org.chromium.apis.web.SerializableIndexedDAO.delegate type from foam.core.Proxy to foam.dao.DAOProperty
Unsupported change of property type fromfoam.core.Proxytofoam.dao.DAOProperty
org.chromium.apis.web.HttpJsonDAO of org.chromium.apis.web.Release created from https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.Release.json
Promised org.chromium.apis.web.HttpJsonDAO of org.chromium.apis.web.Release from https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.Release.json resolved as org.chromium.apis.web.MDAO
Change of Axiom org.chromium.apis.web.GridDAO.warn type from foam.core.Method to foam.core.Import
Import "warn" already exists in ancestor class of org.chromium.apis.web.GridDAO.
org.chromium.apis.web.HttpJsonDAO of org.chromium.apis.web.GridRow created from https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.GridRow.json
Promised org.chromium.apis.web.HttpJsonDAO of org.chromium.apis.web.GridRow from https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.GridRow.json resolved as org.chromium.apis.web.MDAO
**** Boxes are running in UNSAFE mode.  Turn this off before you go to production!

2nd attempt (yes I do have a checkout of mdn-confluence) after copying my local HTMLIFrameElement.json (the one I've written under my local fork of browser-compat-data under the node_modules\mdn-browser-compat-data with npm run generate -- --interfaces=HTMLIFrameElement &> log_from_local_file.log

> mdn-confluence@0.0.2 generate /home/julieng/mdn-confluence
> node ./main/generate.es6.js "--interfaces=HTMLIFrameElement"

core boot time:  35
Unknown property foam.core.Class.javaInfoType: foam.core.AbstractObjectPropertyInfo
Unknown property foam.core.Property.javaInfoType: foam.core.AbstractObjectPropertyInfo
Change of Axiom org.chromium.apis.web.LocalJsonDAO.error type from foam.core.Method to foam.core.Import
Import "error" already exists in ancestor class of org.chromium.apis.web.LocalJsonDAO.
Change of Axiom org.chromium.apis.web.HttpJsonDAO.error type from foam.core.Method to foam.core.Import
Import "error" already exists in ancestor class of org.chromium.apis.web.HttpJsonDAO.
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: classId,opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: classId,opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: classId,opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
Unknown property foam.core.Function.args: classId,opt_gcloudProjectId
Unknown property foam.core.Function.returns: String
**** Boxes are running in UNSAFE mode.  Turn this off before you go to production!
**** Boxes are running in UNSAFE mode.  Turn this off before you go to production!
Property org.mozilla.mdn.BaseImporter.dataClass_ "value" hidden by "getter"
Change of Axiom org.chromium.apis.web.SerializableIndexedDAO.delegate type from foam.core.Proxy to foam.dao.DAOProperty
Unsupported change of property type fromfoam.core.Proxytofoam.dao.DAOProperty
org.chromium.apis.web.HttpJsonDAO of org.chromium.apis.web.Release created from https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.Release.json
Promised org.chromium.apis.web.HttpJsonDAO of org.chromium.apis.web.Release from https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.Release.json resolved as org.chromium.apis.web.MDAO
Change of Axiom org.chromium.apis.web.GridDAO.warn type from foam.core.Method to foam.core.Import
Import "warn" already exists in ancestor class of org.chromium.apis.web.GridDAO.
org.chromium.apis.web.HttpJsonDAO of org.chromium.apis.web.GridRow created from https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.GridRow.json
Promised org.chromium.apis.web.HttpJsonDAO of org.chromium.apis.web.GridRow from https://storage.googleapis.com/web-api-confluence-data-cache/latest/json/org.chromium.apis.web.GridRow.json resolved as org.chromium.apis.web.MDAO
**** Boxes are running in UNSAFE mode.  Turn this off before you go to production!
mdittmer commented 6 years ago

It looks like the issue is related to the nesting of objects in JSON. The PR proposes:

{
  "api": {
    "HTMLIFrameElement": {/*...*/},
    "propertyOrMethod1": {/*...*/},
    /*...*/
    "propertyOrMethodN": {/*...*/}
  }
}

which should be

{
  "api": {
    "HTMLIFrameElement": {
      /*...*/
      "propertyOrMethod1": {/*...*/},
      /*...*/
      "propertyOrMethodN": {/*...*/}
    }
  }
}

Once I made that change to ~/Downloads/HTMLIFrameElement.json the following script worked for me:

#!/bin/bash

set -evh

cd $(mktemp -d)
git clone https://github.com/mdittmer/mdn-confluence.git
cd mdn-confluence
echo " :: "
echo " :: Staging mdn-confluence run in $(pwd)"
echo " :: "
npm install
npm install mdn-browser-compat-data
cp ~/Downloads/HTMLIFrameElement.json ./node_modules/mdn-browser-compat-data/api/
npm run generate -- --interfaces=HTMLIFrameElement
diff node_modules/mdn-browser-compat-data/api/HTMLIFrameElement.json data/browser-compat-data/api/HTMLIFrameElement.json
SphinxKnight commented 6 years ago

@mdittmer thanks a lot for the script and pointing out the issue with the structure. I've got a valid diff and added that to this pending PR. I was a bit afraid of still seeing this set of Java warnings but all went well.

Thanks a lot for the time you've been spending on such a mistake of mine :$