inrupt/artifact-generator

Restore type definitions to @inrupt/vocab-common-rdf

Closed this issue · 6 comments

Describe the bug

The package has lost its type definitions in its v1.0.0 release. Thus TypeScript started complaining.

To Reproduce

mkdir reprod && cd reprod
npm init -y
npm i @inrupt/vocab-common-rdf@0
cat ./node_modules/@inrupt/vocab-common-rdf/package.json

Notice how the output includes "types": "./dist/index.d.ts",. Now run:

npm i @inrupt/vocab-common-rdf@1
cat ./node_modules/@inrupt/vocab-common-rdf/package.json

Notice that "types" are missing now.

Expected behavior
Type definitions to keep being included.

Yeah, thanks for reporting @riovir. We'll look into this ASAP.

Hi @riovir,

Thanks so much again for reporting - it actually kicked off a big internal update (that I'll describe below), but in fact the issue you noticed was due to something else entirely.

Basically we switched the 'default form' of our generated artifacts (by default I just mean the artifacts named without a suffix that explicitly describes whether they build on top of RDF/JS, or on top of rdflib, or which implementation of RDF/JS, or whether they use String Literals, etc.).

Previously the default form (in your case the artifact named @inrupt/vocab-common-rdf) relied on IRI-typed constants for vocab terms, and so it depended on @types/rdf-js. But with v1 we've switched that to just using String-typed constants instead, and with that switch we also generated just pure JavaScript artifacts, so with no type information or any TypeScript configuration at all. That was why you noticed the now missing "types".

So one of the changes I've now made is to update this so that we now default to generating string literal-based artifacts that support TypeScript out-of-the-box.

We always also published the other forms of our artifacts, we just name them more explicitly now. So the new name for the Common RDF artifact that uses RDF/JS types for the vocab term constants (and that uses Ruben Taelman's rdf-data-factory implementation of the RDF/JS Data Factory interface) is now named:

@inrupt/vocab-common-rdf-rdfjs-rdfdatafactory

If you try that dependency you should see the correct "types" field when you:

cat ./node_modules/@inrupt/vocab-common-rdf-rdfjs-rdfdatafactory/package.json

But now to describe the internal change sparked by your issue. It turns out that the RDF/JS community recently released the official TypeScript types, specifically @rdfjs/types. So we've now updated our Artifact Generator templates to use those types (as opposed to the DefinitelyTyped types that we were depending on before). But then it turned out that Ruben Taelman's implementation was still depending on the old types too. We raised an issue there, and Ruben quickly updated his library, allowing us to update our dependency on it, thereby tidying up all usage of RDF/JS types now.

So we'll be releasing new v1.0.1 versions for the Artifact Generator, and our published artifacts very soon (and I've updated the README documentation around all this too). It would be great if you could let us know if all that makes sense before we release the updated v1.0.1 versions of everything.

It would be great if you could let us know if all that makes sense before we release the updated v1.0.1 versions of everything.

It does, it's much appreciated, and also thank you for responding so quickly!

and I've updated the README documentation around all this too

Is that why currently I'm getting 404s (as in not yet released?) for the following links in the README?

  • Generated directory structure
  • Multiple forms of generated artifact
  • Generated source-code documentation
  • The relationship between generated source-code artifacts and RDF vocabularies

Hi @riovir,

Whoops! No, those broken links you found were actually broken - but fixed now (and the text improved a wee bit while I was at it).

I hope to get the next release of the Artifact Generator and the generated artifacts published tomorrow, so I'll leave this issue open until we get those released and verify that all is well again.

Again, thanks for the great feedback - it's been really invaluable, and thanks for your patience in dealing with these teething issues before we officially announce the open-sourcing of the Artifact Generator.

Hi @riovir,

Just the latest update - version v1.0.1 of the Artifact Generator and all the generated artifacts have been released to npmjs.org now (with a nice number of tidy ups and enhancements thrown in too for good measure (like really detailed JSDoc/JavaDoc comments for vocab terms that provide multi-lingual rdfs:label and rdfs:comment meta-data)).

If you get a chance it would be great if you could re-try and see if your expectations are met this time around.

Cheers,

Pat.

Ahoy @pmcb55! Yup, works as advertised. Thanks again! :)