Finally, OptimizeIt is released on npm!
npm was definitely the go-to, since I use it as a package manager for OptimizeIt. Let's discuss how this process went from A to Z.
Setting Up Releases
First things first, I had to create an account on npm. Afterwards, I had to update the package.json
file to include repository
, bugs
, and homepage
URLs. I also had to create an .npmignore file to ignore everything that is not included in the build
directory. Then, I did a fresh install and build, and using the cli
, I logged into my newly created npm
account.
Once that was done, I created a tag for version 1.0.0
, and I published OptimizeIt
for the very first time using npm publish
. I didn't have to update any code, files, or anything—it just worked!
It was much easier than expected, as those were the exact steps I took, and boom! OptimizeIt
was now on npm!
This is great and all; however, I wanted to automate this. I didn't want to do this manually every single time. Additionally, after doing this, the releases section on the GitHub Repo
was not updated with the most recently added release! I wanted a way to automate all of this—ideally: tag, publish to npm, publish on GitHub, finish.
To do this, I had to add a new job to my current workflow that runs only when a new tag
is detected. I had to retrieve an NPM_TOKEN from my npm account
and add it to GitHub Secrets so that my newly added job could access it to publish to npm
!
For the GitHub releases
part, however, I didn't have to create any secret manually, as the workflow already listens in on the repository's permissions and fetches the GITHUB_TOKEN
, which is required to create a release
on GitHub
.
After adding the new workflow, creating a new release is simpler than ever. These are the exact steps that I must do every single time I need to create a new release:
npm version 1.0.2
git push origin v1.0.2
This will automatically trigger the workflow
and execute linting
, building
, testing
, and if all pass, publishing
. Now, everything is automated—both npm
and GitHub
's releases are updated automatically!
Testing The Release
Testing the release went much better than I thought. The very first time OptimizeIt
was run, it complained that no API Key
was provided. However, a quick glance at the README.md
immediately tells the user how to provide that using the toml config!
Afterwards, very thorough testing was done on all of its features, until... It was time for OptimizeIt
to output some files. This is when the issue happened. Not that it wasn't working as intended, but whenever OptimizeIt
creates a file in the output
directory, it does so in the output
directory in its directory
. As in, if the user uses either its html
, markdown
, or output
features, the file created is somewhere in node_modules
in the system. While this does work, and it did work as intended... I personally thought this was very unintuitive and cumbersome. Therefore, small updates were done to OptimizeIt
to now automatically create an output
file at the current directory where the OptimizeIt
call was invoked. As in, no matter where users are in their system, if they use any of OptimizeIt
's output features, it will now automatically create an output
folder and place the updated file within! This was much more intuitive than before, hassle-free, and very helpful!
Aside from that, no issues arose when testing OptimizeIt
, and it works beautifully!
How Should You Use OptimizeIt
OptimizeIt
is intended to be installed globally, as in:
npm i -g optimizeit
Its purpose is to offer help for the user, no matter where they are in their system. Using OptimizeIt
has not changed! It works just like it always did; a very thorough explanation can be found here. However, a small example of my favorite feature is:
optimizeit examples/main.cpp examples/main.py --html
This would generate an html
file in your output
directory, showcasing the differences in the before
and after
usage of OptimizeIt
:
Users can also customize its configurations however they want using the toml config option that OptimizeIt
uses!
Summary
Now that OptimizeIt
is released, anyone can use it for a little help in optimizing the performance of their source code! I know, I know—do not use AI
to alter your code because it will break it, never use AI to write your code, it's unreadable, it's not good enough... I've heard it all. However, you, the reader, would be lying if you said you've never used AI
before to help give you ideas on how to improve your code! I understand that no one should solely
rely on AI
to write their code; however, optimizing it, on the other hand, is something that every developer does! Whether it's to optimize an entire file, give you ideas on how to approach a problem differently, or simply make code readability improvements, OptimizeIt
is here to help you Optimize
it
!
Well, what are you waiting for? Try it out!
Top comments (0)