File tree Expand file tree Collapse file tree 4 files changed +25
-6
lines changed Expand file tree Collapse file tree 4 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ set -euo pipefail
4
4
main () {
5
5
cd " $( dirname " $0 " ) /../.."
6
6
7
+ cd test/test-plugin
8
+ make -s out/index.js
9
+ cd $OLDPWD
7
10
mocha -r ts-node/register ./test/* .test.ts " $@ "
8
11
}
9
12
Original file line number Diff line number Diff line change @@ -23,7 +23,10 @@ interface Plugin extends pluginapi.Plugin {
23
23
}
24
24
25
25
interface Application extends pluginapi . Application {
26
- plugin : Plugin
26
+ /*
27
+ * Clone of the above without functions.
28
+ */
29
+ plugin : Omit < Plugin , "init" | "router" | "applications" >
27
30
}
28
31
29
32
/**
@@ -57,7 +60,15 @@ export class PluginAPI {
57
60
// Add plugin key to each app.
58
61
apps . push (
59
62
...pluginApps . map ( ( app ) => {
60
- return { ...app , plugin : p }
63
+ return {
64
+ ...app ,
65
+ plugin : {
66
+ name : p . name ,
67
+ version : p . version ,
68
+ description : p . description ,
69
+ modulePath : p . modulePath ,
70
+ } ,
71
+ }
61
72
} ) ,
62
73
)
63
74
}
@@ -74,8 +85,9 @@ export class PluginAPI {
74
85
}
75
86
76
87
/**
77
- * loadPlugins loads all plugins based on this.csPluginPath
78
- * and this.csPlugin.
88
+ * loadPlugins loads all plugins based on this.csPlugin,
89
+ * this.csPluginPath and the built in plugins.
90
+ *
79
91
*/
80
92
public async loadPlugins ( ) : Promise < void > {
81
93
// Built-in plugins.
Original file line number Diff line number Diff line change @@ -12,8 +12,7 @@ describe("plugin", () => {
12
12
const papi = new PluginAPI ( logger , path . resolve ( __dirname , "test-plugin" ) + ":meow" )
13
13
await papi . loadPlugins ( )
14
14
15
- // We remove the function fields from the application's plugins.
16
- const apps = JSON . parse ( JSON . stringify ( await papi . applications ( ) ) )
15
+ const apps = await papi . applications ( )
17
16
18
17
assert . deepEqual (
19
18
[
Original file line number Diff line number Diff line change
1
+ out/index.js : src/index.ts
2
+ yarn build
3
+
4
+ node_modules : package.json yarn.lock
5
+ yarn
You can’t perform that action at this time.
0 commit comments