doc: Add documentation for optional arg to convert.

Also removes the useless example.d.ts file from the distribution.
  Updates the civet compiler to the greatest version that works
  on this code.
  Resolves #13.
  Resolves #14.
This commit is contained in:
Glen Whitney 2023-09-11 23:32:07 -07:00
parent 7765a53327
commit 0f5ebc7ff6
3 changed files with 13 additions and 8 deletions

View File

@ -38,7 +38,7 @@ npx vrml1to97 < old.wrl > shinynew.wrl
Currently this package exports just two functions: Currently this package exports just two functions:
* convert(vrml1: string): string * convert(vrml1: string, source?: string): string
The main function, takes in VRML 1 syntax (note that it does not The main function, takes in VRML 1 syntax (note that it does not
actually check that its input is VRML 1, so its behavior is undefined actually check that its input is VRML 1, so its behavior is undefined
@ -47,6 +47,10 @@ Currently this package exports just two functions:
VRML 1 is recognized, and some of the translations may be somewhat VRML 1 is recognized, and some of the translations may be somewhat
approximate. approximate.
If the optional second argument `source` is supplied, `convert` adds
a comment indicating that the original vrml1 came from the specified
source, before conversion to VRML97.
* tree97(vrml1: string): Tree * tree97(vrml1: string): Tree
Takes the same input as convert, but rather than returning a string, it Takes the same input as convert, but rather than returning a string, it

View File

@ -1,6 +1,6 @@
{ {
name: 'vrml1to97', name: 'vrml1to97',
version: '0.2.0', version: '0.2.1',
description: 'JavaScript converter from VRML 1 to VRML97', description: 'JavaScript converter from VRML 1 to VRML97',
scripts: { scripts: {
test: 'echo "Error: no test specified" && exit 1', test: 'echo "Error: no test specified" && exit 1',
@ -13,7 +13,8 @@
// Give Typescript the info it needs: // Give Typescript the info it needs:
build_deps3: 'cp node_modules/@types/moo/index.d.ts deps/moo.d.ts', build_deps3: 'cp node_modules/@types/moo/index.d.ts deps/moo.d.ts',
// Use the Typescript compiler to create the final .js files: // Use the Typescript compiler to create the final .js files:
build_js: 'tsc && mkdir -p dist/deps && cp deps/*.js dist/deps', build_js1: 'tsc && mkdir -p dist/deps && cp deps/*.js dist/deps',
build_js2: 'rm dist/vrml1to97/example.d.ts', // it's empty anyway
// And finally add the executable and construct a package.json // And finally add the executable and construct a package.json
build_etc1: 'cp etc/*.js README.md dist', build_etc1: 'cp etc/*.js README.md dist',
build_etc2: 'node tools/repackage.mjs < package.json5 > dist/package.json', build_etc2: 'node tools/repackage.mjs < package.json5 > dist/package.json',
@ -39,7 +40,7 @@
}, },
type: 'module', type: 'module',
devDependencies: { devDependencies: {
'@danielx/civet': '^0.6.30', '@danielx/civet': '^0.6.35',
'@types/moo': '^0.5.6', '@types/moo': '^0.5.6',
'http-server': '^14.1.1', 'http-server': '^14.1.1',
json5: '^2.2.3', json5: '^2.2.3',

View File

@ -11,8 +11,8 @@ dependencies:
devDependencies: devDependencies:
'@danielx/civet': '@danielx/civet':
specifier: ^0.6.30 specifier: ^0.6.35
version: 0.6.30(typescript@5.2.2) version: 0.6.35(typescript@5.2.2)
'@types/moo': '@types/moo':
specifier: ^0.5.6 specifier: ^0.5.6
version: 0.5.6 version: 0.5.6
@ -35,8 +35,8 @@ packages:
'@jridgewell/trace-mapping': 0.3.9 '@jridgewell/trace-mapping': 0.3.9
dev: true dev: true
/@danielx/civet@0.6.30(typescript@5.2.2): /@danielx/civet@0.6.35(typescript@5.2.2):
resolution: {integrity: sha512-/aZjryo8T9TWVBczbeY8eO8Xmi91KkaKZG6YhCS2lCErmPXxP+zOEUATJiaZBp6AcT2bQEbW+poGyrU6BHL9Dg==} resolution: {integrity: sha512-C6Yf7sQBUAnkPWRMirUT0wrQ2BtQtgc/Iz1ymPyyt+Ayo3gWlAi/wotWeCtt6Z2+WEoG8XNmmJI80B4QkCiwAQ==}
engines: {node: '>=19 || ^18.6.0 || ^16.17.0'} engines: {node: '>=19 || ^18.6.0 || ^16.17.0'}
hasBin: true hasBin: true
peerDependencies: peerDependencies: