froggy-docs 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/froggy-docs +0 -0
- package/lib/src/web_server.dart +5 -12
- package/package.json +1 -1
package/bin/froggy-docs
CHANGED
|
Binary file
|
package/lib/src/web_server.dart
CHANGED
|
@@ -29,10 +29,7 @@ const _corsHeaders = {
|
|
|
29
29
|
String get _packageDir {
|
|
30
30
|
final exePath = Platform.resolvedExecutable;
|
|
31
31
|
final exeDir = File(exePath).parent.path;
|
|
32
|
-
|
|
33
|
-
print('DEBUG: exeDir = $exeDir');
|
|
34
|
-
print('DEBUG: webDir = ${p.join(exeDir, 'frontend', 'web')}');
|
|
35
|
-
return exeDir;
|
|
32
|
+
return p.dirname(exeDir);
|
|
36
33
|
}
|
|
37
34
|
|
|
38
35
|
String get webDir => p.join(_packageDir, 'frontend', 'web');
|
|
@@ -42,9 +39,7 @@ Router get _router {
|
|
|
42
39
|
final router = Router();
|
|
43
40
|
|
|
44
41
|
router.get('/froggy_docs.json', (Request request) async {
|
|
45
|
-
final file = File(
|
|
46
|
-
p.join(Directory.current.path, webDir, 'froggy_docs.json'),
|
|
47
|
-
);
|
|
42
|
+
final file = File(p.join(webDir, 'froggy_docs.json'));
|
|
48
43
|
if (await file.existsSync()) {
|
|
49
44
|
return Response.ok(
|
|
50
45
|
file.openRead(),
|
|
@@ -55,9 +50,7 @@ Router get _router {
|
|
|
55
50
|
});
|
|
56
51
|
|
|
57
52
|
router.get('/', (Request request) async {
|
|
58
|
-
final indexFile = File(
|
|
59
|
-
p.join(Directory.current.path, deployDir, 'index.html'),
|
|
60
|
-
);
|
|
53
|
+
final indexFile = File(p.join(webDir, 'index.html'));
|
|
61
54
|
if (await indexFile.existsSync()) {
|
|
62
55
|
return Response.ok(
|
|
63
56
|
indexFile.openRead(),
|
|
@@ -139,14 +132,14 @@ Router get _router {
|
|
|
139
132
|
// ═════════════════════════════════════════════════════════════
|
|
140
133
|
|
|
141
134
|
router.get('/<path|[^/]+>', (Request request, String path) async {
|
|
142
|
-
var file = File(p.join(
|
|
135
|
+
var file = File(p.join(deployDir, path));
|
|
143
136
|
if (await file.existsSync()) {
|
|
144
137
|
return Response.ok(
|
|
145
138
|
file.openRead(),
|
|
146
139
|
headers: {'Content-Type': _getContentType(path)},
|
|
147
140
|
);
|
|
148
141
|
}
|
|
149
|
-
file = File(p.join(
|
|
142
|
+
file = File(p.join(webDir, path));
|
|
150
143
|
if (await file.existsSync()) {
|
|
151
144
|
return Response.ok(
|
|
152
145
|
file.openRead(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "froggy-docs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Auto-generate API documentation from code annotations. Works with any programming language.",
|
|
5
5
|
"author": "Kaung Mrat Thu <kaungmyatthuu.dev@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Kaung-Myat/froggydocs",
|