Skip to content

Commit

Permalink
Fixes issue #48:
Browse files Browse the repository at this point in the history
- the `--` argument should not be used in the described use-case.
- the init script should only test for specific "pipelines/configuration/example" folder, not for "pipelines"
- if "static" is excluded from the NPM package (in .npmignore), the example pipeline can of course not be installed with --init, since it is not present.
  • Loading branch information
mightymax committed May 23, 2024
1 parent 8fa7e07 commit 909028f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
.vscode
.idea
src/
static/
static/ao
static/figures
static/tests
tsconfig.json
.eslintrc.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ stages:
2. Install LD Workbench:

```sh
npx @netwerk-digitaal-erfgoed/ld-workbench -- --init
npx @netwerk-digitaal-erfgoed/ld-workbench --init
```

Your workbench is now ready for use.
Expand Down
10 changes: 4 additions & 6 deletions src/utils/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ import glob from 'glob'

export default function init(): void {
const $dirname = path.dirname(fileURLToPath(import.meta.url));
if(fs.existsSync('pipelines')) {
throw new Error('The --init script found an existing directory "pipelines". Make sure this directory does not exists before running this script.')
if(fs.existsSync(path.join('pipelines', 'configurations', 'example'))) {
throw new Error('The --init script found an existing directory "' + path.join('pipelines', 'configurations', 'example') + '". Make sure this directory does not exists before running this script.')
}
fs.mkdirSync('pipelines')
fs.mkdirSync(path.join('pipelines', 'data'))
fs.mkdirSync(path.join('pipelines', 'configurations'))
fs.mkdirSync(path.join('pipelines', 'configurations', 'example'))
fs.mkdirSync(path.join('pipelines', 'data'), {recursive: true})
fs.mkdirSync(path.join('pipelines', 'configurations', 'example'), {recursive: true})
const filepaths = glob.sync(path.join($dirname, '..', '..', 'static', 'example', '*'))
for(const filepath of filepaths) {
fs.copyFileSync(filepath, path.join('pipelines', 'configurations', 'example', path.basename(filepath)))
Expand Down

0 comments on commit 909028f

Please sign in to comment.