Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.0.20 #494

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog

## v0.0.20 (unreleased)
## v0.0.21 (unreleased)

## v0.0.20
- Remove `sandboxSetup` parameter from `mkEnvironment`, add lower-level
`addToSetup` helper function to use instead.
- Add support for Python projects through `garn.python.mkPythonProject`.

## v0.0.19

Expand All @@ -9,9 +14,6 @@
- Add `garn.callFlake` helper to allow importing flake files by local path.
- Add `garn.importFlake` helper to allow importing flake files by url, e.g. from GitHub.

- Remove `sandboxSetup` parameter from `mkEnvironment`, add lower-level
`addToSetup` helper function to use instead.

## v0.0.18

- Allow entering top-level `Environment`s with `garn enter`.
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

[![built with garnix](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgarnix.io%2Fapi%2Fbadges%2Fgarnix-io%2Fgarn)](https://garnix.io)
[![](https://dcbadge.vercel.app/api/server/q2Fptb7My4?style=flat)](https://discord.gg/q2Fptb7My4)
[![](https://img.shields.io/badge/library-v0.0.19-black)](https://doc.deno.land/https://garn.io/ts/v0.0.19/mod.ts)
[![](https://img.shields.io/badge/library-v0.0.20-black)](https://doc.deno.land/https://garn.io/ts/v0.0.20/mod.ts)
[![License](https://img.shields.io/github/license/garnix-io/garn)](LICENSE)

</p>
Expand All @@ -32,7 +32,7 @@ works for you, it works for everyone.[^1]
For example, with this `garn.ts` file:

```typescript
import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
import * as garn from "https://garn.io/ts/v0.0.20/mod.ts";

export const frontend = garn.javascript.mkNpmProject({
description: "My project frontend",
Expand Down Expand Up @@ -185,8 +185,8 @@ directory, which contains tested examples of using **garn** in various ways.
All examples below require the two following imports:

```typescript
import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
import * as pkgs from "https://garn.io/ts/v0.0.19/nixpkgs.ts";
import * as garn from "https://garn.io/ts/v0.0.20/mod.ts";
import * as pkgs from "https://garn.io/ts/v0.0.20/nixpkgs.ts";
```

All `garn.ts` files require the first import, and often you also need the
Expand Down Expand Up @@ -272,7 +272,7 @@ you can also from Nix call things generated by **garn**.

## Typescript API

You can find documentation for the **garn** Deno library [here](https://doc.deno.land/https://garn.io/ts/v0.0.19/mod.ts).
You can find documentation for the **garn** Deno library [here](https://doc.deno.land/https://garn.io/ts/v0.0.20/mod.ts).


## Comparison to other tools
Expand Down
23 changes: 10 additions & 13 deletions examples/getting-started/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@
buildInputs = dev.buildInputs ++ dev.nativeBuildInputs;
} "${"mkdir -p \$out"}
${"
${"
echo copying source
cp -r ${(let
echo copying source
cp -r ${(let
lib = pkgs.lib;
lastSafe = list :
if lib.lists.length list == 0
Expand All @@ -129,11 +128,11 @@ ${"
fileName != "flake.nix" &&
fileName != "garn.ts";
})}/. .
chmod -R u+rwX .
"}
${"
echo copying node_modules
cp -r ${let
chmod -R u+rwX .
"}
${"
echo copying node_modules
cp -r ${let
npmlock2nix = import npmlock2nix-repo {
inherit pkgs;
};
Expand Down Expand Up @@ -164,11 +163,9 @@ ${"
});
nodejs = pkgs.nodejs-18_x;
}}/node_modules .
chmod -R u+rwX node_modules
"}
"}
${"npm test"}
";
chmod -R u+rwX node_modules
"}
${"npm test"}";
}
);
devShells = forAllSystems (system:
Expand Down
4 changes: 2 additions & 2 deletions examples/getting-started/garn.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
import * as pkgs from "https://garn.io/ts/v0.0.19/nixpkgs.ts";
import * as garn from "https://garn.io/ts/v0.0.20/mod.ts";
import * as pkgs from "https://garn.io/ts/v0.0.20/nixpkgs.ts";

export const frontend = garn.javascript
.mkNpmProject({
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
installScriptFiles = nix-tool-installer.lib.${system}.mkInstallScriptFiles {
toolName = "garn";
baseUrl = "https://garn.io";
flakeLocation = "github:garnix-io/garn/v0.0.19";
flakeLocation = "github:garnix-io/garn/v0.0.20";
testCommand = "garn --help";
};
}
Expand Down
10 changes: 5 additions & 5 deletions test/spec/GarnSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ spec = do
it "outputs a version with --version" $ \onTestFailureLog -> do
output <- runGarn ["--version"] "" repoDir Nothing
onTestFailureLog output
when (stdout output /= "v0.0.19\n") $
when (stdout output /= "v0.0.20\n") $
expectationFailure
( unindent
[i|
garn --version output wrong:
#{show (stdout output)} /= "v0.0.19\n"
#{show (stdout output)} /= "v0.0.20\n"
(consider running `cabal clean`!)
|]
)
Expand Down Expand Up @@ -164,7 +164,7 @@ spec = do
`shouldBe` unindent
[i|
[garn] Error: Version mismatch detected:
garn cli tool version: v0.0.19
garn cli tool version: v0.0.20
garn typescript library version: <testTsLibVersion>

Either:
Expand All @@ -174,8 +174,8 @@ spec = do

Or:

Use version v0.0.19 of the typescript library.
E.g.: import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
Use version v0.0.20 of the typescript library.
E.g.: import * as garn from "https://garn.io/ts/v0.0.20/mod.ts";

(Internal details: Error in $: key \"tag\" not found)
|]
12 changes: 6 additions & 6 deletions test/spec/InitSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ spec = do
readFile "garn.ts"
`shouldReturn` unindent
[i|
import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
import * as pkgs from "https://garn.io/ts/v0.0.19/nixpkgs.ts";
import * as garn from "https://garn.io/ts/v0.0.20/mod.ts";
import * as pkgs from "https://garn.io/ts/v0.0.20/nixpkgs.ts";

export const test = garn.haskell.mkHaskellProject({
description: "",
Expand Down Expand Up @@ -89,8 +89,8 @@ spec = do
readFile "garn.ts"
`shouldReturn` unindent
[i|
import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
import * as pkgs from "https://garn.io/ts/v0.0.19/nixpkgs.ts";
import * as garn from "https://garn.io/ts/v0.0.20/mod.ts";
import * as pkgs from "https://garn.io/ts/v0.0.20/nixpkgs.ts";

export const someGoProject = garn.go.mkGoProject({
description: "My go project",
Expand Down Expand Up @@ -161,8 +161,8 @@ spec = do
onTestFailureLog output
garnFile <- lines <$> readFile "garn.ts"
take 2 garnFile
`shouldBe` [ "import * as garn from \"https://garn.io/ts/v0.0.19/mod.ts\";",
"import * as pkgs from \"https://garn.io/ts/v0.0.19/nixpkgs.ts\";"
`shouldBe` [ "import * as garn from \"https://garn.io/ts/v0.0.20/mod.ts\";",
"import * as pkgs from \"https://garn.io/ts/v0.0.20/nixpkgs.ts\";"
]
forM_ (drop 2 garnFile) $ \line ->
when (line /= "") $
Expand Down
4 changes: 2 additions & 2 deletions ts/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export function check(
*
* Example:
* ```typescript
* import * as pkgs from "https://garn.io/ts/v0.0.19/nixpkgs.ts";
* import * as pkgs from "https://garn.io/ts/v0.0.20/nixpkgs.ts";
*
* garn.build`
* ${pkgs.cowsay}/bin/cowsay moo > $out/moo
Expand Down Expand Up @@ -290,7 +290,7 @@ export function mkEnvironment(
*
* For example:
* ```typescript
* import * as pkgs from "https://garn.io/ts/v0.0.19/nixpkgs.ts";
* import * as pkgs from "https://garn.io/ts/v0.0.20/nixpkgs.ts";
*
* // Create an environment with nothing but go and gopls installed:
* emptyEnvironment.withDevTools([pkgs.go, pkgs.gopls])
Expand Down
2 changes: 1 addition & 1 deletion ts/internal/version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"tsLibVersion": "v0.0.19",
"tsLibVersion": "v0.0.20",
"nixpkgsInputComment": "pinned to master on 2023-10-26",
"nixpkgsInput": "github:NixOS/nixpkgs/6fc7203e423bbf1c8f84cccf1c4818d097612566"
}
2 changes: 1 addition & 1 deletion ts/javascript/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Plugin } from "../project.ts";
* Here's an example:
*
* ```typescript
* import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
* import * as garn from "https://garn.io/ts/v0.0.20/mod.ts";
*
* export const frontend = garn.javascript
* .mkNpmProject({
Expand Down
4 changes: 2 additions & 2 deletions ts/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export type ProjectData = {
* Here's an example of a simple `Plugin` and how to use it:
*
* ```typescript
* import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
* import * as pkgs from "https://garn.io/ts/v0.0.19/nixpkgs.ts";
* import * as garn from "https://garn.io/ts/v0.0.20/mod.ts";
* import * as pkgs from "https://garn.io/ts/v0.0.20/nixpkgs.ts";
*
* const prettier =
* (
Expand Down
4 changes: 2 additions & 2 deletions website/src/components/Hero/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const garnTs = (
<Keyword>import</Keyword> * as garn from{" "}
<String>
"
<Tooltip item="https://garn.io/ts/v0.0.19/mod.ts">
<Tooltip item="https://garn.io/ts/v0.0.20/mod.ts">
<Garn /> uses Deno to run 'garn.ts' files. This means you can import
dependencies directly through URLs. But you don't need to have Deno
installed, <Garn /> takes care of that for you.
Expand All @@ -109,7 +109,7 @@ of packages, nixpkgs. If you
need a tool or dependency,
it's probably here`}
</Tooltip>{" "}
from <String>"https://garn.io/ts/v0.0.19/nixpkgs.ts"</String>;<br />
from <String>"https://garn.io/ts/v0.0.20/nixpkgs.ts"</String>;<br />
<br />
<Export>export</Export> <Keyword>const</Keyword>{" "}
<Tooltip item="backend">
Expand Down
18 changes: 9 additions & 9 deletions website/src/docs/concepts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ of the above entities and give them structure. `Project`s are described at the
bottom in the [Projects](#projects) section.

All of these concepts are implemented as typescript types. Feel free to browse
the [API docs](https://doc.deno.land/https://garn.io/ts/v0.0.19/mod.ts) as well.
the [API docs](https://doc.deno.land/https://garn.io/ts/v0.0.20/mod.ts) as well.

## Environments

(See also the [API docs](https://doc.deno.land/https://garn.io/ts/v0.0.19/mod.ts/~/Environment).)
(See also the [API docs](https://doc.deno.land/https://garn.io/ts/v0.0.20/mod.ts/~/Environment).)

`Environment`s define what is available to a computation. For example they can
contain compilers and developer tools that you want to use on a project, but
Expand All @@ -42,7 +42,7 @@ what the `Environment`s provide. For example `Check`s, which are our next topic.

## Checks

(See also the [API docs](https://doc.deno.land/https://garn.io/ts/v0.0.19/mod.ts/~/Check).)
(See also the [API docs](https://doc.deno.land/https://garn.io/ts/v0.0.20/mod.ts/~/Check).)

`Check`s are commands (usually shell commands) that are used to define
reproducible, automated tests or other checks. They run in a sandbox, which
Expand All @@ -65,7 +65,7 @@ configuration.

## Executables

(See also the [API docs](https://doc.deno.land/https://garn.io/ts/v0.0.19/mod.ts/~/Executable).)
(See also the [API docs](https://doc.deno.land/https://garn.io/ts/v0.0.20/mod.ts/~/Executable).)

`Executable`s are commands (usually shell snippets) that are being run on your
local machine (not in a sandbox). They are based on an underlying `Environment`,
Expand All @@ -81,7 +81,7 @@ and can make use of e.g. the tools that `Environment`s provide. You can use
Here's a small example:

```typescript
import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
import * as garn from "https://garn.io/ts/v0.0.20/mod.ts";

export const hello =
garn.emptyEnvironment.shell("echo Hello, world!");
Expand All @@ -91,7 +91,7 @@ You can run `Executable`s with `garn run`.

## Packages

(See also the [API docs](https://doc.deno.land/https://garn.io/ts/v0.0.19/mod.ts/~/Package).)
(See also the [API docs](https://doc.deno.land/https://garn.io/ts/v0.0.20/mod.ts/~/Package).)

`Package`s are instructions to `garn` about how to _build_ a set of files. For
example for a Go backend a package would define how to compile it into
Expand All @@ -107,7 +107,7 @@ You can build `Package`s with `garn build`.

## Projects

(See also the [API docs](https://doc.deno.land/https://garn.io/ts/v0.0.19/mod.ts/~/Project).)
(See also the [API docs](https://doc.deno.land/https://garn.io/ts/v0.0.20/mod.ts/~/Project).)

`Project`s are used to combine `Environment`s, `Check`s, `Executable`s and
`Package`s into a single entity. A `Project` can contain any number of these
Expand All @@ -126,8 +126,8 @@ that contains a few `Check`s and adds a developer tool to its default
environment:

```typescript
import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
import * as pkgs from "https://garn.io/ts/v0.0.19/nixpkgs.ts";
import * as garn from "https://garn.io/ts/v0.0.20/mod.ts";
import * as pkgs from "https://garn.io/ts/v0.0.20/nixpkgs.ts";

export const project = garn.javascript
.mkNpmProject({
Expand Down
4 changes: 2 additions & 2 deletions website/src/docs/getting_started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ To update garn to a new version you can run:
nix profile list
# Find the index number of the entry where 'Original flake URL' starts with `github:garnix-io/garn`.
nix profile remove <garn index number>
nix profile install github:garnix-io/garn/v0.0.19
nix profile install github:garnix-io/garn/v0.0.20
```

### Manual installation
Expand Down Expand Up @@ -165,4 +165,4 @@ garn --fish-completion-script (which garn) > ~/.config/fish/completions/garn.fis

- [tutorial](/docs/tutorial)
- [garn concepts](/docs/concepts)
- [typescript api](https://doc.deno.land/https://garn.io/ts/v0.0.19/mod.ts)
- [typescript api](https://doc.deno.land/https://garn.io/ts/v0.0.20/mod.ts)
4 changes: 2 additions & 2 deletions website/src/docs/tutorial.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ construct projects for common stacks, but you can also define these yourself.
Here is an example `garn.ts` file for a single node-based project:

```typescript
import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
import * as pkgs from "https://garn.io/ts/v0.0.19/nixpkgs.ts";
import * as garn from "https://garn.io/ts/v0.0.20/mod.ts";
import * as pkgs from "https://garn.io/ts/v0.0.20/nixpkgs.ts";

export const frontend = garn.javascript.mkNpmProject({
description: "my frontend",
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/docs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const docMenuItems: { name: string; url: string }[] = [
...docEntries.map(([{ name, url }]) => ({ name, url: `/docs/${url}` })),
{
name: "typescript api",
url: "https://doc.deno.land/https://garn.io/ts/v0.0.19/mod.ts",
url: "https://doc.deno.land/https://garn.io/ts/v0.0.20/mod.ts",
},
];

Expand Down
8 changes: 4 additions & 4 deletions website/src/pages/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const Info: React.FC = () => {
<Code
header="garn.ts"
lineNumbers
code={`import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
code={`import * as garn from "https://garn.io/ts/v0.0.20/mod.ts";

export const frontend = garn.javascript.mkNpmProject({
description: "my frontend project",
Expand Down Expand Up @@ -84,8 +84,8 @@ v18.17.1`}
<Code
header="garn.ts"
lineNumbers
code={`import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
import * as nixpkgs from "https://garn.io/ts/v0.0.19/nixpkgs.ts";
code={`import * as garn from "https://garn.io/ts/v0.0.20/mod.ts";
import * as nixpkgs from "https://garn.io/ts/v0.0.20/nixpkgs.ts";

export const backend = garn.haskell
.mkHaskellProject({
Expand Down Expand Up @@ -224,7 +224,7 @@ $ garn run backend.codegen `}
<Code
header="garn.ts"
lineNumbers
code={`import * as garn from "https://garn.io/ts/v0.0.19/mod.ts";
code={`import * as garn from "https://garn.io/ts/v0.0.20/mod.ts";

export const deno = garn.mkProject({
description: "garn configuration environment",
Expand Down