@@ -12,19 +12,19 @@ To install the latest version of cwl-ts-auto execute:
1212### Loading Documents
1313Documents can be loaded by specyfying a file path or by string
1414``` TypeScript
15- import * as cwltsauto from ' cwl-ts-auto'
15+ import * as cwlTsAuto from ' cwl-ts-auto'
1616import fs from ' fs'
1717import url from ' url'
1818
1919// Load document by file
20- cwltsauto .loadDocument (' ./test.cwl' )
20+ cwlTsAuto .loadDocument (' ./test.cwl' )
2121 .then ((file ) => {
22- if (file instanceof cwltsauto .CommandLineTool ) {
22+ if (file instanceof cwlTsAuto .CommandLineTool ) {
2323 console .log (' This document is a CommandLineTool with baseCommand: ' , file .baseCommand )
2424 }
2525 })
2626 .catch ((e ) => {
27- if (e instanceof cwltsauto .ValidationException ) {
27+ if (e instanceof cwlTsAuto .ValidationException ) {
2828 console .log (e .toString ())
2929 } else {
3030 console .log (e )
@@ -33,14 +33,29 @@ cwltsauto.loadDocument('./test.cwl')
3333
3434// Load document by string
3535let docAsString = fs .readFileSync (' ./test.cwl' ).toString ()
36- cwltsauto .loadDocumentByString (docAsString , url .pathToFileURL (' /your/base/uri/' ).toString ())
36+ cwlTsAuto .loadDocumentByString (docAsString , url .pathToFileURL (' /your/base/uri/' ).toString ())
3737 .then ((file ) => {
38- if (file instanceof cwltsauto .CommandLineTool ) {
38+ if (file instanceof cwlTsAuto .CommandLineTool ) {
3939 console .log (' This document is a CommandLineTool with baseCommand: ' , file .baseCommand )
4040 }
4141 })
4242 .catch ((e ) => {
43- if (e instanceof cwltsauto .ValidationException ) {
43+ if (e instanceof cwlTsAuto .ValidationException ) {
44+ console .log (e .toString ())
45+ } else {
46+ console .log (e )
47+ }
48+ })
49+
50+ // Load document by URL
51+ cwlTsAuto .loadDocument (' https://raw.githubusercontent.com/common-workflow-lab/cwl-ts-auto/main/src/test/data/examples/valid-cat-tool.cwl' )
52+ .then ((file ) => {
53+ if (file instanceof cwlTsAuto .CommandLineTool ) {
54+ console .log (' This document is a CommandLineTool with baseCommand: ' , file .baseCommand )
55+ }
56+ })
57+ .catch ((e ) => {
58+ if (e instanceof cwlTsAuto .ValidationException ) {
4459 console .log (e .toString ())
4560 } else {
4661 console .log (e )
@@ -51,24 +66,29 @@ cwltsauto.loadDocumentByString(docAsString, url.pathToFileURL('/your/base/uri/')
5166### Creating, editing and saving Documents
5267This example shows how to create a simple CommandLineTool with one input
5368``` TypeScript
54- import * as cwltsauto from ' cwl-ts-auto'
69+ import * as cwlTsAuto from ' cwl-ts-auto'
5570
5671let exampleCommandLineTool =
57- new cwltsauto .CommandLineTool ({
58- class_: cwltsauto .CommandLineTool_class .COMMANDLINETOOL ,
72+ new cwlTsAuto .CommandLineTool ({
73+ class_: cwlTsAuto .CommandLineTool_class .COMMANDLINETOOL ,
5974 inputs: [],
6075 outputs: []
6176 })
6277exampleCommandLineTool .baseCommand = ' echo'
6378
6479let exampleInput =
65- new cwltsauto .CommandInputParameter ({
66- type: cwltsauto .PrimitiveType .STRING
80+ new cwlTsAuto .CommandInputParameter ({
81+ type: cwlTsAuto .PrimitiveType .STRING
6782 })
6883exampleInput .default_ = ' Hello World!'
6984exampleCommandLineTool .inputs .push (exampleInput )
7085
7186console .log (JSON .stringify (exampleCommandLineTool .save ()))
7287```
88+
89+ ## Documentation
90+ The complete documentation, autogenerated by [ TypeDoc] ( https://typedoc.org/ ) can be found under the following link:
91+ https://common-workflow-lab.github.io/cwl-ts-auto/
92+
7393## Limitations
74- cwl-ts-auto only supports the CWL v1.2 syntax. Other documents have to be upgraded using the [ cwl-upgrader] ( https://pypi.org/project/cwl-upgrader/ )
94+ cwl-ts-auto only supports the CWL v1.2 syntax. Other documents have to be upgraded using the [ cwl-upgrader] ( https://pypi.org/project/cwl-upgrader/ )
0 commit comments