Skip to content

Commit

Permalink
vocab tests updated for new package labels, and TS templates fixed (#348
Browse files Browse the repository at this point in the history
)
  • Loading branch information
pmcb55 authored Jul 4, 2020
1 parent 27f0688 commit 96b96f5
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 79 deletions.
2 changes: 1 addition & 1 deletion src/VocabGeneration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const VERSION_LIT_VOCAB_TERM = "^0.2.4";
const NPM_REGISTRY = "http://localhost:4873";
const RUN_NPM_INSTALL = false;
const SUPPORT_BUNDLING = true;
const RUN_PACKAGING = ["localMaven", "localNpmNode"];
const RUN_PACKAGING = ["mavenLocal", "npmLocal"];

const ConfigAll = {
_: "generate",
Expand Down
4 changes: 2 additions & 2 deletions templates/rdfLibraryDependent/typescript/rdfext/package.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
},
{{/if}}
"dependencies": {
"@rdfjs/data-model": "{{rdfjsDatamodelVersion}}",
"@types/rdf-js": "{{rdfjsTypesVersion}}"
"@rdfjs/namespace": "{{rdfjsNamespaceVersion}}",
"@types/rdfjs__namespace": "{{rdfjsNamespaceTypesVersion}}"
},
"devDependencies": {
"typescript": "{{typescriptVersion}}"
Expand Down
154 changes: 78 additions & 76 deletions templates/rdfLibraryDependent/typescript/rdfext/vocab.hbs
Original file line number Diff line number Diff line change
@@ -1,76 +1,78 @@
{{#if license/header}}
{{license/header}}

{{/if}}
const namespace = require("@rdfjs/namespace");

/**
Generated by artifact generator [{{generatorName}}], version [{{artifactGeneratorVersion}}]
as part of artifact: [{{artifactName}}], version: [{{artifactVersion}}]
at '{{generatedTimestamp}}'.

{{sourceRdfResources}}
{{#if description}}

{{{description}}}
{{/if}}
*/

const RDFJS_NAMESPACE = namespace("{{namespace}}");

const _NAMESPACE = "{{namespace}}";
function _NS (localName) {
return (_NAMESPACE + localName);
}

const {{vocabNameUpperCase}} = {
PREFIX: "{{vocabPrefix}}",
NAMESPACE: _NAMESPACE,
PREFIX_AND_NAMESPACE: { "{{vocabPrefix}}": "{{namespace}}" },
NS: _NS,

{{#if classes}}
// *****************
// All the Classes.
// *****************
{{#each classes}}

/**
*{{#if comment}} {{{comment}}}{{/if}}
*/
{{nameEscapedForLanguage}}: RDFJS_NAMESPACE("{{{name}}}"),
{{/each}}
{{/if}}

{{#if properties}}
// *******************
// All the Properties.
// *******************
{{#each properties}}

/**
*{{#if comment}} {{{comment}}}{{/if}}
*/
{{nameEscapedForLanguage}}: RDFJS_NAMESPACE("{{{name}}}"),
{{/each}}
{{/if}}

{{#if literals}}
// *******************
// All the Literals.
// *******************
{{#each literals}}

/**
*{{#if comment}} {{{comment}}}{{/if}}
*/
{{nameEscapedForLanguage}}: RDFJS_NAMESPACE("{{{name}}}"),
{{/each}}
{{/if}}
//
// Marker allowing us put commas at the end of all lines above (only the last line does not have a comma).
//
END_OF_VOCAB: "End of vocab."
}

module.exports = {{vocabNameUpperCase}};
{{#if license/header}}
{{license/header}}

{{/if}}
import namespace from "@rdfjs/namespace";

/**
Generated by artifact generator [{{generatorName}}], version [{{artifactGeneratorVersion}}]
as part of artifact: [{{artifactName}}], version: [{{artifactVersion}}]
at '{{generatedTimestamp}}'.

{{sourceRdfResources}}
{{#if description}}

{{{description}}}
{{/if}}
*/

const RDFJS_NAMESPACE = namespace("{{namespace}}");

const _NAMESPACE = "{{namespace}}";
function _NS (localName: string) {
return (_NAMESPACE + localName);
}

const {{vocabNameUpperCase}} = {
PREFIX: "{{vocabPrefix}}",
NAMESPACE: _NAMESPACE,
PREFIX_AND_NAMESPACE: { "{{vocabPrefix}}": "{{namespace}}" },
NS: _NS,

{{#if classes}}
// *****************
// All the Classes.
// *****************
{{#each classes}}

/**
*{{#if comment}} {{{comment}}}{{/if}}{{#if isDefinedBy}}
*
* Defined by the vocabulary: {{isDefinedBy}}{{/if}}
*/
{{nameEscapedForLanguage}}: RDFJS_NAMESPACE("{{{name}}}"),
{{/each}}
{{/if}}

{{#if properties}}
// *******************
// All the Properties.
// *******************
{{#each properties}}

/**
*{{#if comment}} {{{comment}}}{{/if}}{{#if isDefinedBy}}
*
* Defined by the vocabulary: {{isDefinedBy}}{{/if}}
*/
{{nameEscapedForLanguage}}: RDFJS_NAMESPACE("{{{name}}}"),
{{/each}}
{{/if}}

{{#if literals}}
// *******************
// All the Literals.
// *******************
{{#each literals}}

/**
*{{#if comment}} {{{comment}}}{{/if}}{{#if isDefinedBy}}
*
* Defined by the vocabulary: {{isDefinedBy}}{{/if}}
*/
{{nameEscapedForLanguage}}: RDFJS_NAMESPACE("{{{name}}}"),
{{/each}}
{{/if}}
};

export { {{vocabNameUpperCase}} };

0 comments on commit 96b96f5

Please sign in to comment.