Merge branch 'main' into update-README

pull/128/head
Muhammad Atif Ali 1 year ago committed by GitHub
commit 3738b9719c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -34,5 +34,7 @@ jobs:
run: bun install
- name: Format
run: bun fmt:ci
- name: typos-action
uses: crate-ci/typos@v1.17.2
- name: Lint
run: bun lint

@ -3,7 +3,7 @@
To create a new module, clone this repository and run:
```shell
./new.sh MOUDLE_NAME
./new.sh MODULE_NAME
```
## Testing a Module

@ -10,7 +10,7 @@ tags: [helper, parameter, instances, exoscale]
# exoscale-instance-type
A parameter with all Exoscale instance types. This allows developers to select
their desired virtuell machine for the workspace.
their desired virtual machine for the workspace.
Customize the preselected parameter value:
@ -72,7 +72,7 @@ resource "coder_metadata" "workspace_info" {
![Exoscale instance types Custom](../.images/exoscale-instance-custom.png)
### Use category and exlude type
### Use category and exclude type
Show only gpu1 types

@ -33,7 +33,7 @@ describe("filebrowser", async () => {
expect(output.stdout).toEqual([
"\u001b[0;1mInstalling filebrowser ",
"",
"🥳 Installation comlete! ",
"🥳 Installation complete! ",
"",
"👷 Starting filebrowser in background... ",
"",
@ -55,7 +55,7 @@ describe("filebrowser", async () => {
expect(output.stdout).toEqual([
"\u001b[0;1mInstalling filebrowser ",
"",
"🥳 Installation comlete! ",
"🥳 Installation complete! ",
"",
"👷 Starting filebrowser in background... ",
"",
@ -77,7 +77,7 @@ describe("filebrowser", async () => {
expect(output.stdout).toEqual([
"\u001B[0;1mInstalling filebrowser ",
"",
"🥳 Installation comlete! ",
"🥳 Installation complete! ",
"",
"👷 Starting filebrowser in background... ",
"",

@ -5,7 +5,7 @@ printf "$${BOLD}Installing filebrowser \n\n"
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
printf "🥳 Installation comlete! \n\n"
printf "🥳 Installation complete! \n\n"
printf "👷 Starting filebrowser in background... \n\n"

@ -13,9 +13,39 @@ let badExit = false;
// error reports an error to the console and sets badExit to true
// so that the process will exit with a non-zero exit code.
const error = (...data: any[]) => {
console.error(...data);
badExit = true;
}
console.error(...data);
badExit = true;
};
const verifyCodeBlocks = (
tokens: marked.Token[],
res = {
codeIsTF: false,
codeIsHCL: false,
}
) => {
for (const token of tokens) {
// Check in-depth.
if (token.type === "list") {
verifyCodeBlocks(token.items, res);
continue;
}
if (token.type === "list_item") {
verifyCodeBlocks(token.tokens, res);
continue;
}
if (token.type === "code") {
if (token.lang === "tf") {
res.codeIsTF = true;
}
if (token.lang === "hcl") {
res.codeIsHCL = true;
}
}
}
return res;
};
// Ensures that each README has the proper format.
// Exits with 0 if all is good!
@ -82,9 +112,6 @@ for (const dir of dirs) {
version = false;
error(dir.name, "missing version in tf code block");
}
if (token.lang === "hcl") {
error(dir.name, "HCL code blocks are not allowed, use tf");
}
continue;
}
}
@ -97,8 +124,13 @@ for (const dir of dirs) {
if (!code) {
error(dir.name, "missing example code block after paragraph");
}
if (!version) {
error(dir.name, "missing version in tf code block");
const { codeIsTF, codeIsHCL } = verifyCodeBlocks(tokens);
if (!codeIsTF) {
error(dir.name, "missing example tf code block");
}
if (codeIsHCL) {
error(dir.name, "hcl code block should be tf");
}
}

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# This scripts creates a new sample moduledir with requried files
# This scripts creates a new sample moduledir with required files
# Run it like : ./new.sh my-module
MODULE_NAME=$1
@ -11,7 +11,7 @@ if [ -z "$MODULE_NAME" ]; then
exit 1
fi
# Create module directory and exit if it alredy exists
# Create module directory and exit if it already exists
if [ -d "$MODULE_NAME" ]; then
echo "Module with name $MODULE_NAME already exists"
echo "Please choose a different name"

Loading…
Cancel
Save