Skip to content
Snippets Groups Projects
  • Phoomparin Mano's avatar
    4ce37a25
    feat(sdk): CLI to bootstrap an embedding-ready Metabase instance (#46080) · 4ce37a25
    Phoomparin Mano authored
    
    * add setup commands
    
    * fix settings definition
    
    * update environment variables for cli
    
    * handle instances not being ready
    
    * update error messages
    
    * add more specific loading messages
    
    * loading spinner state
    
    * improve error message
    
    * use a fixed demo setup token
    
    * remove extraneous spinner
    
    * update status checks
    
    * update container messages
    
    * update wait timing
    
    * create api keys
    
    * extract constants
    
    * remove manual steps
    
    * Add anonymous tracking + other things. will need to clean up
    
    * Modify SDK for better structure
    
    * remove line from print.ts
    
    * Update webpack.embedding-sdk-cli.config.js back to production
    
    * Add types and add quick note
    
    * Fix a typo
    
    * Add index file, simplify types, use an array
    
    * Add safer json parsing
    
    * use delay of 100ms between each setup call
    
    * Suggestions from review
    
    * ensure that cli works
    
    * Attempt to fix jest errors
    
    * Remove node-fetch from sdk code to hopefully get unit tests working again
    
    * fix yarn.lock file
    
    * revert capture groups change
    
    ---------
    
    Co-authored-by: default avatarOisin Coveney <oisin@metabase.com>
    feat(sdk): CLI to bootstrap an embedding-ready Metabase instance (#46080)
    Phoomparin Mano authored
    
    * add setup commands
    
    * fix settings definition
    
    * update environment variables for cli
    
    * handle instances not being ready
    
    * update error messages
    
    * add more specific loading messages
    
    * loading spinner state
    
    * improve error message
    
    * use a fixed demo setup token
    
    * remove extraneous spinner
    
    * update status checks
    
    * update container messages
    
    * update wait timing
    
    * create api keys
    
    * extract constants
    
    * remove manual steps
    
    * Add anonymous tracking + other things. will need to clean up
    
    * Modify SDK for better structure
    
    * remove line from print.ts
    
    * Update webpack.embedding-sdk-cli.config.js back to production
    
    * Add types and add quick note
    
    * Fix a typo
    
    * Add index file, simplify types, use an array
    
    * Add safer json parsing
    
    * use delay of 100ms between each setup call
    
    * Suggestions from review
    
    * ensure that cli works
    
    * Attempt to fix jest errors
    
    * Remove node-fetch from sdk code to hopefully get unit tests working again
    
    * fix yarn.lock file
    
    * revert capture groups change
    
    ---------
    
    Co-authored-by: default avatarOisin Coveney <oisin@metabase.com>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
webpack.embedding-sdk-cli.config.js 1.36 KiB
const path = require("path");
const webpack = require("webpack");
const TerserPlugin = require("terser-webpack-plugin");

const SDK_CLI_DIST_PATH = path.join(__dirname, "/resources/embedding-sdk/dist");
const SDK_SRC_PATH = __dirname + "/enterprise/frontend/src/embedding-sdk";
const SDK_CLI_PATH = path.join(
  __dirname,
  "/enterprise/frontend/src/embedding-sdk/cli",
);

const METABASE_SRC_PATH = path.join(__dirname, "/frontend/src/metabase");

const BABEL_CONFIG = {
  cacheDirectory: process.env.BABEL_DISABLE_CACHE ? false : ".babel_cache",
};

module.exports = {
  mode: "production",
  entry: `${SDK_CLI_PATH}/cli.ts`,
  target: "node",
  context: SDK_CLI_PATH,
  output: {
    path: SDK_CLI_DIST_PATH,
    filename: "cli.js",
    library: { type: "commonjs2" },
  },
  resolve: {
    extensions: [".ts", ".js"],
    alias: {
      metabase: METABASE_SRC_PATH,
      "embedding-sdk": SDK_SRC_PATH,
    },
  },
  module: {
    rules: [
      {
        test: /\.(ts|js)$/,
        exclude: /node_modules/,
        use: [{ loader: "babel-loader", options: BABEL_CONFIG }],
      },
    ],
  },
  plugins: [
    new webpack.BannerPlugin({ banner: "#!/usr/bin/env node", raw: true }),
  ],
  optimization: {
    minimize: true,
    minimizer: [
      new TerserPlugin({
        terserOptions: { output: { comments: false } },
        extractComments: false,
      }),
    ],
  },
};