1 | /**
|
2 | * Represents an extension in the framework.
|
3 | *
|
4 | * @public
|
5 | * @module Xethya
|
6 | * @class ExtensionBase
|
7 | */
|
8 |
|
9 | /**
|
10 | * Builds an extension using Babel with Rollup. The extension will be exported
|
11 | * in ES and UMD module formats into a `dist` folder, with the following name
|
12 | * format:
|
13 | *
|
14 | * ```
|
15 | * dist/<package.name>.<format>.js
|
16 | * ```
|
17 | *
|
18 | * In order for an extension to be buildable, it must contain the following
|
19 | * configuration in its `package.json` file:
|
20 | *
|
21 | * ```json
|
22 | * {
|
23 | * "xethya": {
|
24 | * "extensionName": "Module.Extension"
|
25 | * }
|
26 | * }
|
27 | * ```
|
28 | *
|
29 | * This will export the extension into the `Xethya.Module.Extension` namespace.
|
30 | * Any classes you define will live there.
|
31 | *
|
32 | * To register the task in your local Gulp file, add the following line:
|
33 | *
|
34 | * ```js
|
35 | * require('xethya-extension-base/tasks/build');
|
36 | * ```
|
37 | *
|
38 | * Then, use it with a globally-installed version of Gulp:
|
39 | *
|
40 | * ```bash
|
41 | * gulp extension:build
|
42 | * ```
|
43 | *
|
44 | * or add it to your `package.json` file as a `run script`:
|
45 | *
|
46 | * ```json
|
47 | * {
|
48 | * "scripts": {
|
49 | * "build": "gulp extension:build"
|
50 | * }
|
51 | * }
|
52 | * ```
|
53 | *
|
54 | * and then run it as:
|
55 | *
|
56 | * ```bash
|
57 | * npm run build
|
58 | * ```
|
59 | *
|
60 | * @public
|
61 | * @memberof ExtensionBase
|
62 | * @method extension:build
|
63 | */
|
64 |
|
65 | /**
|
66 | * Runs the extension's test suite. This will spawn a Karma server, hooked-up
|
67 | * with Mocha, Chai and Sinon, using headless Chrome as browser.
|
68 | *
|
69 | * Test files must reside in the `test` folder, and use the `.spec.js` suffix.
|
70 | * Tests can be written in ES6, without using `import`. The module you're testing
|
71 | * is available globally under the `Xethya` namespace, as specified by
|
72 | * `extension:build`.
|
73 | *
|
74 | * To register the task in your local Gulp file, add the following line:
|
75 | *
|
76 | * ```js
|
77 | * require('xethya-extension-base/tasks/test');
|
78 | * ```
|
79 | *
|
80 | * Then, use it with a globally-installed version of Gulp:
|
81 | *
|
82 | * ```bash
|
83 | * gulp extension:test
|
84 | * ```
|
85 | *
|
86 | * or add it to your `package.json` file as a `run script`:
|
87 | *
|
88 | * ```json
|
89 | * {
|
90 | * "scripts": {
|
91 | * "test": "gulp extension:test"
|
92 | * }
|
93 | * }
|
94 | * ```
|
95 | *
|
96 | * and then run it as:
|
97 | *
|
98 | * ```bash
|
99 | * npm run test
|
100 | * ```
|
101 | *
|
102 | * @public
|
103 | * @memberof ExtensionBase
|
104 | * @method extension:test
|
105 | */
|
106 |
|
107 | /**
|
108 | * Builds the extension's documentation. It'll scan any *.js files
|
109 | * living in `src/` and create a `README.md` file in `src/`.
|
110 | *
|
111 | * Proper usage of JSDoc is required for this task to run correctly.
|
112 | * `@module` declaration is mandatory.
|
113 | *
|
114 | * To register the task in your local Gulp file, add the following line:
|
115 | *
|
116 | * ```js
|
117 | * require('xethya-extension-base/tasks/docs');
|
118 | * ```
|
119 | *
|
120 | * Then, use it with a globally-installed version of Gulp:
|
121 | *
|
122 | * ```bash
|
123 | * gulp extension:docs
|
124 | * ```
|
125 | *
|
126 | * or add it to your `package.json` file as a `run script`:
|
127 | *
|
128 | * ```json
|
129 | * {
|
130 | * "scripts": {
|
131 | * "test": "gulp extension:docs"
|
132 | * }
|
133 | * }
|
134 | * ```
|
135 | *
|
136 | * and then run it as:
|
137 | *
|
138 | * ```bash
|
139 | * npm run docs
|
140 | * ```
|
141 | *
|
142 | * @public
|
143 | * @memberof ExtensionBase
|
144 | * @method extension:docs
|
145 | */
|