-
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.
Merge pull request #12 from sandwichfarm/monorepo
Monorepo
- Loading branch information
Showing
76 changed files
with
11,887 additions
and
30 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,8 @@ | ||
# Changesets | ||
|
||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works | ||
with multi-package repos, or single-package repos to help you version and publish your code. You can | ||
find the full documentation for it [in our repository](https://github.com/changesets/changesets) | ||
|
||
We have a quick list of common questions to get you started engaging with this project in | ||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) |
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 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "restricted", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
notemine | ||
target | ||
|
||
./pkg | ||
!./demo/pkg | ||
node_modules | ||
dist | ||
**/*/node_modules | ||
**/*/dist | ||
target |
Binary file not shown.
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 @@ | ||
nodeLinker: 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 |
---|---|---|
@@ -1,26 +1,24 @@ | ||
# note⛏️ | ||
**notemine** mines nostr notes, is written in rust, targets web and compiles to wasm. Variable difficulty and realtime hashrate. There's a [demo](https://sandwichfarm.github.io/notemine). | ||
# @notemine | ||
|
||
# related | ||
- [`notemine-js`](https://github.com/sandwichfarm/notemine-js) is an npm module that wraps this package with observables for use with modern stacks. | ||
- [`notemine-hw`](https://github.com/plebemineira/notemine_hw) is a fork ported to a cli application that leverages hardware acceleration | ||
**notemine** mines nostr notes, is written in rust, targets web and compiles to wasm. Variable difficulty and realtime hashrate. There's some [demos](https://sandwichfarm.github.io/notemine). | ||
|
||
# deps | ||
``` | ||
cargo install wasm-pack | ||
``` | ||
## Packages: | ||
- [`@notemine/core`](./packages/core/) - It is in here you find the `rust` source for the moner. Build step generates JS Bindings, type declarations and wasm file via `wasm-bindgen`. The base of all packages in this monorepo. | ||
- [`@notemine/wrapper`](./packages/wrapper/) - A user-friendly wrapper for `@notemine/core` that greatly simplifies usage in modern stacks and deployments with modern bundlers. Provides observables, manages workers, tracks internal state and bundles wasm as _inline base64_ within _inline_ web-workers for hassle-free use in modern apps targeted for the browser. | ||
- _[`@notemine/svelte`](./packages/svelte/)_ [coming soon] - Library optimized for Svelte that exports stores and components for hassle-free use in svelte projects. | ||
- _[`@notemine/reactjs`](./packages/reactjs/)_ [coming soon] - Library optimized for ReactJS that exports stores and components for hassle-free use in svelte projects. | ||
|
||
## Demos: | ||
- [`@notemine/vanilla-js-demo`](./demos/vanilla-js/) - Demo of Notemine written with vanilla Javascript, HTML and CSS that implements `@notemine/core`. No bundlers. | ||
- [`@notemine/svelte-demo`](./demos/svelte/) - Vanilla JS Demo Ported to Svelte that implements `@notemine/wrapper` (note: future version will implement `@notemine/svelte`) | ||
|
||
# build | ||
## Contrib | ||
`@notemine` monorepo presently uses `yarn workspaces` without any monorepo toolkit (pending). Recommended to use `yarn v2` until monorepo is fully configured. | ||
``` | ||
cargo clean | ||
wasm-pack build --target web --release | ||
yarn install | ||
``` | ||
|
||
# run demo | ||
Use workspace commands: | ||
``` | ||
cd demo && npx serve | ||
yarn workspace @notemine/wrapper ... | ||
``` | ||
|
||
# license | ||
GNU General Public License v3.0 | ||
|
Empty file.
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,5 @@ | ||
{ | ||
"rules": { | ||
"jsx-a11y/rule-name": "off" | ||
} | ||
} |
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 @@ | ||
/node_modules/ | ||
/public/build/ | ||
|
||
.DS_Store |
Empty file.
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,18 @@ | ||
# `@notemine/svelte-demo` | ||
|
||
The vanilla-js demo ported to Svelte with `@notemine/wrapper` as the dependency instead of `@notemine/core` | ||
|
||
``` | ||
yarn install | ||
``` | ||
|
||
## Usage | ||
Run development server | ||
``` | ||
yarn dev | ||
``` | ||
|
||
Build package | ||
``` | ||
yarn 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,36 @@ | ||
{ | ||
"name": "@notemine/svelte-demo", | ||
"version": "0.1.0", | ||
"type": "module", | ||
"scripts": { | ||
"build": "rollup -c", | ||
"dev": "rollup -c -w", | ||
"start": "sirv public --no-clear" | ||
}, | ||
"dependencies": { | ||
"@notemine/wrapper": "workspace:*", | ||
"@rollup/plugin-alias": "5.1.1", | ||
"@rollup/plugin-url": "8.0.2", | ||
"@rollup/plugin-wasm": "6.2.2", | ||
"nostr-tools": "2.7.2", | ||
"rollup-plugin-terser": "7.0.2", | ||
"rollup-plugin-typescript2": "0.36.0", | ||
"rollup-plugin-web-worker-loader": "1.6.1", | ||
"sirv-cli": "^2.0.0", | ||
"webpack-env": "0.8.0" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "28.0.0", | ||
"@rollup/plugin-node-resolve": "15.3.0", | ||
"@rollup/plugin-terser": "^0.4.0", | ||
"rollup": "^3.15.0", | ||
"rollup-plugin-copy": "3.5.0", | ||
"rollup-plugin-css-only": "^4.3.0", | ||
"rollup-plugin-livereload": "^2.0.0", | ||
"rollup-plugin-postcss": "4.0.2", | ||
"rollup-plugin-svelte": "^7.1.2", | ||
"svelte": "^3.55.0", | ||
"svelte-preprocess": "6.0.2", | ||
"webpack": "5.94.0" | ||
} | ||
} |
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,63 @@ | ||
html, body { | ||
position: relative; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
body { | ||
color: #333; | ||
margin: 0; | ||
padding: 8px; | ||
box-sizing: border-box; | ||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; | ||
} | ||
|
||
a { | ||
color: rgb(0,100,200); | ||
text-decoration: none; | ||
} | ||
|
||
a:hover { | ||
text-decoration: underline; | ||
} | ||
|
||
a:visited { | ||
color: rgb(0,80,160); | ||
} | ||
|
||
label { | ||
display: block; | ||
} | ||
|
||
input, button, select, textarea { | ||
font-family: inherit; | ||
font-size: inherit; | ||
-webkit-padding: 0.4em 0; | ||
padding: 0.4em; | ||
margin: 0 0 0.5em 0; | ||
box-sizing: border-box; | ||
border: 1px solid #ccc; | ||
border-radius: 2px; | ||
} | ||
|
||
input:disabled { | ||
color: #ccc; | ||
} | ||
|
||
button { | ||
color: #333; | ||
background-color: #f4f4f4; | ||
outline: none; | ||
} | ||
|
||
button:disabled { | ||
color: #999; | ||
} | ||
|
||
button:not(:disabled):active { | ||
background-color: #ddd; | ||
} | ||
|
||
button:focus { | ||
border-color: #666; | ||
} |
File renamed without changes
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,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset='utf-8'> | ||
<meta name='viewport' content='width=device-width,initial-scale=1'> | ||
|
||
<title>Svelte app</title> | ||
|
||
<link rel='icon' type='image/png' href='/favicon.png'> | ||
<link rel='stylesheet' href='/global.css'> | ||
<link rel='stylesheet' href='/build/bundle.css'> | ||
|
||
<script defer src='/build/bundle.js'></script> | ||
</head> | ||
|
||
<body> | ||
</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,92 @@ | ||
import svelte from 'rollup-plugin-svelte'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import typescript from 'rollup-plugin-typescript2'; | ||
import wasm from '@rollup/plugin-wasm'; | ||
import postcss from 'rollup-plugin-postcss'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
import { sveltePreprocess } from 'svelte-preprocess'; | ||
import livereload from 'rollup-plugin-livereload'; | ||
import { spawn } from 'child_process'; | ||
import copy from 'rollup-plugin-copy' | ||
import alias from '@rollup/plugin-alias'; | ||
|
||
|
||
const production = !process.env.ROLLUP_WATCH; | ||
|
||
function serve() { | ||
let server; | ||
|
||
function toExit() { | ||
if (server) server.kill(0); | ||
} | ||
|
||
return { | ||
writeBundle() { | ||
if (server) return; | ||
server = spawn('yarn', ['start', '--', '--dev'], { | ||
stdio: ['ignore', 'inherit', 'inherit'], | ||
shell: true, | ||
}); | ||
|
||
process.on('SIGTERM', toExit); | ||
process.on('exit', toExit); | ||
} | ||
}; | ||
} | ||
|
||
export default { | ||
input: 'src/main.js', | ||
output: { | ||
sourcemap: true, | ||
format: 'iife', // IIFE format works well in the browser context | ||
name: 'app', | ||
file: 'public/build/bundle.js', | ||
}, | ||
plugins: [ | ||
svelte({ | ||
compilerOptions: { | ||
dev: !production, | ||
}, | ||
preprocess: sveltePreprocess(), | ||
}), | ||
|
||
resolve({ | ||
browser: true, | ||
dedupe: ['svelte'], | ||
}), | ||
|
||
commonjs({ | ||
include: 'node_modules/**', // Ensure CommonJS modules are properly handled | ||
sourceMap: !production, | ||
}), | ||
|
||
copy({ | ||
targets: [ | ||
{ src: 'node_modules/@notemine/wrapper/dist/notemine_bg.wasm', dest: 'public/build' } | ||
] | ||
}), | ||
|
||
// typescript({ | ||
// include: ['src/**/*', 'node_modules/@notemine/wrapper/dist/**/*'], | ||
// }), | ||
|
||
wasm(), // Handle WASM files | ||
|
||
// Add PostCSS for CSS handling | ||
postcss({ | ||
extract: true, | ||
}), | ||
|
||
// Auto-reload in development mode | ||
!production && serve(), | ||
!production && livereload('public'), | ||
|
||
// Minify for production | ||
production && terser(), | ||
], | ||
|
||
watch: { | ||
clearScreen: false, | ||
}, | ||
}; |
Oops, something went wrong.