Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Julli4n committed Sep 3, 2021
1 parent 745aa40 commit a5c6407
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
19 changes: 13 additions & 6 deletions middleware/deno-bundler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ const denoBundler: Middleware = {
file.originalPath!
]);

if (!bundle.stdout.length) return file.change({ shouldCommit: false });
if (!bundle.stdout.length) {
file.errors.push(new Error(bundle.stderr));
return file.change({ shouldCommit: false })
};

if (!settings?.useBabel) return file.change({
source: bundle.stdout.toString(),
path: `${file.path}.js`
});
if (!settings?.useBabel)
return file.change({
source: bundle.stdout.toString(),
path: `${file.path}.js`
});

const transformed = babel.transformSync(bundle.stdout.toString(), {
presets: [[babelPresetEnv, { targets: "> 0.25%, not dead" }]],
Expand All @@ -50,7 +54,10 @@ const denoBundler: Middleware = {
],
});

if (!transformed?.code) return file.change({ shouldCommit: false });
if (!transformed?.code) {
file.errors.push(new Error("babel.transformSync sent no code"));
return file.change({ shouldCommit: false })
};


return file.change({
Expand Down
4 changes: 2 additions & 2 deletions middleware/deno-bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "@rumblewikis/wikipages-deno-bundler-middleware",
"description": "Bundles .jsx, .tsx, .js, and .ts files into .js files using the Deno bundler for WikiPages.",
"version": "0.3.0",
"main": "out/index.js",
"types": "out/index.d.ts",
"main": "index.js",
"types": "index.d.ts",
"keywords": [
"mediawiki",
"wiki",
Expand Down
3 changes: 2 additions & 1 deletion middleware/sass-compiler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const sassCompiler: Middleware = {
source: compiled.css.toString()
})

} catch {
} catch(err) {
file.errors.push(err);
return file.change({
shouldCommit: false
});
Expand Down
4 changes: 2 additions & 2 deletions middleware/sass-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "@rumblewikis/wikipages-sass-compiler-middleware",
"description": "Compiles SASS/SCSS code for WikiPages.",
"version": "0.3.0",
"main": "out/index.js",
"types": "out/index.d.ts",
"main": "index.js",
"types": "index.d.ts",
"keywords": [
"mediawiki",
"wiki",
Expand Down

0 comments on commit a5c6407

Please sign in to comment.