-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
base: release
Are you sure you want to change the base?
Changes from 4 commits
4909464
8c5dfb9
c51e46d
488d615
1bef3ac
4287ae7
fd288d0
fbc9fc1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,16 @@ | |
"main": "src/index.ts", | ||
"author": "Valera Melnikov <[email protected]>, Pawan Kumar <[email protected]>", | ||
"license": "MIT", | ||
"type": "module", | ||
"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:^", | ||
|
@@ -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" | ||
} | ||
} |
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify 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 |
||
resolve({ | ||
extensions: [".js", ".jsx", ".ts", ".tsx"], | ||
browser: true, | ||
preferBuiltins: false, | ||
dedupe: EXTERNALS, | ||
}), | ||
], | ||
}); |
This file was deleted.
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; |
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, | ||
}, | ||
]; | ||
} |
There was a problem hiding this comment.
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.