- Writing a [README.md](https://github.com/garronej/ts_ci/blob/master/README.template.md) with decent presentation and instructions on how to install/import your module.
Once you've done that a GitHub action workflow will set up the ``README.md`` and the ``package.json`` for you, wait a couple of minutes for it to complete ( a bot will push ). You can follow the job advancement in the "Action" tab.
Each time you will push changes ``npm test`` will be run on remote docker containers against multiple node versions if everything passes you will get a green ``ci`` badges in your readme.
# Few things you need to be aware of before getting started
- You probably want to "Use this template" ( the green button ) instead of forking the repo.
- The files to include in the NPM bundle are cherry-picked using the ``package.json`` ``files`` field.
If you don't want to bother and includes everything just remove the ``files`` field from the ``package.json``
otherwise remember, when you add a subdirectory in ``src/``, to update the ``package.json`` ``files``.
- If you are going to programmatically load files outside of the ``dis/`` directory ( like the ``package.json`` or files inside ``res/`` ) be mindful that the paths might not be the one you expect. [Details](#accessing-files-outside-the-dist-directory).
- The template does not support ``.npmignore`` ( it use the safer ``package.json`` ``files`` instead ).
- The template does not support ``.npmrc``.
- In rare occasions the workflow in charge of performing the initial configuration does not fire up.
If it is the case for you please delete the repo you just created and start over again.
All your source files must remain inside the ``src`` dir, you can change how things are organized inside the source directory
but don't forget to update your ``package.json`` ``main``, ``type`` and ``files`` fields and ``tsconfig.esm.json`` ``include`` field when appropriate.
## Enabling "Go to Definition" to redirect to the source ``.ts`` file
There is no denying that it is more convenient when clicking "Go To Definition" to get redirected to
a file ``.ts`` file rather than to a ``.d.ts``.
To enable this feature simply point to the ``package.json``'s ``types`` filed to the ``main``'s source
file instead the type definition file ``.d.ts``.
For example you would replace:
```json
{
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
}
```
by:
```json
{
"main": "./dist/index.js",
"types": "./src/index.ts",
}
```
Enabling this feature comes at a cost though. Be aware that if you use [optional chaining](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#optional-chaining) or [nullish coalescing](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#nullish-coalescing) for example, your module will only be importable
in projects using typescript 3.7 or newer ( version that introduces theses features ).
It is important to keep your project compatible with older TS version because
- You don't want to force your users to update the typescript version they use in their project,
updating typescript might break some other things in their code.
- In certain environments updating TypeScript is not an option. Take [Stackblitz](https://stackblitz.com)
A good way to host your repo image is to open an issue named ASSET in your project, close it, create a comment, drag and drop the picture you want to use and that's it. You have a link that you can replace in the ``README.md``.
[](https://youtu.be/Q5t-yP2PvPA)
Beside the documentation website, you might want to have a catchy landing page to share on social networks.
You can use [GitHub pages](https://pages.github.com) to host it.
If you like the landing page of EVT, [evt.land](http://evt.land), you can fork the [repo](https://github.com/garronej/evt.land) and adapt it for your module.
To produce high quality GIF from screen recording that remain relatively small checkout the wonderful [Gifski](https://gif.ski) from [Sindre Sorhus](https://github.com/sindresorhus).
Once your page is ready you'll just have to go to settings and enable Pages yo put it online.
I let you consult the [GitHub Pages Documentation](https://help.github.com/en/github/working-with-github-pages/managing-a-custom-domain-for-your-github-pages-site#configuring-an-apex-domain).