Skip to content

Commit 0ea8187

Browse files
committed
Update build process and version of example
1 parent 4a78004 commit 0ea8187

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

build.mjs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@ async function compilePlugins() {
6868
return await esbuild.build({
6969
entryPoints: filesToProcess,
7070
outdir: outDir,
71+
outExtension: { '.js': '.mjs' },
7172
bundle: true,
7273
format: "esm",
73-
minify: false,
74+
minify: true,
7475
treeShaking: true,
7576
platform: "node",
7677
sourcesContent: false,
@@ -80,9 +81,9 @@ async function compilePlugins() {
8081
let source = await fs.promises.readFile(args.path, { encoding: 'utf-8' });
8182

8283
// Remove `extends FDO_SDK`, `super();`, and `import` statements
83-
source = source.replace(/extends\s+\w+\s?/g, "");
84-
source = source.replace(/super\(\);/g, "");
85-
source = source.replace(/import\s.*?;?\n/g, "");
84+
//source = source.replace(/extends\s+\w+\s?/g, "");
85+
//source = source.replace(/super\(\);/g, "");
86+
//source = source.replace(/import\s.*?;?\n/g, "");
8687

8788
return {
8889
contents: source, loader: "ts"
@@ -97,13 +98,13 @@ async function extractMetadataAndPushS3() {
9798
try {
9899
fs.readdir(outDir, function(err, files) {
99100
if (err) return {errors: [err]};
100-
files = files.filter(fn => fn.endsWith('.js'));
101+
files = files.filter(fn => fn.endsWith('.mjs'));
101102
for (const file of files) {
102103
const filePath = path.join(path.resolve(outDir), file);
103104
import(filePath).then(plugin => {
104105
const PluginClass = plugin.default;
105106
const pluginInstance = new PluginClass();
106-
const pluginName = FDO_SDK.generatePluginName(file.replace(".js", ""));
107+
const pluginName = FDO_SDK.generatePluginName(file.replace(".mjs", ""));
107108
const pluginVersion = pluginInstance.metadata.version;
108109
console.log("Plugin name: " + pluginName);
109110
console.log("Plugin version: " + pluginVersion);
@@ -113,7 +114,7 @@ async function extractMetadataAndPushS3() {
113114
if (err) throw err;
114115
const command = new PutObjectCommand({
115116
Bucket: "fdo-plugins",
116-
Key: pluginName + "/" + pluginVersion + "/" + pluginName + ".js",
117+
Key: pluginName + "/" + pluginVersion + "/" + pluginName + ".mjs",
117118
Body: data,
118119
ContentType: "application/javascript",
119120
IfNoneMatch: "*"

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"build": "node build.mjs"
66
},
77
"dependencies": {
8-
"@anikitenko/fdo-sdk": "^1.0.6",
8+
"@anikitenko/fdo-sdk": "^1.0.10",
99
"@aws-sdk/client-s3": "^3.744.0",
1010
"esbuild": "^0.25.0",
1111
"glob": "^11.0.1",

src/example_plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {FDO_SDK, FDOInterface, PluginMetadata} from '@anikitenko/fdo-sdk';
33
class MyPlugin extends FDO_SDK implements FDOInterface {
44
private readonly _metadata: PluginMetadata = {
55
name: "MyPlugin",
6-
version: "1.0.1",
6+
version: "1.0.2",
77
author: "AleXvWaN",
88
description: "A sample FDO plugin",
99
icon: "COG",

0 commit comments

Comments
 (0)