@kanopi/wp-ai-indexer 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/README.md +41 -0
- package/.circleci/config.yml +43 -0
- package/.circleci/install-dependencies.sh +319 -0
- package/.circleci/security-audit-npm.sh +264 -0
- package/.circleci/setup-node.sh +223 -0
- package/.circleci/test-package.sh +247 -0
- package/.eslintrc.js +52 -0
- package/.prettierrc +10 -0
- package/LICENSE +21 -0
- package/README.md +479 -0
- package/bin/wp-ai-indexer.js +25 -0
- package/package.json +71 -0
- package/tests/helpers/test-config.ts +36 -0
- package/tests/mocks/fixtures/settings.json +13 -0
- package/tests/mocks/fixtures/wordpress-posts.json +42 -0
- package/tests/mocks/openai.mock.ts +52 -0
- package/tests/mocks/pinecone.mock.ts +76 -0
- package/tests/setup.ts +20 -0
- package/vitest.config.ts +29 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Node.js Setup Script
|
|
4
|
+
#
|
|
5
|
+
# Description:
|
|
6
|
+
# Installs Node.js if not already present, or validates existing installation.
|
|
7
|
+
#
|
|
8
|
+
# Usage:
|
|
9
|
+
# setup-node.sh [OPTIONS]
|
|
10
|
+
#
|
|
11
|
+
# Options:
|
|
12
|
+
# --version VERSION Node.js major version to install (default: 22)
|
|
13
|
+
# --skip-if-installed Skip installation if Node.js is already installed
|
|
14
|
+
# --validate-version Ensure installed version matches requested version
|
|
15
|
+
# --dry-run Show what would be done without executing
|
|
16
|
+
# --help Show this help message
|
|
17
|
+
#
|
|
18
|
+
# Exit Codes:
|
|
19
|
+
# 0 - Node.js is installed and validated
|
|
20
|
+
# 1 - Installation failed
|
|
21
|
+
# 2 - Invalid arguments or version mismatch
|
|
22
|
+
#
|
|
23
|
+
|
|
24
|
+
set -eo pipefail
|
|
25
|
+
|
|
26
|
+
# Colors for output
|
|
27
|
+
RED='\033[0;31m'
|
|
28
|
+
GREEN='\033[0;32m'
|
|
29
|
+
YELLOW='\033[1;33m'
|
|
30
|
+
BLUE='\033[0;34m'
|
|
31
|
+
NC='\033[0m' # No Color
|
|
32
|
+
|
|
33
|
+
# Default values
|
|
34
|
+
NODE_VERSION="22"
|
|
35
|
+
SKIP_IF_INSTALLED="false"
|
|
36
|
+
VALIDATE_VERSION="false"
|
|
37
|
+
DRY_RUN="false"
|
|
38
|
+
|
|
39
|
+
# Parse arguments
|
|
40
|
+
while [[ $# -gt 0 ]]; do
|
|
41
|
+
case $1 in
|
|
42
|
+
--version)
|
|
43
|
+
NODE_VERSION="$2"
|
|
44
|
+
shift 2
|
|
45
|
+
;;
|
|
46
|
+
--skip-if-installed)
|
|
47
|
+
SKIP_IF_INSTALLED="true"
|
|
48
|
+
shift
|
|
49
|
+
;;
|
|
50
|
+
--validate-version)
|
|
51
|
+
VALIDATE_VERSION="true"
|
|
52
|
+
shift
|
|
53
|
+
;;
|
|
54
|
+
--dry-run)
|
|
55
|
+
DRY_RUN="true"
|
|
56
|
+
shift
|
|
57
|
+
;;
|
|
58
|
+
--help)
|
|
59
|
+
grep '^#' "$0" | grep -v '#!/bin/bash' | sed 's/^# //;s/^#//'
|
|
60
|
+
exit 0
|
|
61
|
+
;;
|
|
62
|
+
*)
|
|
63
|
+
echo -e "${RED}Error: Unknown option $1${NC}"
|
|
64
|
+
echo "Use --help for usage information"
|
|
65
|
+
exit 2
|
|
66
|
+
;;
|
|
67
|
+
esac
|
|
68
|
+
done
|
|
69
|
+
|
|
70
|
+
# Helper functions
|
|
71
|
+
log_header() {
|
|
72
|
+
echo -e "\n${BLUE}========================================${NC}"
|
|
73
|
+
echo -e "${BLUE}$1${NC}"
|
|
74
|
+
echo -e "${BLUE}========================================${NC}"
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
log_success() {
|
|
78
|
+
echo -e "${GREEN}✓${NC} $1"
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
log_error() {
|
|
82
|
+
echo -e "${RED}✗${NC} $1"
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
log_warning() {
|
|
86
|
+
echo -e "${YELLOW}⚠${NC} $1"
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
log_info() {
|
|
90
|
+
echo -e "${BLUE}ℹ${NC} $1"
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
# Validate version format
|
|
94
|
+
if [[ ! "$NODE_VERSION" =~ ^[0-9]+$ ]]; then
|
|
95
|
+
log_error "Invalid Node.js version: $NODE_VERSION (must be a number like 18, 20, 22)"
|
|
96
|
+
exit 2
|
|
97
|
+
fi
|
|
98
|
+
|
|
99
|
+
log_header "Node.js Setup"
|
|
100
|
+
log_info "Requested version: $NODE_VERSION.x"
|
|
101
|
+
log_info "Dry run: $DRY_RUN"
|
|
102
|
+
|
|
103
|
+
# Check if Node.js is already installed
|
|
104
|
+
if command -v node &> /dev/null; then
|
|
105
|
+
INSTALLED_VERSION=$(node --version | sed 's/v//' | cut -d. -f1)
|
|
106
|
+
log_info "Node.js is already installed: $(node --version)"
|
|
107
|
+
log_info "npm version: $(npm --version)"
|
|
108
|
+
|
|
109
|
+
if [[ "$VALIDATE_VERSION" == "true" ]]; then
|
|
110
|
+
if [[ "$INSTALLED_VERSION" != "$NODE_VERSION" ]]; then
|
|
111
|
+
log_warning "Installed version (v$INSTALLED_VERSION) doesn't match requested version (v$NODE_VERSION)"
|
|
112
|
+
|
|
113
|
+
if [[ "$SKIP_IF_INSTALLED" == "true" ]]; then
|
|
114
|
+
log_info "Skipping installation due to --skip-if-installed flag"
|
|
115
|
+
log_success "Using existing Node.js installation"
|
|
116
|
+
exit 0
|
|
117
|
+
else
|
|
118
|
+
log_info "Proceeding with installation of Node.js $NODE_VERSION.x..."
|
|
119
|
+
fi
|
|
120
|
+
else
|
|
121
|
+
log_success "Installed version matches requested version"
|
|
122
|
+
exit 0
|
|
123
|
+
fi
|
|
124
|
+
else
|
|
125
|
+
if [[ "$SKIP_IF_INSTALLED" == "true" ]]; then
|
|
126
|
+
log_success "Node.js is already installed, skipping"
|
|
127
|
+
exit 0
|
|
128
|
+
else
|
|
129
|
+
log_info "Node.js is installed but will reinstall as requested"
|
|
130
|
+
fi
|
|
131
|
+
fi
|
|
132
|
+
else
|
|
133
|
+
log_info "Node.js not found, installing..."
|
|
134
|
+
fi
|
|
135
|
+
|
|
136
|
+
# Detect OS and package manager
|
|
137
|
+
if [[ "$DRY_RUN" == "true" ]]; then
|
|
138
|
+
log_info "[DRY RUN] Would detect OS and install Node.js $NODE_VERSION.x"
|
|
139
|
+
exit 0
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
log_header "Installing Node.js $NODE_VERSION.x"
|
|
143
|
+
|
|
144
|
+
# Detect OS
|
|
145
|
+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
146
|
+
log_info "Detected Linux OS"
|
|
147
|
+
|
|
148
|
+
# Check if running Debian/Ubuntu
|
|
149
|
+
if command -v apt-get &> /dev/null; then
|
|
150
|
+
log_info "Using apt package manager"
|
|
151
|
+
|
|
152
|
+
# Download and run NodeSource setup script
|
|
153
|
+
log_info "Downloading NodeSource setup script..."
|
|
154
|
+
curl -fsSL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" -o /tmp/nodesource_setup.sh
|
|
155
|
+
|
|
156
|
+
log_info "Running NodeSource setup script..."
|
|
157
|
+
sudo bash /tmp/nodesource_setup.sh
|
|
158
|
+
rm /tmp/nodesource_setup.sh
|
|
159
|
+
|
|
160
|
+
log_info "Installing Node.js via apt..."
|
|
161
|
+
sudo apt-get install -y nodejs
|
|
162
|
+
|
|
163
|
+
# Check if running RedHat/CentOS/Fedora
|
|
164
|
+
elif command -v yum &> /dev/null; then
|
|
165
|
+
log_info "Using yum package manager"
|
|
166
|
+
|
|
167
|
+
# Download and run NodeSource setup script
|
|
168
|
+
log_info "Downloading NodeSource setup script..."
|
|
169
|
+
curl -fsSL "https://rpm.nodesource.com/setup_${NODE_VERSION}.x" -o /tmp/nodesource_setup.sh
|
|
170
|
+
|
|
171
|
+
log_info "Running NodeSource setup script..."
|
|
172
|
+
sudo bash /tmp/nodesource_setup.sh
|
|
173
|
+
rm /tmp/nodesource_setup.sh
|
|
174
|
+
|
|
175
|
+
log_info "Installing Node.js via yum..."
|
|
176
|
+
sudo yum install -y nodejs
|
|
177
|
+
|
|
178
|
+
else
|
|
179
|
+
log_error "Unsupported Linux distribution (no apt or yum found)"
|
|
180
|
+
exit 1
|
|
181
|
+
fi
|
|
182
|
+
|
|
183
|
+
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
184
|
+
log_info "Detected macOS"
|
|
185
|
+
|
|
186
|
+
if command -v brew &> /dev/null; then
|
|
187
|
+
log_info "Installing via Homebrew..."
|
|
188
|
+
brew install node@${NODE_VERSION}
|
|
189
|
+
|
|
190
|
+
# Link the installed version
|
|
191
|
+
brew link --overwrite node@${NODE_VERSION}
|
|
192
|
+
else
|
|
193
|
+
log_error "Homebrew not found. Please install Homebrew first: https://brew.sh"
|
|
194
|
+
exit 1
|
|
195
|
+
fi
|
|
196
|
+
|
|
197
|
+
else
|
|
198
|
+
log_error "Unsupported operating system: $OSTYPE"
|
|
199
|
+
exit 1
|
|
200
|
+
fi
|
|
201
|
+
|
|
202
|
+
# Validate installation
|
|
203
|
+
log_header "Validating Installation"
|
|
204
|
+
|
|
205
|
+
if command -v node &> /dev/null; then
|
|
206
|
+
INSTALLED_VERSION=$(node --version | sed 's/v//' | cut -d. -f1)
|
|
207
|
+
log_success "Node.js installed: $(node --version)"
|
|
208
|
+
log_success "npm version: $(npm --version)"
|
|
209
|
+
|
|
210
|
+
if [[ "$VALIDATE_VERSION" == "true" ]]; then
|
|
211
|
+
if [[ "$INSTALLED_VERSION" != "$NODE_VERSION" ]]; then
|
|
212
|
+
log_warning "Installed version (v$INSTALLED_VERSION) doesn't match requested version (v$NODE_VERSION)"
|
|
213
|
+
log_warning "This may be acceptable if the system provided a compatible version"
|
|
214
|
+
else
|
|
215
|
+
log_success "Version validation passed"
|
|
216
|
+
fi
|
|
217
|
+
fi
|
|
218
|
+
|
|
219
|
+
exit 0
|
|
220
|
+
else
|
|
221
|
+
log_error "Node.js installation failed - node command not found"
|
|
222
|
+
exit 1
|
|
223
|
+
fi
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Node Package Testing Script
|
|
4
|
+
#
|
|
5
|
+
# Description:
|
|
6
|
+
# Runs tests for Node.js packages with dependency caching and parallel execution support.
|
|
7
|
+
#
|
|
8
|
+
# Usage:
|
|
9
|
+
# test-package.sh [OPTIONS] PACKAGE_PATH
|
|
10
|
+
#
|
|
11
|
+
# Arguments:
|
|
12
|
+
# PACKAGE_PATH Path to the package (e.g., packages/wp-ai-indexer)
|
|
13
|
+
#
|
|
14
|
+
# Options:
|
|
15
|
+
# --cache-key KEY Custom cache key prefix (default: v1-package-deps)
|
|
16
|
+
# --max-workers NUM Number of parallel test workers (default: 2)
|
|
17
|
+
# --test-command CMD npm test command to run (default: test:ci)
|
|
18
|
+
# --skip-cache Skip cache restoration and saving
|
|
19
|
+
# --store-results Store test results in CircleCI (default: true in CI)
|
|
20
|
+
# --results-path PATH Path to store test results (default: {package}/coverage)
|
|
21
|
+
# --dry-run Show what would be done without executing
|
|
22
|
+
# --help Show this help message
|
|
23
|
+
#
|
|
24
|
+
# Exit Codes:
|
|
25
|
+
# 0 - Tests passed
|
|
26
|
+
# 1 - Tests failed or execution error
|
|
27
|
+
# 2 - Invalid arguments
|
|
28
|
+
#
|
|
29
|
+
|
|
30
|
+
set -eo pipefail
|
|
31
|
+
|
|
32
|
+
# Colors for output
|
|
33
|
+
RED='\033[0;31m'
|
|
34
|
+
GREEN='\033[0;32m'
|
|
35
|
+
YELLOW='\033[1;33m'
|
|
36
|
+
BLUE='\033[0;34m'
|
|
37
|
+
NC='\033[0m' # No Color
|
|
38
|
+
|
|
39
|
+
# Default values
|
|
40
|
+
PACKAGE_PATH=""
|
|
41
|
+
CACHE_KEY="v1-package-deps"
|
|
42
|
+
MAX_WORKERS="2"
|
|
43
|
+
TEST_COMMAND="test:ci"
|
|
44
|
+
SKIP_CACHE="false"
|
|
45
|
+
STORE_RESULTS="${CIRCLECI:-false}"
|
|
46
|
+
RESULTS_PATH=""
|
|
47
|
+
DRY_RUN="false"
|
|
48
|
+
|
|
49
|
+
# Parse arguments
|
|
50
|
+
while [[ $# -gt 0 ]]; do
|
|
51
|
+
case $1 in
|
|
52
|
+
--cache-key)
|
|
53
|
+
CACHE_KEY="$2"
|
|
54
|
+
shift 2
|
|
55
|
+
;;
|
|
56
|
+
--max-workers)
|
|
57
|
+
MAX_WORKERS="$2"
|
|
58
|
+
shift 2
|
|
59
|
+
;;
|
|
60
|
+
--test-command)
|
|
61
|
+
TEST_COMMAND="$2"
|
|
62
|
+
shift 2
|
|
63
|
+
;;
|
|
64
|
+
--skip-cache)
|
|
65
|
+
SKIP_CACHE="true"
|
|
66
|
+
shift
|
|
67
|
+
;;
|
|
68
|
+
--store-results)
|
|
69
|
+
STORE_RESULTS="true"
|
|
70
|
+
shift
|
|
71
|
+
;;
|
|
72
|
+
--results-path)
|
|
73
|
+
RESULTS_PATH="$2"
|
|
74
|
+
shift 2
|
|
75
|
+
;;
|
|
76
|
+
--dry-run)
|
|
77
|
+
DRY_RUN="true"
|
|
78
|
+
shift
|
|
79
|
+
;;
|
|
80
|
+
--help)
|
|
81
|
+
grep '^#' "$0" | grep -v '#!/bin/bash' | sed 's/^# //;s/^#//'
|
|
82
|
+
exit 0
|
|
83
|
+
;;
|
|
84
|
+
-*)
|
|
85
|
+
echo -e "${RED}Error: Unknown option $1${NC}"
|
|
86
|
+
echo "Use --help for usage information"
|
|
87
|
+
exit 2
|
|
88
|
+
;;
|
|
89
|
+
*)
|
|
90
|
+
PACKAGE_PATH="$1"
|
|
91
|
+
shift
|
|
92
|
+
;;
|
|
93
|
+
esac
|
|
94
|
+
done
|
|
95
|
+
|
|
96
|
+
# Helper functions
|
|
97
|
+
log_header() {
|
|
98
|
+
echo -e "\n${BLUE}========================================${NC}"
|
|
99
|
+
echo -e "${BLUE}$1${NC}"
|
|
100
|
+
echo -e "${BLUE}========================================${NC}"
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
log_success() {
|
|
104
|
+
echo -e "${GREEN}✓${NC} $1"
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
log_error() {
|
|
108
|
+
echo -e "${RED}✗${NC} $1"
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
log_info() {
|
|
112
|
+
echo -e "${BLUE}ℹ${NC} $1"
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
# Validate required parameters
|
|
116
|
+
if [[ -z "$PACKAGE_PATH" ]]; then
|
|
117
|
+
log_error "Package path is required"
|
|
118
|
+
echo "Usage: $0 [OPTIONS] PACKAGE_PATH"
|
|
119
|
+
exit 2
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
if [[ ! -d "$PACKAGE_PATH" ]]; then
|
|
123
|
+
log_error "Package path does not exist: $PACKAGE_PATH"
|
|
124
|
+
exit 2
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
if [[ ! -f "$PACKAGE_PATH/package.json" ]]; then
|
|
128
|
+
log_error "No package.json found in $PACKAGE_PATH"
|
|
129
|
+
exit 2
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
# Set default results path if not specified
|
|
133
|
+
if [[ -z "$RESULTS_PATH" ]]; then
|
|
134
|
+
RESULTS_PATH="$PACKAGE_PATH/coverage"
|
|
135
|
+
fi
|
|
136
|
+
|
|
137
|
+
log_header "Node Package Testing"
|
|
138
|
+
log_info "Package: $PACKAGE_PATH"
|
|
139
|
+
log_info "Max workers: $MAX_WORKERS"
|
|
140
|
+
log_info "Test command: npm run $TEST_COMMAND"
|
|
141
|
+
log_info "Dry run: $DRY_RUN"
|
|
142
|
+
|
|
143
|
+
# Restore cache (if in CircleCI and cache enabled)
|
|
144
|
+
if [[ "$SKIP_CACHE" == "false" ]] && [[ -n "${CIRCLECI:-}" ]]; then
|
|
145
|
+
log_header "Restoring Cache"
|
|
146
|
+
if [[ "$DRY_RUN" == "false" ]]; then
|
|
147
|
+
# CircleCI cache restoration would happen via CircleCI's restore_cache step
|
|
148
|
+
# This script focuses on the execution logic
|
|
149
|
+
log_info "Cache restoration handled by CircleCI"
|
|
150
|
+
log_info "Cache keys:"
|
|
151
|
+
log_info " - ${CACHE_KEY}-{{ checksum \"$PACKAGE_PATH/package-lock.json\" }}"
|
|
152
|
+
log_info " - ${CACHE_KEY}-{{ .Branch }}-"
|
|
153
|
+
log_info " - ${CACHE_KEY}-main-"
|
|
154
|
+
log_info " - ${CACHE_KEY}-"
|
|
155
|
+
else
|
|
156
|
+
log_info "[DRY RUN] Would restore cache with key: $CACHE_KEY"
|
|
157
|
+
fi
|
|
158
|
+
fi
|
|
159
|
+
|
|
160
|
+
# Install dependencies
|
|
161
|
+
log_header "Installing Dependencies"
|
|
162
|
+
if [[ "$DRY_RUN" == "false" ]]; then
|
|
163
|
+
cd "$PACKAGE_PATH"
|
|
164
|
+
|
|
165
|
+
# Use npm ci for clean, reproducible installs
|
|
166
|
+
if [[ -f "package-lock.json" ]]; then
|
|
167
|
+
log_info "Running npm ci..."
|
|
168
|
+
npm ci
|
|
169
|
+
log_success "Dependencies installed"
|
|
170
|
+
else
|
|
171
|
+
log_info "No package-lock.json found, running npm install..."
|
|
172
|
+
npm install
|
|
173
|
+
log_success "Dependencies installed"
|
|
174
|
+
fi
|
|
175
|
+
|
|
176
|
+
cd - > /dev/null
|
|
177
|
+
else
|
|
178
|
+
log_info "[DRY RUN] Would run: cd $PACKAGE_PATH && npm ci"
|
|
179
|
+
fi
|
|
180
|
+
|
|
181
|
+
# Save cache (if in CircleCI and cache enabled)
|
|
182
|
+
if [[ "$SKIP_CACHE" == "false" ]] && [[ -n "${CIRCLECI:-}" ]]; then
|
|
183
|
+
log_header "Saving Cache"
|
|
184
|
+
if [[ "$DRY_RUN" == "false" ]]; then
|
|
185
|
+
# CircleCI cache saving would happen via CircleCI's save_cache step
|
|
186
|
+
log_info "Cache saving handled by CircleCI"
|
|
187
|
+
log_info "Cache paths:"
|
|
188
|
+
log_info " - $PACKAGE_PATH/node_modules"
|
|
189
|
+
log_info " - ~/.npm"
|
|
190
|
+
log_info " - ~/.cache"
|
|
191
|
+
else
|
|
192
|
+
log_info "[DRY RUN] Would save cache to: $CACHE_KEY"
|
|
193
|
+
fi
|
|
194
|
+
fi
|
|
195
|
+
|
|
196
|
+
# Run tests
|
|
197
|
+
log_header "Running Tests"
|
|
198
|
+
if [[ "$DRY_RUN" == "false" ]]; then
|
|
199
|
+
cd "$PACKAGE_PATH"
|
|
200
|
+
|
|
201
|
+
# Check if test command exists in package.json
|
|
202
|
+
if ! npm run | grep -q "$TEST_COMMAND"; then
|
|
203
|
+
log_error "Test command '$TEST_COMMAND' not found in package.json"
|
|
204
|
+
exit 1
|
|
205
|
+
fi
|
|
206
|
+
|
|
207
|
+
# Run tests with specified max workers
|
|
208
|
+
log_info "Executing: npm run $TEST_COMMAND -- --maxWorkers=$MAX_WORKERS"
|
|
209
|
+
if npm run "$TEST_COMMAND" -- --maxWorkers="$MAX_WORKERS"; then
|
|
210
|
+
log_success "Tests passed"
|
|
211
|
+
TEST_RESULT=0
|
|
212
|
+
else
|
|
213
|
+
log_error "Tests failed"
|
|
214
|
+
TEST_RESULT=1
|
|
215
|
+
fi
|
|
216
|
+
|
|
217
|
+
cd - > /dev/null
|
|
218
|
+
else
|
|
219
|
+
log_info "[DRY RUN] Would run: npm run $TEST_COMMAND -- --maxWorkers=$MAX_WORKERS"
|
|
220
|
+
TEST_RESULT=0
|
|
221
|
+
fi
|
|
222
|
+
|
|
223
|
+
# Store test results and artifacts (if in CircleCI)
|
|
224
|
+
if [[ "$STORE_RESULTS" == "true" ]] && [[ -n "${CIRCLECI:-}" ]]; then
|
|
225
|
+
log_header "Storing Test Results"
|
|
226
|
+
if [[ "$DRY_RUN" == "false" ]]; then
|
|
227
|
+
if [[ -d "$RESULTS_PATH" ]]; then
|
|
228
|
+
log_success "Test results available at: $RESULTS_PATH"
|
|
229
|
+
log_info "Store test results handled by CircleCI"
|
|
230
|
+
log_info " - store_test_results: $RESULTS_PATH"
|
|
231
|
+
log_info " - store_artifacts: $RESULTS_PATH"
|
|
232
|
+
else
|
|
233
|
+
log_info "No test results found at $RESULTS_PATH"
|
|
234
|
+
fi
|
|
235
|
+
else
|
|
236
|
+
log_info "[DRY RUN] Would store test results from: $RESULTS_PATH"
|
|
237
|
+
fi
|
|
238
|
+
fi
|
|
239
|
+
|
|
240
|
+
log_header "Testing Complete"
|
|
241
|
+
if [[ $TEST_RESULT -eq 0 ]]; then
|
|
242
|
+
log_success "All tests passed"
|
|
243
|
+
else
|
|
244
|
+
log_error "Tests failed"
|
|
245
|
+
fi
|
|
246
|
+
|
|
247
|
+
exit $TEST_RESULT
|
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
parser: '@typescript-eslint/parser',
|
|
4
|
+
parserOptions: {
|
|
5
|
+
ecmaVersion: 2020,
|
|
6
|
+
sourceType: 'module',
|
|
7
|
+
project: './tsconfig.json',
|
|
8
|
+
},
|
|
9
|
+
plugins: ['@typescript-eslint', 'prettier'],
|
|
10
|
+
extends: [
|
|
11
|
+
'eslint:recommended',
|
|
12
|
+
'plugin:@typescript-eslint/recommended',
|
|
13
|
+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
14
|
+
'prettier',
|
|
15
|
+
],
|
|
16
|
+
rules: {
|
|
17
|
+
// TypeScript-specific rules
|
|
18
|
+
'@typescript-eslint/explicit-function-return-type': [
|
|
19
|
+
'warn',
|
|
20
|
+
{
|
|
21
|
+
allowExpressions: true,
|
|
22
|
+
allowTypedFunctionExpressions: true,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
'@typescript-eslint/no-unused-vars': [
|
|
26
|
+
'error',
|
|
27
|
+
{
|
|
28
|
+
argsIgnorePattern: '^_',
|
|
29
|
+
varsIgnorePattern: '^_',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
33
|
+
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
34
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
35
|
+
'@typescript-eslint/await-thenable': 'error',
|
|
36
|
+
|
|
37
|
+
// General code quality
|
|
38
|
+
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
39
|
+
'prefer-const': 'error',
|
|
40
|
+
'no-var': 'error',
|
|
41
|
+
'eqeqeq': ['error', 'always'],
|
|
42
|
+
'curly': ['error', 'all'],
|
|
43
|
+
|
|
44
|
+
// Prettier integration
|
|
45
|
+
'prettier/prettier': 'error',
|
|
46
|
+
},
|
|
47
|
+
env: {
|
|
48
|
+
node: true,
|
|
49
|
+
es2020: true,
|
|
50
|
+
},
|
|
51
|
+
ignorePatterns: ['dist', 'node_modules', 'coverage', '*.js', '!.eslintrc.js'],
|
|
52
|
+
};
|
package/.prettierrc
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kanopi Studios
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|