适配ohpm

Signed-off-by: fengwei <fengwei55@h-partners.com>
This commit is contained in:
fengwei 2023-10-18 10:06:35 +08:00
parent 32b9554e81
commit 1a14d7fd5f
48 changed files with 302 additions and 2012 deletions

2
.gitignore vendored
View File

@ -4,3 +4,5 @@
**/build
/features/**/build
/.hvigor
oh_modules
oh-package-lock.json5

View File

@ -83,6 +83,14 @@
<filteritem type="filepath" name="features/.*/.*.json5" desc="build config file"/>
<filteritem type="filepath" name="product/.*/.*.json5" desc="build config file"/>
</filefilter>
<filefilter name="copyrightPolicyFilter" desc="Filters for copyright header policies">
<filteritem type="filename" name="README|README_zh|.*.log|.*.json5|.*.json" desc=""/>
<filteritem type="filename" name="hvigorw|hvigorw.bat|hvigor-wrapper.js" desc="Build files"/>
</filefilter>
<filefilter name="defaultPolicyFilter" desc="Filters for LICENSE file policies">
<filteritem type="filename" name="README|README_zh|*.log|*.json5|*.json" desc="json file"/>
<filteritem type="filename" name="hvigorw|hvigorw.bat|hvigor-wrapper.js" desc="Build files"/>
</filefilter>
</filefilterlist>
</oatconfig>
</configuration>

11
common/oh-package.json5 Normal file
View File

@ -0,0 +1,11 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/common",
"description": "a npm package which contains arkUI2.0 page",
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,5 +0,0 @@
{
"name": "@ohos/common",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -1,14 +0,0 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/common",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

9
entry/oh-package.json5 Normal file
View File

@ -0,0 +1,9 @@
{
"license": "ISC",
"devDependencies": {},
"name": "entry",
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,5 +0,0 @@
{
"name": "entry",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -1,14 +0,0 @@
{
"license": "ISC",
"devDependencies": {},
"name": "entry",
"ohos": {
"org": "huawei",
"directoryLevel": "module",
"buildTool": "hvigor"
},
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -0,0 +1,11 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/batterycomponent",
"description": "a npm package which contains arkUI2.0 page",
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,5 +0,0 @@
{
"name": "@ohos/batterycomponent",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -1,14 +0,0 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/batterycomponent",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -0,0 +1,11 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/clockcomponent",
"description": "a npm package which contains arkUI2.0 page",
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,5 +0,0 @@
{
"name": "@ohos/clockcomponent",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -1,14 +0,0 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/clockcomponent",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -0,0 +1,11 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/datetimecomponent",
"description": "a npm package which contains arkUI2.0 page",
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,5 +0,0 @@
{
"name": "@ohos/datetimecomponent",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -1,14 +0,0 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/datetimecomponent",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -0,0 +1,11 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/noticeitem",
"description": "a npm package which contains arkUI2.0 page",
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,5 +0,0 @@
{
"name": "@ohos/noticeitem",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -1,14 +0,0 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/noticeitem",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -0,0 +1,11 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/screenlock",
"description": "a npm package which contains arkUI2.0 page",
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,5 +0,0 @@
{
"name": "@ohos/screenlock",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -1,14 +0,0 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/screenlock",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -0,0 +1,11 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/shortcutcomponent",
"description": "a npm package which contains arkUI2.0 page",
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,5 +0,0 @@
{
"name": "@ohos/shortcutcomponent",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -1,14 +0,0 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/shortcutcomponent",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -0,0 +1,11 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/signalcomponent",
"description": "a npm package which contains arkUI2.0 page",
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,5 +0,0 @@
{
"name": "@ohos/signalcomponent",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -1,14 +0,0 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/signalcomponent",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -0,0 +1,11 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/wallpapercomponent",
"description": "a npm package which contains arkUI2.0 page",
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,5 +0,0 @@
{
"name": "@ohos/wallpapercomponent",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -1,14 +0,0 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/wallpapercomponent",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -0,0 +1,11 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/wificomponent",
"description": "a npm package which contains arkUI2.0 page",
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,5 +0,0 @@
{
"name": "@ohos/wificomponent",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -1,14 +0,0 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/wificomponent",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -0,0 +1,6 @@
{
"hvigorVersion": "2.1.1",
"dependencies": {
"@ohos/hvigor-ohos-plugin": "2.1.1"
}
}

2
hvigor/hvigor-wrapper.js Normal file

File diff suppressed because one or more lines are too long

48
hvigorw Normal file
View File

@ -0,0 +1,48 @@
#!/bin/bash
# ----------------------------------------------------------------------------
# Hvigor startup script, version 1.0.0
#
# Required ENV vars:
# ------------------
# NODE_HOME - location of a Node home dir
# or
# Add /usr/local/nodejs/bin to the PATH environment variable
# ----------------------------------------------------------------------------
HVIGOR_APP_HOME=$(dirname $(readlink -f $0))
HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js
warn() {
echo ""
echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
error() {
echo ""
echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
fail() {
error "$@"
exit 1
}
# Determine node to start hvigor wrapper script
if [ -n "${NODE_HOME}" ];then
EXECUTABLE_NODE="${NODE_HOME}/bin/node"
if [ ! -x "$EXECUTABLE_NODE" ];then
fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed"
fi
else
EXECUTABLE_NODE="node"
which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path"
fi
# Check hvigor wrapper script
if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then
fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}"
fi
# start hvigor-wrapper script
exec "${EXECUTABLE_NODE}" \
"${HVIGOR_WRAPPER_SCRIPT}" "$@"

64
hvigorw.bat Normal file
View File

@ -0,0 +1,64 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Hvigor startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
set NODE_EXE=node.exe
goto start
:start
@rem Find node.exe
if defined NODE_HOME goto findNodeFromNodeHome
%NODE_EXE% --version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:findNodeFromNodeHome
set NODE_HOME=%NODE_HOME:"=%
set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
if exist "%NODE_EXE_PATH%" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:execute
@rem Execute hvigor
"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
if "%ERRORLEVEL%" == "0" goto hvigorwEnd
:fail
exit /b 1
:hvigorwEnd
if "%OS%" == "Windows_NT" endlocal
:end

12
oh-package.json5 Normal file
View File

@ -0,0 +1,12 @@
{
"license": "ISC",
"devDependencies": {
"@ohos/hypium": "1.0.6"
},
"name": "systemui",
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {
}
}

1657
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +0,0 @@
{
"license": "ISC",
"devDependencies": {},
"name": "systemui",
"ohos": {
"org": "huawei",
"directoryLevel": "project",
"buildTool": "hvigor"
},
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {
"@ohos/hvigor-ohos-plugin": "1.1.6",
"hypium": "^1.0.0",
"@ohos/hvigor": "1.1.6",
"@ohos/hypium": "1.0.1"
}
}

View File

@ -0,0 +1,20 @@
{
"license": "ISC",
"devDependencies": {},
"name": "pc",
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {
"@ohos/wificomponent": "file:../../features/wificomponent",
"@ohos/screenlock": "file:../../features/screenlock",
"@ohos/signalcomponent": "file:../../features/signalcomponent",
"@ohos/clockcomponent": "file:../../features/clockcomponent",
"@ohos/datetimecomponent": "file:../../features/datetimecomponent",
"@ohos/batterycomponent": "file:../../features/batterycomponent",
"@ohos/common": "file:../../common",
"@ohos/noticeitem": "file:../../features/noticeitem",
"@ohos/shortcutcomponent": "file:../../features/shortcutcomponent",
"@ohos/wallpapercomponent": "file:../../features/wallpapercomponent"
}
}

View File

@ -1,38 +0,0 @@
{
"name": "pc",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/batterycomponent": {
"version": "file:../../features/batterycomponent"
},
"@ohos/clockcomponent": {
"version": "file:../../features/clockcomponent"
},
"@ohos/common": {
"version": "file:../../common"
},
"@ohos/datetimecomponent": {
"version": "file:../../features/datetimecomponent"
},
"@ohos/noticeitem": {
"version": "file:../../features/noticeitem"
},
"@ohos/screenlock": {
"version": "file:../../features/screenlock"
},
"@ohos/shortcutcomponent": {
"version": "file:../../features/shortcutcomponent"
},
"@ohos/signalcomponent": {
"version": "file:../../features/signalcomponent"
},
"@ohos/wallpapercomponent": {
"version": "file:../../features/wallpapercomponent"
},
"@ohos/wificomponent": {
"version": "file:../../features/wificomponent"
}
}
}

View File

@ -1,25 +0,0 @@
{
"license": "ISC",
"devDependencies": {},
"name": "pc",
"ohos": {
"org": "huawei",
"directoryLevel": "module",
"buildTool": "hvigor"
},
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {
"@ohos/wificomponent": "file:../../features/wificomponent",
"@ohos/screenlock": "file:../../features/screenlock",
"@ohos/signalcomponent": "file:../../features/signalcomponent",
"@ohos/clockcomponent": "file:../../features/clockcomponent",
"@ohos/datetimecomponent": "file:../../features/datetimecomponent",
"@ohos/batterycomponent": "file:../../features/batterycomponent",
"@ohos/common": "file:../../common",
"@ohos/noticeitem": "file:../../features/noticeitem",
"@ohos/shortcutcomponent": "file:../../features/shortcutcomponent",
"@ohos/wallpapercomponent": "file:../../features/wallpapercomponent"
}
}

View File

@ -0,0 +1,20 @@
{
"license": "ISC",
"devDependencies": {},
"name": "phone",
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {
"@ohos/wificomponent": "file:../../features/wificomponent",
"@ohos/screenlock": "file:../../features/screenlock",
"@ohos/signalcomponent": "file:../../features/signalcomponent",
"@ohos/clockcomponent": "file:../../features/clockcomponent",
"@ohos/datetimecomponent": "file:../../features/datetimecomponent",
"@ohos/batterycomponent": "file:../../features/batterycomponent",
"@ohos/common": "file:../../common",
"@ohos/noticeitem": "file:../../features/noticeitem",
"@ohos/shortcutcomponent": "file:../../features/shortcutcomponent",
"@ohos/wallpapercomponent": "file:../../features/wallpapercomponent"
}
}

View File

@ -1,38 +0,0 @@
{
"name": "phone",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/batterycomponent": {
"version": "file:../../features/batterycomponent"
},
"@ohos/clockcomponent": {
"version": "file:../../features/clockcomponent"
},
"@ohos/common": {
"version": "file:../../common"
},
"@ohos/datetimecomponent": {
"version": "file:../../features/datetimecomponent"
},
"@ohos/noticeitem": {
"version": "file:../../features/noticeitem"
},
"@ohos/screenlock": {
"version": "file:../../features/screenlock"
},
"@ohos/shortcutcomponent": {
"version": "file:../../features/shortcutcomponent"
},
"@ohos/signalcomponent": {
"version": "file:../../features/signalcomponent"
},
"@ohos/wallpapercomponent": {
"version": "file:../../features/wallpapercomponent"
},
"@ohos/wificomponent": {
"version": "file:../../features/wificomponent"
}
}
}

View File

@ -1,25 +0,0 @@
{
"license": "ISC",
"devDependencies": {},
"name": "phone",
"ohos": {
"org": "huawei",
"directoryLevel": "module",
"buildTool": "hvigor"
},
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {
"@ohos/wificomponent": "file:../../features/wificomponent",
"@ohos/screenlock": "file:../../features/screenlock",
"@ohos/signalcomponent": "file:../../features/signalcomponent",
"@ohos/clockcomponent": "file:../../features/clockcomponent",
"@ohos/datetimecomponent": "file:../../features/datetimecomponent",
"@ohos/batterycomponent": "file:../../features/batterycomponent",
"@ohos/common": "file:../../common",
"@ohos/noticeitem": "file:../../features/noticeitem",
"@ohos/shortcutcomponent": "file:../../features/shortcutcomponent",
"@ohos/wallpapercomponent": "file:../../features/wallpapercomponent"
}
}