@m2c2kit/build-helpers 0.3.13 → 0.3.14
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/dist/index.d.ts +67 -21
- package/dist/index.js +369 -6643
- package/package.json +1 -4
package/dist/index.d.ts
CHANGED
|
@@ -66,13 +66,21 @@ interface ExtraFile {
|
|
|
66
66
|
}
|
|
67
67
|
interface CopyAssetsOptions {
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
70
|
-
* assets copied, e.g.,
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
69
|
+
* For assets in an external m2c2kit package, the name of the m2c2kit package
|
|
70
|
+
* or array of names of m2c2kit packages that need assets copied, e.g.,
|
|
71
|
+
* `@m2c2kit/assessment-symbol-search` or
|
|
72
|
+
* `["@m2c2kit/assessment-symbol-search", "@m2c2kit/survey"]`, or a
|
|
73
|
+
* `PackageAndExtras` object, e.g.,
|
|
74
|
+
* `{name: "@m2c2kit/survey", extras: [{ source: "assets/index.html*", dest: "" }]}`
|
|
74
75
|
*/
|
|
75
|
-
package
|
|
76
|
+
package?: string | PackageAndExtras | Array<string | PackageAndExtras>;
|
|
77
|
+
/**
|
|
78
|
+
* For assets within this package, the _id_ or _ids_ of the
|
|
79
|
+
* assessment(s) to copy assets for. If the assessment is not within this
|
|
80
|
+
* package, then the assessment _package name_ should be provided in the
|
|
81
|
+
* `package` option.
|
|
82
|
+
*/
|
|
83
|
+
id?: string | Array<string>;
|
|
76
84
|
/**
|
|
77
85
|
* Output folder, e.g. `dist` or `build`.
|
|
78
86
|
*/
|
|
@@ -84,33 +92,71 @@ interface CopyAssetsOptions {
|
|
|
84
92
|
verbose?: boolean;
|
|
85
93
|
}
|
|
86
94
|
/**
|
|
87
|
-
* Copies
|
|
95
|
+
* Copies m2c2kit assets to the bundle output folder.
|
|
88
96
|
*
|
|
89
97
|
* @remarks Assets such as images, fonts, CSS, and WebAssembly files are
|
|
90
98
|
* needed by assessments. This plugin copies those assets from their
|
|
91
|
-
* respective packages to the output folder.
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* - All other packages are assumed to be assessments, and their assets folder
|
|
97
|
-
* **and** the wasm file from the required version of `@m2c2kit/core` are
|
|
98
|
-
* copied. Note that the assessment's package name must be used, not its
|
|
99
|
-
* m2c2kit game `id`.
|
|
99
|
+
* respective packages to the output folder.
|
|
100
|
+
*
|
|
101
|
+
* Packages and ids are assumed to be assessments (see exception below), and
|
|
102
|
+
* their assets folders **and** the wasm file from the required version of
|
|
103
|
+
* `@m2c2kit/core` are copied.
|
|
100
104
|
*
|
|
101
105
|
* At the end of the copy process, the `index.html` file from the `src` folder
|
|
102
|
-
* is copied to the output folder. This `index.html` file will have been
|
|
103
|
-
* by the CLI or the user.
|
|
106
|
+
* is copied to the output folder. This `index.html` file will have been
|
|
107
|
+
* created by the CLI or the user.
|
|
108
|
+
*
|
|
109
|
+
* A typical use case: Here, there is a new assessment with the id
|
|
110
|
+
* `my-new-assessment` being developed in this package. In addition, two
|
|
111
|
+
* existing assessments, `@m2c2kit/assessment-symbol-search` and
|
|
112
|
+
* `@m2c2kit/assessment-grid-memory`, are being used.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```
|
|
116
|
+
* copyAssets({
|
|
117
|
+
* id: "my-new-assessment",
|
|
118
|
+
* package: [
|
|
119
|
+
* "@m2c2kit/assessment-symbol-search",
|
|
120
|
+
* "@m2c2kit/assessment-grid-memory"
|
|
121
|
+
* ],
|
|
122
|
+
* outputFolder: "dist",
|
|
123
|
+
* })
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* Exception: if the `package` option is specified and it includes
|
|
127
|
+
* `@m2c2kit/db`, `@m2c2kit/survey`, or `@m2c2kit/session`, then the following
|
|
128
|
+
* assets are copied:
|
|
129
|
+
* - `@m2c2kit/db`: `data.js` and `data.html`
|
|
130
|
+
* - `@m2c2kit/survey`: assets css folder contents
|
|
131
|
+
* - `@m2c2kit/session`: assets folder contents, except `index.html`
|
|
132
|
+
*
|
|
133
|
+
* A typical use case: Here, in addition to assessments, a survey will be
|
|
134
|
+
* administered, and thus survey CSS assets are needed.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```
|
|
138
|
+
* copyAssets({
|
|
139
|
+
* id: "my-new-assessment",
|
|
140
|
+
* package: [
|
|
141
|
+
* "@m2c2kit/assessment-symbol-search",
|
|
142
|
+
* "@m2c2kit/assessment-grid-memory",
|
|
143
|
+
* "@m2c2kit/survey"
|
|
144
|
+
* ],
|
|
145
|
+
* outputFolder: "dist",
|
|
146
|
+
* })
|
|
147
|
+
* ```
|
|
104
148
|
*
|
|
105
149
|
* If the `index.html` from `@m2c2kit/session` or `@m2c2kit/survey` is needed, it
|
|
106
150
|
* can be added as an extra file to copy, but this will be done only in special
|
|
107
151
|
* cases, such as when creating library demos within this repository.
|
|
108
152
|
*
|
|
153
|
+
* This is a very atypical, unusual use case: Here, the `index.html` file from
|
|
154
|
+
* `@m2c2kit/survey` is copied to the output folder on every build.
|
|
155
|
+
*
|
|
109
156
|
* @example
|
|
110
157
|
* ```
|
|
111
158
|
* copyAssets({
|
|
112
159
|
* package: [
|
|
113
|
-
* "@m2c2kit/session",
|
|
114
160
|
* "@m2c2kit/assessment-symbol-search",
|
|
115
161
|
* {
|
|
116
162
|
* name: "@m2c2kit/survey",
|
|
@@ -125,13 +171,13 @@ interface CopyAssetsOptions {
|
|
|
125
171
|
* ```
|
|
126
172
|
*
|
|
127
173
|
* Usually, the `index.html` **should not** be copied from `@m2c2kit/session` or
|
|
128
|
-
* `@m2c2kit/survey` on every build with the `extras`
|
|
174
|
+
* `@m2c2kit/survey` on every build with the `extras` option because the
|
|
129
175
|
* `index.html` file in the `src` folder should be used. Thus, the `extras`
|
|
130
176
|
* option is only for special cases, such as when creating library demos within
|
|
131
177
|
* this repository (see `@m2c2kit/assessments-demo`).
|
|
132
178
|
*
|
|
133
179
|
* @param options - {@link CopyAssetsOptions}
|
|
134
|
-
* @returns
|
|
180
|
+
* @returns the copyAssets rollup plugin
|
|
135
181
|
*/
|
|
136
182
|
declare function copyAssets(options: CopyAssetsOptions): Plugin;
|
|
137
183
|
|