diff --git a/package.json b/package.json index 8028b9a..16e4260 100644 --- a/package.json +++ b/package.json @@ -91,5 +91,8 @@ "ora": "^7.0.1", "pretty-ms": "^8.0.0", "sparqljs": "^3.7.1" + }, + "publishConfig": { + "registry": "https://npm.pkg.github.com" } } diff --git a/src/lib/File.class.ts b/src/lib/File.class.ts index 14e7158..9b69dd2 100644 --- a/src/lib/File.class.ts +++ b/src/lib/File.class.ts @@ -4,7 +4,7 @@ import { dirname } from 'path' export default class File { public static $id = 'File' - private readonly $isValid?: boolean + private $isValid?: boolean public constructor(private $path: string, private readonly skipExistsCheck: boolean = false) {} public validate(): File { @@ -17,6 +17,7 @@ export default class File { if (!this.skipExistsCheck && (!existsSync(this.$path) || !statSync(this.$path).isFile())) { throw new Error(`File not found: \`${this.$path}\``) } + this.$isValid = true return this } diff --git a/src/lib/Pipeline.class.ts b/src/lib/Pipeline.class.ts index d4d91cb..74a3bea 100644 --- a/src/lib/Pipeline.class.ts +++ b/src/lib/Pipeline.class.ts @@ -30,7 +30,7 @@ class Pipeline { if(!destinationFile.endsWith('.nt')) { throw new Error('We currently only writing results in N-Triples format,\nmake sure your destination filename ends with \'.nt\'.') } - this.destination = new File(destinationFile, true) + this.destination = (new File(destinationFile, true)).validate() } private error(e: Error, stage?: string): void { @@ -158,7 +158,7 @@ class Pipeline { chalk.green( `✔ your pipeline "${chalk.bold( this.name - )}" was completed in ${duration(this.now)}}` + )}" was completed in ${duration(this.now)}` ) ); } @@ -172,11 +172,6 @@ class Pipeline { private writeResult(): void { const spinner = ora("Combining statements from all stages:").start(); - - const destinationPathNew = this.configuration.destination - if (!isFilePathString(destinationPathNew)) { - throw new Error('We currently only allow publishing data to local files.') - } const destinationStream = this.destination.getStream() const stageNames = Array.from(this.stages.keys()) for (const stageName of stageNames) { diff --git a/static/example/config.yml b/static/example/config.yml index 748587c..08d007a 100644 --- a/static/example/config.yml +++ b/static/example/config.yml @@ -4,6 +4,10 @@ description: > This is an example pipeline. It uses files that are available in this repository and SPARQL endpoints that should work. + +# This is optional, by default it will be stored in the data directory of the pipeline using filename 'statements.nt' +destination: file://data/example-pipeline.nt + # The individual stages for your pipeline stages: - name: "Stage 1" diff --git a/tsconfig.json b/tsconfig.json index 5584064..986c709 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -49,10 +49,10 @@ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ /* Emit */ - "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ "outDir": "./dist", /* Specify an output folder for all emitted files. */