Skip to content

Commit

Permalink
chore: publish to external
Browse files Browse the repository at this point in the history
  • Loading branch information
kittapon.j committed Sep 17, 2023
1 parent c0dcd2c commit 7cc13f4
Show file tree
Hide file tree
Showing 22 changed files with 3,747 additions and 4,085 deletions.
15 changes: 15 additions & 0 deletions .eslintrc
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"
}
}
3 changes: 0 additions & 3 deletions .eslintrc.js

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/release.yml
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
6 changes: 0 additions & 6 deletions .gitlab-ci.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .gitlab/merge_request_templates/default.md

This file was deleted.

2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/gallium
lts/hydrogen
11 changes: 11 additions & 0 deletions .prettierrc
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"
}
5 changes: 5 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"branches": [
"main"
]
}
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

### Features

* add inject data qa ([77e8ef5](https://git.wndv.co/wongnai/frontend/lmwn-libraries/rollup-plugin-data-qa/commit/77e8ef5cb684d423521adf34ca3d89a2cf08aacc))
* init project ([d189896](https://git.wndv.co/wongnai/frontend/lmwn-libraries/rollup-plugin-data-qa/commit/d189896e19fceb399a5e2931c84def44f7bea297))
* add inject data qa
* init project
21 changes: 21 additions & 0 deletions LICENSE
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.
98 changes: 97 additions & 1 deletion README.md
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
43 changes: 28 additions & 15 deletions package.json
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"
}
}
3 changes: 0 additions & 3 deletions release.config.js

This file was deleted.

Loading

0 comments on commit 7cc13f4

Please sign in to comment.