create a ts module20210704 ☕ 5 min read

Create export package

mkdir create-tx-and-export-it
cd create-tx-and-export-it
yarn init
git init
yarn add typescript
  1. Create file index.ts with code:
console.log('hello, world');
  1. From command line run node index.ts should output hello, world

  2. add following to package.json

"scripts": {
"run:script": "node index.ts"
}
  1. run yarn run:script Should get the same result

  2. Create dir called src

  3. Move index.tx to ~/src

  4. modify script and main tags to reflect this

  5. Change the script text so you can see it's picking up the correct version.

  6. Now add another

  7. run git init

  8. touch .gitignore and add **/*.js and any editor or IDE config stuff

  9. run git status and tidy your .gitignore

  10. run git add .

  11. run git commit -m beginning

Create import package

mkdir import-tx
cd import-tx
yarn init
yarn add ../create-tx-and-export-it