aki2o / tern-gas

A plugin of tern for Google Apps Script
8 stars 2 forks source link

add tern-gas to npm? #5

Open enuchi opened 6 years ago

enuchi commented 6 years ago

Would you be able to publish tern-gas on npm? If not I am happy to set it up.

I've temporarily set up tern-googleappsscript on npm to host the plugin only. See here, with minor modifications. I've temporarily included it in my React + Google Apps Script project, but if you set up tern-gas on npm I'm happy to update my project and reference your npm package.

The reason for adding to npm is it would be nice to install tern-gas to individual projects, not globally, using simple command npm install tern-gas, then adding .tern-project file to project root directory like this:

// .tern-project

{
  "libs": [
  ],
  "plugins": {
    "gas"
  }
}

Tern documentation:

When a name attribute is specified in the plugins section of the project configuration, Tern first searches for a file name.js in its distribution plugin directory, then for a file name.js in the user’s project directory, and finally for an installed package named "tern-name" to load as a plugin. A plugin distributed as an npm package must have a package name matching the pattern "tern-name".

rudimusmaximus commented 5 years ago

@enuchi Thanks. I am trying to use your tern-googleappsscript I noticed that npm doc shows

// .tern-project

{
  "libs": [
  ],
  "plugins": {
    "googleappsscript"
  }
}

but should likely be this i think

// .tern-project

{
  "libs": [
  ],
  "plugins": {
    "googleappsscript": {}
  }
}

Either way, i am getting this error I cannot resolve when trying to setup in atom with ternjs setup atom-ternjs Cannot find module 'tern/lib/"infer'" my .tern-project file is:

{
  "ecmaVersion": 6,
  "libs": [
    "browser"
  ],
  "loadEagerly": [
    "./Add-on/*.gs"
  ],
  "dontLoad": [],
  "plugins": {
    "node": {},
    "doc_comment": true,
    "googleappsscript": {},
    "modules": {
      "dontLoad": "",
      "load": "",
      "modules": ""
    }
  }
}

Any ideas or suggestions? Thank you @aki2o Any suggestions, sir?

enuchi commented 5 years ago

Yes, you're right about the .tern-project file. Is tern installed globally? Locally? And where is atom's version of tern installed?

rudimusmaximus commented 5 years ago

this is the atom install https://github.com/tststs/atom-ternjs

the readme has some instructions there about Third party plugins where they are an issue....trying to sort that out

rudimusmaximus commented 5 years ago

Until tern-gas is in npm, using https://www.npmjs.com/package/tern-googleappsscript These have to be installed inside atom in addition to the .tern-project file. SO, per https://github.com/tststs/atom-ternjs readme on Third party plugins

cd ~/.atom/packages/atom-ternjs
npm install tern-googleappsscript

Getting warning: npm WARN tern-googleappsscript@1.0.2 requires a peer of tern@0.22.3 but none is installed. You must install peer dependencies yourself. What is required? @enuchi