Docs: 102: move cue package to a sub-directory

Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
Solomon Hykes 2021-06-16 15:31:31 +00:00 committed by Solomon Hykes
parent 469f45806a
commit 325c843924

View File

@ -113,10 +113,10 @@ See the [Cue documentation](https://cuelang.org/docs/concepts/packages/#files-be
We will call our package `multibucket` because it sounds badass and vaguely explains what it does. We will call our package `multibucket` because it sounds badass and vaguely explains what it does.
But you can call your packages anything you want. But you can call your packages anything you want.
Let's layout the structure of our package by creating all the files in advance: Let's create a new directory for our Cue package:
```shell ```shell
touch multibucket-source.cue multibucket-yarn.cue multibucket-netlify.cue mkdir multibucket
``` ```
### Component 1: app source code ### Component 1: app source code
@ -128,9 +128,9 @@ In Dagger terms, this component has 2 important properties:
1. It is an *artifact*: something that can be represented as a directory. 1. It is an *artifact*: something that can be represented as a directory.
2. It is an *input*: something that is provided by the end user. 2. It is an *input*: something that is provided by the end user.
Let's write the corresponding Cue code to `multibucket-source.cue`: Let's write the corresponding Cue code to a new file in our package:
```cue title="~/examples/todoapp/multibucket-source.cue" ```cue title="todoapp/multibucket/source.cue"
package multibucket package multibucket
import ( import (
@ -145,11 +145,9 @@ This defines a component at the key `src`, of type `dagger.#Artifact`, annotated
### Component 2: yarn package ### Component 2: yarn package
The second component of our plan is the Yarn package built from the source code. The second component of our plan is the Yarn package built from the app source code:
Let's write it to `multibucket-yarn.cue`: ```cue title="todoapp/multibucket/yarn.cue"
```cue title="~/examples/todoapp/multibucket-yarn.cue"
package multibucket package multibucket
import ( import (
@ -176,11 +174,9 @@ Let's break it down:
### Component 4: deploy to Netlify ### Component 4: deploy to Netlify
The third component of our plan is the Netlify site to which the app will be deployed. The third component of our plan is the Netlify site to which the app will be deployed:
Let's write it to `multibucket-netlify.cue`: ```cue title="todoapp/multibucket/netlify.cue"
```cue title="~/examples/todoapp/multibucket-netlify.cue"
package multibucket package multibucket
import ( import (
@ -228,7 +224,7 @@ dagger new 'multibucket'
Now let's configure the new environment to use our package as its plan: Now let's configure the new environment to use our package as its plan:
```shell ```shell
cp multibucket-*.cue .dagger/env/multibucket/plan/ cp multibucket/*.cue .dagger/env/multibucket/plan/
``` ```
Note: you need to copy the files from your package into the environment, as shown above. Note: you need to copy the files from your package into the environment, as shown above.