-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonathan Staab
committed
Jul 7, 2023
0 parents
commit c5e830c
Showing
17 changed files
with
629 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,4 @@ | ||
--ignore-dir=node_modules | ||
--ignore-dir=dist | ||
--ignore-file=match:package-lock.json | ||
|
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,2 @@ | ||
node_modules | ||
android |
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,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
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 @@ | ||
.cache/ | ||
.idea/ | ||
.vs/ | ||
.vscode/ | ||
docs/ | ||
node_modules/ | ||
lib/ | ||
src/ | ||
|
||
.gitignore | ||
.npmrc | ||
.prettierrc | ||
favicon.svg | ||
index.html | ||
nodemon.json | ||
package-lock.json | ||
tsconfig.json | ||
vite.config.js | ||
yarn-error.log | ||
yarn.lock |
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,11 @@ | ||
{ | ||
"arrowParens": "always", | ||
"bracketSpacing": true, | ||
"jsxBracketSameLine": true, | ||
"jsxSingleQuote": false, | ||
"printWidth": 80, | ||
"semi": true, | ||
"singleQuote": false, | ||
"tabWidth": 2, | ||
"trailingComma": "es5" | ||
} |
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 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Jon Staab | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 @@ | ||
# OstrichScript | ||
|
||
OstrichScript is a convention for extending nostr clients with user-defined functionality. | ||
Extensions are written in lua so that they are easy to write, and easy to sandbox in any client. | ||
|
||
The basic idea is that a script can export any number of functions which can then be called from | ||
javascript to augment a client's functionality with highly customized user scripts. | ||
|
||
You can learn lua by following along with [programming in lua](https://www.lua.org/pil/contents.html). | ||
|
||
You can write, edit, publish, and delete extensions using [Ostrich Editor](). | ||
|
||
# Interface | ||
|
||
A script may export any of the following functions: | ||
|
||
``` | ||
filterEvent(event: NostrEvent): boolean | ||
``` | ||
|
||
Functions are expected to be synchronous, but are awaited by this library. | ||
|
||
# Implementations | ||
|
||
Currently OstricScript is implemented in the following clients: | ||
|
||
(none yet) | ||
|
||
|
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,24 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="favicon.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>vite-library-template</title> | ||
|
||
<link | ||
rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css" | ||
/> | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Inter:wght@100;300;400;600;700&display=swap" | ||
rel="stylesheet" | ||
/> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
</html> |
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,3 @@ | ||
export const testFunction = (name: string) => { | ||
console.log(`Hello, ${name}!`); | ||
}; |
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,43 @@ | ||
{ | ||
"name": "vite-library-template", | ||
"version": "0.0.1", | ||
"description": "A template for JavaScript/TypeScript library projects using Vite as a bundler.", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/yuigoto/vite-library-template.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/yuigoto/vite-library-template/issues" | ||
}, | ||
"homepage": "https://github.com/yuigoto/vite-library-template/tree/main#readme", | ||
"keywords": [ | ||
"javascript", | ||
"typescript" | ||
], | ||
"files": [ | ||
"dist" | ||
], | ||
"author": "Fabio Y. Goto <[email protected]>", | ||
"license": "MIT", | ||
"main": "./dist/index.umd.js", | ||
"module": "./dist/index.es.js", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.es.js", | ||
"require": "./dist/index.umd.js", | ||
"default": "./dist/index.es.js" | ||
} | ||
}, | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"preview": "vite preview" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^8.3.0", | ||
"sass": "^1.45.1", | ||
"tslib": "^2.3.1", | ||
"typescript": "^4.4.4", | ||
"vite": "^2.7.2" | ||
} | ||
} |
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,8 @@ | ||
#app { | ||
font-family: Avenir, Helvetica, Arial, sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
text-align: center; | ||
color: #2c3e50; | ||
margin-top: 60px; | ||
} |
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,10 @@ | ||
import { testFunction } from "lib"; | ||
import "./main.scss"; | ||
|
||
testFunction("Fabio"); | ||
|
||
const app = document.querySelector<HTMLDivElement>('#app')!; | ||
|
||
app.innerHTML = ` | ||
<h1>Vite Library Template!</h1> | ||
` |
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 @@ | ||
/// <reference types="vite/client" /> |
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,45 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"*": ["src/*"], | ||
"lib/*": ["lib/*"] | ||
}, | ||
"allowJs": true, | ||
"allowSyntheticDefaultImports": true, | ||
"declaration": true, | ||
"declarationDir": "dist", | ||
"emitDecoratorMetadata": true, | ||
"esModuleInterop": true, | ||
"experimentalDecorators": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"lib": [ | ||
"ES5", | ||
"ES6", | ||
"ES7", | ||
"ESNext", | ||
"DOM", | ||
"DOM.Iterable", | ||
"ES2015.Core" | ||
], | ||
"isolatedModules": false, | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"noEmit": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"removeComments": false, | ||
"resolveJsonModule": true, | ||
"rootDir": "./lib", | ||
"skipLibCheck": true, | ||
"sourceMap": true, | ||
"strict": true, | ||
"target": "ES2020", | ||
"traceResolution": false, | ||
"useDefineForClassFields": true | ||
}, | ||
"include": ["lib/**/*.ts"], | ||
"exclude": ["node_modules", "**/*.spec.ts"] | ||
} |
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,30 @@ | ||
const path = require("path"); | ||
const { defineConfig } = require("vite"); | ||
const typescript = require("@rollup/plugin-typescript"); | ||
|
||
module.exports = defineConfig({ | ||
server: { | ||
fs: { | ||
allow: [".."], | ||
}, | ||
}, | ||
build: { | ||
lib: { | ||
entry: path.resolve(__dirname, "lib/index.ts"), | ||
fileName: (format) => `index.${format}.js`, | ||
name: "@yuigoto/vite-library-template", | ||
}, | ||
rollupOptions: { | ||
plugins: [ | ||
typescript({ | ||
sourceMap: true, | ||
}), | ||
], | ||
}, | ||
}, | ||
resolve: { | ||
alias: { | ||
lib: path.resolve(__dirname, "lib"), | ||
}, | ||
}, | ||
}); |
Oops, something went wrong.