-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create structure, dependencies for development
- Loading branch information
0 parents
commit b274be5
Showing
10 changed files
with
1,278 additions
and
0 deletions.
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,6 @@ | ||
node_modules | ||
build | ||
.DS_Store | ||
*.log | ||
.idea | ||
test |
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,12 @@ | ||
# Serenade for Hyper | ||
|
||
## Development | ||
|
||
1. Clone this repo, and run `ln -s <path> ~/.hyper_plugins/local/serenade-hyper` to create a symlink. | ||
1. In the menu bar, use Hyper > Preferences to open the preferences file, and towards the bottom, set: | ||
``` | ||
localPlugins: [ | ||
"serenade-hyper" | ||
], | ||
``` | ||
1. Run `yarn` to get dependencies, then `yarn watch` to build. |
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,27 @@ | ||
{ | ||
"name": "serenade-hyper", | ||
"version": "0.0.1", | ||
"description": "Serenade for Hyper", | ||
"main": "build/main.js", | ||
"author": "Serenade", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "webpack --mode development", | ||
"watch": "webpack --mode development --watch" | ||
}, | ||
"devDependencies": { | ||
"@types/mkdirp": "^1.0.1", | ||
"@types/uuid": "^8.3.0", | ||
"@types/ws": "^7.4.0", | ||
"prettier": "^2.2.1", | ||
"ts-loader": "^8.0.17", | ||
"typescript": "^3.9.7", | ||
"webpack": "^5.22.0", | ||
"webpack-cli": "^4.5.0" | ||
}, | ||
"dependencies": { | ||
"mkdirp": "^1.0.4", | ||
"uuid": "^8.3.1", | ||
"ws": "^7.4.1" | ||
} | ||
} |
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,20 @@ | ||
import IPC from "./shared/ipc"; | ||
|
||
/* | ||
* The CommandHandler class is a wrapper around other handlers | ||
* for each category of commands. | ||
* | ||
* This needs to be composed with "mixins" since TypeScript currently | ||
* only allows extending one class. | ||
*/ | ||
|
||
export class CommandHandler { | ||
// We can use the extension's IPC to send messages back to the client if needed | ||
ipc?: IPC; | ||
|
||
setIPC(ipc: IPC) { | ||
this.ipc = ipc; | ||
} | ||
} | ||
|
||
export default CommandHandler; |
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,48 @@ | ||
import CommandHandler from "./command-handler"; | ||
import IPC from "./shared/ipc"; | ||
|
||
export const onRendererWindow = (window: any) => { | ||
let commandHandler: CommandHandler; | ||
let ipc: IPC; | ||
|
||
function resetAndConnect() { | ||
commandHandler = new CommandHandler(); | ||
ipc = new IPC(commandHandler, "hyper"); | ||
commandHandler.setIPC(ipc); | ||
|
||
ipc.start(); | ||
} | ||
|
||
// resetAndConnect(); | ||
}; | ||
|
||
export const middleware = () => (next: any) => (action: any) => { | ||
console.log("middleware:", action); | ||
|
||
next(action); | ||
}; | ||
|
||
export const reduceUI = (state: any, action: any) => { | ||
console.log("reduceUI:", state, action); | ||
return state; | ||
} | ||
|
||
export const reduceSessions = (state: any, action: any) => { | ||
console.log("reduceSessions:", state, action); | ||
return state; | ||
} | ||
|
||
export const reduceTermGroups = (state: any, action: any) => { | ||
console.log("reduceTermGroups:", state, action); | ||
return state; | ||
} | ||
|
||
export const getTermProps = (uid: any, parentProps: any, props: any) => { | ||
console.log("getTermProps:", uid, parentProps, props); | ||
return props; | ||
} | ||
|
||
export const mapHyperState = (state: any, map: any) => { | ||
console.log("mapHyperState:", state, map); | ||
return map; | ||
} |
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 @@ | ||
../../editor-shared/src |
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 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"*": ["types/*"] | ||
}, | ||
"module": "commonjs", | ||
"target": "es5", | ||
"outDir": "dist", | ||
"lib": ["es2015", "dom"], | ||
"sourceMap": true, | ||
"rootDir": "src", | ||
"strict": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noUnusedParameters": true, | ||
"preserveSymlinks": true, | ||
"esModuleInterop": true | ||
}, | ||
"exclude": ["node_modules"] | ||
} |
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,15 @@ | ||
{ | ||
"rules": { | ||
"no-string-throw": true, | ||
"no-unused-expression": true, | ||
"no-duplicate-variable": true, | ||
"curly": true, | ||
"class-name": true, | ||
"semicolon": [ | ||
true, | ||
"always" | ||
], | ||
"triple-equals": true | ||
}, | ||
"defaultSeverity": "warning" | ||
} |
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,36 @@ | ||
"use strict"; | ||
|
||
const path = require("path"); | ||
|
||
const config = { | ||
name: "serenade-hyper", | ||
target: "web", | ||
entry: "./src/index.ts", | ||
output: { | ||
path: path.resolve(__dirname, "build"), | ||
filename: "[name].js", | ||
// This is necessary for exports to work correctly with Hyper! | ||
libraryTarget: 'commonjs2', | ||
}, | ||
resolve: { | ||
extensions: [".tsx", ".ts", ".js"], | ||
symlinks: false | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
exclude: /node_modules/, | ||
test: /\.tsx?$/, | ||
use: "ts-loader" | ||
} | ||
] | ||
} | ||
} | ||
|
||
module.exports = (env, argv) => { | ||
if (argv.mode === 'development') { | ||
config.devtool = 'cheap-module-source-map'; | ||
} | ||
|
||
return config; | ||
}; |
Oops, something went wrong.