Skip to content

Commit a78acb5

Browse files
committed
chore: wip
chore: wip chore: wip
1 parent 3562aa5 commit a78acb5

11 files changed

Lines changed: 25 additions & 20 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
run: bun install
3131

3232
- name: Publish to npm
33-
run: bun publish --access public
33+
run: bun run --filter './packages/*' release
3434
env:
3535
BUN_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
3636

docs/.vitepress/theme/components/QRDemo.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script setup>
2-
import { QRCode, QRCodeCorrectLevel } from '@stacksjs/qrx'
2+
import { QRCode } from '@stacksjs/qrx'
33
import { onMounted, ref, watch } from 'vue'
44
// import { QRCode, QRCodeCorrectLevel } from './qrcode'
55
6-
const text = ref('Hello VitePress!')
6+
const text = ref('Hello World!')
77
const errorLevel = ref('2') // H level by default
88
const useSVG = ref(true)
99
const qrContainer = ref(null)

docs/.vitepress/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export default defineConfig({
5555
exclude: [
5656
// 'vue',
5757
'body-scroll-lock',
58+
'bunfig',
5859
],
5960
},
6061
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"fresh": "bunx rimraf node_modules/ bun.lock && bun i",
3838
"changelog": "bunx changelogen --output CHANGELOG.md",
3939
"prepublishOnly": "bun --bun run build && bun run compile:all",
40-
"release": "bun run changelog && bunx bumpp package.json --all",
40+
"release": "bun run changelog && bunx bumpp -r --all",
4141
"test": "bun test",
4242
"dev:docs": "bun --bun vitepress dev docs",
4343
"build:docs": "bun --bun vitepress build docs",

packages/qrx/build.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const resp = await Bun.build({
44
target: 'browser',
55
entrypoints: ['./src/index.ts'],
66
outdir: './dist',
7+
external: ['bunfig'],
78
plugins: [dts()],
89
})
910

packages/qrx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"lint": "bunx --bun eslint --flag unstable_ts_config .",
6161
"lint:fix": "bunx --bun eslint --flag unstable_ts_config . --fix",
6262
"prepublishOnly": "bun --bun run build && bun run compile:all",
63-
"release": "bun run changelog && bunx bumpp package.json --all",
63+
"release": "bun publish --access public",
6464
"test": "bun test",
6565
"typecheck": "bun --bun tsc --noEmit"
6666
},

packages/qrx/src/barcode/drivers/EAN_UPC/UPC.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,20 @@ class UPC extends Barcode {
2727
this.guardHeight = options.height + this.fontSize / 2 + options.textMargin
2828
}
2929

30-
valid() {
30+
valid(): boolean {
3131
return this.data.search(/^\d{12}$/) !== -1
3232
&& this.data[11] == checksum(this.data)
3333
}
3434

35-
encode() {
35+
encode(): any {
3636
if (this.options.flat) {
3737
return this.flatEncoding()
3838
}
39-
else {
40-
return this.guardedEncoding()
41-
}
39+
40+
return this.guardedEncoding()
4241
}
4342

44-
flatEncoding() {
43+
flatEncoding(): { data: string, text: string } {
4544
let result = ''
4645

4746
result += '101'
@@ -56,7 +55,7 @@ class UPC extends Barcode {
5655
}
5756
}
5857

59-
guardedEncoding() {
58+
guardedEncoding(): any {
6059
const result = []
6160

6261
// Add the first digit
@@ -115,7 +114,7 @@ class UPC extends Barcode {
115114

116115
// Calulate the checksum digit
117116
// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit
118-
export function checksum(number) {
117+
export function checksum(number: string): number {
119118
let result = 0
120119

121120
let i

packages/qrx/src/barcode/drivers/MSI/MSI.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import Barcode from '../barcode'
55

66
class MSI extends Barcode {
7-
constructor(data, options) {
7+
constructor(data: string, options: any) {
88
super(data, options)
99
}
1010

11-
encode() {
11+
encode(): { data: string, text: string } {
1212
// Start bits
1313
let ret = '110'
1414

@@ -20,7 +20,7 @@ class MSI extends Barcode {
2020

2121
// Add 100 for every zero and 110 for every 1
2222
for (let b = 0; b < bin.length; b++) {
23-
ret += bin[b] == '0' ? '100' : '110'
23+
ret += bin[b] === '0' ? '100' : '110'
2424
}
2525
}
2626

@@ -33,15 +33,16 @@ class MSI extends Barcode {
3333
}
3434
}
3535

36-
valid() {
36+
valid(): boolean {
3737
return this.data.search(/^\d+$/) !== -1
3838
}
3939
}
4040

41-
function addZeroes(number, n) {
41+
function addZeroes(number: string, n: number): string {
4242
for (let i = 0; i < n; i++) {
4343
number = `0${number}`
4444
}
45+
4546
return number
4647
}
4748

packages/qrx/src/barcode/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ API.prototype.options = function (options) {
116116

117117
// Will create a blank space (usually in between barcodes)
118118
API.prototype.blank = function (size) {
119+
// eslint-disable-next-line unicorn/no-new-array
119120
const zeroes = new Array(size + 1).join('0')
120121
this._encodings.push({ data: zeroes })
121122
return this
@@ -128,7 +129,7 @@ API.prototype.init = function () {
128129
return
129130
}
130131

131-
// Make sure renderProperies is an array
132+
// Make sure renderProperties is an array
132133
if (!Array.isArray(this._renderProperties)) {
133134
this._renderProperties = [this._renderProperties]
134135
}
@@ -138,7 +139,7 @@ API.prototype.init = function () {
138139
renderProperty = this._renderProperties[i]
139140
var options = merge(this._options, renderProperty.options)
140141

141-
if (options.format == 'auto') {
142+
if (options.format === 'auto') {
142143
options.format = autoSelectBarcode()
143144
}
144145

packages/react/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"build": "bun --bun build.ts",
5151
"lint": "bunx --bun eslint --flag unstable_ts_config .",
5252
"lint:fix": "bunx --bun eslint --flag unstable_ts_config . --fix",
53+
"release": "bun publish --access public",
5354
"prepublishOnly": "bun --bun run build",
5455
"test": "bun test",
5556
"typecheck": "bun --bun tsc --noEmit"

0 commit comments

Comments
 (0)