You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@annotator.apache.org by Benjamin Young <by...@bigbluehat.com> on 2024/09/04 18:33:01 UTC

Easy webpage use

Hi all,

I took some time to try to setup Apache Annotator on a simple webpage of just text. I couldn't find a way to include it (either dom, selector, or otherwise) without setting up some significant build tool (webpack, etc.).

Do we have a minimum viable setup for folks wanting to do something closer to a script tag style include?

The demo code was the closest I could find which uses webpack. Is that the best place to point folks?

Our Getting Started page makes no mention of how to wire it into the HTML page...which is where most people will be starting.

Just looking for ways to lower the barrier to entry.

Thanks!
Benjamin


--
https://bigbluehat.com/
https://linkedin.com/in/benjaminyoung



Re: Easy webpage use

Posted by Colby Russell <ap...@x.colbyrussell.com>.
"[T]he current behavior is intentional".  See issue 161 on the
bugtracker. <https://github.com/apache/incubator-annotator/issues/161>

Crummy, ramshackle build systems that are simultaneously under- and
over-engineered are the only conscionable choice for a NodeJS
programmer.  Being uncomplicated means being uncool--and simple,
reliable build scripts that would allow any random passerby to operate
them are _especially_ uncool.

 > [we should be] looking for ways to lower the barrier to entry

Absolutely not.  Get out of here and go fuck yourself.

-- 
Colby Russell


Re: Easy webpage use

Posted by Richard Eckart de Castilho <re...@apache.org>.
> On 4. Sep 2024, at 21:52, Richard Eckart de Castilho <re...@apache.org> wrote:
> 
> optimally the code should be available on some JavaScript CDN from where people could easily incorporate it.
> 
> Since annotator is on npm, it should be usable through https://unpkg.com/.

Looks like we only publish the "raw" ES6 modules to npm which are meant not directly
suitable for consumption in a browser. I believe typically, there would be some "dist"
folder as well that would contain a bundled version of the module.

I'm not familiar with the whole lerna/tsc/webpack stack that is used in annotator.

Using single-module-per-repo esbuild setup, I would have a build.mjs file that I call
from `npm run build` which would go something like this:

```
esbuild.build({
  entryPoints: ['index.ts'],
  outfile: `dist/annotator.min.js`,
  globalName: 'annotator',
  bundle: true,
  sourcemap: true,
  minify: true,
  target: 'es2018',
  loader: { '.ts': 'ts' },
  logLevel: 'info',
  plugins: [sassPlugin()]
})
```

That would produce a JS file that could be published to npmjs/unpkg for consumption by
in a browser.

Any idea how to achieve that with the mono-repo setup used by annotator and with the
stack used here? 

-- Richard


Re: Easy webpage use

Posted by Richard Eckart de Castilho <re...@apache.org>.
Hi,

optimally the code should be available on some JavaScript CDN from where people could easily incorporate it.

Since annotator is on npm, it should be usable through https://unpkg.com/.

Cheers,

-- Richard

> On 4. Sep 2024, at 20:33, Benjamin Young <by...@bigbluehat.com> wrote:
> 
> Hi all,
> 
> I took some time to try to setup Apache Annotator on a simple webpage of just text. I couldn't find a way to include it (either dom, selector, or otherwise) without setting up some significant build tool (webpack, etc.).
> 
> Do we have a minimum viable setup for folks wanting to do something closer to a script tag style include?
> 
> The demo code was the closest I could find which uses webpack. Is that the best place to point folks?
> 
> Our Getting Started page makes no mention of how to wire it into the HTML page...which is where most people will be starting.
> 
> Just looking for ways to lower the barrier to entry.
> 
> Thanks!
> Benjamin
> 
> 
> --
> https://bigbluehat.com/
> https://linkedin.com/in/benjaminyoung
> 
>