Skip to content

Commit fb4adc1

Browse files
committed
build: updated tests and files
1 parent 3607609 commit fb4adc1

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

files/create-plugin/src/PluginInstance.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export class PluginInstance implements IContainerPlugin {
1010
}
1111

1212
async init(): Promise<void> {
13-
// add your plugin initialization here
13+
// add your plugin initialization here, replace the empty promise
14+
return await Promise.resolve();
1415
}
1516
}

files/create-plugin/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ class Plugin implements IPlugin {
2020

2121
loadOptions(_options: Options, _source?: ISourceOptions): void {
2222
if (!this.needsPlugin()) {
23+
// ignore plugin options when not needed
24+
2325
return;
2426
}
2527

2628
// Load your options here
2729
}
2830

2931
needsPlugin(_options?: ISourceOptions): boolean {
30-
return true; // add your condition here
32+
return true; // add your condition here, replace true with condition if needed
3133
}
3234
}
3335

files/create-preset/src/bundle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { loadTemplatePreset } from ".";
22
import { tsParticles } from "@tsparticles/engine";
33

4-
loadTemplatePreset(tsParticles);
4+
void loadTemplatePreset(tsParticles);
55

66
export { loadTemplatePreset, tsParticles };

files/create-preset/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { options } from "./options";
55
*
66
* @param engine - the engine instance to load the preset into
77
*/
8-
export function loadTemplatePreset(engine: Engine): void {
8+
export async function loadTemplatePreset(engine: Engine): Promise<void> {
99
// TODO: additional modules must be loaded here
1010

1111
// Adds the preset to the engine, with the given options
12-
engine.addPreset("#template#", options);
12+
await engine.addPreset("#template#", options);
1313
}

tests/create-preset.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { createPresetTemplate } from "../src/create/preset/create-preset";
44
import path from "path";
55
import fs from "fs-extra";
66

7-
describe("create-plugin", async () => {
7+
describe("create-preset", async () => {
88
it("should have created the preset project", async () => {
99
const destDir = path.resolve(path.join(__dirname, "tmp-files", "foo-preset"));
1010

0 commit comments

Comments
 (0)