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_ver=v12.18.4 33node_js_name=node-${node_js_ver}-${host_platform}-x64 34 35cd ${code_dir}/third_party/jsframework/ 36export PATH=${code_dir}/prebuilts/build-tools/common/nodejs/${node_js_name}/bin:$PATH 37npm config set registry https://repo.huaweicloud.com/repository/npm/ 38npm install 39 40cd ${code_dir} 41if [ -d "${code_dir}/prebuilts/build-tools/common/js-framework" ]; then 42 echo -e "\n" 43 echo "${code_dir}/prebuilts/build-tools/common/js-framework already exist, it will be replaced with node-${node_js_ver}" 44 /bin/rm -rf ${code_dir}/prebuilts/build-tools/common/js-framework 45 echo -e "\n" 46fi 47 48mkdir -p ${code_dir}/prebuilts/build-tools/common/js-framework 49/bin/cp -rf ${code_dir}/third_party/jsframework/node_modules ${code_dir}/prebuilts/build-tools/common/js-framework/ 50