diff --git a/packages/eslint-plugin-rxjs/package.json b/packages/eslint-plugin-rxjs/package.json index 57a976c..86203bb 100644 --- a/packages/eslint-plugin-rxjs/package.json +++ b/packages/eslint-plugin-rxjs/package.json @@ -31,7 +31,8 @@ "exports": { ".": { "require": "./index.cjs", - "types": "./index.d.ts" + "types": "./index.d.ts", + "import": "./index.cjs" } } } diff --git a/test/package.json b/test/package.json new file mode 100644 index 0000000..d82dd36 --- /dev/null +++ b/test/package.json @@ -0,0 +1,8 @@ +{ + "name": "eslint-rxjs-test", + "private": true, + "type": "module", + "dependencies": { + "@smarttools/eslint-plugin-rxjs": "link:../dist/packages/eslint-plugin-rxjs" + } +} diff --git a/tests/esm-js/index.js b/tests/esm-js/index.js new file mode 100644 index 0000000..e9db51a --- /dev/null +++ b/tests/esm-js/index.js @@ -0,0 +1,3 @@ +import eslintPluginRxjs from '@smarttools/eslint-plugin-rxjs'; + +console.log(eslintPluginRxjs); diff --git a/tests/esm-js/package.json b/tests/esm-js/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/tests/esm-js/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/tests/esm-js/test.sh b/tests/esm-js/test.sh new file mode 100755 index 0000000..fd0bdaa --- /dev/null +++ b/tests/esm-js/test.sh @@ -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 + +