Skip to content

Commit

Permalink
create-primate: create routes/index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
terrablue committed Feb 12, 2024
1 parent 558941a commit e494d6f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
12 changes: 6 additions & 6 deletions packages/create-primate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@
},
"dependencies": {
"@clack/prompts": "^0.7.0",
"rcompat": "^0.8.0"
"rcompat": "^0.8.2"
},
"type": "module",
"devDependencies": {
"@primate/build": "^0.4.1",
"@primate/frontend": "^0.13.2",
"@primate/build": "^0.4.2",
"@primate/frontend": "^0.13.5",
"@primate/session": "^0.17.1",
"@primate/store": "^0.22.1",
"@primate/store": "^0.22.2",
"@primate/types": "^0.13.1",
"babel-preset-solid": "^1.8.12",
"better-sqlite3": "^9.4.0",
"better-sqlite3": "^9.4.1",
"esbuild": "^0.20.0",
"handlebars": "^4.7.8",
"htmx.org": "^1.9.10",
"marked": "^12.0.0",
"mongodb": "^6.3.0",
"postgres": "^3.4.3",
"primate": "^0.29.1",
"primate": "^0.29.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"solid-js": "^1.8.14",
Expand Down
10 changes: 7 additions & 3 deletions packages/create-primate/src/commands/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ const create = async ([root, configs]) => {
await files.gitignore(root, config);
await files.package_json(root, config);
await files.primate_config_js(root, config);
await root.join("pages").create();
await files.app_html(root);
await files.error_html(root);
const pages = root.join("pages");
await pages.create();
await files.app_html(pages);
await files.error_html(pages);
const routes = root.join("routes");
await routes.create();
await files.index_route(routes);

return root;
};
Expand Down
4 changes: 1 addition & 3 deletions packages/create-primate/src/files/app_html.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const path = ["pages", "app.html"];

export default root => root.join(...path).write(`<!doctype html>
export default pages => pages.join("app.html").write(`<!doctype html>
<html>
<head>
<title>Primate app</title>
Expand Down
4 changes: 1 addition & 3 deletions packages/create-primate/src/files/error_html.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const path = ["pages", "error.html"];

export default root => root.join(...path).write(`<!doctype html>
export default pages => pages.join("error.html").write(`<!doctype html>
<html>
<head>
<title>Error page</title>
Expand Down
1 change: 1 addition & 0 deletions packages/create-primate/src/files/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export { default as package_json } from "./package_json.js";
export { default as primate_config_js } from "./primate_config_js.js";
export { default as app_html } from "./app_html.js";
export { default as error_html } from "./error_html.js";
export { default as index_route } from "./index_route.js";
5 changes: 5 additions & 0 deletions packages/create-primate/src/files/index_route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default routes => routes.join("index.js").write(`export default {
get() {
return "Hello, world!";
},
};`);

0 comments on commit e494d6f

Please sign in to comment.