Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript Refactor #15

Merged
merged 64 commits into from Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
a24942b
remove files
leonardoventurini Aug 22, 2023
2518efc
add files
leonardoventurini Aug 22, 2023
c381f5f
update github workflow
leonardoventurini Aug 22, 2023
5628041
update lock file
leonardoventurini Aug 22, 2023
355c45f
rename export
leonardoventurini Aug 28, 2023
2047ffb
rename package
leonardoventurini Aug 30, 2023
d7af2af
add experimental folder
leonardoventurini Sep 17, 2023
ee7a88a
add await detector
leonardoventurini Sep 17, 2023
20f8319
downgrade sinon
leonardoventurini Sep 17, 2023
7ba66f4
disable fail fast
leonardoventurini Sep 17, 2023
b4aef0f
remove node prefix
leonardoventurini Sep 17, 2023
e56d85c
remove unused module
leonardoventurini Sep 18, 2023
e5b9a06
adjust method
leonardoventurini Sep 18, 2023
d2a7d9d
add order test
leonardoventurini Sep 18, 2023
a98bfe5
add other node versions
leonardoventurini Sep 19, 2023
7fcf32e
remove .envrc
leonardoventurini Sep 19, 2023
db45275
adjust ecmascript version
leonardoventurini Sep 19, 2023
46c0469
downgrade mocha
leonardoventurini Sep 19, 2023
705ad95
remove debug types
leonardoventurini Sep 19, 2023
672a07a
remove more types
leonardoventurini Sep 19, 2023
1372818
remove all types
leonardoventurini Sep 19, 2023
5f16c4c
downgrade mocha again
leonardoventurini Sep 19, 2023
64f0981
remove swc due to old node versions
leonardoventurini Sep 20, 2023
ac9ac0a
ts-node uses swc still
leonardoventurini Sep 20, 2023
6e5a95a
add types for node
leonardoventurini Sep 20, 2023
5a6cbbe
ignore await detector tests on < node 12
leonardoventurini Sep 20, 2023
cea72e1
downgrade axios
leonardoventurini Sep 20, 2023
bfd937d
downgrade ws
leonardoventurini Sep 20, 2023
bdb0ddc
downgrade ws more
leonardoventurini Sep 20, 2023
809aeeb
add better ignoring await detector logic on old versions
leonardoventurini Sep 21, 2023
0b69453
fix symbol reference
leonardoventurini Sep 21, 2023
718d676
set npm version for node v4 in workflow
leonardoventurini Sep 21, 2023
6c06b29
update workflow
leonardoventurini Sep 21, 2023
31b762f
oops
leonardoventurini Sep 21, 2023
d590a38
add script to exclude packages
leonardoventurini Sep 22, 2023
bbcf6e4
adjust syntax for node 4
leonardoventurini Sep 22, 2023
0662e20
exclude package
leonardoventurini Sep 22, 2023
86a8792
downgrade mocha
leonardoventurini Sep 22, 2023
f781067
downgrade mocha
leonardoventurini Sep 22, 2023
c332826
use alternate version of mocha
leonardoventurini Sep 22, 2023
c1ce68c
downgrade mocha for v4 again
leonardoventurini Sep 22, 2023
4241d02
remove watch option
leonardoventurini Sep 22, 2023
57feda4
use es2015
leonardoventurini Sep 25, 2023
330623f
add node 6
leonardoventurini Sep 25, 2023
6a193c5
remove support code for v4/6
leonardoventurini Sep 26, 2023
a803f4b
downgrade mocha
leonardoventurini Sep 26, 2023
df41994
downgrade mocha
leonardoventurini Sep 26, 2023
e2354b4
downgrade mocha
leonardoventurini Sep 26, 2023
ac4d0a5
disable skip lib check and rename folder
leonardoventurini Oct 25, 2023
31d279a
fix comments
leonardoventurini Oct 25, 2023
71b1523
enable test for version 8 temporarily
leonardoventurini Oct 25, 2023
5f0bd7e
remove unused file
leonardoventurini Oct 25, 2023
8d0c43f
add version 10 as well
leonardoventurini Oct 25, 2023
c8768aa
add comment
leonardoventurini Oct 25, 2023
79f197a
rename variable
leonardoventurini Oct 25, 2023
bdd6e7c
adjust type
leonardoventurini Oct 25, 2023
31c0024
disable no implicit any
leonardoventurini Oct 25, 2023
9e2b892
detect async local storage directly
leonardoventurini Oct 25, 2023
ebcf494
add cross env
leonardoventurini Oct 25, 2023
81967b7
use off only
leonardoventurini Oct 25, 2023
961c866
drop remeda
leonardoventurini Oct 25, 2023
6e5f718
use removeEventListener instead
leonardoventurini Oct 26, 2023
c198de0
add circuit breaker flag for race condition
leonardoventurini Oct 26, 2023
5178976
we should await for clock to sync on connection
leonardoventurini Oct 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
182 changes: 0 additions & 182 deletions .eslintrc

This file was deleted.

32 changes: 32 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,32 @@
module.exports = {
plugins: ['prettier'],
extends: ['eslint:recommended', 'plugin:prettier/recommended'],
parser: '@typescript-eslint/parser',
root: true,
rules: {
'no-console': 0,
'no-inner-declarations': 0,
'arrow-parens': ['error', 'always'],
semi: ['error', 'always'],
},
env: {
node: true,
},
overrides: [
{
files: ['*.ts'],
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-empty-interface': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-this-alias': 0,
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/no-namespace': 0,
'@typescript-eslint/no-empty-function': 0,
},
},
],
};
48 changes: 36 additions & 12 deletions .github/workflows/test.yml
Expand Up @@ -5,24 +5,48 @@ on:
- master
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
- run: npm ci
- run: npm run lint
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
- run: npm ci
- run: npm run build
- name: upload dist
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
test:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
node-version: [ 14.x ]
node-version: [8, 10, 12, 14, 16, 18, 20]
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm run test
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
- run: npm install
- run: npm run test:dist
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -9,3 +9,4 @@ npm-debug.log

node_modules
dist
.envrc
9 changes: 4 additions & 5 deletions .npmignore
@@ -1,14 +1,13 @@
.*
*.swp
*~
*.iml
.*.haste_cache.*
.DS_Store
.idea
npm-debug.log
.eslintcache
leonardoventurini marked this conversation as resolved.
Show resolved Hide resolved

node_modules
scripts
lib
.babelrc
/dist/**.test.d.ts
/dist/**.test.js
/dist/**.test.js.map
/dist/tests
9 changes: 9 additions & 0 deletions .prettierrc.js
@@ -0,0 +1,9 @@
module.exports = {
semi: true,
trailingComma: "all",
singleQuote: true,
printWidth: 80,
tabWidth: 2,
bracketSpacing: true,
arrowParens: "always",
};
50 changes: 50 additions & 0 deletions experimental/ask-poc.mmd
@@ -0,0 +1,50 @@
graph TD
main["Main Program"] -->|Calls| runAsync;

runAsync -->|Creates| sleep1[Sleep 100];
runAsync -->|Creates| sleep2[Sleep 200];
runAsync -->|Creates & Returns| sleep3[Sleep 300];

runAsync --> initHook[async_hooks.createHook.init]
sleep1 --> initHook
sleep2 --> initHook
sleep3 --> initHook

initHook -->|Depending on condition| fsWrite1[fs.writeSync: Start]
initHook -->|Depending on condition| fsWrite2[fs.writeSync: Await]

fsWrite1 --> stdout1[stdout]
fsWrite2 --> stdout2[stdout]

initHook -->|Updates| asyncFunctions[asyncFunctions Set]
initHook -->|Updates| awaits[Awaits Set]
initHook -->|Updates| afterAwaits[AfterAwaits Map]

initHook --> beforeHook[async_hooks.createHook.before]
beforeHook -->|Writes| fsWrite3[fs.writeSync: Await End]
fsWrite3 --> stdout3[stdout]

initHook --> destroyHook[async_hooks.createHook.destroy]
destroyHook -->|Deletes from| asyncFunctions
destroyHook -->|Deletes from| awaits

initHook --> promiseResolveHook[async_hooks.createHook.promiseResolve]
promiseResolveHook -->|Deletes from| asyncFunctions

sleep1 -->|Uses| oldPromise[oldPromise]
sleep2 -->|Uses| oldPromise
sleep3 -->|Uses| oldPromise

AClass["Global Promise Class (A)"] -->|Extends| oldPromise

note1[Note: fs.writeSync writes log messages to stdout]
note2[Note: Async operations are monitored using async_hooks]

fsWrite1 -.-> note1
fsWrite2 -.-> note1
fsWrite3 -.-> note1

initHook -.-> note2
beforeHook -.-> note2
destroyHook -.-> note2
promiseResolveHook -.-> note2