diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..10607f6 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +@alpacahq:registry=https://npm.pkg.github.com/alpacahq +//npm.pkg.github.com/:_authToken=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 \ No newline at end of file diff --git a/Makefile b/Makefile index c42ec2a..d21dda2 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,19 @@ SRC_DEPS = src/index.tsx src/third-party/qrcodegen/index.ts -CFG_DEPS = yarn.lock package.json tsup.config.ts +CFG_DEPS = package.json tsup.config.ts -all: lib/index.js lib/index.d.ts lib/index.js examples/iife/demo.js +all: lib/index.js lib/index.d.ts lib/index.js lib: mkdir -p lib lib/index.d.ts: lib $(SRC_DEPS) $(CFG_DEPS) - yarn run build:code + npm run build:code lib/esm/index.js: lib $(SRC_DEPS) $(CFG_DEPS) - yarn run build:code + npm run build:code lib/index.js: lib $(SRC_DEPS) $(CFG_DEPS) - yarn run build:code - -examples/iife/demo.js: lib/esm/index.js examples/demo.tsx - yarn run build:examples + npm run build:code clean: - rm -rf lib examples/iife/demo.js + rm -rf lib diff --git a/README.md b/README.md index 1d67113..d2543d5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # qrcode.react +This is a copy of qrcode.react A React component to generate [QR codes](http://en.wikipedia.org/wiki/QR_code) for rendering to the DOM. ## Installation diff --git a/examples/demo.tsx b/examples/demo.tsx deleted file mode 100644 index a0eccfb..0000000 --- a/examples/demo.tsx +++ /dev/null @@ -1,292 +0,0 @@ -'use strict'; - -import {QRCodeSVG, QRCodeCanvas} from '..'; -import React, {useState} from 'react'; -import ReactDOM from 'react-dom'; -import {version} from '../package.json'; - -function Demo() { - const [value, setValue] = useState( - 'https://picturesofpeoplescanningqrcodes.tumblr.com/' - ); - const [size, setSize] = useState(128); - const [fgColor, setFgColor] = useState('#000000'); - const [bgColor, setBgColor] = useState('#ffffff'); - const [level, setLevel] = useState('L'); - const [includeMargin, setIncludeMargin] = useState(false); - const [includeImage, setIncludeImage] = useState(true); - const [imageH, setImageH] = useState(24); - const [imageW, setImageW] = useState(24); - const [imageX, setImageX] = useState(0); - const [imageY, setImageY] = useState(0); - const [imageSrc, setImageSrc] = useState( - 'https://static.zpao.com/favicon.png' - ); - const [imageExcavate, setImageExcavate] = useState(true); - const [centerImage, setCenterImage] = useState(true); - - function makeExampleCode(componentName: string) { - const imageSettingsCode = includeImage - ? ` - imageSettings={{ - src: "${imageSrc}", - x: ${centerImage ? 'null' : imageX}, - y: ${centerImage ? 'null' : imageY}, - height: ${imageH}, - width: ${imageW}, - excavate: ${imageExcavate}, - }}` - : ''; - return `import {${componentName}} from 'qrcode.react'; -<${componentName} - value={"${value}"} - size={${size}} - bgColor={"${bgColor}"} - fgColor={"${fgColor}"} - level={"${level}"} - includeMargin={${includeMargin}}${imageSettingsCode} -/>`; - } - const svgCode = makeExampleCode('QRCodeSVG'); - const canvasCode = makeExampleCode('QRCodeSVG'); - - const renderProps = { - value, - size, - fgColor, - bgColor, - level, - includeMargin, - imageSettings: includeImage - ? { - src: imageSrc, - height: imageH, - width: imageW, - x: centerImage ? null : imageX, - y: centerImage ? null : imageY, - excavate: imageExcavate, - } - : null, - }; - - return ( - <> -

- QRCode.react Demo -{' '} - - v{version} - -

-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
-