1#!/bin/bash 2# Copyright (c) 2021-2022 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. 14 15set -e 16 17script_path=$(cd $(dirname $0);pwd) 18code_dir=$(dirname ${script_path})/../ 19 20case $(uname -s) in 21 Linux) 22 host_platform=linux 23 ;; 24 Darwin) 25 host_platform=darwin 26 ;; 27 *) 28 echo "Unsupported host platform: $(uname -s)" 29 exit 1 30esac 31 32node_js_name=current 33 34cd ${code_dir}/third_party/jsframework/ 35export PATH=${code_dir}/prebuilts/build-tools/common/nodejs/${node_js_name}/bin:$PATH 36npm config set registry https://repo.huaweicloud.com/repository/npm/ 37npm install 38 39cd ${code_dir} 40if [ -d "${code_dir}/prebuilts/build-tools/common/js-framework" ]; then 41 echo -e "\n" 42 echo "${code_dir}/prebuilts/build-tools/common/js-framework already exist, it will be replaced" 43 /bin/rm -rf ${code_dir}/prebuilts/build-tools/common/js-framework 44 echo -e "\n" 45fi 46 47mkdir -p ${code_dir}/prebuilts/build-tools/common/js-framework 48/bin/cp -rf ${code_dir}/third_party/jsframework/node_modules ${code_dir}/prebuilts/build-tools/common/js-framework/ 49