Merge branch 'fix-publish' into 'development'
Attempted fix for publishing See merge request GeneralProtocols/xo/stack!12
This commit is contained in:
+17
-21
@@ -1,6 +1,7 @@
|
|||||||
image: node:22
|
image: node:22
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- test
|
||||||
- publish
|
- publish
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
@@ -15,31 +16,26 @@ cache:
|
|||||||
- node_modules/
|
- node_modules/
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- npm install
|
- npm install
|
||||||
- npm run build
|
- npm run build
|
||||||
|
|
||||||
.publish_to_npm:
|
|
||||||
# Configure which stage in the pipeline this part should be run in.
|
|
||||||
stage: publish
|
|
||||||
|
|
||||||
|
test:
|
||||||
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npm config set //registry.npmjs.org/:_authToken ${NPM_AUTH_TOKEN}
|
- npm run test
|
||||||
- npx lerna publish from-package --no-private --yes --registry https://registry.npmjs.org/ --tag ${NPM_TAG}
|
|
||||||
|
|
||||||
publish:development:
|
publish:development:
|
||||||
# Configure what tag to use for this publication.
|
# Configure what tag to use for this publication.
|
||||||
variables:
|
variables:
|
||||||
NPM_TAG: 'development'
|
NPM_TAG: 'development'
|
||||||
|
script:
|
||||||
script:
|
# add the NPM_TAG to the version field in the package file during this script
|
||||||
# add the NPM_TAG to the version field in the package file during this script
|
- sed -i -r "/version/s/([0-9\.]+)/\1-${NPM_TAG}.${CI_JOB_ID}/g" packages/primitives/package.json
|
||||||
- sed -i -r "/version/s/([0-9\.]+)/\1-${NPM_TAG}.${CI_JOB_ID}/g" packages/primitives/package.json
|
# set our npm token and then use lerna to publish all packages that are not marked as "private".
|
||||||
|
- npm config set //registry.npmjs.org/:_authToken ${NPM_AUTH_TOKEN}
|
||||||
only:
|
- npx lerna publish from-package --no-private --yes --registry https://registry.npmjs.org/ --tag ${NPM_TAG}
|
||||||
- development
|
only:
|
||||||
|
- development
|
||||||
# Use the common template to publish the library.
|
|
||||||
extends: .publish_to_npm
|
|
||||||
|
|
||||||
# Publish the documentation to GitLab Pages (for now).
|
# Publish the documentation to GitLab Pages (for now).
|
||||||
pages:
|
pages:
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
||||||
"packages": [
|
"packages": ["packages/*"],
|
||||||
"packages/*"
|
|
||||||
],
|
|
||||||
"version": "0.0.1"
|
"version": "0.0.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,4 +3,5 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Resume Markdown parsing -->
|
<!-- Resume Markdown parsing -->
|
||||||
|
|
||||||
TODO: Once we have other tools, we might want to turn this into a page like that on Quick Start that presents a "box" of each Tool Group.
|
TODO: Once we have other tools, we might want to turn this into a page like that on Quick Start that presents a "box" of each Tool Group.
|
||||||
|
|||||||
@@ -24,26 +24,31 @@ import {
|
|||||||
# Primitive Tools
|
# Primitive Tools
|
||||||
|
|
||||||
## Address
|
## Address
|
||||||
|
|
||||||
<div class="tool">
|
<div class="tool">
|
||||||
<p>A Utility tool for converting between different address formats.</p>
|
<p>A Utility tool for converting between different address formats.</p>
|
||||||
|
|
||||||
<PrimitiveToolVue
|
<PrimitiveToolVue
|
||||||
:fromFunctions="address.from"
|
:fromFunctions="address.from"
|
||||||
:toFunctions="address.to"
|
:toFunctions="address.to"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## Block Header
|
## Block Header
|
||||||
|
|
||||||
<div class="tool">
|
<div class="tool">
|
||||||
<p>A utility tool for converting between different byte representations.</p>
|
<p>A utility tool for converting between different byte representations.</p>
|
||||||
|
|
||||||
<PrimitiveToolVue
|
<PrimitiveToolVue
|
||||||
:fromFunctions="blockHeader.from"
|
:fromFunctions="blockHeader.from"
|
||||||
:toFunctions="blockHeader.to"
|
:toFunctions="blockHeader.to"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## Bytes
|
## Bytes
|
||||||
|
|
||||||
<div class="tool">
|
<div class="tool">
|
||||||
<p>A utility tool for converting between different byte representations.</p>
|
<p>A utility tool for converting between different byte representations.</p>
|
||||||
|
|
||||||
@@ -54,93 +59,111 @@ import {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
## Hasher
|
## Hasher
|
||||||
|
|
||||||
<div class="tool">
|
<div class="tool">
|
||||||
<p>A utility tool for computing various cryptographic hashes commonly used in Bitcoin Cash.</p>
|
<p>A utility tool for computing various cryptographic hashes commonly used in Bitcoin Cash.</p>
|
||||||
|
|
||||||
<PrimitiveToolVue
|
<PrimitiveToolVue
|
||||||
:fromFunctions="hasher.from"
|
:fromFunctions="hasher.from"
|
||||||
:toFunctions="hasher.to"
|
:toFunctions="hasher.to"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## HD Private Node
|
## HD Private Node
|
||||||
|
|
||||||
<div class="tool">
|
<div class="tool">
|
||||||
<p>A utility tool for generating and manipulating HD Private Nodes.</p>
|
<p>A utility tool for generating and manipulating HD Private Nodes.</p>
|
||||||
|
|
||||||
<PrimitiveToolVue
|
<PrimitiveToolVue
|
||||||
:fromFunctions="hdPrivateNode.from"
|
:fromFunctions="hdPrivateNode.from"
|
||||||
:toFunctions="hdPrivateNode.to"
|
:toFunctions="hdPrivateNode.to"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## HD Public Node
|
## HD Public Node
|
||||||
|
|
||||||
<div class="tool">
|
<div class="tool">
|
||||||
<p>A utility tool for generating and manipulating HD Public Nodes.</p>
|
<p>A utility tool for generating and manipulating HD Public Nodes.</p>
|
||||||
|
|
||||||
<PrimitiveToolVue
|
<PrimitiveToolVue
|
||||||
:fromFunctions="hdPublicNode.from"
|
:fromFunctions="hdPublicNode.from"
|
||||||
:toFunctions="hdPublicNode.to"
|
:toFunctions="hdPublicNode.to"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## Mnemonic
|
## Mnemonic
|
||||||
|
|
||||||
<div class="tool">
|
<div class="tool">
|
||||||
<p>A utility tool for generating and validating BIP39 Mnemonics. Note that mnemonics will be normalized by removing redundant whitespace and will also be validated against the BIP39 English Word List (other word-lists can be specified via the API)</p>
|
<p>A utility tool for generating and validating BIP39 Mnemonics. Note that mnemonics will be normalized by removing redundant whitespace and will also be validated against the BIP39 English Word List (other word-lists can be specified via the API)</p>
|
||||||
|
|
||||||
<PrimitiveToolVue
|
<PrimitiveToolVue
|
||||||
:fromFunctions="mnemonic.from"
|
:fromFunctions="mnemonic.from"
|
||||||
:toFunctions="mnemonic.to"
|
:toFunctions="mnemonic.to"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## Private Key
|
## Private Key
|
||||||
|
|
||||||
<div class="tool">
|
<div class="tool">
|
||||||
<p>A utility tool for generating and manipulating Private Keys.</p>
|
<p>A utility tool for generating and manipulating Private Keys.</p>
|
||||||
|
|
||||||
<PrimitiveToolVue
|
<PrimitiveToolVue
|
||||||
:fromFunctions="privateKey.from"
|
:fromFunctions="privateKey.from"
|
||||||
:toFunctions="privateKey.to"
|
:toFunctions="privateKey.to"
|
||||||
:methods="privateKey.methods"
|
:methods="privateKey.methods"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## Public Key
|
## Public Key
|
||||||
|
|
||||||
<div class="tool">
|
<div class="tool">
|
||||||
<p>A utility tool for generating and manipulating Public Keys.</p>
|
<p>A utility tool for generating and manipulating Public Keys.</p>
|
||||||
|
|
||||||
<PrimitiveToolVue
|
<PrimitiveToolVue
|
||||||
:fromFunctions="publicKey.from"
|
:fromFunctions="publicKey.from"
|
||||||
:toFunctions="publicKey.to"
|
:toFunctions="publicKey.to"
|
||||||
:methods="publicKey.methods"
|
:methods="publicKey.methods"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## Satoshis
|
## Satoshis
|
||||||
|
|
||||||
<div class="tool">
|
<div class="tool">
|
||||||
<p>A utility tool for converting between Bitcoin Cash value units.</p>
|
<p>A utility tool for converting between Bitcoin Cash value units.</p>
|
||||||
|
|
||||||
<PrimitiveToolVue
|
<PrimitiveToolVue
|
||||||
:fromFunctions="satoshis.from"
|
:fromFunctions="satoshis.from"
|
||||||
:toFunctions="satoshis.to"
|
:toFunctions="satoshis.to"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## Script
|
## Script
|
||||||
|
|
||||||
<div class="tool">
|
<div class="tool">
|
||||||
<p>A utility tool for generating and manipulating Script objects.</p>
|
<p>A utility tool for generating and manipulating Script objects.</p>
|
||||||
|
|
||||||
<PrimitiveToolVue
|
<PrimitiveToolVue
|
||||||
:fromFunctions="script.from"
|
:fromFunctions="script.from"
|
||||||
:toFunctions="script.to"
|
:toFunctions="script.to"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## Transaction
|
## Transaction
|
||||||
|
|
||||||
<div class="tool">
|
<div class="tool">
|
||||||
<p>A utility tool for generating and manipulating Transaction objects.</p>
|
<p>A utility tool for generating and manipulating Transaction objects.</p>
|
||||||
|
|
||||||
<PrimitiveToolVue
|
<PrimitiveToolVue
|
||||||
:fromFunctions="transaction.from"
|
:fromFunctions="transaction.from"
|
||||||
:toFunctions="transaction.to"
|
:toFunctions="transaction.to"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,12 +12,14 @@ import {
|
|||||||
# Utils
|
# Utils
|
||||||
|
|
||||||
## Encryption
|
## Encryption
|
||||||
|
|
||||||
<div class="tool">
|
<div class="tool">
|
||||||
<p>A Utility tool for converting between different address formats.</p>
|
<p>A Utility tool for converting between different address formats.</p>
|
||||||
|
|
||||||
<PrimitiveToolVue
|
<PrimitiveToolVue
|
||||||
:fromFunctions="encryption.from"
|
:fromFunctions="encryption.from"
|
||||||
:toFunctions="encryption.to"
|
:toFunctions="encryption.to"
|
||||||
:methods="encryption.methods"
|
:methods="encryption.methods"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,10 +12,12 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc --build --clean && tsc --build",
|
"build": "tsc --build --clean && tsc --build",
|
||||||
"prepublishOnly": "npm run build",
|
"prepublishOnly": "npm run build",
|
||||||
"test": "vitest",
|
"test": "vitest --run",
|
||||||
"test:coverage": "vitest run --coverage",
|
"test:coverage": "vitest run --coverage",
|
||||||
|
"test:watch": "vitest",
|
||||||
"watch": "tsc --watch"
|
"watch": "tsc --watch"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC"
|
"license": "ISC",
|
||||||
|
"gitHead": "2d550cef4b179b17110363512ee0fde54a5da79a"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
export type MnemonicRaw = {
|
export type MnemonicRaw = {
|
||||||
words: string[];
|
words: string[];
|
||||||
passphrase?: string;
|
passphrase?: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing a BIP39 Mnemonic phrase.
|
* Class representing a BIP39 Mnemonic phrase.
|
||||||
@@ -32,7 +32,10 @@ export class Mnemonic {
|
|||||||
* @throws {Error} If mnemonic could not be generated.
|
* @throws {Error} If mnemonic could not be generated.
|
||||||
* @returns Instance of Mnemonic.
|
* @returns Instance of Mnemonic.
|
||||||
*/
|
*/
|
||||||
public static from(phraseOrWords: string | Array<string>, wordList: Array<string> = bip39WordListEnglish) {
|
public static from(
|
||||||
|
phraseOrWords: string | Array<string>,
|
||||||
|
wordList: Array<string> = bip39WordListEnglish,
|
||||||
|
) {
|
||||||
// If this is a list of words...
|
// If this is a list of words...
|
||||||
if (Array.isArray(phraseOrWords)) {
|
if (Array.isArray(phraseOrWords)) {
|
||||||
return this.fromWords(phraseOrWords, wordList);
|
return this.fromWords(phraseOrWords, wordList);
|
||||||
@@ -49,7 +52,10 @@ export class Mnemonic {
|
|||||||
* @throws {Error} If mnemonic could not be generated.
|
* @throws {Error} If mnemonic could not be generated.
|
||||||
* @returns Instance of Mnemonic.
|
* @returns Instance of Mnemonic.
|
||||||
*/
|
*/
|
||||||
public static fromString(phrase: string, wordList: Array<string> = bip39WordListEnglish) {
|
public static fromString(
|
||||||
|
phrase: string,
|
||||||
|
wordList: Array<string> = bip39WordListEnglish,
|
||||||
|
) {
|
||||||
// Split into words and remove any whitespace.
|
// Split into words and remove any whitespace.
|
||||||
const allWords = phrase
|
const allWords = phrase
|
||||||
.trim()
|
.trim()
|
||||||
@@ -67,7 +73,10 @@ export class Mnemonic {
|
|||||||
* @throws {Error} If mnemonic could not be generated.
|
* @throws {Error} If mnemonic could not be generated.
|
||||||
* @returns Instance of Mnemonic.
|
* @returns Instance of Mnemonic.
|
||||||
*/
|
*/
|
||||||
public static fromWords(words: Array<string>, wordList: Array<string> = bip39WordListEnglish) {
|
public static fromWords(
|
||||||
|
words: Array<string>,
|
||||||
|
wordList: Array<string> = bip39WordListEnglish,
|
||||||
|
) {
|
||||||
// Check if last word is a passphrase by looking at total count
|
// Check if last word is a passphrase by looking at total count
|
||||||
const hasPassphrase =
|
const hasPassphrase =
|
||||||
words.length === 13 ||
|
words.length === 13 ||
|
||||||
@@ -79,10 +88,10 @@ export class Mnemonic {
|
|||||||
// Parse words and optional passphrase
|
// Parse words and optional passphrase
|
||||||
const mnemonicRaw: MnemonicRaw = {
|
const mnemonicRaw: MnemonicRaw = {
|
||||||
words: hasPassphrase ? words.slice(0, -1) : words,
|
words: hasPassphrase ? words.slice(0, -1) : words,
|
||||||
}
|
};
|
||||||
|
|
||||||
if(hasPassphrase) {
|
if (hasPassphrase) {
|
||||||
mnemonicRaw.passphrase = words[words.length - 1]
|
mnemonicRaw.passphrase = words[words.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate word count
|
// Validate word count
|
||||||
@@ -226,9 +235,9 @@ export class Mnemonic {
|
|||||||
* @returns Number of words.
|
* @returns Number of words.
|
||||||
*/
|
*/
|
||||||
public toWords(includePassphrase: boolean = true): Array<string> {
|
public toWords(includePassphrase: boolean = true): Array<string> {
|
||||||
const words = [ ...this.mnemonic.words ];
|
const words = [...this.mnemonic.words];
|
||||||
|
|
||||||
if(this.mnemonic.passphrase && includePassphrase) {
|
if (this.mnemonic.passphrase && includePassphrase) {
|
||||||
words.push(this.mnemonic.passphrase);
|
words.push(this.mnemonic.passphrase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,16 +4,9 @@
|
|||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"paths": {
|
"paths": {
|
||||||
"~/*": [
|
"~/*": ["./*"]
|
||||||
"./*"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["src/**/*"],
|
||||||
"src/**/*"
|
"exclude": ["node_modules", "dist"]
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"dist"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,9 @@
|
|||||||
"bench": "vitest bench",
|
"bench": "vitest bench",
|
||||||
"build": "tsc --build --clean && tsc --build",
|
"build": "tsc --build --clean && tsc --build",
|
||||||
"prepublishOnly": "npm run build",
|
"prepublishOnly": "npm run build",
|
||||||
"test": "vitest",
|
"test": "vitest --run",
|
||||||
"test:coverage": "vitest run --coverage",
|
"test:coverage": "vitest run --coverage",
|
||||||
|
"test:watch": "vitest",
|
||||||
"watch": "tsc --watch"
|
"watch": "tsc --watch"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import { BaseStorage, BaseStore, StorageOpts } from './base-store.js';
|
import { BaseStorage, BaseStore, StorageOpts } from './base-store.js';
|
||||||
import { StoreInMemorySynced } from './store-inmemory-synced.js';
|
import { StoreInMemorySynced } from './store-inmemory-synced.js';
|
||||||
|
|
||||||
import {
|
import { Encryption } from '../utils';
|
||||||
Encryption,
|
|
||||||
} from '../utils';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
encodeExtendedJsonObject,
|
encodeExtendedJsonObject,
|
||||||
|
|||||||
@@ -4,19 +4,10 @@
|
|||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"paths": {
|
"paths": {
|
||||||
"~/*": [
|
"~/*": ["./*"]
|
||||||
"./*"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"lib": [
|
"lib": ["dom"]
|
||||||
"dom"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["src/**/*"],
|
||||||
"src/**/*"
|
"exclude": ["node_modules", "dist"]
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"dist"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user