1#!/bin/bash 2# Copyright (c) 2021 Huawei Device Co., Ltd. 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14set -e 15 16script_path=$(cd $(dirname $0);pwd) 17ts2panda_dir=$(dirname ${script_path}) 18code_dir=${ts2panda_dir}/../../.. 19 20nodejs_dir=$1 21 22cd ${ts2panda_dir} 23export PATH=${nodejs_dir}:$PATH 24npm config set registry http://repo.huaweicloud.com/repository/npm/ 25if [ "X${SKIP_SSL}" == "XYES" ];then 26 npm config set strict-ssl false 27fi 28npm cache clean -f 29npm install 30 31cd ${code_dir} 32if [ -d "${code_dir}/prebuilts/build-tools/common/ts2abc" ]; then 33 echo -e "\n" 34 echo "${code_dir}/prebuilts/build-tools/common/ts2abc already exist, it will be replaced" 35 /bin/rm -rf ${code_dir}/prebuilts/build-tools/common/ts2abc 36 echo -e "\n" 37fi 38 39mkdir -p ${code_dir}/prebuilts/build-tools/common/ts2abc 40/bin/cp -rf ${code_dir}/arkcompiler/ets_frontend/ts2panda/node_modules ${code_dir}/prebuilts/build-tools/common/ts2abc/ || echo "skip copying due to other thread" 41