Skip to content

Commit

Permalink
Add "Start from template" step under CLI -> Get Started (#590)
Browse files Browse the repository at this point in the history
* add "Start from template" step under CLI -> Get Started

* update content and wording

* editorial fixes, update github code link, add callout backlink to templates
  • Loading branch information
igor-p authored Sep 13, 2024
1 parent 449f6c8 commit c000234
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 5 deletions.
3 changes: 3 additions & 0 deletions apps/nextra/pages/en/build/cli/_meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export default {
"setup-cli": {
title: "Setup",
},
"start-from-template": {
title: "Start from template",
},
"---usage---": {
type: "separator",
title: "Usage",
Expand Down
42 changes: 42 additions & 0 deletions apps/nextra/pages/en/build/cli/start-from-template.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Card, RemoteCodeblock, permalinkFetch } from '@components/index';
import { Steps } from "nextra/components"

export async function getStaticProps() {
return await permalinkFetch([
"https://github.com/aptos-labs/aptos-core/blob/afd3706c17bcccfb39a9d6059aecbfa648ed295d/aptos-move/move-examples/hello_blockchain/sources/hello_blockchain.move#L1-L64"
])
}

# Start a Move package from a template
Follow the steps below to quickly get started.

<Steps>
### Initialize
Run the following to initialize a package using the `hello-blockchain` template:
```bash filename="Terminal"
aptos move init --name hello_blockchain --template hello-blockchain
```

### Start building
The template creates a `hello_blockchain.move` file under `sources` to help get you started.
<RemoteCodeblock
permalink="https://github.com/aptos-labs/aptos-core/blob/afd3706c17bcccfb39a9d6059aecbfa648ed295d/aptos-move/move-examples/hello_blockchain/sources/hello_blockchain.move#L1-L64"
/>

### See all templates
Run the following command to see all templates (and for general help initializing a package):
```bash
aptos move init --help
```

### Learn More
<Card href="../smart-contracts">
<Card.Title>Smart Contracts</Card.Title>
<Card.Description>Learn how to build in Move</Card.Description>
</Card>
<Card href="../smart-contracts/create-package">
<Card.Title>Create Package</Card.Title>
<Card.Description>Get started by learning how to create a Move package</Card.Description>
</Card>

</Steps>
14 changes: 9 additions & 5 deletions apps/nextra/pages/en/build/smart-contracts/create-package.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import { RemoteCodeblock, permalinkFetch } from '@components/index';

export async function getStaticProps() {
return await permalinkFetch([
'https://github.com/aptos-labs/aptos-core/blob/77e1d222ebc5e7294e115e0d090c001da1d0e072/aptos-move/move-examples/hello_blockchain/sources/hello_blockchain.move#L1-L59'
'https://github.com/aptos-labs/aptos-core/blob/afd3706c17bcccfb39a9d6059aecbfa648ed295d/aptos-move/move-examples/hello_blockchain/sources/hello_blockchain.move#L1-L64'
])
}

# Create Package

<Callout>
We recommend installing the Aptos CLI before beginning.
We recommend installing the Aptos CLI before beginning.
If you haven't already installed the Aptos CLI, see the [CLI section](../cli)
</Callout>

Expand All @@ -37,6 +37,10 @@ You should now have a Move project that looks like so:
<FileTree.File name="Move.toml" />
</FileTree>

<Callout type={"default"}>
You can also create a Move package from a [template](../cli/start-from-template).
</Callout>

### Update `Move.toml`

In `Move.toml`, fill in the following key information:
Expand Down Expand Up @@ -66,8 +70,8 @@ subdir = "aptos-move/framework/aptos-framework"

Add your code in the `sources` directory. Here we have a `hello_blockchain.move` example.

<RemoteCodeblock
permalink="https://github.com/aptos-labs/aptos-core/blob/77e1d222ebc5e7294e115e0d090c001da1d0e072/aptos-move/move-examples/hello_blockchain/sources/hello_blockchain.move#L1-L59"
<RemoteCodeblock
permalink="https://github.com/aptos-labs/aptos-core/blob/afd3706c17bcccfb39a9d6059aecbfa648ed295d/aptos-move/move-examples/hello_blockchain/sources/hello_blockchain.move#L1-L64"
/>

</Steps>
</Steps>

0 comments on commit c000234

Please sign in to comment.