File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Publishing the packages/libs into npm registry
4
+ # ---
5
+ # There is an error that I (chalda) haven't been able to fix yet (knowledge+lack of time)
6
+ # That pnpm `workspace:` depedency is not correctly translated to npm published package
7
+ # and when the dependency uses `workspace:` then command `npm install -g ...` fails
8
+ # to load such dependencies when running as a global command at the system.
9
+ # I think the `npm` does not understand the `workspace:` prefix as it's from `pnpm`. Not sure though.
10
+
11
+
12
+ # This script thus stripping the `workspace:` prefix from the `dependencies` in `package.json`
13
+ # and then publishing the package to npm registry
14
+ # and then placing it back to the `package.json` file.
15
+
16
+ if [ -z " $1 " ]; then
17
+ echo " Usage: $0 <version>"
18
+ exit 1
19
+ fi
20
+
21
+ SCRIPT_PATH=` readlink -f " $0 " `
22
+ SCRIPT_DIR=` dirname " $SCRIPT_PATH " `
23
+ VERSION=` cat $SCRIPT_DIR /../packages/lib/ts-common/package.json | grep version | cut -d ' "' -f 4`
24
+ NEW_VERSION=" $1 "
25
+
26
+ set -e
27
+ pnpm install
28
+ pnpm build
29
+
30
+ find -name package.json | xargs -I file sed -i ' s/workspace:[ \t]*//' file
31
+ find -name package.json | xargs -I file sed -i " s/${VERSION} /${NEW_VERSION} /" file
32
+
33
+ echo " Going to publish the packages/libs to npm registry, from version ${VERSION} to ${NEW_VERSION} "
34
+ read -p " Press enter to continue"
35
+
36
+ pnpm publish:libs
37
+
38
+ find -name package.json | xargs -I file sed -i ' s/\(@marinade.finance[^:]*: "\)' " ${NEW_VERSION} " ' /\1workspace: ' " ${NEW_VERSION} " ' /' file
39
+ pnpm install
You can’t perform that action at this time.
0 commit comments