Skip to content

Commit

Permalink
fix: version func breaking blumen
Browse files Browse the repository at this point in the history
  • Loading branch information
talentlessguy committed Apr 29, 2024
1 parent 161f841 commit aa916b6
Show file tree
Hide file tree
Showing 9 changed files with 2,930 additions and 2,295 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"homepage": "https://github.com/StauroDEV/blumen",
"scripts": {
"dev": "tsx src/cli.ts",
"build": "tsc",
"build": "tsc -p tsconfig.build.json",
"postbuild": "chmod +x ./dist/cli.js",
"prepublishOnly": "pnpm build",
"lint": "eslint --config eslint.config.js src/**/*.ts eslint.config.js",
Expand Down Expand Up @@ -71,5 +71,6 @@
},
"publishConfig": {
"provenance": true
}
},
"packageManager": "[email protected]"
}
5,147 changes: 2,882 additions & 2,265 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions scripts/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { readFile, writeFile } from 'node:fs/promises'

const pkg = await readFile('./package.json', 'utf8')

const {version} = JSON.parse(pkg)

await writeFile('./src/utils/version.ts', `export const BLUMEN_VERSION = '${version}'`)
2 changes: 2 additions & 0 deletions src/actions/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import { deployMessage, logger } from '../utils/logger.js'
import * as colors from 'colorette'
import { dnsLinkAction } from './dnslink.js'

// @ts-ignore
const AsciiBar = mod.default


type DeployActionArgs = {
strict: boolean
chain?: ChainName
Expand Down
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { deployAction } from './actions/deploy.js'

import './polyfills/globals.js'
import { pingAction } from './actions/ping.js'
import { getVersion } from './utils/version.js'
import { BLUMEN_VERSION } from './utils/version.js'
import { dnsLinkAction } from './actions/dnslink.js'

const cli = cac('blumen')
Expand Down Expand Up @@ -58,5 +58,5 @@ cli.command('dnslink <cid> <name>', 'Update DNSLink with a given CID using Cloud
.action(dnsLinkAction)

cli.help()
cli.version(await getVersion())
cli.version(BLUMEN_VERSION)
cli.parse()
12 changes: 1 addition & 11 deletions src/utils/version.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
import { readFile } from 'node:fs/promises'
import path from 'node:path'

const root = path.resolve(import.meta.dirname, '../..')

export async function getVersion(): Promise<string > {
const packageData = await readFile(path.resolve(root, 'package.json'), 'utf-8')
const packageJson = JSON.parse(packageData)
const packageVersion = packageJson.version
return packageVersion as string
}
export const BLUMEN_VERSION = '0.1.2'
5 changes: 3 additions & 2 deletions src/utils/w3up.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as Client from '@web3-storage/w3up-client'
import { StoreMemory } from '@web3-storage/access/stores/store-memory'
import { importDAG } from '@ucanto/core/delegation'
import { CarReader } from '@ipld/car'
import { Block } from 'ipfs-car'

export async function setupW3Up({ pk, proof: _proof }: { pk: string, proof: string }) {
const principal = Signer.parse(pk)
Expand All @@ -20,10 +21,10 @@ export async function setupW3Up({ pk, proof: _proof }: { pk: string, proof: stri
}

async function parseProof(data: string) {
const blocks = []
const blocks: Array<Block<unknown, number, number, 1>> = []
const reader = await CarReader.fromBytes(Buffer.from(data, 'base64'))
for await (const block of reader.blocks()) {
blocks.push(block)
blocks.push(block as Block<unknown, number, number, 1>)
}
return importDAG(blocks)
}
15 changes: 15 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"module": "Preserve",
"target": "es2022",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "Bundler",
"outDir": "dist",
"isolatedModules": true,
"resolveJsonModule": true
},
"exclude": ["node_modules", "**/*.test.ts"],
"include": ["src"]
}
28 changes: 15 additions & 13 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"compilerOptions": {
"module": "Node16",
"target": "es2022",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node16",
"outDir": "dist",
"isolatedModules": true,
},
"exclude": ["node_modules", "**/node_modules/*","**/*.test.ts"],
"include": ["src"]
}
"compilerOptions": {
"module": "Preserve",
"target": "es2022",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "Bundler",
"outDir": "dist",
"isolatedModules": true,
"resolveJsonModule": true
},
"exclude": ["node_modules", "**/*.test.ts"],
"include": ["src", "scripts"]
}

0 comments on commit aa916b6

Please sign in to comment.