Skip to content

Commit

Permalink
addresses issue and test for the issue succeeds (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveMBush authored Jan 10, 2025
1 parent 8134848 commit fd64cab
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/eslint-plugin-rxjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"exports": {
".": {
"require": "./index.cjs",
"types": "./index.d.ts"
"types": "./index.d.ts",
"import": "./index.cjs"
}
}
}
8 changes: 8 additions & 0 deletions test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "eslint-rxjs-test",
"private": true,
"type": "module",
"dependencies": {
"@smarttools/eslint-plugin-rxjs": "link:../dist/packages/eslint-plugin-rxjs"
}
}
3 changes: 3 additions & 0 deletions tests/esm-js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import eslintPluginRxjs from '@smarttools/eslint-plugin-rxjs';

console.log(eslintPluginRxjs);
3 changes: 3 additions & 0 deletions tests/esm-js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
46 changes: 46 additions & 0 deletions tests/esm-js/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

# Exit on any error
set -e

# Get the directory where the script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT_DIR="$SCRIPT_DIR/../.."

# Define source and destination paths relative to root
SRC_DIR="$ROOT_DIR/dist/packages/eslint-plugin-rxjs"
DEST_DIR="$ROOT_DIR/node_modules/@smarttools/eslint-plugin-rxjs"

# Check if source directory exists
if [ ! -d "$SRC_DIR" ]; then
echo "Error: Source directory $SRC_DIR does not exist"
exit 1
fi

# Create destination parent directory if it doesn't exist
mkdir -p "$(dirname "$DEST_DIR")"

# Remove destination directory if it exists
if [ -d "$DEST_DIR" ]; then
rm -rf "$DEST_DIR"
fi

# Copy the directory
if cp -r "$SRC_DIR" "$DEST_DIR"; then
echo "✓ Successfully copied $SRC_DIR to $DEST_DIR"
else
echo "✗ Failed to copy directory"
exit 1
fi

# Run the index.js file
echo "Running index.js..."
if node "$SCRIPT_DIR/index.js"; then
echo "✓ Tests completed successfully"
exit 0
else
echo "✗ Tests failed"
exit 1
fi


0 comments on commit fd64cab

Please sign in to comment.