My Journey In The Open Source World
Tags: opensource, javascript, node, typescript
Published: 2022-12-20 15:03:09

[Follow me on Github](https://github.com/Cadienvan)

Hi everyone, my name is Michael and a couple months ago I decided to start developing and publishing open source packages in Javascript and wanted to share my journey with you all!

As a software developer, I have always been interested in contributing to the open source community. However, I never quite knew where to start or how to get involved. That is, until I decided to take the plunge and start developing and publishing my own open source packages in Javascript.

The process of getting started wasn't as daunting as I thought it would be. First, I had to decide on a project idea. I wanted to create something that would be useful to others and also challenge me to learn and grow as a developer. After some brainstorming, I settled on a package that would help developers with a common task in their workflow.

That's why I decided to create a scaffolding, some basic structure to.. Well, you guessed it, develop and publish `npm` packages!

Next, I set up a Github repository and got to work on the code. As I was writing and testing the package, I made sure to follow best practices for open source development, such as including thorough documentation and following the appropriate licensing guidelines.

Once I was confident in the package and its functionality, I published it to GitHub for others to use. It was a great feeling to see my work out in the open and available for others to benefit from.

# My scaffolding
So there you have it: [npm-package-ts-scaffolding](https://github.com/Cadienvan/npm-package-ts-scaffolding)

# What Does It Provide?
It provides a build command that will compile your code to a CommonJS Node 14.16 target, allowing named imports for CommonJS packages inside ESM files.
The package contains a simple "hello world" based on TypeScript, built on esbuild, tested through Jest and linted with ESLint and Prettier.
It also provides a Husky pre-commit hook to run some linting based on prettier and eslint and run tests, so you can simple git add and git commit without worrying about anything else.

## How To Install?

```bash
git clone git://github.com/Cadienvan/npm-package-ts-scaffolding.git package_name
cd package_name
npm install
npx husky install
```

## What do you mean by `allowing named imports from CommonJS`?

If you try to run `npm run build` you will be able to import the `sayHello` function from the `index.js` file, both via `require` and `import` syntax.

### Importing via `require`

```js
const { sayHello } = require('my-package');
```

### Importing via `import`

```js
import { sayHello } from 'my-package';
```
# How can I personalize it?

You can change the `package.json` file to your liking, bringing your own package name and description.  
Please, remember to give me a star if you like the project!

# What's Inside?

- Typescript
- Jest
- Eslint
- Prettier
- Husky
- Esbuild
- Commitlint

# How to push and release an update?

```bash
git add --all
git commit -m "chore: update package"
npm run release:patch
```

Remember to follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard.
You can substitute `patch` with `minor` or `major` to update the version accordingly.

# How to run tests?

```bash
npm test
```

# Contributing

If you want to contribute to this project, please open an issue or a pull request.  
I will be happy to review it and merge it if it's useful.  
Please, remember to follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard.  

# Something more about Open Source

Since then, I have continued to maintain and improve the package, as well as contribute to other open source projects. Participating in the open source community has been a rewarding and fulfilling experience, and I highly recommend it to other developers looking to give back and make a positive impact.

If you are considering starting your own open source journey, don't let fear or uncertainty hold you back. There are many resources and communities available to support you, and the benefits of getting involved in open source are immeasurable.

So take the first step and start building and contributing today!

And, of course, if you like my package, please star it!