-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kittapon.j
committed
Sep 17, 2023
1 parent
c0dcd2c
commit 7cc13f4
Showing
22 changed files
with
3,747 additions
and
4,085 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"rules": { | ||
"no-console": "off", | ||
"semi": ["error", "never"], | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-var-requires": "off" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 'lts/hydrogen' | ||
- name: Install dependencies | ||
run: yarn | ||
- name: Build & Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: yarn release |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
lts/gallium | ||
lts/hydrogen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"bracketSpacing": true, | ||
"jsxBracketSameLine": false, | ||
"printWidth": 100, | ||
"semi": false, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "all", | ||
"useTabs": true, | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"branches": [ | ||
"main" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 LINE MAN Wongnai | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,97 @@ | ||
Rollup Plugin inject data-qa | ||
# Rollup Plugin inject data-qa | ||
|
||
[![semantic-release](https://img.shields.io/badge/semantic-release-e10079.svg?logo=semantic-release)](https://github.com/semantic-release/semantic-release) | ||
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) | ||
![ts](https://badgen.net/badge/Built%20With/TypeScript/blue) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
|
||
rollup plugin of react and styled-component that can injection `data-qa` attribute to DOM that can display/hide with ENV flag. | ||
|
||
## Installation | ||
|
||
```sh | ||
yarn add -D @lmwn/rollup-data-qa | ||
``` | ||
|
||
## Usage | ||
|
||
- on rollup.config.js | ||
|
||
```sh | ||
import { injectDataQa } from '@lmwn/rollup-plugin-inject-data-qa' | ||
|
||
export default [{ | ||
..., | ||
plugins:[ | ||
injectDataQa() | ||
] | ||
}] | ||
``` | ||
- on script | ||
```sh | ||
E2E_ENABLED=true && yarn build | ||
``` | ||
- however if you using rollup to build lib you should set env flag `E2E_ENABLED` in your main project instead. | ||
**input** | ||
```js | ||
const StyledA = styled.div`...` | ||
const ComponentA = () => ( | ||
<div> | ||
<StyledA>...</StyledA> | ||
</div> | ||
) | ||
``` | ||
**output** (after build) | ||
```js | ||
const ComponentA = () => ( | ||
<div data-qa="component-a"> | ||
<div className="styled-xxx" data-qa="styled-a"> | ||
... | ||
</div> | ||
</div> | ||
) | ||
``` | ||
## Params | ||
### include | ||
Type: String[] | ||
Default: null | ||
### exclude | ||
Type: String[] | ||
Default: null | ||
### format | ||
Type: 'paramCase' | 'camelCase' | .. | ||
Default: 'paramCase' | ||
this lib using [change-case](https://www.npmjs.com/package/change-case) to format data-qa attribute | ||
### options | ||
Type: Object | ||
Default: null | ||
options for configure plugin setting | ||
**disabledStyledComponent** | ||
Type: Boolean | ||
Default: false | ||
- if you not using styled component it should set be true | ||
**disabledReactFunctionComponent** | ||
Type: Boolean | ||
Default: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,64 @@ | ||
{ | ||
"name": "@lmwn/rollup-plugin-inject-data-qa", | ||
"version": "1.0.0", | ||
"repository": "https://git.wndv.co/wongnai/frontend/lmwn-libraries/rollup-plugin-data-qa", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/wongnai/rollup-plugin-data-qa.git" | ||
}, | ||
"author": "LINE MAN Wongnai Frontend Team", | ||
"homepage": "https://github.com/wongnai/rollup-plugin-data-qa#readme", | ||
"license": "MIT", | ||
"deploy": "dist", | ||
"scripts": { | ||
"prepare": "husky install", | ||
"lint": "eslint --ext .tsx,.ts src", | ||
"lint:fix": "eslint --ext .tsx,.ts --fix src", | ||
"test": "jest", | ||
"test:mr": "jest --ci --coverage --changedSince=origin/main", | ||
"type-check": "tsc --noEmit", | ||
"build": "rollup -c rollup.config.js", | ||
"release": "yarn build && semantic-release", | ||
"postversion": "cp package.json .." | ||
}, | ||
"dependencies": { | ||
"@rollup/pluginutils": "5.0.2", | ||
"@wongnai/utils": "1.84.0", | ||
"change-case": "4.1.2", | ||
"estree-walker": "3.0.1", | ||
"lodash": "4.17.21", | ||
"magic-string": "0.27.0" | ||
}, | ||
"devDependencies": { | ||
"@lmwn/kyo-rollup": "1.3.2", | ||
"@lmwn/semantic-release-lib": "1.1.0", | ||
"@optimize-lodash/rollup-plugin": "4.0.1", | ||
"@rollup/plugin-commonjs": "21.0.0", | ||
"@rollup/plugin-node-resolve": "13.0.0", | ||
"@rollup/plugin-typescript": "6.0.0", | ||
"@rollup/pluginutils": "5.0.2", | ||
"@testing-library/jest-dom": "5.16.4", | ||
"@types/jest": "27.0.2", | ||
"@types/jsdom": "16.2.10", | ||
"@types/lodash": "4.14.191", | ||
"@wongnai/eslint-config-wongnailib": "7.1.2", | ||
"@wongnai/prettier": "2.3.1", | ||
"@typescript-eslint/eslint-plugin": "6.7.0", | ||
"@typescript-eslint/parser": "6.7.0", | ||
"@zerollup/ts-transform-paths": "1.7.18", | ||
"eslint": "7.28.0", | ||
"husky": "8.0.1", | ||
"jest": "27.3.1", | ||
"jest-transform-stub": "2.0.0", | ||
"lint-staged": "10.3.0", | ||
"lodash": "4.17.21", | ||
"prettier": "2.3.1", | ||
"rollup": "2.58.0", | ||
"rollup-plugin-cleaner": "1.0.0", | ||
"rollup-plugin-copy": "3.3.0", | ||
"rollup-plugin-multi-input": "1.3.1", | ||
"rollup-plugin-terser": "7.0.2", | ||
"rollup-plugin-visualizer": "4.1.1", | ||
"semantic-release": "21.0.0", | ||
"ts-jest": "27.0.7", | ||
"ttypescript": "1.5.15", | ||
"typescript": "4.7.3" | ||
}, | ||
"peerDependencies": { | ||
"jest": ">=27.3.1", | ||
"typescript": ">=4.4.4" | ||
}, | ||
"publishConfig": { | ||
"registry": "https://nexus.wndv.co/repository/wongnai-npm/" | ||
"jest": ">=27.3.1" | ||
}, | ||
"prettier": "@wongnai/prettier" | ||
"engines": { | ||
"node": ">=18" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.