Skip to content

Commit e9d38cb

Browse files
committed
🎉
0 parents  commit e9d38cb

16 files changed

+2564
-0
lines changed

.env

Whitespace-only changes.

.eslintrc.js

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
module.exports = {
2+
env: {
3+
node: true,
4+
browser: true,
5+
es2020: true,
6+
},
7+
extends: [],
8+
parser: '@typescript-eslint/parser',
9+
parserOptions: {
10+
ecmaVersion: 11,
11+
sourceType: 'module',
12+
},
13+
plugins: ['@typescript-eslint'],
14+
rules: {
15+
// Possible Errors
16+
'for-direction': 'off',
17+
'getter-return': 'error',
18+
'no-async-promise-executor': 'warn',
19+
'no-await-in-loop': 'warn',
20+
'no-compare-neg-zero': 'warn',
21+
'no-cond-assign': 'error',
22+
'no-console': 'warn',
23+
'no-constant-condition': 'error',
24+
'no-control-regex': 'warn',
25+
'no-debugger': 'error',
26+
'no-dupe-args': 'error',
27+
'no-dupe-else-if': 'error',
28+
'no-dupe-keys': 'error',
29+
'no-duplicate-case': 'error',
30+
'no-empty': 'warn',
31+
'no-empty-character-class': 'error',
32+
'no-ex-assign': 'error',
33+
'no-extra-boolean-cast': 'warn',
34+
'no-extra-parens': 'off', // Prettier
35+
'no-extra-semi': 'off', // Prettier
36+
'no-func-assign': 'off',
37+
'no-import-assign': 'off',
38+
'no-inner-declarations': 'error',
39+
'no-invalid-regexp': 'error',
40+
'no-irregular-whitespace': 'error',
41+
'no-loss-of-precision': 'warn',
42+
'no-misleading-character-class': 'error',
43+
'no-obj-calls': 'error',
44+
'no-promise-executor-return': 'error',
45+
'no-prototype-builtins': 'error',
46+
'no-regex-spaces': 'error',
47+
'no-setter-return': 'error',
48+
'no-sparse-arrays': 'warn',
49+
'no-template-curly-in-string': 'warn',
50+
'no-unexpected-multiline': 'error',
51+
'no-unreachable': 'error',
52+
'no-unreachable-loop': 'error',
53+
'no-unsafe-finally': 'error',
54+
'no-unsafe-negation': 'error',
55+
'no-useless-backreference': 'error',
56+
'require-atomic-updates': 'error',
57+
'use-isnan': 'error',
58+
'valid-typeof': 'error',
59+
60+
// Best Practices
61+
'accessor-pairs': 'error',
62+
'array-callback-return': 'warn',
63+
'block-scoped-var': 'off', // We disallow var completely
64+
'class-methods-use-this': 'error',
65+
complexity: 'off',
66+
'consistent-return': 'off',
67+
curly: 'error',
68+
'default-case': 'off',
69+
'default-case-last': 'error',
70+
'default-param-last': 'off',
71+
'dot-location': 'off', // Prettier
72+
'dot-notation': 'warn',
73+
eqeqeq: ['error', 'always', { null: 'ignore' }],
74+
'grouped-accessor-pairs': 'warn',
75+
'guard-for-in': 'off',
76+
'max-classes-per-file': 'off',
77+
'no-alert': 'warn',
78+
'no-caller': 'off',
79+
'no-case-declarations': 'error',
80+
'no-constructor-return': 'error',
81+
'no-div-regex': 'error',
82+
'no-else-return': 'off', // Who thought that this was a good idea?!?!
83+
'no-empty-function': 'off', // Annoying: Marks all service import constructors that are otherwise empty
84+
'no-empty-pattern': 'warn',
85+
'no-eq-null': 'off',
86+
'no-eval': 'warn',
87+
'no-extend-native': 'error',
88+
'no-extra-bind': 'warn',
89+
'no-extra-label': 'error',
90+
'no-fallthrough': 'warn',
91+
'no-floating-decimal': 'error',
92+
'no-global-assign': 'error',
93+
'no-implicit-coercion': ['error', { allow: ['!!'] }],
94+
'no-implicit-globals': 'error',
95+
'no-implied-eval': 'error',
96+
'no-invalid-this': 'error',
97+
'no-iterator': 'error',
98+
'no-labels': 'error',
99+
'no-lone-blocks': 'error',
100+
'no-loop-func': 'error',
101+
'no-magic-numbers': 'off', // Blocking 60 * 60 * 1000 seems rather inconventient
102+
'no-multi-spaces': 'off', // Prettier
103+
'no-multi-str': 'error',
104+
'no-new': 'warn',
105+
'no-new-func': 'error',
106+
'no-new-wrappers': 'error',
107+
'no-octal': 'error',
108+
'no-octal-escape': 'error',
109+
'no-param-reassign': 'warn',
110+
'no-proto': 'off',
111+
'no-redeclare': 'error',
112+
'no-restricted-properties': 'off',
113+
'no-return-assign': 'error',
114+
'no-return-await': 'error',
115+
'no-script-url': 'error',
116+
'no-self-assign': 'error',
117+
'no-self-compare': 'error',
118+
'no-sequences': 'warn',
119+
'no-throw-literal': 'error',
120+
'no-unmodified-loop-condition': 'error',
121+
'no-unused-expressions': 'error',
122+
'no-unused-labels': 'error',
123+
'no-useless-call': 'error',
124+
'no-useless-catch': 'error',
125+
'no-useless-concat': 'error',
126+
'no-useless-escape': 'error',
127+
'no-useless-return': 'error',
128+
'no-void': 'error',
129+
'no-warning-comments': 'off',
130+
'no-with': 'error',
131+
'prefer-named-capture-group': 'warn',
132+
'prefer-promise-reject-errors': 'warn', // CHECK ME: This rule might be annoying - it should probably be revisited.
133+
'prefer-regex-literals': 'error',
134+
radix: ['error', 'as-needed'],
135+
'require-await': 'error',
136+
'require-unicode-regexp': 'error',
137+
'vars-on-top': 'off',
138+
'wrap-iife': 'error',
139+
yoda: 'off', // Assignments in statement headers are already prevented
140+
141+
// Variables
142+
'init-declarations': 'off',
143+
'no-delete-var': 'error',
144+
'no-label-var': 'error',
145+
'no-restricted-globals': 'error',
146+
'no-shadow': 'error',
147+
'no-shadow-restricted-names': 'off',
148+
'no-undef': 'off',
149+
'no-undef-init': 'warn',
150+
'no-undefined': 'off',
151+
'no-unused-vars': 'off', // Erroneously reports service imports
152+
'no-use-before-define': 'off',
153+
154+
// Basically all Stylistic Rules are omitted as Prettier takes care of that.
155+
'id-length': [
156+
'error',
157+
{ min: 3, exceptions: ['_', 'i', 'id', 'up', 'fs', 'a', 'b'] },
158+
],
159+
'no-nested-ternary': 'error',
160+
161+
// Modern ECMAScript
162+
'arrow-body-style': 'off',
163+
'arrow-parens': 'off', // Prettier
164+
'arrow-spacing': 'off', // Prettier
165+
'constructor-super': 'error',
166+
'generator-star-spacing': 'off', // Prettier
167+
'no-class-assign': 'error',
168+
'no-confusing-arrow': 'warn', // CHECK ME: This rule might be annoying - it should probably be revisited.
169+
'no-const-assign': 'off',
170+
'no-dupe-class-members': 'off',
171+
'no-duplicate-imports': 'off',
172+
'no-new-symbol': 'error',
173+
'no-restricted-exports': 'off',
174+
'no-restricted-imports': 'off',
175+
'no-this-before-super': 'off',
176+
'no-useless-computed-key': 'warn',
177+
'no-useless-constructor': 'off', // Erroneously reports service imports
178+
'no-useless-rename': 'error',
179+
'no-var': 'error',
180+
'object-shorthand': 'error',
181+
'prefer-arrow-callback': 'warn',
182+
'prefer-const': 'off',
183+
'prefer-destructuring': 'off',
184+
'prefer-numeric-literals': 'error',
185+
'prefer-rest-params': 'error',
186+
'prefer-spread': 'error',
187+
'prefer-template': 'error',
188+
'require-yield': 'error',
189+
'rest-spread-spacing': 'off', // Prettier
190+
'sort-imports': 'off',
191+
'symbol-description': 'warn',
192+
'template-curly-spacing': 'off', // Prettier
193+
'yield-star-spacing': 'off', // Prettier
194+
},
195+
}

.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
6+
# dependencies
7+
/node_modules
8+
9+
# profiling files
10+
chrome-profiler-events.json
11+
speed-measure-plugin.json
12+
13+
# IDEs and editors
14+
/.idea
15+
.project
16+
.classpath
17+
.c9/
18+
*.launch
19+
.settings/
20+
*.sublime-workspace
21+
22+
# IDE - VSCode
23+
.vscode/*
24+
!.vscode/settings.json
25+
!.vscode/tasks.json
26+
!.vscode/launch.json
27+
!.vscode/extensions.json
28+
.history/*
29+
30+
# misc
31+
/.sass-cache
32+
/connect.lock
33+
/coverage
34+
/libpeerconnection.log
35+
npm-debug.log
36+
yarn-error.log
37+
testem.log
38+
/typings
39+
*.log
40+
junit.xml
41+
42+
# System Files
43+
.DS_Store
44+
Thumbs.db

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tsconfig.json
2+
src
3+
assets

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Websiteshot NodeJS Client
2+
3+
<hr />
4+
5+
<div align="center">
6+
<a href="https://websiteshot.app/">
7+
<img src="./assets/logo-mini.png">
8+
</a>
9+
</div>
10+
11+
<div align="center">
12+
<p>Never spend time again to create awesome screenshots of your websites.</p>
13+
</div>
14+
15+
<div align="center">
16+
<a style="margin: 1em;" href="https://websiteshot.app">Websiteshot</a> | <a style="margin: 1em;" href="https://docs.websiteshot.app">Documentation</a>
17+
</div>
18+
19+
<hr />
20+
21+
## Installation
22+
23+
```bash
24+
npm i @websiteshot/nodejs-client --save
25+
```
26+
27+
## Usage
28+
29+
Import the Controller and the needed types:
30+
31+
```js
32+
import {
33+
Config,
34+
CreateRequest,
35+
ScreenshotParameter,
36+
Url,
37+
WebsiteshotController,
38+
} from '@websiteshot/nodejs-client'
39+
```
40+
41+
Use the Client:
42+
43+
```js
44+
const config: Config = {
45+
projectId: '...',
46+
apikey: '...',
47+
}
48+
49+
const websiteshotController = new WebsiteshotController(config)
50+
51+
const screenshotParameter: ScreenshotParameter = {
52+
width: 1200,
53+
height: 720,
54+
}
55+
56+
const urls: Url[] = [
57+
{
58+
url: 'https://websiteshot.app',
59+
name: 'Websiteshot',
60+
},
61+
]
62+
63+
const createRequest: CreateRequest = {
64+
screenshotParameter,
65+
urls,
66+
}
67+
68+
await websiteshotController.create(createRequest)
69+
```

assets/logo-mini.png

13.2 KB
Loading

0 commit comments

Comments
 (0)