Skip to content

Commit

Permalink
feat: add penx agent
Browse files Browse the repository at this point in the history
  • Loading branch information
0xzio committed Jan 24, 2024
1 parent 137246a commit caf5f63
Show file tree
Hide file tree
Showing 32 changed files with 4,236 additions and 281 deletions.
1 change: 1 addition & 0 deletions apps/penx-agent/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DB_HOST=127.0.0.1
1 change: 1 addition & 0 deletions apps/penx-agent/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DB_HOST=127.0.0.1
16 changes: 16 additions & 0 deletions apps/penx-agent/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/electron",
"plugin:import/typescript"
],
"parser": "@typescript-eslint/parser"
}
37 changes: 37 additions & 0 deletions apps/penx-agent/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release
# on:
# release:
# types:
# - created

on:
push:
tags:
- 'v*'

jobs:
build:
strategy:
matrix:
os:
[
{ name: 'linux', image: 'ubuntu-latest' },
{ name: 'windows', image: 'windows-latest' },
{ name: 'macos', image: 'macos-latest' },
]
runs-on: ${{ matrix.os.image }}
steps:
- name: Github checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install
- name: Publish app
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run publish
92 changes: 92 additions & 0 deletions apps/penx-agent/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock
.DS_Store

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# Webpack
.webpack/

# Vite
.vite/

# Electron-Forge
out/
7 changes: 7 additions & 0 deletions apps/penx-agent/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 80
}
Binary file added apps/penx-agent/assets/icons/penx.icns
Binary file not shown.
Binary file added apps/penx-agent/assets/icons/penx.ico
Binary file not shown.
Binary file added apps/penx-agent/assets/icons/penx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions apps/penx-agent/assets/icons/penx.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/penx-agent/assets/images/penx-agent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions apps/penx-agent/forge.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import * as path from 'node:path'

import type { ForgeConfig } from '@electron-forge/shared-types'
import { MakerSquirrel } from '@electron-forge/maker-squirrel'
import { MakerZIP } from '@electron-forge/maker-zip'
import { MakerDeb } from '@electron-forge/maker-deb'
import { MakerRpm } from '@electron-forge/maker-rpm'
import { MakerDMG } from '@electron-forge/maker-dmg'
// import { MakerPKG } from "@electron-forge/maker-pkg";
import { AutoUnpackNativesPlugin } from '@electron-forge/plugin-auto-unpack-natives'
import { WebpackPlugin } from '@electron-forge/plugin-webpack'

import { mainConfig } from './webpack.main.config'
import { rendererConfig } from './webpack.renderer.config'
import packageJson from './package.json'

const { version } = packageJson
const iconDir = path.resolve(__dirname, 'assets', 'icons')
const root = process.cwd()

const config: ForgeConfig = {
packagerConfig: {
asar: true,
name: 'PenX Agent',
executableName: 'penx-agent',
appBundleId: 'com.penxio.penx-agent',
icon: path.resolve(__dirname, 'assets', 'icons', 'penx'),
},
rebuildConfig: {},
makers: [
new MakerSquirrel({}),
new MakerZIP({}, ['darwin']),
new MakerRpm({}),
new MakerDeb(),
new MakerDMG({
format: 'ULFO',
}),
],
publishers: [
{
name: '@electron-forge/publisher-github',
config: {
repository: {
owner: 'penxio',
name: 'penx-agent',
},
// prerelease: true,
// prerelease: false,
draft: true,
},
},
],
plugins: [
new AutoUnpackNativesPlugin({}),
new WebpackPlugin({
port: 3003,
devContentSecurityPolicy:
"default-src 'self' 'unsafe-eval' 'unsafe-inline' static: http: https: ws:",
mainConfig,
renderer: {
config: rendererConfig,
entryPoints: [
{
html: './src/index.html',
js: './src/renderer.ts',
name: 'main_window',

preload: {
js: './src/preload.ts',
},
},
],
},
}),
],
}

export default config
66 changes: 66 additions & 0 deletions apps/penx-agent/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "penx-agent",
"productName": "PenX Agent",
"version": "0.0.3",
"description": "Penx",
"main": ".webpack/main",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "eslint --ext .ts,.tsx ."
},
"keywords": [],
"author": {
"name": "0xzion",
"email": "[email protected]"
},
"license": "MIT",
"devDependencies": {
"@electron-forge/cli": "^7.2.0",
"@electron-forge/maker-deb": "^7.2.0",
"@electron-forge/maker-dmg": "^7.2.0",
"@electron-forge/maker-pkg": "^7.2.0",
"@electron-forge/maker-rpm": "^7.2.0",
"@electron-forge/maker-squirrel": "^7.2.0",
"@electron-forge/maker-zip": "^7.2.0",
"@electron-forge/plugin-auto-unpack-natives": "^7.2.0",
"@electron-forge/plugin-webpack": "^7.2.0",
"@electron-forge/publisher-github": "^7.2.0",
"@types/body-parser": "^1.19.5",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@types/uuid": "^9.0.7",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"@vercel/webpack-asset-relocator-loader": "1.7.3",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^6.0.0",
"dotenv": "^16.3.2",
"dotenv-webpack": "^8.0.1",
"electron": "28.1.4",
"eslint": "^8.0.1",
"eslint-plugin-import": "^2.25.0",
"fork-ts-checker-webpack-plugin": "^7.2.13",
"node-loader": "^2.0.0",
"prettier": "^3.2.4",
"style-loader": "^3.0.0",
"ts-loader": "^9.2.2",
"ts-node": "^10.0.0",
"typescript": "~4.5.4"
},
"dependencies": {
"@fower/react": "^2.0.0",
"body-parser": "^1.20.2",
"cors": "^2.8.5",
"electron-squirrel-startup": "^1.0.0",
"express": "^4.18.2",
"fs-jetpack": "^5.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"uuid": "^9.0.1"
}
}
7 changes: 7 additions & 0 deletions apps/penx-agent/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# PenX Agent

PenX Agent is a proxy between PenX App and quick input client.

With PenX Agent, you can input note quickly in PenX chrome extension, PenX CLI, PenX Raycast plugin, PenX Alfred plugin...

![](https://github.com/penxio/penx-agent/blob/main/assets/images/penx-agent.png)
6 changes: 6 additions & 0 deletions apps/penx-agent/src/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { createRoot } from 'react-dom/client'
import { PageHome } from './pages/home'

const root = createRoot(document.getElementById('penx-root'))

root.render(<PageHome />)
Binary file added apps/penx-agent/src/assets/images/penx-agent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions apps/penx-agent/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
Arial, sans-serif;
margin: auto;
max-width: 38rem;
padding: 2rem;
}
15 changes: 15 additions & 0 deletions apps/penx-agent/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8" />
<title>PenX Agent</title>

</head>

<div id="penx-root"></div>

<body>
</body>

</html>
Loading

0 comments on commit caf5f63

Please sign in to comment.