https://github.com/bird-studio/shenron
Code generator.
https://github.com/bird-studio/shenron
deno typescript
Last synced: about 2 months ago
JSON representation
Code generator.
- Host: GitHub
- URL: https://github.com/bird-studio/shenron
- Owner: bird-studio
- License: mit
- Created: 2023-11-02T12:24:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-13T12:27:48.000Z (almost 2 years ago)
- Last Synced: 2025-06-10T15:09:54.178Z (about 1 year ago)
- Topics: deno, typescript
- Language: TypeScript
- Homepage: https://deno.land/x/shenron
- Size: 28.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# shenron
## What is this?
Code generator.
This is a [repository](https://github.com/akira-toriyama/shenron-demo) for
operation confirmation.
## Features
There are many libraries that generate code using `handlebars.js` and `ejs`.
However, readability is low. It is not possible to directly test or confirm
operation.
Below is an example of Ract, but it is difficult to read because of the many
tags. Syntax highlighting is also disabled.
It is difficult to produce because it is not possible to check directly.
```ejs
import React from 'react'
type Props = {
}
export const <%= h.changeCase.pascal(name) %>: React.FC = ({}) => {
return (
<>
<%= h.changeCase.pascal(name) %>
>
)
}
```
## Use
### Step.0
```bash
brew install f2
```
### Step.1
Create a file like this one.
`./tpl/fruits/fruits.html`
```html
This is red fruits
This is green fruits
```
`./generation.ts`
```
import { generate } from "https://deno.land/x/shenron/mod.ts";
generate({
dir: {
output: "./output",
template: "./demo/tpl/fruits",
},
replacements: [{
before: "fruits",
after: "apple",
}, {
before: "Fruits",
after: "Apple",
}],
});
```
### Step.2
Execute.
```bash
deno run --allow-run --allow-read --allow-write --allow-env --allow-sys ./generation.ts
```
### Finish
`./output/apple/apple.html`
```html
This is red apple
This is green apple
```
## Notes
Please use alphabetic letters for `replacements` as much as possible.