initial commit
This commit is contained in:
commit
2dccb8116a
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"deno.enable": true
|
||||||
|
}
|
||||||
3
denogen/.vscode/settings.json
vendored
Normal file
3
denogen/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"deno.enable": true
|
||||||
|
}
|
||||||
8
denogen/deno.jsonc
Normal file
8
denogen/deno.jsonc
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"imports": {
|
||||||
|
"ts_morph/": "https://deno.land/x/ts_morph/"
|
||||||
|
},
|
||||||
|
"tasks": {
|
||||||
|
"dev": "deno run --watch main.ts"
|
||||||
|
}
|
||||||
|
}
|
||||||
34
denogen/deno.lock
generated
Normal file
34
denogen/deno.lock
generated
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"version": "2",
|
||||||
|
"remote": {
|
||||||
|
"https://deno.land/std@0.140.0/_util/assert.ts": "e94f2eb37cebd7f199952e242c77654e43333c1ac4c5c700e929ea3aa5489f74",
|
||||||
|
"https://deno.land/std@0.140.0/_util/os.ts": "3b4c6e27febd119d36a416d7a97bd3b0251b77c88942c8f16ee5953ea13e2e49",
|
||||||
|
"https://deno.land/std@0.140.0/fs/_util.ts": "0fb24eb4bfebc2c194fb1afdb42b9c3dda12e368f43e8f2321f84fc77d42cb0f",
|
||||||
|
"https://deno.land/std@0.140.0/fs/ensure_dir.ts": "9dc109c27df4098b9fc12d949612ae5c9c7169507660dcf9ad90631833209d9d",
|
||||||
|
"https://deno.land/std@0.140.0/fs/expand_glob.ts": "0c10130d67c9b02164b03df8e43c6d6defbf8e395cb69d09e84a8586e6d72ac3",
|
||||||
|
"https://deno.land/std@0.140.0/fs/walk.ts": "117403ccd21fd322febe56ba06053b1ad5064c802170f19b1ea43214088fe95f",
|
||||||
|
"https://deno.land/std@0.140.0/path/_constants.ts": "df1db3ffa6dd6d1252cc9617e5d72165cd2483df90e93833e13580687b6083c3",
|
||||||
|
"https://deno.land/std@0.140.0/path/_interface.ts": "ee3b431a336b80cf445441109d089b70d87d5e248f4f90ff906820889ecf8d09",
|
||||||
|
"https://deno.land/std@0.140.0/path/_util.ts": "c1e9686d0164e29f7d880b2158971d805b6e0efc3110d0b3e24e4b8af2190d2b",
|
||||||
|
"https://deno.land/std@0.140.0/path/common.ts": "bee563630abd2d97f99d83c96c2fa0cca7cee103e8cb4e7699ec4d5db7bd2633",
|
||||||
|
"https://deno.land/std@0.140.0/path/glob.ts": "cb5255638de1048973c3e69e420c77dc04f75755524cb3b2e160fe9277d939ee",
|
||||||
|
"https://deno.land/std@0.140.0/path/mod.ts": "d3e68d0abb393fb0bf94a6d07c46ec31dc755b544b13144dee931d8d5f06a52d",
|
||||||
|
"https://deno.land/std@0.140.0/path/posix.ts": "293cdaec3ecccec0a9cc2b534302dfe308adb6f10861fa183275d6695faace44",
|
||||||
|
"https://deno.land/std@0.140.0/path/separator.ts": "fe1816cb765a8068afb3e8f13ad272351c85cbc739af56dacfc7d93d710fe0f9",
|
||||||
|
"https://deno.land/std@0.140.0/path/win32.ts": "31811536855e19ba37a999cd8d1b62078235548d67902ece4aa6b814596dd757",
|
||||||
|
"https://deno.land/x/code_block_writer@11.0.3/mod.ts": "2c3448060e47c9d08604c8f40dee34343f553f33edcdfebbf648442be33205e5",
|
||||||
|
"https://deno.land/x/code_block_writer@11.0.3/utils/string_utils.ts": "60cb4ec8bd335bf241ef785ccec51e809d576ff8e8d29da43d2273b69ce2a6ff",
|
||||||
|
"https://deno.land/x/ts_morph@17.0.1/bootstrap/mod.ts": "b53aad517f106c4079971fcd4a81ab79fadc40b50061a3ab2b741a09119d51e9",
|
||||||
|
"https://deno.land/x/ts_morph@17.0.1/bootstrap/ts_morph_bootstrap.d.ts": "607e651c5ae5aa57c2ac4090759a6379e809c0cdc42114742ac67353b1a75038",
|
||||||
|
"https://deno.land/x/ts_morph@17.0.1/bootstrap/ts_morph_bootstrap.js": "91a954daa993c5acb3361aa5279394f81ea6fe18b3854345c86111b336491cfc",
|
||||||
|
"https://deno.land/x/ts_morph@17.0.1/common/DenoRuntime.ts": "537800e840d0994f9055164e11bf33eadf96419246af0d3c453793c3ae67bdb3",
|
||||||
|
"https://deno.land/x/ts_morph@17.0.1/common/mod.ts": "01985d2ee7da8d1caee318a9d07664774fbee4e31602bc2bb6bb62c3489555ed",
|
||||||
|
"https://deno.land/x/ts_morph@17.0.1/common/ts_morph_common.d.ts": "ee7767b0c68b23c65bb607c94b6cb3512e8237fbcb7d1d8383a33235cde2c068",
|
||||||
|
"https://deno.land/x/ts_morph@17.0.1/common/ts_morph_common.js": "49a79124b941ba2b35d81ac9eb90fc33c957b2640cdb97569c1941bac5a3bbdb",
|
||||||
|
"https://deno.land/x/ts_morph@17.0.1/common/typescript.d.ts": "57e52a0882af4e835473dda27e4316cc31149866970210f9f79b940e916b7838",
|
||||||
|
"https://deno.land/x/ts_morph@17.0.1/common/typescript.js": "5dd669eb199ee2a539924c63a92e23d95df43dfe2fbe3a9d68c871648be1ad5e",
|
||||||
|
"https://deno.land/x/ts_morph@17.0.1/mod.ts": "adba9b82f24865d15d2c78ef6074b9a7457011719056c9928c800f130a617c93",
|
||||||
|
"https://deno.land/x/ts_morph@17.0.1/ts_morph.d.ts": "a54b0c51b06d84defedf5fdd59c773d803808ae7c9678f7165f7a1a6dfa7f6a3",
|
||||||
|
"https://deno.land/x/ts_morph@17.0.1/ts_morph.js": "1bb80284b9e31a4c5c2078cd533fe9b12b4b2d710267055cb655225aa88fb2df"
|
||||||
|
}
|
||||||
|
}
|
||||||
23
denogen/mod.ts
Normal file
23
denogen/mod.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { Project, ResolutionHosts, ts } from "ts_morph/mod.ts";
|
||||||
|
|
||||||
|
export function generate(path: string) {
|
||||||
|
const project = new Project({
|
||||||
|
resolutionHost: ResolutionHosts.deno,
|
||||||
|
});
|
||||||
|
|
||||||
|
const file = project.addSourceFileAtPath(path);
|
||||||
|
|
||||||
|
const classes = file.getClasses();
|
||||||
|
|
||||||
|
const props = classes[0].getConstructors();
|
||||||
|
|
||||||
|
const ps = props[0].getParameters()[0];
|
||||||
|
|
||||||
|
console.log(classes[0].getProperties()[0].hasQuestionToken());
|
||||||
|
|
||||||
|
console.log(ps.isParameterProperty());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (import.meta.main) {
|
||||||
|
generate("../myapp/todo.ts");
|
||||||
|
}
|
||||||
3
myapp/.vscode/settings.json
vendored
Normal file
3
myapp/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"deno.enable": true
|
||||||
|
}
|
||||||
8
myapp/deno.jsonc
Normal file
8
myapp/deno.jsonc
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"imports": {
|
||||||
|
"denogen/": "../denogen/"
|
||||||
|
},
|
||||||
|
"tasks": {
|
||||||
|
"dev": "deno run --watch main.ts"
|
||||||
|
}
|
||||||
|
}
|
||||||
5
myapp/gen.ts
Normal file
5
myapp/gen.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { generate } from "denogen/mod.ts";
|
||||||
|
|
||||||
|
if (import.meta.main) {
|
||||||
|
generate("todo.ts");
|
||||||
|
}
|
||||||
0
myapp/main.ts
Normal file
0
myapp/main.ts
Normal file
17
myapp/todo.ts
Normal file
17
myapp/todo.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
export class Todo {
|
||||||
|
something?: boolean;
|
||||||
|
|
||||||
|
constructor(private readonly id: string, private content: string) {}
|
||||||
|
|
||||||
|
// Update the todo's content.
|
||||||
|
setContent(content: string) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @post /api/todos
|
||||||
|
*/
|
||||||
|
export function createTodo(content: string): Todo {
|
||||||
|
return new Todo(new Date().toISOString(), content);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user