odoo / o-spreadsheet

Other
186 stars 42 forks source link

No npm package ? #1820

Closed SimonGenin closed 1 year ago

SimonGenin commented 1 year ago

Could be nice to deploy this to npm (like owl) to make it easier to pull.

The js tooling in odoo could require it as dev-dependency and provide easily .d.ts support with one line added in main.d.ts (web/static/tooling/types)

pro-odoo commented 1 year ago

Yes, it's planned in a very near future :)

ged-odoo commented 1 year ago

if you do, you'll probably want to do it in the @odoo namespace like owl. i think I am the owner (?) of that npm account, so you know

pro-odoo commented 1 year ago

if you do, you'll probably want to do it in the @odoo namespace like owl. i think I am the owner (?) of that npm account, so you know

Yes, I'm writting the release script and come back to you :)

dberardo-com commented 1 year ago

would the npm package be usable as a "frontend-only" module as well ? without need of a backend server?

rrahir commented 1 year ago

The package is officially released on npm. Note that we still need to provide a more thorough documentation on how to setup/manipulate the library and explain our versioning system.

@dberardo-com Indeed, the library in itself can work as "frontend-only". It provides the tools to extract the current state of data and reload it at will, it is up to you to decide if you want to save this data on some server or just save it locally for personal use (e.g. this is what we proposed in the early versions of the library: https://github.com/odoo/o-spreadsheet/blob/14.0/demo/main.js#L31-L41

dberardo-com commented 1 year ago

thanks for the answer, i am very familiar with react development but never heard of owl before ... i hope i can still get my head around this library then. definitely worth a try ;)

could you maybe provide a link to the npm llibrary and the documentation available so far ? that would be great

rrahir commented 1 year ago

The package is available here: https://www.npmjs.com/package/@odoo/o-spreadsheet Concerning the documentation, as I mentioned in my previous message, we have to put some work in it to address every point in details but you can already consult https://github.com/odoo/o-spreadsheet#extending-the-functionalities-of-o-spreadsheet about how to extend the library with custom features. In the meantime, you can already consult this folder https://github.com/odoo/o-spreadsheet/tree/master/demo, especially https://github.com/odoo/o-spreadsheet/blob/master/demo/main.js which contains the minimal setup to use the library with every feature (including import/export to xlsx format).

dberardo-com commented 1 year ago

thanks for the references, i will have a look at the links. i suppose that the npm start command will bring up a fullstack environment, with also server-side functionalities. but i guess it will be easy to extract only the frontend part from it. this is a guess.

why is this very issue still open? i feel that the npm package already exists, so ... it could be closed ?

and btw, as for the LGPLv3 license: if i understand it correctly, then the source code is free for use on any kind of application, but if modified, then the changes need to be published in this github project in form of Pull Requests. correct? And i assume also that the code library can be statically built in the distributed applications, and not just dinamically linked to it (as in via a CDN, which would be hard for npm packages). why do i ask? because of the first answer here: https://softwareengineering.stackexchange.com/questions/47323/can-i-use-an-lgpl-licenced-library-in-my-commercial-app

regards

jannikbecher commented 1 year ago

Hello everyone,

I've been following this conversation and I'm interested in using o-spreadsheet in my project. I noticed there's no mention of an example using a CDN. Is there an example available demonstrating how to use o-spreadsheet with a CDN, or could someone provide guidance on setting it up this way?

Thank you in advance!

rrahir commented 1 year ago

Hi,

I am not 100% sure of what you are asking for. If you wish to access the library from a cdn, you either have to set it up yourself or you can alternatively access the package builds from https://www.unpkg.com/.

Typically, you could reuse the files in demo and replace the path of the local scripts to their equivalent to https://www.unpkg.com/.

Something like

<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
  </head>
  <body>
    <script src="https://unpkg.com/@odoo/owl@2.0.9"></script>
    <script src="https://unpkg.com/chart.js@2.9.3"></script>
    <script src="https://unpkg.com/chartjs-gauge@0.3.0"></script>
    <script src="https://unpkg.com/@odoo/o-spreadsheet"></script>
    <script src="main.js" type="module"></script>
    <link rel="stylesheet" href="main.css" />
    <link rel="stylesheet" href="https://unpkg.com/bootstrap@5.1.3/dist/css//bootstrap.min.css" />
    <!-- those are dev dependencies to support import/export excel  -->
    <script src="https://unpkg.com/jszip@3.6.0"></script>
    <script src="https://unpkg.com/file-saver@2.0.5"></script>
    <title>o_spreadsheet</title>
  </body>
</html>
rrahir commented 1 year ago

if you wish to investigate this morre, I suggest you make some research on CDN use, Its a buit out of scope of the library :)

rrahir commented 1 year ago

thanks for the references, i will have a look at the links. i suppose that the npm start command will bring up a fullstack environment, with also server-side functionalities. but i guess it will be easy to extract only the frontend part from it. this is a guess.

why is this very issue still open? i feel that the npm package already exists, so ... it could be closed ?

I will close it after answering your last comment

and btw, as for the LGPLv3 license: if i understand it correctly, then the source code is free for use on any kind of application, but if modified, then the changes need to be published in this Github project in form of Pull Requests. correct It is very encouraged to propose your bug fixes to this repository to make the library evolve. As per feature suggestions, we are following our own roadmap as we are developing it in parallel with the whole Odoo software suite. Since the said roadmap is not explicitly public, you can still ask around in an issue, we might already be working on it.

code under LGPL license can be forked and you can decide to make your own modifications to it as long as you

  1. reference the original author and source code
  2. Publish your modified code under a compatible license (simply put, keep LGPL) as the first answer points out.

And I assume also that the code library can be statically built in the distributed applications, and not just dinamically linked to it (as in via a CDN, which would be hard for npm packages). why do i ask? because of the first answer here: https://softwareengineering.stackexchange.com/questions/47323/can-i-use-an-lgpl-licenced-library-in-my-commercial-app

As long as you respect the full bindings of the license (expose it as LGPL, make the source code available to your end user, etc..

Keep in mind that I might be mistaken or be forgetting important points. I think the link you provided pretty much resumes the dos and don'ts.