Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add rollup config for wds #39397

Open
wants to merge 8 commits into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
"babel-plugin-module-resolver": "^4.1.0",
"babel-plugin-named-asset-import": "^0.3.8",
"babel-preset-react-app": "^10.0.1",
"browserslist": "^4.18.1",
"browserslist": "^4.24.4",
"case-sensitive-paths-webpack-plugin": "^2.4.0",
"chalk": "^4.1.1",
"compression-webpack-plugin": "^10.0.0",
Expand Down Expand Up @@ -398,7 +398,7 @@
"xlsx": "https://cdn.sheetjs.com/xlsx-0.19.3/xlsx-0.19.3.tgz"
},
"resolutions": {
"browserslist": "4.20.3",
"browserslist": "4.24.4",
"chokidar": "3.5.3",
"css-select": "4.1.3",
"ejs": "3.1.10",
Expand Down
2 changes: 1 addition & 1 deletion app/client/packages/design-system/widgets/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const esModules = ["remark-gfm"].join("|");

module.exports = {
export default {
preset: "ts-jest",
roots: ["<rootDir>/src"],
setupFiles: ["<rootDir>../../../test/__mocks__/reactMarkdown.tsx"],
Expand Down
33 changes: 29 additions & 4 deletions app/client/packages/design-system/widgets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@
"main": "src/index.ts",
"author": "Valera Melnikov <[email protected]>, Pawan Kumar <[email protected]>",
"license": "MIT",
"type": "module",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to check if this affects the current work of the package in the main app.

"files": [
"build"
],
"scripts": {
"lint": "yarn g:lint",
"prettier": "yarn g:prettier",
"test:unit": "yarn g:jest",
"build:icons": "npx tsx ./src/scripts/build-icons.ts"
"build:icons": "npx tsx ./src/scripts/build-icons.ts",
"build:package": "rm -rf build && rollup -c rollup.config.js"
},
"dependencies": {
"@appsmith/wds-headless": "workspace:^",
Expand All @@ -34,12 +39,32 @@
"usehooks-ts": "*"
},
"devDependencies": {
"@babel/core": "^7.26.9",
"@babel/helper-compilation-targets": "^7.26.5",
"@babel/preset-env": "^7.26.9",
"@babel/preset-react": "^7.26.3",
"@babel/preset-typescript": "^7.26.0",
"@babel/runtime": "^7.26.9",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^28.0.2",
"@rollup/plugin-image": "^3.0.3",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-replace": "^6.0.2",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.2",
"@rollup/plugin-url": "^8.0.2",
"@types/fs-extra": "^11.0.4",
"@types/react-syntax-highlighter": "^15.5.13",
"@types/react-transition-group": "^4.4.11",
"eslint-plugin-storybook": "^0.6.10"
"@types/react-transition-group": "^4.4.12",
"browserslist": "^4.24.4",
"eslint-plugin-storybook": "^0.11.3",
"postcss-import": "^16.1.0",
"rollup": "^4.34.8",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-postcss": "^4.0.2"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
}
}
93 changes: 93 additions & 0 deletions app/client/packages/design-system/widgets/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import path from "path";
import { dirname } from "path";
import { fileURLToPath } from "url";
import { defineConfig } from "rollup";

import postcssNesting from "postcss-nesting";
import postcssImport from "postcss-import";
import postcssAtRulesVariables from "postcss-at-rules-variables";
import postcssEach from "postcss-each";
import postcssModulesValues from "postcss-modules-values";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

import json from "@rollup/plugin-json";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "@rollup/plugin-typescript";
import postcss from "rollup-plugin-postcss";
import babel from "@rollup/plugin-babel";
import replace from "@rollup/plugin-replace";

const BUILD_DIR = path.resolve(__dirname, "build");

const EXTERNALS = ["react", "react-dom"];

export default defineConfig({
input: path.resolve(__dirname, "src/index.ts"),
output: {
file: path.resolve(BUILD_DIR, "bundle.js"),
format: "esm",
sourcemap: true,
inlineDynamicImports: true,
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
external: EXTERNALS,
plugins: [
json(),
replace({
preventAssignment: true,
values: {
"process.env.NODE_ENV": JSON.stringify("production"),
"process.env.REACT_APP_ENV": JSON.stringify("production"),
},
}),
commonjs({
include: /node_modules/,
transformMixedEsModules: true,
requireReturnsDefault: "preferred",
esmExternals: true,
}),
babel({
exclude: "node_modules/**",
babelHelpers: "bundled",
extensions: [".js", ".jsx", ".ts", ".tsx"],
presets: [
["@babel/preset-react", { runtime: "automatic" }],
["@babel/preset-typescript", { isTSX: true, allExtensions: true }],
],
skipPreflightCheck: true,
babelrc: false,
configFile: false,
}),
postcss({
modules: true,
minimize: true,
sourceMap: true,
plugins: [
postcssNesting(),
postcssImport(),
postcssAtRulesVariables(),
postcssEach(),
postcssModulesValues(),
],
}),
typescript({
tsconfig: "./tsconfig.json",
declaration: true,
declarationDir: path.resolve(BUILD_DIR),
rootDir: "src",
outDir: path.resolve(BUILD_DIR),
}),
Comment on lines +79 to +85
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify TypeScript configuration exists.

Make sure the referenced tsconfig.json exists and has compatible settings.


🏁 Script executed:

#!/bin/bash
# Check if tsconfig.json exists and has compatible settings
if [ -f "./tsconfig.json" ]; then
  echo "tsconfig.json exists"
  grep -E "\"jsx\":|\"jsxFactory\":|\"target\":|\"module\":" ./tsconfig.json
else
  echo "tsconfig.json does not exist"
fi

Length of output: 95


Action Required: Update the TypeScript configuration reference.

The rollup configuration references ./tsconfig.json (lines 79–85), but our check confirms that this file does not exist in the repo root. Please add the missing tsconfig.json with the necessary settings (such as "jsx", "target", "module", etc.) or update the reference path to point to the correct location.

resolve({
extensions: [".js", ".jsx", ".ts", ".tsx"],
browser: true,
preferBuiltins: false,
dedupe: EXTERNALS,
}),
],
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { Hotkey, Hotkeys, HotkeysTarget } from "@blueprintjs/core";
import { Hotkey, Hotkeys } from "@blueprintjs/core";
import type { SearchItem, SelectEvent } from "./utils";

interface Props {
Expand All @@ -15,7 +15,6 @@ interface Props {
children: React.ReactNode;
}

@HotkeysTarget
class GlobalSearchHotKeys extends React.Component<Props> {
get hotKeysConfig() {
return [
Expand Down
25 changes: 0 additions & 25 deletions app/client/src/git/components/HotKeys/HotKeysView.tsx

This file was deleted.

9 changes: 3 additions & 6 deletions app/client/src/git/components/HotKeys/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from "react";
import HotKeysView from "./HotKeysView";
import { useHotKeysView } from "./useHotKeysView";
import useOps from "git/hooks/useOps";

function HotKeys() {
export function useHotKeys() {
const { toggleOpsModal } = useOps();

return <HotKeysView toggleOpsModal={toggleOpsModal} />;
return useHotKeysView({ toggleOpsModal });
}

export default HotKeys;
22 changes: 22 additions & 0 deletions app/client/src/git/components/HotKeys/useHotKeysView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { GitOpsTab } from "git/constants/enums";
import noop from "lodash/noop";
import { useCallback } from "react";

interface HotKeysViewProps {
toggleOpsModal: (show: boolean, tab?: GitOpsTab.Deploy) => void;
}

export function useHotKeysView({ toggleOpsModal = noop }: HotKeysViewProps) {
const handleCommitModal = useCallback(() => {
toggleOpsModal(true, GitOpsTab.Deploy);
}, [toggleOpsModal]);

return [
{
combo: "ctrl + shift + g",
global: true,
label: "Show git commit modal",
onKeyDown: handleCommitModal,
},
];
}
2 changes: 1 addition & 1 deletion app/client/src/git/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
export { GitArtifactType, GitOpsTab } from "./constants/enums";

// components
export { useHotKeys } from "./components/HotKeys";
export { default as GitContextProvider } from "./components/GitContextProvider";
export { default as GitModals } from "./ee/components/GitModals";
export { default as GitImportModal } from "./components/ImportModal";
Expand All @@ -10,7 +11,6 @@ export { default as GitQuickActions } from "./components/QuickActions";
export { default as GitProtectedBranchCallout } from "./components/ProtectedBranchCallout";
export { default as GitGlobalProfile } from "./components/GlobalProfile";
export { default as GitDeployMenuItems } from "./components/DeployMenuItems";
export { default as GitHotKeys } from "./components/HotKeys";
export { default as GitCardBadge } from "./components/CardBadge";

export type { ConnectSuccessPayload as GitConnectSuccessPayload } from "./store/actions/connectActions";
Loading
Loading