While Deno provides most tooling for bootstrapping a TypeScript
project there are some things it doesn’t handle directly. In my Caltech
Library project I like to include a CITATION.cff, about.md and have a
simple Pandoc template for generating the website for the project. These
can all be accomplished with CodeMeta Tools’ cmt
command.
git init
in the directorydeno init
in the directoryHere’s the commands I’d run in my shell to accomplish these tasks.
mkdir myproject && cd myproject
git init
deno init
touch README.md INSTALL.md
cp ../<SOME_OTHER_PROJECT>/LICENSE ./
# Edit the three files.
micro README.md INSTALL.md LICENSE
firefox https://codemeta.github.io/codemeta-generator/
# paste the result into my codemeta.json file
micro codemeta.json
# create an about page from the codemeta.json contents
micro about.md
# copy then edit a Pandoc template for building website
cp ../<SOME_OTHER_PROJECT>/page.tmpl ./
micro page.tmpl
codemeta2cff
# I usually write a Makefile to generate version.ts
# and other artifacts. NOTE: Makefile doesn't work on Windows
micro Makefile
make version.ts
Now I am ready to start code the project. The copy edit approach can be improved using GitHub repository templates but I’ve found those to be more work then just grinding through the project setup. Relying on Make means I can’t develop on a Windows machine without resorting to the Linux Subsystem for Windows. Do while Go and Deno make it easy to cross compile the build process isn’t cross platform.
Steps one through four remaining the same. Step five is easy as using
the CodeMeta
Generator. Steps six through nine in the past have meant either
copying and editing scripts to generate the content or manually creating
the content. With cmt
you just need to run a single command
for each of the targeted files. Here’s the steps adjusted to use
cmt.
mkdir myproject && cd myproject
git init
deno init
touch README.md INSTALL.md
cp ../<SOME_OTHER_PROJECT>/LICENSE ./
# Edit the three files.
micro README.md INSTALL.md LICENSE
firefox https://codemeta.github.io/codemeta-generator/
# paste the result into my codemeta.json file
micro codemeta.json
Now you can generate the rest using cmt
and the
--gen-project
option. For TypeScript that would look
like.
cmt codemeta.json about.md page.tmpl CITATION.cff version.ts
NOTE: You can individual create the files using cmt
like
this.
For deno projects you can also generate tasks to manage your project
with the --deno
option as the last command line
parameter.
cmt codemeta.json version.ts about.md CITATION.cff --deno
This would result in a deno.json task element like the following.
{
"tasks": {
"gen-code": "deno task version.ts ; deno task about.md ; deno task CITATION.cff",
"version.ts": "cmt codemeta.json version.ts",
"about.md": "cmt codemeta.json about.ts",
"CITATION.cff": "cmt codemeta.json CITATION.cff"
}
}
This means I can run deno task gen-code
to update these
files when I update my codemeta.json.