Skip to content

Commit

Permalink
Merge pull request #18 from Intosoft/feat/web
Browse files Browse the repository at this point in the history
chore: code quality
  • Loading branch information
sakul-budhathoki authored Mar 8, 2024
2 parents c79b5ee + d48fd9d commit 2b1fe0a
Show file tree
Hide file tree
Showing 25 changed files with 3,733 additions and 1,882 deletions.
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/dist
/node_modules
/.github
/examples
/.git
esbuild.js
18 changes: 18 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["plugin:@typescript-eslint/recommended", "airbnb-base", "prettier"],
"parser": "@typescript-eslint/parser",
"plugins": ["prettier", "@typescript-eslint"],
"rules": {
"prettier/prettier": "error",
"no-unused-vars": ["error", { "vars": "all", "args": "none" }],
"no-console": "off",
"import/order": "error",
"import/no-unresolved": "off",
"import/named": 0,
"import/extensions": "off",
"import/prefer-default-export": "off",
"no-plusplus": "off",
"no-shadow": "off",
"@typescript-eslint/ban-ts-comment": "off"
}
}
3 changes: 3 additions & 0 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ jobs:
- name: TSC
run: yarn tsc

- name: yarn lint
run: yarn lint

- name: Build
run: yarn build
40 changes: 20 additions & 20 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
on:
push:
branches:
- main
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: 18
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: 18

- name: Install node modules
run: yarn
- name: Install node modules
run: yarn

- name: Build
run: yarn build
- name: Build
run: yarn build

- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
/.github
/src
.nvmrc
./scripts
./scripts
esbuild.js
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

dist/
node_modules/
examples/
.git/
.github/
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 100,
"useTabs": false,
"tabWidth": 4,
"singleQuote": true
}
41 changes: 24 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,51 @@

# [Intosoft QR Code](https://qrcode.intosoft.com/) · [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Intosoft/qrcode/blob/main/LICENSE)
# [Intosoft QR Code](https://qrcode.intosoft.com/) · [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Intosoft/qrcode/blob/main/LICENSE)

Intosoft QR Code is a fully customizable open source QR code generator tool.
- **Versatile and Customizable:** Fully color, style, content customization
- **Seamless Integration:** Integrate Intosoft QRcode seamlessly into your existing tech stack, whether you're working with React, React Native, NodeJS, Vue.js, Angular, or pure JavaScript.


- **Versatile and Customizable:** Fully color, style, content customization
- **Seamless Integration:** Integrate Intosoft QRcode seamlessly into your existing tech stack, whether you're working with React, React Native, NodeJS, Vue.js, Angular, or pure JavaScript.

[Start customizing](https://qrcode.intosoft.com)

## Installation

NPM

```
npm i @intosoft/qrcode
```

Yarn

```
yarn add @intosoft/qrcode
```
## Examples
```

## Examples

React

```jsx
import { generateSVGString } from '@intosoft/qrcode';
import { generateSVGString } from '@intosoft/qrcode';

const svgString = generateSVGString();

export const RenderQR = () => {
return (<div dangerouslySetInnerHTML={{__html: svgString}}/>);
export const RenderQR = () => {
return <div dangerouslySetInnerHTML={{ __html: svgString }} />;
};
```

React Native
First Install [react-native-svg](https://github.com/software-mansion/react-native-svg)

```jsx
import { SvgFromXml } from "react-native-svg";
import { generateSVGString } from '@intosoft/qrcode';
import { SvgFromXml } from 'react-native-svg';
import { generateSVGString } from '@intosoft/qrcode';

const svgString = generateSVGString();

export const RenderQR = () => {
return (<SvgFromXml xml={svgString} />);
export const RenderQR = () => {
return <SvgFromXml xml={svgString} />;
};
```

Expand All @@ -59,7 +66,7 @@ Vanilla JS
</script>
</html>
```

### License [MIT licensed](./LICENSE).

*QR Code is a registered trademark of DENSO WAVE INCORPORATED.*
### License [MIT licensed](./LICENSE).

_QR Code is a registered trademark of DENSO WAVE INCORPORATED._
30 changes: 30 additions & 0 deletions esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable import/no-extraneous-dependencies */
const { build } = require('esbuild');
const { Generator } = require('npm-dts');
const { dependencies } = require('./package.json');

new Generator({
entry: 'src/index.ts',
output: 'dist/index.d.ts',
}).generate();

const sharedConfig = {
entryPoints: ['src/index.ts'],
bundle: true,
minify: true,
external: Object.keys(dependencies),
};

build({
...sharedConfig,
platform: 'node', // for CJS
outfile: 'dist/index.js',
});

build({
...sharedConfig,
outfile: 'dist/index.esm.js',
platform: 'neutral', // for ESM
format: 'esm',
});
61 changes: 39 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
{
"name": "@intosoft/qrcode",
"version": "0.0.6",
"description": "",
"main": "dist/index.js",
"scripts": {
"tsc": "tsc",
"build": "esbuild ./src/index.ts --bundle --outfile=dist/index.js"
},
"author": "[email protected]",
"license": "MIT",
"dependencies": {
"qrcode": "^1.5.3"
},
"devDependencies": {
"@types/qrcode": "^1.5.5",
"esbuild": "^0.20.1",
"tsx": "^4.7.1",
"typescript": "^5.3.3"
},
"publishConfig": {
"access": "public"
}
"name": "@intosoft/qrcode",
"version": "0.0.7",
"description": "",
"module": "dist/index.esm.js",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"build": "node esbuild.js",
"unused-exports": "ts-unused-exports ./tsconfig.json --excludePathsFromReport='index.ts'",
"tsc": "tsc",
"lint": "yarn format && yarn eslint && yarn unused-exports",
"format": "prettier --check .",
"eslint": "eslint .",
"lint:fix": "eslint --fix ."
},
"author": "[email protected]",
"license": "MIT",
"dependencies": {
"qrcode": "^1.5.3"
},
"devDependencies": {
"@types/qrcode": "^1.5.5",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"esbuild": "^0.20.1",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"npm-dts": "^1.3.12",
"prettier": "^3.2.5",
"ts-unused-exports": "^10.0.1",
"tsx": "^4.7.1",
"typescript": "^5.3.3"
},
"publishConfig": {
"access": "public"
}
}
Loading

0 comments on commit 2b1fe0a

Please sign in to comment.