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

feat: Change placeholder format to use underscores #3900

Merged
merged 2 commits into from
Sep 3, 2024
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
2 changes: 1 addition & 1 deletion src/dfx/assets/project_templates/any_js/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "{project_name}",
"name": "__project_name__",
"type": "module",
"scripts": {
"start": "npm start --workspaces --if-present",
Expand Down
10 changes: 5 additions & 5 deletions src/dfx/assets/project_templates/azle/dfx.json-patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[
{
"path": "/canisters/{backend_name}",
"path": "/canisters/__backend_name__",
"op": "add",
"value": {
"type": "custom",
"main": "src/{backend_name}/src/index.ts",
"candid": "src/{backend_name}/{backend_name}.did",
"build": "npx azle {backend_name}",
"wasm": ".azle/{backend_name}/{backend_name}.wasm",
"main": "src/__backend_name__/src/index.ts",
"candid": "src/__backend_name__/__backend_name__.did",
"build": "npx azle __backend_name__",
"wasm": ".azle/__backend_name__/__backend_name__.wasm",
"gzip": true,
"tech_stack": {
"language": {
Expand Down
2 changes: 1 addition & 1 deletion src/dfx/assets/project_templates/azle/package.json-patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
"op": "add",
"path": "/workspaces/-",
"value": "src/{backend_name}"
"value": "src/__backend_name__"
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "{backend_name}",
"name": "__backend_name__",
"version": "0.0.0",
"private": true,
"type": "module",
Expand Down
8 changes: 4 additions & 4 deletions src/dfx/assets/project_templates/base/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# `{project_name}`
# `__project_name__`

Welcome to your new `{project_name}` project and to the Internet Computer development community. By default, creating a new project adds this README and some template files to your project directory. You can edit these template files to customize your project and to include your own code to speed up the development cycle.
Welcome to your new `__project_name__` project and to the Internet Computer development community. By default, creating a new project adds this README and some template files to your project directory. You can edit these template files to customize your project and to include your own code to speed up the development cycle.

To get started, you might want to explore the project directory structure and the default configuration file. Working with this project in your development environment will not affect any production deployment or identity tokens.

To learn more before you start working with `{project_name}`, see the following documentation available online:
To learn more before you start working with `__project_name__`, see the following documentation available online:

- [Quick Start](https://internetcomputer.org/docs/current/developer-docs/setup/deploy-locally)
- [SDK Developer Tools](https://internetcomputer.org/docs/current/developer-docs/setup/install)

If you want to start working on your project right away, you might want to try the following commands:

```bash
cd {project_name}/
cd __project_name__/
dfx help
dfx canister --help
```
Expand Down
10 changes: 5 additions & 5 deletions src/dfx/assets/project_templates/kybra/dfx.json-patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[
{
"path": "/canisters/{backend_name}",
"path": "/canisters/__backend_name__",
"op": "add",
"value": {
"type": "custom",
"build": "python -m kybra {backend_name} src/{backend_name}/src/main.py src/{backend_name}/{backend_name}.did",
"post_install": ".kybra/{backend_name}/post_install.sh",
"candid": "src/{backend_name}/{backend_name}.did",
"wasm": ".kybra/{backend_name}/{backend_name}.wasm",
"build": "python -m kybra __backend_name__ src/__backend_name__/src/main.py src/__backend_name__/__backend_name__.did",
"post_install": ".kybra/__backend_name__/post_install.sh",
"candid": "src/__backend_name__/__backend_name__.did",
"wasm": ".kybra/__backend_name__/__backend_name__.wasm",
"gzip": true,
"tech_stack": {
"language": {
Expand Down
4 changes: 2 additions & 2 deletions src/dfx/assets/project_templates/motoko/dfx.json-patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[
{
"op": "add",
"path": "/canisters/{backend_name}",
"path": "/canisters/__backend_name__",
"value": {
"type": "motoko",
"main": "src/{backend_name}/main.mo"
"main": "src/__backend_name__/main.mo"
}
}
]
8 changes: 4 additions & 4 deletions src/dfx/assets/project_templates/react/dfx.json-patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[
{
"op": "add",
"path": "/canisters/{frontend_name}",
"path": "/canisters/__frontend_name__",
"value": {
"type": "assets",
"source": [
"src/{frontend_name}/dist"
"src/__frontend_name__/dist"
],
"dependencies": [
"{backend_name}"
"__backend_name__"
],
"workspace": "{frontend_name}"
"workspace": "__frontend_name__"
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
"op": "add",
"path": "/workspaces/-",
"value": "src/{frontend_name}"
"value": "src/__frontend_name__"
}
]
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "{frontend_name}",
"name": "__frontend_name__",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"setup": "npm i && dfx canister create {backend_name} && dfx generate {backend_name} && dfx deploy",
"setup": "npm i && dfx canister create __backend_name__ && dfx generate __backend_name__ && dfx deploy",
"start": "vite --port 3000",
"prebuild": "dfx generate",
"build": "tsc && vite build",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useState } from 'react';
import { {backend_name_ident} } from 'declarations/{backend_name}';
import { __backend_name_ident__ } from 'declarations/__backend_name__';

function App() {
const [greeting, setGreeting] = useState('');

function handleSubmit(event) {
event.preventDefault();
const name = event.target.elements.name.value;
{backend_name_ident}.greet(name).then((greeting) => {
__backend_name_ident__.greet(name).then((greeting) => {
setGreeting(greeting);
});
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- a/src/{frontend_name}/vite.config.js
+++ b/src/{frontend_name}/vite.config.js
--- a/src/__frontend_name__/vite.config.js
+++ b/src/__frontend_name__/vite.config.js
@@ -1,1 +1,2 @@
+/// <reference types="vitest" />
import { fileURLToPath, URL } from 'url';
Expand Down
2 changes: 1 addition & 1 deletion src/dfx/assets/project_templates/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = [
"src/{backend_name}"
"src/__backend_name__"
]
resolver = "2"
6 changes: 3 additions & 3 deletions src/dfx/assets/project_templates/rust/dfx.json-patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[
{
"op": "add",
"path": "/canisters/{backend_name}",
"path": "/canisters/__backend_name__",
"value": {
"type": "rust",
"package": "{backend_name}",
"candid": "src/{backend_name}/{backend_name}.did"
"package": "__backend_name__",
"candid": "src/__backend_name__/__backend_name__.did"
}
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "{backend_name}"
name = "__backend_name__"
version = "0.1.0"
edition = "2021"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[
{
"op": "add",
"path": "/canisters/{frontend_name}",
"path": "/canisters/__frontend_name__",
"value": {
"type": "assets",
"source": [
"src/{frontend_name}/assets"
"src/__frontend_name__/assets"
],
"dependencies": [
"{backend_name}"
"__backend_name__"
]
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/dfx/assets/project_templates/svelte/dfx.json-patch
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[
{
"op": "add",
"path": "/canisters/{frontend_name}",
"path": "/canisters/__frontend_name__",
"value": {
"type": "assets",
"source": [
"src/{frontend_name}/dist"
"src/__frontend_name__/dist"
],
"dependencies": [
"{backend_name}"
"__backend_name__"
],
"workspace": "{frontend_name}"
"workspace": "__frontend_name__"
}
},
{
"op": "add",
"path": "/canisters/{backend_name}/declarations",
"path": "/canisters/__backend_name__/declarations",
"value": {
"node_compatibility": true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
"op": "add",
"path": "/workspaces/-",
"value": "src/{frontend_name}"
"value": "src/__frontend_name__"
}
]
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "{frontend_name}",
"name": "__frontend_name__",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"setup": "npm i && dfx canister create {backend_name} && dfx generate {backend_name} && dfx deploy",
"setup": "npm i && dfx canister create __backend_name__ && dfx generate __backend_name__ && dfx deploy",
"start": "vite --port 3000",
"prebuild": "dfx generate",
"build": "tsc && vite build",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createActor, canisterId } from 'declarations/{backend_name}';
import { createActor, canisterId } from 'declarations/__backend_name__';
import { building } from '$app/environment';

function dummyActor() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- a/src/{frontend_name}/vite.config.js
+++ b/src/{frontend_name}/vite.config.js
--- a/src/__frontend_name__/vite.config.js
+++ b/src/__frontend_name__/vite.config.js
@@ -1,1 +1,2 @@
+/// <reference types="vitest" />
import { fileURLToPath, URL } from 'url';
Expand Down
8 changes: 4 additions & 4 deletions src/dfx/assets/project_templates/vanilla_js/dfx.json-patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[
{
"op": "add",
"path": "/canisters/{frontend_name}",
"path": "/canisters/__frontend_name__",
"value": {
"type": "assets",
"source": [
"src/{frontend_name}/dist"
"src/__frontend_name__/dist"
],
"dependencies": [
"{backend_name}"
"__backend_name__"
],
"workspace": "{frontend_name}"
"workspace": "__frontend_name__"
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
"op": "add",
"path": "/workspaces/-",
"value": "src/{frontend_name}"
"value": "src/__frontend_name__"
}
]
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "{frontend_name}",
"name": "__frontend_name__",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"setup": "npm i && dfx canister create {backend_name} && dfx generate {backend_name} && dfx deploy",
"setup": "npm i && dfx canister create __backend_name__ && dfx generate __backend_name__ && dfx deploy",
"start": "vite --port 3000",
"prebuild": "dfx generate",
"build": "tsc && vite build",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { html, render } from 'lit-html';
import { {backend_name_ident} } from 'declarations/{backend_name}';
import { __backend_name_ident__ } from 'declarations/__backend_name__';
import logo from './logo2.svg';

class App {
Expand All @@ -12,7 +12,7 @@ class App {
#handleSubmit = async (e) => {
e.preventDefault();
const name = document.getElementById('name').value;
this.greeting = await {backend_name_ident}.greet(name);
this.greeting = await __backend_name_ident__.greet(name);
this.#render();
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- a/src/{frontend_name}/vite.config.js
+++ b/src/{frontend_name}/vite.config.js
--- a/src/__frontend_name__/vite.config.js
+++ b/src/__frontend_name__/vite.config.js
@@ -1,1 +1,2 @@
+/// <reference types="vitest" />
import { defineConfig } from 'vite';
Expand Down
8 changes: 4 additions & 4 deletions src/dfx/assets/project_templates/vue/dfx.json-patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[
{
"op": "add",
"path": "/canisters/{frontend_name}",
"path": "/canisters/__frontend_name__",
"value": {
"type": "assets",
"dependencies": [
"{backend_name}"
"__backend_name__"
],
"source": [
"src/{frontend_name}/dist"
"src/__frontend_name__/dist"
],
"workspace": "{frontend_name}"
"workspace": "__frontend_name__"
}
}
]
2 changes: 1 addition & 1 deletion src/dfx/assets/project_templates/vue/package.json-patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
"op": "add",
"path": "/workspaces/-",
"value": "src/{frontend_name}"
"value": "src/__frontend_name__"
}
]
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "{frontend_name}",
"name": "__frontend_name__",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"setup": "npm i && dfx canister create {backend_name} && dfx generate {backend_name} && dfx deploy",
"setup": "npm i && dfx canister create __backend_name__ && dfx generate __backend_name__ && dfx deploy",
"start": "vite --port 3000",
"prebuild": "dfx generate",
"build": "tsc && vite build",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<script setup>
import { ref } from 'vue';
import { {backend_name_ident} } from 'declarations/{backend_name}/index';
import { __backend_name_ident__ } from 'declarations/__backend_name__/index';
let greeting = ref('');

async function handleSubmit(e) {
e.preventDefault();
const target = e.target;
const name = target.querySelector('#name').value;
await {backend_name_ident}.greet(name).then((response) => {
await __backend_name_ident__.greet(name).then((response) => {
greeting.value = response;
});
}
Expand Down
Loading
Loading