Languages that create compiled output
Michael Currin
Posted on October 27, 2020
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
For C:
$ cc -O -c main.c
Rust:
$ cargo build
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:
Posted on October 27, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.