DEV Community

Cover image for Languages that create compiled output
Michael Currin
Michael Currin

Posted on

2 1

Languages that create compiled output

This is context for the previous post in the series, for areas I know of in programming where it makes sense to create an output distribution file.

Compiled languages

For C, C++, Rust and Go, one might want to distribute a pre-built executable binary. I want to get into Go and so want to see a good approach for sharing my projects.

From Hello world example:

$ go build hello-world.go
$ ls
hello-world    hello-world.go
Enter fullscreen mode Exit fullscreen mode

For C:

$ cc -O -c main.c
Enter fullscreen mode Exit fullscreen mode

Rust:

$ cargo build
Enter fullscreen mode Exit fullscreen mode

Zip a package

In the case of a VS Code extension (typically made in TypeScript) or a Ruby gem, one creates a zipped archive like .vsix or .gem which contains selected files to be distributed.

Then this file could be uploaded to GitHub or a provider (like VS Code Marketplace or RubyGems), so others can install your project.

For example, I create a local archive of my VS Code extension and add it to a release under Assets.

https://github.com/MichaelCurrin/auto-commit-msg/releases

Dist directory for JS

For JavaScript projects, one might have a src directory of source code (e.g. TypeScript) and a dist directory of compiled JavaScript (vanilla JS, possible minified and bundled as a single JS file or a multiple files). This directory might be versioned or not in the repo. It might be available on the NPM registry or a CDN.

For example, here are some Vue JS files available in a dist on cdn.jsdelivr.net.

https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/

That seems to match the versioned dist directory on GitHub.

https://github.com/vuejs/vue/tree/dev/dist

Or you can use a single Production CDN JS file:

https://cdn.jsdelivr.net/npm/vue@2.6.12

Top comments (0)