Skip to content

Commit

Permalink
Fixes issues with path
Browse files Browse the repository at this point in the history
  • Loading branch information
mightymax committed Nov 29, 2023
1 parent 7d59d12 commit 9b70c67
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,8 @@
"ora": "^7.0.1",
"pretty-ms": "^8.0.0",
"sparqljs": "^3.7.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com"
}
}
3 changes: 2 additions & 1 deletion src/lib/File.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}

Expand Down
9 changes: 2 additions & 7 deletions src/lib/Pipeline.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)}`
)
);
}
Expand All @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions static/example/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit 9b70c67

Please sign in to comment.