!224 备忘录ohpm迁移

Merge pull request !224 from wangzhiyusss/master
This commit is contained in:
openharmony_ci 2023-08-22 08:03:51 +00:00 committed by Gitee
commit d08f7859e1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
20 changed files with 303 additions and 174 deletions

View File

@ -0,0 +1,26 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/resources",
"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/resources",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -1,14 +0,0 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/resources",
"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,28 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/utils",
"description": "a npm package which contains arkUI2.0 page",
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {
"@ohos/source": "file:../resources"
}
}

View File

@ -1,11 +0,0 @@
{
"name": "@ohos/utils",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/source": {
"version": "file:../resources"
}
}
}

View File

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

View File

@ -13,7 +13,6 @@
* limitations under the License.
*/
import { atob } from 'js-base64'
import fileio from '@ohos.fileio'
import { LogUtil } from './LogUtil'
import FolderUtil from './FolderUtil'
@ -29,6 +28,7 @@ import {
SysDefFolderUuid
} from '../model/databaseModel/EnumData'
import relationalStore from '@ohos.data.relationalStore'
import util from '@ohos.util';
const TAG = "RdbStoreUtil"
@ -325,9 +325,10 @@ export default {
return imgNameArray
}
let base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/
let html = ""
let html
if (base64regex.test(noteData.content_text)) {
html = atob(noteData.content_text)
let base64 = new util.Base64Helper
html = base64.decodeSync(noteData.content_text)
} else {
html = noteData.content_text
}

29
features/oh-package.json5 Normal file
View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/component",
"description": "a npm package which contains arkUI2.0 page",
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {
"@ohos/utils": "file:../common/utils",
"@ohos/source": "file:../common/resources"
}
}

View File

@ -1,22 +0,0 @@
{
"name": "@ohos/component",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/source": {
"version": "file:../common/resources"
},
"@ohos/utils": {
"version": "file:../common/utils",
"requires": {
"@ohos/source": "file:../common/resources"
},
"dependencies": {
"@ohos/source": {
"version": "file:../common/resources"
}
}
}
}
}

View File

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

View File

@ -0,0 +1,21 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"hvigorVersion": "2.0.0",
"dependencies": {
"@ohos/hvigor-ohos-plugin": "2.0.0"
}
}

2
hvigor/hvigor-wrapper.js Normal file

File diff suppressed because one or more lines are too long

63
hvigorw Normal file
View File

@ -0,0 +1,63 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#!/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}" "$@"

72
hvigorw.bat Normal file
View File

@ -0,0 +1,72 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@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% %*
:fail
exit /b 1

26
oh-package.json5 Normal file
View File

@ -0,0 +1,26 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"license": "ISC",
"devDependencies": {
"@ohos/hypium": "1.0.6"
},
"name": "ohos_note",
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,20 +0,0 @@
{
"license": "ISC",
"devDependencies": {},
"name": "ohos_note",
"ohos": {
"org": "huawei",
"directoryLevel": "project",
"buildTool": "hvigor"
},
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {
"@ohos/hvigor": "1.2.2",
"@ohos/hvigor-ohos-plugin": "1.2.2",
"hypium": "^1.0.0",
"js-base64": "^3.7.2",
"@ohos/hypium": "1.0.2"
}
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"license": "ISC",
"devDependencies": {},
"name": "default",
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {
"@ohos/utils": "file:../../common/utils",
"@ohos/component": "file:../../features",
"@ohos/source": "file:../../common/resources"
}
}

View File

@ -1,45 +0,0 @@
{
"name": "default",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/component": {
"version": "file:../../features",
"requires": {
"@ohos/source": "file:../../common/resources",
"@ohos/utils": "file:../../common/utils"
},
"dependencies": {
"@ohos/source": {
"version": "file:../../common/resources"
},
"@ohos/utils": {
"version": "file:../../common/utils",
"requires": {
"@ohos/source": "file:../../common/resources"
},
"dependencies": {
"@ohos/source": {
"version": "file:../../common/resources"
}
}
}
}
},
"@ohos/source": {
"version": "file:../../common/resources"
},
"@ohos/utils": {
"version": "file:../../common/utils",
"requires": {
"@ohos/source": "file:../../common/resources"
},
"dependencies": {
"@ohos/source": {
"version": "file:../../common/resources"
}
}
}
}
}

View File

@ -1,18 +0,0 @@
{
"license": "ISC",
"devDependencies": {},
"name": "default",
"ohos": {
"org": "huawei",
"directoryLevel": "module",
"buildTool": "hvigor"
},
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {
"@ohos/utils": "file:../../common/utils",
"@ohos/component": "file:../../features",
"@ohos/source": "file:../../common/resources"
}
}

View File

@ -19,9 +19,9 @@ import AbilityConstant from '@ohos.app.ability.AbilityConstant'
import fileio from '@ohos.fileio'
import inputMethod from '@ohos.inputMethod';
import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import { atob } from 'js-base64'
import display from '@ohos.display';
import window from '@ohos.window';
import util from '@ohos.util';
globalThis.rdbStore = undefined
@ -169,9 +169,10 @@ export default class MainAbility extends UIAbility {
return srcArray
}
let base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/
let realHtml = ""
let realHtml
if (base64regex.test(html)) {
realHtml = atob(html)
let base64 = new util.Base64Helper
realHtml = base64.decodeSync(html)
} else {
realHtml = html;
}