-
-
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 #8 from ciegovolador/package-migration
chore(structure): change package build to copy from nostr
- Loading branch information
Showing
97 changed files
with
5,119 additions
and
25,523 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository | ||
|
||
github: [MostroP2P] | ||
custom: ["https://geyser.fund/project/mostro"] | ||
custom: ['https://geyser.fund/project/mostro'] |
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
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
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
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
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 +1 @@ | ||
pnpm dlx commitlint --edit $1 | ||
bunx --no -- commitlint --edit $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 |
---|---|---|
@@ -1 +1 @@ | ||
pnpm lint-staged | ||
just 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,7 @@ | ||
{ | ||
"semi": true, | ||
"singleQuote": true, | ||
"printWidth": 80, | ||
"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
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
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
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 @@ | ||
const fs = require('node:fs'); | ||
const esbuild = require('esbuild'); | ||
const { join } = require('path'); | ||
|
||
const entryPoints = fs.readdirSync(process.cwd()).filter( | ||
(file) => | ||
file.endsWith('.ts') && | ||
// file !== 'core.ts' && | ||
// file !== 'test-helpers.ts' && | ||
// file !== 'helpers.ts' && | ||
// file !== 'benchmarks.ts' && | ||
!file.endsWith('.config.d.ts') && | ||
!file.endsWith('.config.ts') && | ||
!file.endsWith('.test.ts') && | ||
fs.statSync(join(process.cwd(), file)).isFile() | ||
); | ||
|
||
let common = { | ||
entryPoints, | ||
bundle: true, | ||
sourcemap: 'external', | ||
}; | ||
|
||
esbuild | ||
.build({ | ||
...common, | ||
outdir: 'lib/esm', | ||
format: 'esm', | ||
packages: 'external', | ||
tsconfig: './tsconfig.json', | ||
}) | ||
.then(() => console.log('esm build success.')); | ||
|
||
esbuild | ||
.build({ | ||
...common, | ||
outdir: 'lib/cjs', | ||
format: 'cjs', | ||
packages: 'external', | ||
tsconfig: './tsconfig.json', | ||
}) | ||
.then(() => { | ||
const packageJson = JSON.stringify({ type: 'commonjs' }); | ||
fs.writeFileSync(`${__dirname}/lib/cjs/package.json`, packageJson, 'utf8'); | ||
|
||
console.log('cjs build success.'); | ||
}); | ||
|
||
esbuild | ||
.build({ | ||
...common, | ||
entryPoints: ['index.ts'], | ||
outfile: 'lib/mostro.bundle.js', | ||
format: 'iife', | ||
globalName: 'MostroTools', | ||
define: { | ||
window: 'self', | ||
global: 'self', | ||
process: '{"env": {}}', | ||
}, | ||
tsconfig: './tsconfig.json', | ||
}) | ||
.then(() => console.log('standalone build success.')); |
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 { test, expect } from 'bun:test'; | ||
import { client } from './mostro.ts'; | ||
|
||
test('Client', () => { | ||
const testValue = 'Mostro'; | ||
const result = client.hello(testValue); | ||
const expected = `Hello Mostro! I am a cli :)`; | ||
|
||
expect(result).toEqual(expected); | ||
}); |
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,113 @@ | ||
export function hello(name: string): string { | ||
return `Hello ${name}! I am a cli :)`; | ||
} | ||
|
||
export function dispute(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
|
||
export function neworder(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
|
||
export function takesell(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
|
||
export function takebuy(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
|
||
export function addinvoice(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
|
||
export function getdm(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
|
||
export function fiatsent(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
export function release(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
export function cancel(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
export function rate(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
export function admcancel(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
export function admsettle(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
export function admlistdisputes(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
export function admaddsolver(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
export function admtakedispute(name: string): string { | ||
return `Hello ${name}! I am the core :)`; | ||
} | ||
|
||
export function help(command: string): string { | ||
let result = ''; | ||
const commandList = `listorders, neworder, takesell, takebuy , addinvoice, getdm, fiatsent, release, cancel, rate, dispute, admcancel, admsettle, admlistdisputes, admaddsolver, admtakedispute`; | ||
switch (command) { | ||
case 'listorders': | ||
result = `Requests open orders from Mostro pubkey`; | ||
break; | ||
case 'neworder': | ||
result = `Create a new buy/sell order on Mostro`; | ||
break; | ||
case 'takesell': | ||
result = `Take a sell order from a Mostro pubkey`; | ||
break; | ||
case 'takebuy': | ||
result = `Take a buy order from a Mostro pubkey`; | ||
break; | ||
case 'addinvoice': | ||
result = `Buyer add a new invoice to receive the payment`; | ||
break; | ||
case 'getdm': | ||
result = `Get the latest direct messages from Mostro`; | ||
break; | ||
case 'fiatsent': | ||
result = `Send fiat sent message to confirm payment to other user`; | ||
break; | ||
case 'release': | ||
result = `Settle the hold invoice and pay to buyer`; | ||
break; | ||
case 'cancel': | ||
result = `Cancel a pending order`; | ||
break; | ||
case 'rate': | ||
result = `Rate counterpart after a successful trade`; | ||
break; | ||
case 'dispute': | ||
result = `Start a dispute`; | ||
break; | ||
case 'admcancel': | ||
result = `Cancel an order (only admin)`; | ||
break; | ||
case 'admsettle': | ||
result = `Settle a seller's hold invoice (only admin)`; | ||
break; | ||
case 'admlistdisputes': | ||
result = `Requests open disputes from Mostro pubkey`; | ||
break; | ||
case 'admaddsolver': | ||
result = `Add a new dispute's solver (only admin)`; | ||
break; | ||
case 'admtakedispute': | ||
result = `Admin or solver take a Pending dispute (only admin)`; | ||
break; | ||
default: | ||
result = `we don't have that command; Choosea supported one (${commandList})`; | ||
} | ||
return result; | ||
} |
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 @@ | ||
path_filters: | ||
exclude: | ||
- 'lib/**' |
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,6 +1,6 @@ | ||
import type { UserConfig } from '@commitlint/types' | ||
import type { UserConfig } from '@commitlint/types'; | ||
// import { RuleConfigSeverity } from '@commitlint/types' | ||
|
||
export default <UserConfig>{ | ||
extends: ['@commitlint/config-conventional'], | ||
} | ||
}; |
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 { test, expect } from 'bun:test'; | ||
import { core } from './mostro.ts'; | ||
|
||
test('Core', () => { | ||
const testValue = 'Mostro'; | ||
const result = core.hello(testValue); | ||
const expected = `Hello Mostro! I am the core :)`; | ||
|
||
expect(result).toEqual(expected); | ||
}); |
Oops, something went wrong.