This scripts use the ES6 module syntax, in package.json
set type:"module"
/
To use with Node.js 12.x
add the --experimental-modules
flag. (Tested with 0.14x
)
npm i @ridomin/repo-scripts
// main.ts
import * as rc from '@ridomin/repo-scripts'
console.log(rc.isDtmi('aaa'))
console.log(rc.dtmiToPath('dtmi:com:ee:aa;1'))
Build with
tsc -t es6 --outDir ./out --moduleResolution node .\main.ts
Run with
node ./out/main.js