-
Notifications
You must be signed in to change notification settings - Fork 127
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
feat: add radix ui example #66
Open
bestony
wants to merge
2
commits into
PlasmoHQ:main
Choose a base branch
from
bestony:feat/add-radix-example
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: "Submit to Web Store" | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Cache pnpm modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: latest | ||
run_install: true | ||
- name: Use Node.js 16.x | ||
uses: actions/[email protected] | ||
with: | ||
node-version: 16.x | ||
cache: "pnpm" | ||
- name: Build the extension | ||
run: pnpm build | ||
- name: Package the extension into a zip artifact | ||
run: pnpm package | ||
- name: Browser Platform Publish | ||
uses: PlasmoHQ/bpp@v3 | ||
with: | ||
keys: ${{ secrets.SUBMIT_KEYS }} | ||
artifact: build/chrome-mv3-prod.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
out/ | ||
build/ | ||
dist/ | ||
|
||
# plasmo | ||
.plasmo | ||
|
||
# typescript | ||
.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @type {import('prettier').Options} | ||
*/ | ||
export default { | ||
printWidth: 80, | ||
tabWidth: 2, | ||
useTabs: false, | ||
semi: false, | ||
singleQuote: false, | ||
trailingComma: "none", | ||
bracketSpacing: true, | ||
bracketSameLine: true, | ||
plugins: ["@ianvs/prettier-plugin-sort-imports"], | ||
importOrder: [ | ||
"<BUILTIN_MODULES>", // Node.js built-in modules | ||
"<THIRD_PARTY_MODULES>", // Imports not matched by other special words or groups. | ||
"", // Empty line | ||
"^@plasmo/(.*)$", | ||
"", | ||
"^@plasmohq/(.*)$", | ||
"", | ||
"^~(.*)$", | ||
"", | ||
"^[./]" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
This is a [Plasmo extension](https://docs.plasmo.com/) project bootstrapped with [`plasmo init`](https://www.npmjs.com/package/plasmo). | ||
|
||
## Getting Started | ||
|
||
First, run the development server: | ||
|
||
```bash | ||
pnpm dev | ||
# or | ||
npm run dev | ||
``` | ||
|
||
Open your browser and load the appropriate development build. For example, if you are developing for the chrome browser, using manifest v3, use: `build/chrome-mv3-dev`. | ||
|
||
You can start editing the popup by modifying `popup.tsx`. It should auto-update as you make changes. To add an options page, simply add a `options.tsx` file to the root of the project, with a react component default exported. Likewise to add a content page, add a `content.ts` file to the root of the project, importing some module and do some logic, then reload the extension on your browser. | ||
|
||
For further guidance, [visit our Documentation](https://docs.plasmo.com/) | ||
|
||
## Making production build | ||
|
||
Run the following: | ||
|
||
```bash | ||
pnpm build | ||
# or | ||
npm run build | ||
``` | ||
|
||
This should create a production bundle for your extension, ready to be zipped and published to the stores. | ||
|
||
## Submit to the webstores | ||
|
||
The easiest way to deploy your Plasmo extension is to use the built-in [bpp](https://bpp.browser.market) GitHub action. Prior to using this action however, make sure to build your extension and upload the first version to the store to establish the basic credentials. Then, simply follow [this setup instruction](https://docs.plasmo.com/framework/workflows/submit) and you should be on your way for automated submission! |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import styleText from "data-text:@radix-ui/themes/styles.css" | ||
import { Button, Theme } from '@radix-ui/themes'; | ||
import { BookmarkIcon } from '@radix-ui/react-icons'; | ||
import type { PlasmoGetStyle } from "plasmo" | ||
|
||
|
||
export const getStyle: PlasmoGetStyle = () => { | ||
const style = document.createElement("style") | ||
style.textContent = styleText.replaceAll(':root', ':host(plasmo-csui)'); | ||
return style | ||
} | ||
|
||
const CustomButton = () => { | ||
return (<Theme isRoot={false}> | ||
<Button variant="classic"> | ||
<BookmarkIcon /> Hello World | ||
</Button> | ||
</Theme>) | ||
} | ||
|
||
export default CustomButton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "with-radix", | ||
"displayName": "With radix", | ||
"version": "0.0.1", | ||
"description": "A basic Plasmo extension.", | ||
"author": "Plasmo Corp. <[email protected]>", | ||
"scripts": { | ||
"dev": "plasmo dev", | ||
"build": "plasmo build", | ||
"package": "plasmo package" | ||
}, | ||
"dependencies": { | ||
"@radix-ui/react-icons": "^1.3.0", | ||
"@radix-ui/themes": "^3.1.3", | ||
"plasmo": "0.88.0", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@ianvs/prettier-plugin-sort-imports": "4.1.1", | ||
"@types/chrome": "0.0.258", | ||
"@types/node": "20.11.5", | ||
"@types/react": "18.2.48", | ||
"@types/react-dom": "18.2.18", | ||
"prettier": "3.2.4", | ||
"typescript": "5.3.3" | ||
Comment on lines
+13
to
+26
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. let's align these with all the other examples in this repo - plasmo should use workspace, and semver should be fixed |
||
}, | ||
"manifest": { | ||
"host_permissions": [ | ||
"https://*/*" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useState } from "react" | ||
import { Theme, Text,Link } from "@radix-ui/themes" | ||
import '@radix-ui/themes/styles.css'; | ||
|
||
function IndexPopup() { | ||
const [data, setData] = useState("") | ||
|
||
return ( | ||
<Theme> | ||
<div | ||
style={{ | ||
padding: 16 | ||
}}> | ||
<Text size="2"> | ||
Welcome to your{" "} | ||
<a href="https://www.plasmo.com" target="_blank"> | ||
Plasmo | ||
</a>{" "} | ||
Extension! | ||
</Text> | ||
<input onChange={(e) => setData(e.target.value)} value={data} /> | ||
<Link href="https://docs.plasmo.com" target="_blank">View Docs</Link> | ||
|
||
</div> | ||
</Theme> | ||
) | ||
} | ||
|
||
export default IndexPopup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"extends": "plasmo/templates/tsconfig.base", | ||
"exclude": [ | ||
"node_modules" | ||
], | ||
"include": [ | ||
".plasmo/index.d.ts", | ||
"./**/*.ts", | ||
"./**/*.tsx" | ||
], | ||
"compilerOptions": { | ||
"paths": { | ||
"~*": [ | ||
"./*" | ||
] | ||
}, | ||
"baseUrl": "." | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit: this should be removed
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.
done