Skip to content

Commit

Permalink
improved creating manifest
Browse files Browse the repository at this point in the history
create manifest and assessment works for 2.x as well.
new commands to create package zips
  • Loading branch information
Marcelh1983 committed Sep 8, 2024
1 parent b82f1e2 commit f53c15b
Show file tree
Hide file tree
Showing 8 changed files with 546 additions and 79 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Not only the files are remove but the reference in the item/test and manifest wi
I you have a directory with one or more items but no assessment test, this command will create a assessment test that contains all the items that are in the foldername.
It will override an existing assessment that's callled test.xml.

Should have the path to a folder as input parameter. This folder should contain the content of a qti3 package
Should have the path to a folder as input parameter. This folder should contain the content of a qti3 or qti2x package

#### Creating or updating an manifest

Expand All @@ -77,7 +77,23 @@ Should have the path to a folder as input parameter. This folder should contain
```

This will create or update an existing manifest. It will look into the directory and search for all items, tests and resources.
Also it will add the resources that are used in an item as a dependency.
Also it will add the resources that are used in an item as a dependency. This folder should contain the content of a qti3 or qti2x package

#### Creating a package zip

This create a package.zip based on all resources in a manifest. So it you have an existing package and you want to remove some items, you can extract the package.zip, remove the manifest, re-generate a manifest using qti-create-manifest and then run this command. The resources used in only the items you deleted, wont be packaged in the new zip.

```sh
npx -p=@citolab/qti-convert qti-create-package yourpackage.zip
```

#### Creating a package zip per item

This create a package.zip per item, for all items in a folder. The package will be called: package\_{item_title || item_identifer}.zip.

```sh
npx -p=@citolab/qti-convert qti-create-package-per-item yourpackage.zip
```

## API

Expand Down
4 changes: 3 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
"qti-convert-folder": "npx qti-convert-folder",
"qti-package-manifest": "npx qti-create-manifest",
"qti-package-assessment": "npx qti-create-assessment",
"qti-package": "npx qti-create-package",
"qti-package-per-item": "npx qti-create-package-per-item",
"qti-strip-media-pkg": "npx qti-strip-media-pkg",
"----dev----": "",
"test": "vitest",
Expand Down
4 changes: 3 additions & 1 deletion scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ const cliOptions = {
'./src/lib/qti-convert-cli/qti-convert-folder.ts',
'./src/lib/qti-convert-cli/qti-package-manifest.ts',
'./src/lib/qti-convert-cli/qti-package-assessment.ts',
'./src/lib/qti-convert-cli/qti-strip-media-pkg.ts'
'./src/lib/qti-convert-cli/qti-strip-media-pkg.ts',
'./src/lib/qti-convert-cli/qti-create-package.ts',
'./src/lib/qti-convert-cli/qti-create-package-per-item.ts'
],
splitting: true,
bundle: true,
Expand Down
17 changes: 17 additions & 0 deletions src/lib/qti-convert-cli/qti-package-per-item.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env node
import { createPackageZipsPerItem } from '../qti-helper-node';

const folderLocation = process.argv[2];

if (!folderLocation) {
console.error('Please provide a folder location as an argument.');
process.exit(1);
}

try {
await createPackageZipsPerItem(folderLocation);
console.log('Done.');
} catch (error) {
console.error(error);
process.exit(1);
}
17 changes: 17 additions & 0 deletions src/lib/qti-convert-cli/qti-package.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env node
import { createPackageZip } from '../qti-helper-node';

const folderLocation = process.argv[2];

if (!folderLocation) {
console.error('Please provide a folder location as an argument.');
process.exit(1);
}

try {
await createPackageZip(folderLocation);
console.log('Done.');
} catch (error) {
console.error(error);
process.exit(1);
}
Loading

0 comments on commit f53c15b

Please sign in to comment.