Skip to content

Commit

Permalink
chore: rename & clean code & update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
dongnaebi committed Nov 21, 2022
1 parent 43a2897 commit b27cc09
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 175 deletions.
16 changes: 0 additions & 16 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,5 @@
"modules": false
}
]
],
"plugins": [
"transform-vue-jsx",
[
"@babel/plugin-transform-runtime",
{
"corejs": false,
"helpers": false,
"regenerator": true,
"useESModules": false
}
],
"@babel/plugin-transform-object-assign",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-proposal-optional-chaining"
]
}
3 changes: 1 addition & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
module.exports = {
root: true,
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
parserOptions: {
sourceType: 'module'
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: 'standard',
// required to lint *.vue files
plugins: [],
// add your custom rules here
'rules': {
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020-present funinps
Copyright (c) 2020-present rotick

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
[![NPM version][npm-image]][npm-url] |
[中文文档](README_zh.md)

[npm-image]: https://img.shields.io/npm/v/@funinps/dom-mark.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/@funinps/dom-mark
[npm-image]: https://img.shields.io/npm/v/@rotick/dom-mark.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/@rotick/dom-mark

Add text/HTML as watermark to DOM node

Expand All @@ -20,9 +20,7 @@ Add text/HTML as watermark to DOM node

## Install
```bash
npm i @funinps/dom-mark -S
# or
yarn add @funinps/dom-mark
npm i @rotick/dom-mark -S
```
In browser, download `dist/dom-mark.js` to your project:
```html
Expand All @@ -31,7 +29,7 @@ In browser, download `dist/dom-mark.js` to your project:

## Useage
```javascript
import DomMark from '@funinps/dom-mark'
import DomMark from '@rotick/dom-mark'

const domMark = new DomMark('body', {
content: '水印', // html,text
Expand Down Expand Up @@ -90,7 +88,7 @@ rerender when hot module reload, rerender only when watermark change in Mutation

## Questions & Suggestions

Please open an issue [here](https://github.com/funinps/dom-mark/issues).
Please open an issue [here](https://github.com/rotick/dom-mark/issues).

## License

Expand Down
12 changes: 5 additions & 7 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
[![NPM version][npm-image]][npm-url] |
[English documentation](README.md)

[npm-image]: https://img.shields.io/npm/v/@funinps/dom-mark.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/@funinps/dom-mark
[npm-image]: https://img.shields.io/npm/v/@rotick/dom-mark.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/@rotick/dom-mark

将文本或者html作为水印添加到DOM节点中

Expand All @@ -20,9 +20,7 @@

## 安装
```bash
npm i @funinps/dom-mark -S
# 或者
yarn add @funinps/dom-mark
npm i @rotick/dom-mark -S
```
如果是直接引入使用,则下载 `dist/dom-mark.js` 到你的项目中:
```html
Expand All @@ -31,7 +29,7 @@ yarn add @funinps/dom-mark

## 用法
```javascript
import DomMark from '@funinps/dom-mark'
import DomMark from '@rotick/dom-mark'

const domMark = new DomMark('body', {
content: '水印', // html,text
Expand Down Expand Up @@ -91,7 +89,7 @@ dm.destroy()

## 问题及建议

请开一个 [issue](https://github.com/funinps/dom-mark/issues).
请开一个 [issue](https://github.com/rotick/dom-mark/issues).

## License

Expand Down
8 changes: 1 addition & 7 deletions dist/dom-mark.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 17 additions & 55 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@funinps/dom-mark",
"version": "1.1.0",
"name": "@rotick/dom-mark",
"version": "1.2.0",
"description": "Add text/HTML as watermark to DOM node, customizable content and style, automatically calculate size and position",
"author": "dongnaebi",
"main": "dist/dom-mark.js",
Expand All @@ -14,71 +14,33 @@
"scripts": {
"lint": "eslint --ext .js src",
"lint:fix": "eslint --fix --ext .js src",
"build1": "npm run lint && rimraf dist && webpack --config webpack.config.js -p --progress --hide-modules",
"build": "npm run lint && rimraf dist && rollup -c ./rollup.config.js",
"pub": "npm config set registry https://registry.npmjs.org/ && npm login && npm publish --access public && npm config set registry https://registry.npm.taobao.org/"
"pub": "npm publish --access public"
},
"dependencies": {},
"engines": {
"node": "> 8.1.4",
"npm": ">= 5.2.0"
"node": "> 14.0.0"
},
"devDependencies": {
"@babel/core": "^7.9.6",
"@babel/parser": "7.7.5",
"@babel/plugin-proposal-object-rest-spread": "^7.9.6",
"@babel/plugin-proposal-optional-chaining": "^7.9.0",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-object-assign": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.9.6",
"@babel/polyfill": "^7.8.7",
"@babel/preset-env": "^7.9.6",
"@babel/runtime": "^7.9.6",
"autoprefixer": "^9.7.6",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"babel-plugin-component": "^1.1.1",
"babel-plugin-import": "^1.13.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"cross-env": "^7.0.2",
"css-loader": "^3.5.3",
"eslint": "^6.8.0",
"eslint-config-enough": "^0.4.3",
"eslint-config-standard": "^14.1.1",
"eslint-loader": "^4.0.2",
"eslint-plugin-html": "^6.0.2",
"eslint-plugin-import": "^2.20.2",
"@babel/core": "^7.20.2",
"@babel/eslint-parser": "^7.19.1",
"@babel/preset-env": "^7.20.2",
"@rollup/plugin-babel": "^6.0.2",
"@rollup/plugin-terser": "^0.1.0",
"eslint": "^8.28.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-vue": "^6.2.2",
"file-loader": "^6.0.0",
"html-loader": "^1.1.0",
"html-webpack-plugin": "^4.3.0",
"less": "^3.11.1",
"less-loader": "^6.1.0",
"node-sass": "^4.14.1",
"postcss-loader": "^3.0.0",
"raw-loader": "^4.0.1",
"eslint-plugin-promise": "^6.1.1",
"rimraf": "^3.0.2",
"rollup": "^2.10.2",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-uglify": "^6.0.4",
"sass-loader": "^8.0.2",
"style-loader": "^1.2.1",
"url-loader": "^4.1.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.11.0"
"rollup": "^3.3.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/funinps/dom-mark.git"
"url": "git+https://github.com/rotick/dom-mark.git"
},
"bugs": {
"url": "https://github.com/funinps/dom-mark/issues"
"url": "https://github.com/rotick/dom-mark/issues"
},
"homepage": "https://github.com/funinps/dom-mark#readme",
"homepage": "https://github.com/rotick/dom-mark#readme",
"license": "MIT"
}
5 changes: 0 additions & 5 deletions postcss.config.js

This file was deleted.

17 changes: 4 additions & 13 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
const babel = require('rollup-plugin-babel')
const { uglify } = require('rollup-plugin-uglify')
const version = process.env.VERSION || require('./package.json').version
const { babel } = require('@rollup/plugin-babel')
const terser = require('@rollup/plugin-terser')
// const version = process.env.VERSION || require('./package.json').version

module.exports = {
input: 'src/index.js',
plugins: [babel(), uglify({
output: {
preamble: `/**
* @funinps/dom-mark v${version}
* https://github.com/funinps/dom-mark
* (c) ${new Date().toLocaleDateString()} @dongnaebi
* @license MIT
*/`
}
})],
plugins: [babel(), terser()],
output: {
file: 'dist/dom-mark.js',
format: 'umd',
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DomMark {
}
if (!this.container) throw new Error(`invalid selector: ${el}`)

const existBox = this.container.querySelector('div[powered-by="https://github.com/funinps/dom-mark"]')
const existBox = this.container.querySelector('div[powered-by="https://github.com/rotick/dom-mark"]')
if (existBox) {
this.box = existBox
}
Expand Down Expand Up @@ -42,7 +42,7 @@ class DomMark {
box.style.cssText = `position:absolute;top:0;left:0;right:0;bottom:0;font-size:${fontSize};
font-family:${fontFamily};opacity:${opacity};color:${color};pointer-events:none;
user-select: none;-ms-user-select: none;z-index:${zIndex};z-index:-1\\9;`
box.setAttribute('powered-by', 'https://github.com/funinps/dom-mark')
box.setAttribute('powered-by', 'https://github.com/rotick/dom-mark')
box.setAttribute('onselectstart', 'return false;')
box.setAttribute('ondragstart', 'return false;')
temp.style.cssText = 'position:absolute;top:0;left:0;opacity:0;'
Expand Down
60 changes: 0 additions & 60 deletions webpack.config.js

This file was deleted.

0 comments on commit b27cc09

Please sign in to comment.