Skip to content

Commit 3058205

Browse files
committed
copy app/ from inet-js
1 parent 6e586ab commit 3058205

File tree

5 files changed

+46
-12
lines changed

5 files changed

+46
-12
lines changed

TODO.md

+15-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
# module system
2-
3-
Mod has definitions: Map<string, Definition>
4-
5-
# loader
6-
7-
fix `Loader` -- parse and execute
8-
9-
# command-line
1+
copy command-line/ from inet-js
2+
setup the `run` command
103

114
# net
125

@@ -20,6 +13,19 @@ fix `Loader` -- parse and execute
2013
- everytime a marking changes,
2114
loop through and try to execute every transitions.
2215

16+
# command-line
17+
18+
fix run command
19+
add repl command
20+
21+
# syntax
22+
23+
parser
24+
25+
# loader
26+
27+
fix `Loader` -- parse and execute
28+
2329
# choice
2430

2531
[maybe] as one kind of `Transition`
@@ -29,9 +35,6 @@ fix `Loader` -- parse and execute
2935
env
3036
Stmt
3137

32-
# syntax
33-
34-
parser
3538

3639
# type system
3740

src/app/App.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { AppConfig } from "./AppConfig"
2+
import { AppHome } from "./AppHome"
3+
4+
export class App {
5+
home = new AppHome()
6+
config = new AppConfig()
7+
}

src/app/AppConfig.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export class AppConfig {
2+
packageJson: any
3+
4+
constructor() {
5+
// NOTE We should not use import for module not in `src/`,
6+
// otherwise `lib/` will have a extra level.
7+
this.packageJson = require("../../package.json")
8+
}
9+
}

src/app/AppHome.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { LocalFileStore } from "@cicada-lang/framework/lib/file-stores/LocalFileStore"
2+
import os from "os"
3+
import Path from "path"
4+
import process from "process"
5+
6+
export class AppHome extends LocalFileStore {
7+
constructor() {
8+
super({
9+
dir: process.env["INET_HOME"] || Path.resolve(os.homedir(), ".inet"),
10+
})
11+
}
12+
}

src/app/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { App } from "./App"
2+
3+
export const app = new App()

0 commit comments

Comments
 (0)