Skip to content

Commit 5a77ced

Browse files
committed
feat: initial commit
0 parents  commit 5a77ced

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+33002
-0
lines changed

.eslintrc.cjs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es6: true,
5+
node: true
6+
},
7+
parser: '@typescript-eslint/parser',
8+
parserOptions: {
9+
sourceType: 'module'
10+
},
11+
plugins: ['@typescript-eslint'],
12+
extends: [
13+
'plugin:@typescript-eslint/recommended',
14+
'eslint:recommended',
15+
'plugin:prettier/recommended',
16+
'prettier'
17+
],
18+
rules: {
19+
'@typescript-eslint/ban-ts-comment': 'off',
20+
'@typescript-eslint/ban-types': 'off',
21+
'@typescript-eslint/explicit-function-return-type': 'off',
22+
'@typescript-eslint/explicit-module-boundary-types': 'off',
23+
'@typescript-eslint/no-inferrable-types': 1,
24+
'@typescript-eslint/no-explicit-any': 'off',
25+
'no-unused-vars': 'off',
26+
'no-undef': 'off',
27+
'no-redeclare': 'off'
28+
}
29+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "\U0001F41B Bug report"
2+
description: Something's not working
3+
labels: ['bug']
4+
assignees: skoshx
5+
body:
6+
- type: textarea
7+
validations:
8+
required: true
9+
attributes:
10+
label: 🐛 The bug
11+
description: What isn't working? Describe what the bug is.
12+
- type: input
13+
validations:
14+
required: true
15+
attributes:
16+
label: 🛠️ To reproduce
17+
description: A reproduction of the bug via https://stackblitz.com/github/danielroe/magic-regexp/tree/main/playground
18+
placeholder: https://stackblitz.com/[...]
19+
- type: textarea
20+
validations:
21+
required: true
22+
attributes:
23+
label: 🌈 Expected behaviour
24+
description: What did you expect to happen? Is there a section in the docs about this?
25+
- type: textarea
26+
attributes:
27+
label: ℹ️ Additional context
28+
description: Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "\U0001F4DA Documentation"
2+
description: How do I ... ?
3+
labels: ['documentation']
4+
assignees: skoshx
5+
body:
6+
- type: textarea
7+
validations:
8+
required: true
9+
attributes:
10+
label: 📚 Is your documentation request related to a problem?
11+
description: A clear and concise description of what the problem is.
12+
placeholder: I feel I should be able to [...] but I can't see how to do it from the docs.
13+
- type: textarea
14+
attributes:
15+
label: 🔍 Where should you find it?
16+
description: What page of the docs do you expect this information to be found on?
17+
- type: textarea
18+
attributes:
19+
label: ℹ️ Additional context
20+
description: Add any other context or information.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "\U0001F195 Feature suggestion"
2+
description: Suggest an idea
3+
labels: ['enhancement']
4+
assignees: skoshx
5+
body:
6+
- type: textarea
7+
validations:
8+
required: true
9+
attributes:
10+
label: 🆒 Your use case
11+
description: Add a description of your use case, and how this feature would help you.
12+
placeholder: When I do [...] I would expect to be able to do [...]
13+
- type: textarea
14+
attributes:
15+
label: 🔍 Alternatives you've considered
16+
description: Have you considered any alternative solutions or features?
17+
- type: textarea
18+
attributes:
19+
label: ℹ️ Additional info
20+
description: Is there any other context you think would be helpful to know?

.github/workflows/ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- run: corepack enable
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 16
21+
cache: 'pnpm'
22+
23+
- name: 📦 Install dependencies
24+
run: pnpm install --no-frozen-lockfile
25+
26+
- name: 🔠 Lint project
27+
run: pnpm lint
28+
29+
test:
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- uses: actions/checkout@v3
34+
- run: corepack enable
35+
- uses: actions/setup-node@v3
36+
with:
37+
node-version: 16
38+
cache: 'pnpm'
39+
40+
- name: 📦 Install dependencies
41+
run: pnpm install --frozen-lockfile
42+
43+
- name: 🛠 Build project
44+
run: pnpm build
45+
46+
- name: 💪 Test types
47+
run: pnpm test:types
48+
49+
- name: 🧪 Test project
50+
run: pnpm test

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Release
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push:
8+
tags:
9+
- 'v*'
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set node
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 18
23+
24+
- run: npx changelogithub
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dist
2+
node_modules
3+
coverage
4+
.DS_Store
5+

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Neftic Oy
4+
Copyright (c) 2022 Daniel Roe
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<p align="center">
2+
<img src="https://github.com/useflytrap/flytrap-js/raw/main/docs/flytrap-banner.png" />
3+
</p>
4+
5+
# 🐛 Flytrap JavaScript SDK
6+
7+
[![npm version][npm-version-src]][npm-href]
8+
[![npm downloads][npm-downloads-src]][npm-href]
9+
[![Github Actions][github-actions-src]][github-actions-href]
10+
11+
> Catch bugs in production and replay them in your local development environment. Fix bugs in production in a matter of minutes, instead of hours.
12+
13+
- [🐛 &nbsp;Changelog](https://www.useflytrap.com/changelog)
14+
- [📖 &nbsp;Documentation](https://docs.useflytrap.com)
15+
16+
## Features
17+
18+
- Catch bugs both front- and backend bugs
19+
- Replay bugs as if you were the user who had the bug
20+
- Identify user who had bug
21+
22+
[📖 &nbsp;Read more](https://docs.useflytrap.com/features)
23+
24+
## 💻 Development
25+
26+
- Clone this repository
27+
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable` (use `npm i -g corepack` for Node.js < 16.10)
28+
- Install dependencies using `pnpm install`
29+
- Run the tests using `pnpm dev`
30+
31+
## License
32+
33+
Made with ❤️ in Helsinki
34+
35+
Published under [MIT License](./LICENSE).
36+
37+
## Known Limitations
38+
39+
- If there are multiple functions in the same file with the same name and args, replaying will have
40+
odd behavior.
41+
- If there are multiple function calls with the same args in the same scope, removing or adding function calls with same args will result to wrong replay behavior.
42+
- Adding / removing anonymous functions, (eg; `() => {}`,), in a scope where there already is anonymous functions will cause the replay to go wrong
43+
- React/framework errors during development (eg. hydration errors, ) manifest as weird errors such as "TypeError: Cannot read properties of null (reading 'useContext')", where the stacktrace points towards Flytrap. Because of this, you're recommended to
44+
not use flytrap during active development if you're not replaying.
45+
46+
<!-- Links -->
47+
48+
[npm-href]: https://npmjs.com/package/useflytrap
49+
[github-actions-href]: https://github.com/useflytrap/flytrap/actions/workflows/ci.yml
50+
51+
<!-- Badges -->
52+
53+
[npm-version-src]: https://badgen.net/npm/v/useflytrap?color=black
54+
[npm-downloads-src]: https://badgen.net/npm/dw/useflytrap?color=black
55+
[prettier-src]: https://badgen.net/badge/style/prettier/black?icon=github
56+
[github-actions-src]: https://github.com/useflytrap/flytrap/actions/workflows/ci.yml/badge.svg

build.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineBuildConfig } from 'unbuild'
2+
export default defineBuildConfig({
3+
declaration: true,
4+
rollup: { emitCJS: true },
5+
entries: ['./src/index', './src/transform'],
6+
externals: ['useflytrap', '@babel/types', 'acorn']
7+
})

0 commit comments

Comments
 (0)