rearranged into pnpm/parcel workflow

master
Brian Sakal 3 years ago
parent 817de00cce
commit 075e4e68c0

109
.gitignore vendored

@ -0,0 +1,109 @@
# ---> Node
# 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
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# 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
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# 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 / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test

@ -1,39 +0,0 @@
let PubSub = ()=>{
// state:
let subscriptions_by_event = {}; // by event name, that is
let subscriptions_by_name = {}; // subscriptions can be named, for easy unsubscribing
// methods:
let pub = (e, ...params)=>{
if(subscriptions_by_event[e]){
subscriptions_by_event[e].forEach(subscription=>subscription.cb(...params))
}
};
let sub = (e, cb, name)=>{ // 'name' is for unsubbing
if(typeof subscriptions_by_event[e] === 'undefined'){
subscriptions_by_event[e] = [];
}
let subscription = { e, cb, name: name || '' };
subscriptions_by_event[e].push(subscription);
if(subscription.name !== ''){
if(typeof subscriptions_by_name[name] !== 'undefined'){ console.warn('Already subscription with name "'+name+'". Overwriting nonetheless.'); }
subscriptions_by_name[name] = subscription;
}
};
let unsub = (name)=>{
// check if such a named subscription exists:
if(typeof subscriptions_by_name[name] !== 'undefined'){
// get ref to subscription object for later:
let subscription = subscriptions_by_name[name];
// delete subscription from both lists:
subscriptions_by_event[subscription.e].splice(subscriptions_by_event[subscription.e].indexOf(subscription), 1);
delete subscriptions_by_name[name];
}
};
return {pub, sub, unsub};
}
export default PubSub;

@ -0,0 +1,24 @@
{
"name": "calendar-optimizer",
"version": "1.0.0",
"description": "Options Calendar-spread optimizer, based on projected underlying price range and IV smiles at different expiries.",
"source": "src/index.html",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://git.sakal.us/brian/calendar-optimizer.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"PubSubJS": "^0.0.3",
"incremental-dom": "^0.7.0",
"nanoid": "^3.3.1"
},
"devDependencies": {
"parcel": "^2.3.2"
}
}

File diff suppressed because it is too large Load Diff

@ -1,4 +1,4 @@
import {elementOpen as o, elementClose as c, text as t} from '../vendor/incremental-dom.js'; import {elementOpen as o, elementClose as c, text as t} from 'incremental-dom';
import state from '../state.js'; import state from '../state.js';
import {pub} from '../pubsub.js'; import {pub} from '../pubsub.js';

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,3 @@
export const calculateBestCombinationOfCalendars(){
}

@ -1,5 +1,5 @@
// global PubSub instance: // global PubSub instance:
import PubSub from './PubSub.js'; import PubSub from 'PubSubJS';
const pubsub = PubSub(); const pubsub = PubSub();
export const {pub, sub, unsub} = pubsub; export const {pub, sub, unsub} = pubsub;

@ -1,4 +1,4 @@
import {patch} from './vendor/incremental-dom.js'; import {patch} from 'incremental-dom';
import App from './components/App.js'; import App from './components/App.js';
export const redraw = ()=>{ export const redraw = ()=>{

@ -1,4 +1,3 @@
// EXAMPLE STATE:
const state = { const state = {
front_months: { // front months, i.e. calendar expiry, at which the user has an opinion on where the underlying price may be front_months: { // front months, i.e. calendar expiry, at which the user has an opinion on where the underlying price may be
"2022-03-11": { "2022-03-11": {
@ -19,6 +18,4 @@ const state = {
export const calculateBestCombinationOfCalendars(){ export default state;
}

@ -1,8 +0,0 @@
let state = {
};
export default state;

File diff suppressed because one or more lines are too long

7
vendor/nanoid.js vendored

@ -1,7 +0,0 @@
/**
* Bundled by jsDelivr using Rollup v2.67.2 and Terser v5.10.0.
* Original file: /npm/nanoid@3.3.1/index.browser.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
let t="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",e=t=>crypto.getRandomValues(new Uint8Array(t)),r=(t,e,r)=>{let l=(2<<Math.log(t.length-1)/Math.LN2)-1,n=-~(1.6*l*e/t.length);return(o=e)=>{let a="";for(;;){let e=r(n),g=n;for(;g--;)if(a+=t[e[g]&l]||"",a.length===o)return a}}},l=(t,l=21)=>r(t,l,e),n=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;){let l=63&r[t];e+=l<36?l.toString(36):l<62?(l-26).toString(36).toUpperCase():l<63?"_":"-"}return e};export{l as customAlphabet,r as customRandom,n as nanoid,e as random,t as urlAlphabet};export default null;
Loading…
Cancel
Save