Skip to main content

· 2 min read
Francisco Leonel Moreno Eraso

DevContainers

DevContainers is a technology based on Docker for develop inside local containers and as a big benefit we are isolated and we don't need to polute our primary OS with programming tools.

Github is also compatible with this technology and base on DevContainers it is able to generate Github Codespaces where you can work from your browser without the necesity of installing anything!

info

VSCode has plugins related to this so work with a container instead of local environment would be seemless

My Approach

Base on this technology with a little bit of Docker, Scripting and Set-App, I'll manage to generate this development flow.

Pre-requisites

Scripting

You would need to create a simple file with:

BASH (Linux/Mac)

docker volume create --name projects --opt type=none --opt device='<LOCAL-PATH>' --opt o=bind
docker pull franciscomoreno1/set-app:latest
docker run -it -v projects:/projects -w /projects franciscomoreno1/set-app:latest /bin/sh

Replace <LOCAL-PATH> with the path that you want to contain your projects in your local filesystem

Execute one time the file and you would have prompt a console where to execute your set-app command:

npx @set-app/cli '<PROJECT-NAME>'

The first time is going to download the tool in the container but the following times just restarting the container would be enoght.

Dev Container configuration 😎

A set of VSCode plugins are already preconfigured for the use, but you could add new ones and just Rebuild the DevContainer

· 2 min read
Francisco Leonel Moreno Eraso

NPM

In SetApp we focus on build the tools around technologies that we already use. One of them is NPM who is in charge of generate our package.json, so in a fresh machine with the default config, it would look like:

Default package.json

There is some config, like the description that is different between projects and because of that, it's taken care with our tool

Please Check the Docs 🙏🏻

Please, check the Cli Commands documentation section for more info about this topic

On the other hand we have common info that we could be shared between projects, for some of them, like the License or the Version we have default values (ISC and 1.0.0). Other values like the Author are not even set.

info

This default behaviour could be changed! The following list of values could be set, and in fact, we recommend that!

Author Url

You could set your personal webpage

npm config set init-author-url="<URL>"

License

You could set a default license (current default value: ISC)

npm config set init-license="<LICENSE>"

Intial Version

You could set a default version (current default value: 1.0.0)

npm config set init-version="<VERSION>"

Author Email

You could set an author email to contact

npm config set init-author-email="<EMAIL>"

Author Name

You could set a default author name

npm config set init-author-name"<NAME>"

If we execute those commands the result will be a package.json similar to the next one:

Full package.json

README

Not only that, other tools used in SetApp use these values, for example our README generator: readme-md-generator.

Before

README

After

README-FULL

Full Example App

Running a command similar to:

Example command

The README generated would look like:

Example README

Have in mind 🙏🏻

More info will be added when we integrate with a Github repo, so the package.json and the README would have even more content