Skip to content

Commit

Permalink
Merge pull request #1633 from Logflare/staging
Browse files Browse the repository at this point in the history
Release v1.3.21
  • Loading branch information
chasers authored Jul 19, 2023
2 parents 77dbab8 + 13661d4 commit 80ad090
Show file tree
Hide file tree
Showing 34 changed files with 2,571 additions and 988 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.20
1.3.21
68 changes: 39 additions & 29 deletions assets/build.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import * as esbuild from "esbuild"
import {sassPlugin} from "esbuild-sass-plugin"
import * as path from "path"
import {copy} from "esbuild-plugin-copy"
import postcss from "postcss"
import autoprefixer from "autoprefixer"
import tailwindcss from "tailwindcss"

const watch = process.argv[2] ? true : false
import * as esbuild from "esbuild";
import { sassPlugin } from "esbuild-sass-plugin";
import * as path from "path";
import { copy } from "esbuild-plugin-copy";
import postcss from "postcss";
import autoprefixer from "autoprefixer";
import tailwindcss from "tailwindcss";
import tailwindConfig from "./tailwind.config.js";
import { globSync } from "glob";
const watch = process.argv[2] ? true : false;

if (watch) {
console.log("[ESBUILD] Initiating watch mode...")
console.log("[ESBUILD] Initiating watch mode...");
}

let externalizeCssImages = {
Expand All @@ -18,14 +19,15 @@ let externalizeCssImages = {
// Intercept import paths called "env" so esbuild doesn't attempt
// to map them to a file system location. Tag them with the "env-ns"
// namespace to reserve them for this plugin.
build.onResolve({filter: /\.png$/}, (args) => {
build.onResolve({ filter: /\.png$/ }, (args) => {
return {
path: args.path,
external: true,
}
})
};
});
},
}
};

let copyStatic = copy({
// this is equal to process.cwd(), which means we use cwd path as base path to resolve `to` path
// if not specified, this plugin uses ESBuild.build outdir/outfile options as base path.
Expand All @@ -36,32 +38,40 @@ let copyStatic = copy({
from: ["./static/**/*"],
to: ["../priv/static"],
},
// copy output css to css folder
{
from: ["../priv/static/js/*.css"],
to: ["../priv/static/css"],
},
],
})
});

// needed because we want to run the sass-plugin for tailwind content files
const watchPaths = tailwindConfig.content.flatMap((pattern) => {
return globSync(pattern, { ignore: "node_modules/**" });
});

let sassPostcssPlugin = sassPlugin({
async transform(source, resolveDir) {
const {css} = await postcss([autoprefixer, tailwindcss]).process(source)
return css
const { css } = await postcss([autoprefixer, tailwindcss]).process(source);
// specify the loader, otherwise plugin tries to resolve the files as js
// https://github.com/glromeo/esbuild-sass-plugin/blob/main/src/plugin.ts#L86
return { loader: "css", contents: css, watchFiles: watchPaths };
},
})
});

await esbuild.build({
const options = {
logLevel: "info",
watch,
entryPoints: ["js/app.js"],
bundle: true,
minify: true,
minify: watch ? false : true,
sourcemap: true,
loader: {".svg": "file", ".png": "file"},
loader: { ".svg": "file", ".png": "file" },
outfile: "../priv/static/js/app.js",
plugins: [sassPostcssPlugin, externalizeCssImages, copyStatic],
jsx: "automatic",
treeShaking: true,
treeShaking: watch ? false : true,
nodePaths: ["node_modules"],
})
color: true,
};
if (watch) {
let ctx = await esbuild.context(options);
await ctx.watch();
} else {
await esbuild.build(options);
}
3 changes: 0 additions & 3 deletions assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import "./vendor/daterangepicker.css";

// interfaces
import * as Interfaces from "./interfaces";
import * as Components from "./components";

let csrfToken = document
.querySelector("meta[name='csrf-token']")
Expand All @@ -38,8 +37,6 @@ const liveReactHooks = { LiveReact };

window.Components = { LogEventsChart, Loader, AdminChart: Chart };
window.Interfaces = Interfaces;
// todo: merge with window.Components
window.Comp = Components;
window.Dashboard = Dashboard;
window.Logs = Logs;
window.Source = Source;
Expand Down
40 changes: 0 additions & 40 deletions assets/js/components/SubHeader.jsx

This file was deleted.

1 change: 0 additions & 1 deletion assets/js/components/index.js

This file was deleted.

13 changes: 0 additions & 13 deletions assets/js/interfaces/EndpointNotFound.jsx

This file was deleted.

35 changes: 0 additions & 35 deletions assets/js/interfaces/EndpointsIntro.jsx

This file was deleted.

2 changes: 0 additions & 2 deletions assets/js/interfaces/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export {default as EndpointEditor} from "./EndpointEditor.jsx"
export {default as EndpointsBrowserList} from "./EndpointsBrowserList.jsx"
export {default as EndpointNotFound} from "./EndpointNotFound.jsx"
export {default as ShowEndpoint} from "./ShowEndpoint.jsx"
export {default as EndpointsIntro} from "./EndpointsIntro.jsx"
Loading

0 comments on commit 80ad090

Please sign in to comment.