mirror of https://github.com/coder/code-server.git
refactor: use npm in build steps and postinstall.sh (#5844)
* refactor: default to npm in postinstall.sh yarn has a bug where it will try to update dependencies even if `yarn.lock` is present. Therefore we're defaulting to `npm` to prevent further issues. * refactor: exclude yarn.lock in standalone By excluding `yarn.lock`, we prevent issues where the user must use `yarn` instead of `npm` to install code-server.
This commit is contained in:
parent
1297e9ac88
commit
3182be634e
|
@ -10,7 +10,7 @@ main() {
|
||||||
|
|
||||||
source ./ci/lib.sh
|
source ./ci/lib.sh
|
||||||
|
|
||||||
rsync "$RELEASE_PATH/" "$RELEASE_PATH-standalone"
|
rsync --exclude yarn.lock "$RELEASE_PATH/" "$RELEASE_PATH-standalone"
|
||||||
RELEASE_PATH+=-standalone
|
RELEASE_PATH+=-standalone
|
||||||
|
|
||||||
# We cannot find the path to node from $PATH because yarn shims a script to ensure
|
# We cannot find the path to node from $PATH because yarn shims a script to ensure
|
||||||
|
|
|
@ -127,14 +127,6 @@ install_with_yarn_or_npm() {
|
||||||
# NOTE@edvincent: We want to keep using the package manager that the end-user was using to install the package.
|
# NOTE@edvincent: We want to keep using the package manager that the end-user was using to install the package.
|
||||||
# This also ensures that when *we* run `yarn` in the development process, the yarn.lock file is used.
|
# This also ensures that when *we* run `yarn` in the development process, the yarn.lock file is used.
|
||||||
case "${npm_config_user_agent-}" in
|
case "${npm_config_user_agent-}" in
|
||||||
yarn*)
|
|
||||||
if [ -f "yarn.lock" ]; then
|
|
||||||
yarn --production --frozen-lockfile --no-default-rc
|
|
||||||
else
|
|
||||||
echo "yarn.lock file not present, not running in development mode. use npm to install code-server!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
npm*)
|
npm*)
|
||||||
if [ -f "yarn.lock" ]; then
|
if [ -f "yarn.lock" ]; then
|
||||||
echo "yarn.lock file present, running in development mode. use yarn to install code-server!"
|
echo "yarn.lock file present, running in development mode. use yarn to install code-server!"
|
||||||
|
@ -146,6 +138,14 @@ install_with_yarn_or_npm() {
|
||||||
npm install --unsafe-perm --legacy-peer-deps --omit=dev
|
npm install --unsafe-perm --legacy-peer-deps --omit=dev
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
yarn*)
|
||||||
|
if [ -f "yarn.lock" ]; then
|
||||||
|
yarn --production --frozen-lockfile --no-default-rc
|
||||||
|
else
|
||||||
|
echo "yarn.lock file not present, not running in development mode. use npm to install code-server!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Could not determine which package manager is being used to install code-server"
|
echo "Could not determine which package manager is being used to install code-server"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in New Issue