File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Step 1: Run Vitest for unit testing in "run" mode to avoid waiting for changes
4
+ echo " Running unit tests with Vitest..."
5
+ npx vitest run
6
+
7
+ # Check if the tests were successful
8
+ if [ $? -ne 0 ]; then
9
+ echo " Tests failed. Aborting publish."
10
+ exit 1
11
+ fi
12
+
13
+ echo " Tests passed. Proceeding with build and publish..."
14
+
15
+ # Step 2: Remove the dist folder
16
+ echo " Removing dist folder..."
17
+ rm -rf dist
18
+
19
+ # Step 3: Build the library
20
+ echo " Building the library..."
21
+ npm run build
22
+
23
+ # Check if the build was successful
24
+ if [ $? -ne 0 ]; then
25
+ echo " Build failed. Aborting publish."
26
+ exit 1
27
+ fi
28
+
29
+ echo " Build successful."
30
+
31
+ # Step 4: Publish the package
32
+ echo " Publishing the package..."
33
+ npm publish
34
+
35
+ # Check if the publish was successful
36
+ if [ $? -ne 0 ]; then
37
+ echo " Publish failed."
38
+ exit 1
39
+ fi
40
+
41
+ echo " Package published successfully!"
You can’t perform that action at this time.
0 commit comments