diff --git a/.gitignore b/.gitignore index 61f39dc..d91e351 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ *.log *.tsbuildinfo -*.d.ts *.pem *.tgz .data diff --git a/src/globals.d.ts b/src/globals.d.ts new file mode 100644 index 0000000..49c3676 --- /dev/null +++ b/src/globals.d.ts @@ -0,0 +1 @@ +declare const TB_VERSION: string | undefined; diff --git a/src/textblock.ts b/src/textblock.ts index 2605316..5c74226 100644 --- a/src/textblock.ts +++ b/src/textblock.ts @@ -146,6 +146,8 @@ export interface TextblockTarget { * additional configurations. */ export const Textblock = (blocks: TextblockTarget[], options?: TextblockOptions) => { + console.log(`[TB] Textblock v${TB_VERSION || "🤔"}`); + const { debounce = 200, debug = false } = options || ({} as TextblockOptions); if (typeof window !== "undefined") { diff --git a/webpack.config.js b/webpack.config.js index 6617279..9c72e10 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,8 @@ // JSON Schema: https://json.schemastore.org/webpack const TerserPlugin = require("terser-webpack-plugin"); +const { version } = require("./package.json"); +const webpack = require("webpack"); module.exports = (env, argv) => { return { @@ -26,6 +28,11 @@ module.exports = (env, argv) => { output: { filename: "textblock.min.js", path: __dirname + "/dist" - } + }, + plugins: [ + new webpack.DefinePlugin({ + TB_VERSION: JSON.stringify(version) + }) + ] }; };