cti-stix-visualization icon indicating copy to clipboard operation
cti-stix-visualization copied to clipboard

Make it an NPM package.

Open dwjohnston opened this issue 2 years ago • 0 comments

Addresses: #42

Changes:

  • I've moved the core of the logic out to stix2viscore.js. Retain stix2vis for compatibility with what you already have.
  • Adds a package.json
  • Adds linting - I mostly added this to help me remove all the non-strict js.
  • Adds typescript as a dependency - I'm using TypeScript to compile - but currently I haven't added types, but this would be a very nice feature feature.
  • Add package scripts (allow you to see the browser, build command)

Notes

Re: the use of requirejs, and the "nbextensions" stuff - I don't really know what I'm doing there - but what I've got looks like it's working.

Possible bug

Take a look at that handleSelected in stix2viscore.js - it looks like it is never defined anywhere.

Worth discussing

  • Should the PNG be included in the package?
  • With putting all of the code in stix2viscore.js you will lose your commit history. Possibly better to put the Jupyter stuff in a different file.
  • no-prototype-builtins - I just disabled the rule - is this something worth fixing? https://eslint.org/docs/rules/no-prototype-builtins

Testing

I tested that it works as an npm package here:

https://github.com/dwjohnston/stix-vis-test

Follow the instructions there.

Things that need to be done before this PR is merged:

  • Update the package.json
    • [ ] Rename name
    • [ ] Repository
    • [ ] Author
    • [ ] License
  • Update the readme
    • [ ] Address TODOS
    • [x] Include installation instructions
    • [x] (Because you might as well) - Include example usage in react

Future improvements:

  • Add types

dwjohnston avatar Mar 29 '22 04:03 dwjohnston