Skip to content

Commit

Permalink
move to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
bguerout committed Jan 2, 2025
1 parent 7098584 commit 4b6c9e9
Show file tree
Hide file tree
Showing 56 changed files with 1,244 additions and 1,144 deletions.
16 changes: 7 additions & 9 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,24 @@
"mocha": true
},
"rules": {
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-explicit-any": "error",
"quote-props": ["error", "consistent"],
"mocha/no-skipped-tests": "error",
"mocha/no-skipped-tests": "warn",
"mocha/no-exclusive-tests": "error",
"node/no-unpublished-import": [
"error", {
"allowModules": ["slow-stream"]
}
],
"node/no-unsupported-features/es-syntax": [
"error",
{
"version": ">=13.0.0",
"ignores": ["modules"]
}
],
"node/no-unpublished-import": [
"error", {
"allowModules": ["slow-stream"]
}
],
"node/no-missing-import": [
"error", {
"allowModules": [],
"resolvePaths": ["/path/to/a/modules/directory"],
"tryExtensions": [".js", ".ts"]
}
]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 21.x
cache: npm
- run: npm ci
- run: npm test
Expand All @@ -24,7 +24,7 @@ jobs:
needs: test
strategy:
matrix:
node-version: [ 10.x, 12.x, 14.x, 15.x, 16.x, 17.x ]
node-version: [ 10.x, 11.x, 12.x, 13.x, 14.x, 15.x, 16.x, 17.x, 18.x, 19.x, 20.x ]
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules/
.idea/
build/
dist/
.DS_Store
9 changes: 8 additions & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"extension": ["ts"]
"timeout": 5000,
"exit": true,
"extension": ["ts", "js"],
"recursive": true,
"node-option": [
"experimental-specifier-resolution=node",
"import=tsx"
]
}
13 changes: 8 additions & 5 deletions .tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,30 @@ mkdir -p "${DIST_DIR}" "${BUILD_DIR}"
cd "${PROJECT_DIR}"

echo "Compiling oleoduc (esm version)..."
tsc -p tsconfig.json
npm run tsc -- -p tsconfig.json
cat >"${DIST_DIR}/mjs/package.json" <<!EOF
{
"type": "module"
}
!EOF

echo "Compiling oleoduc (cjs version)..."
tsc -p tsconfig.cjs.json
npm run tsc -- -p tsconfig.cjs.json
cat >"${DIST_DIR}/cjs/package.json" <<!EOF
{
"type": "commonjs"
}
!EOF

echo "Building oleoduc for test..."
tsc -p tsconfig.test.json
npm run tsc -- -p tsconfig.test.json
echo "Patching package.json to be able to run tests against previous versions of nodejs..."
cp "${PROJECT_DIR}/package.json" "${BUILD_DIR}"
npx json -I -f "${BUILD_DIR}/package.json" -e 'this.scripts.test="mocha --recursive --exit test/**/*-test.js"'
npx json -I -f "${BUILD_DIR}/package.json" -e 'this.type="commonjs"'
npx json -I -f "${BUILD_DIR}/package.json" -e 'this.devDependencies.mocha="9.x"'

npx json -I -f "${BUILD_DIR}/package.json" -e 'this.scripts.test="mocha --recursive --exit test/**/*-test.js"'
cat >"${BUILD_DIR}/.mocharc.json" <<!EOF
{}
!EOF
cd -

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ for await (const data of csvStream) {
## accumulateData(callback, [options])
Allows data to be accumulated before piping them to the next step. It can be used to reduce the data or to create group
Allows data to be accumulated before piping them to the next step. It can be used to reduce or group data
#### Parameters
Expand Down
Loading

0 comments on commit 4b6c9e9

Please sign in to comment.