diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..773ca2d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true +quote_type = single diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dc7e058 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +# Build output +dist + +# Coverage directory +coverage + +# Dependency directories +node_modules/ + +# Lock files +package-lock.json +pnpm-lock.yaml +yarn.lock + +# Output of 'npm pack' +*.tgz diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..17fab0c --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + "recommendations": [ + "dbaeumer.vscode-eslint", + "editorconfig.editorconfig", + "esbenp.prettier-vscode" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b14a167 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,27 @@ +{ + "eslint.validate": [ + "javascript", + "typescript" + ], + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true, + "source.organizeImports": true + }, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "editor.rulers": [ + 100 + ], + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b6f5fa7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changelog + +## 1.0.0 - 2023-03-30 + +- Added something +- Changed something +- Fixed something +- Removed something +- Deprecated something diff --git a/README.md b/README.md new file mode 100644 index 0000000..f184790 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# vite-plugin-adsense + +## Install + +```bash +npm i vite-plugin-adsense +``` + +## Usage + +```ts +import { hello } from 'vite-plugin-adsense'; + +hello('world'); +``` diff --git a/package.json b/package.json new file mode 100644 index 0000000..62cc7fe --- /dev/null +++ b/package.json @@ -0,0 +1,60 @@ +{ + "name": "vite-plugin-adsense", + "version": "1.0.0", + "description": "Insert Google AdSense script and ads.txt", + "keywords": [ + "node", + "vite", + "vite-plugin", + "google", + "adsense", + "advertisement" + ], + "homepage": "https://github.com/guoyunhe/vite-plugin-adsense#readme", + "bugs": { + "url": "https://github.com/guoyunhe/vite-plugin-adsense/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/guoyunhe/vite-plugin-adsense.git" + }, + "funding": "https://github.com/sponsors/guoyunhe", + "license": "GPL-3.0", + "author": { + "name": "Guo Yunhe", + "email": "i@guoyunhe.me" + }, + "main": "dist/index.js", + "module": "dist/index.js", + "typings": "dist/index.d.ts", + "files": [ + "dist", + "CHANGELOG.md", + "LICENSE", + "README.md" + ], + "scripts": { + "build": "node-scripts build", + "format": "node-scripts format", + "lint": "node-scripts lint", + "test": "node-scripts test", + "watch": "node-scripts watch" + }, + "prettier": { + "printWidth": 100, + "singleQuote": true + }, + "eslintConfig": { + "extends": "@guoyunhe/node-scripts" + }, + "jest": { + "preset": "@guoyunhe/node-scripts" + }, + "devDependencies": { + "@guoyunhe/node-scripts": "^2.0.0", + "@tsconfig/node16": "^1.0.0", + "@types/jest": "^29.0.0", + "@types/node": "^16.0.0", + "typescript": "^4.0.0" + } +} diff --git a/src/index.test.ts b/src/index.test.ts new file mode 100644 index 0000000..c51ecee --- /dev/null +++ b/src/index.test.ts @@ -0,0 +1,8 @@ +import { hello } from '.'; + +describe('hello()', () => { + it('say hello', () => { + expect(hello()).toBe('Hello, world!'); + expect(hello('Bob')).toBe('Hello, Bob!'); + }); +}); diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..c8f346c --- /dev/null +++ b/src/index.ts @@ -0,0 +1,3 @@ +export function hello(who = 'world'): string { + return `Hello, ${who}!`; +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..afe540c --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "@tsconfig/node16/tsconfig.json", + "compilerOptions": { + "resolveJsonModule": true, + "types": [ + "node", + "jest", + "@guoyunhe/node-scripts/global" + ] + }, + "include": [ + "src" + ] +}