@deveco-test/deveco-cli-common 1.3.12-Test.1 → 1.3.12-Test.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +120 -25
  2. package/THIRD-PARTY-LICENSES +32 -3
  3. package/dist/cli.js +231 -217
  4. package/dist/internal/telemetry-upload-background.js +10 -10
  5. package/package.json +4 -2
  6. package/skills/deveco-cli/SKILL.md +56 -9
  7. package/skills/index.json +2 -2
  8. package/templates/application/template.json +8 -0
  9. package/templates/native-cpp/AppScope/app.json5 +10 -0
  10. package/templates/native-cpp/AppScope/resources/base/element/string.json +8 -0
  11. package/templates/native-cpp/AppScope/resources/base/media/layered_image.json +7 -0
  12. package/templates/native-cpp/build-profile.json5 +43 -0
  13. package/templates/native-cpp/code-linter.json5 +32 -0
  14. package/templates/native-cpp/entry/build-profile.json5 +48 -0
  15. package/templates/native-cpp/entry/gitignore.txt +6 -0
  16. package/templates/native-cpp/entry/hvigorfile.ts +6 -0
  17. package/templates/native-cpp/entry/obfuscation-rules.txt +20 -0
  18. package/templates/native-cpp/entry/oh-package.json5 +11 -0
  19. package/templates/native-cpp/entry/src/main/cpp/CMakeLists.txt +15 -0
  20. package/templates/native-cpp/entry/src/main/cpp/napi_init.cpp +67 -0
  21. package/templates/native-cpp/entry/src/main/cpp/types/libentry/Index.d.ts +16 -0
  22. package/templates/native-cpp/entry/src/main/cpp/types/libentry/oh-package.json5 +6 -0
  23. package/templates/native-cpp/entry/src/main/ets/entryability/EntryAbility.ets +63 -0
  24. package/templates/native-cpp/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +31 -0
  25. package/templates/native-cpp/entry/src/main/ets/pages/Index.ets +26 -0
  26. package/templates/native-cpp/entry/src/main/module.json5 +50 -0
  27. package/templates/native-cpp/entry/src/main/resources/base/element/color.json +8 -0
  28. package/templates/native-cpp/entry/src/main/resources/base/element/float.json +8 -0
  29. package/templates/native-cpp/entry/src/main/resources/base/element/string.json +16 -0
  30. package/templates/native-cpp/entry/src/main/resources/base/media/layered_image.json +7 -0
  31. package/templates/native-cpp/entry/src/main/resources/base/profile/backup_config.json +3 -0
  32. package/templates/native-cpp/entry/src/main/resources/base/profile/main_pages.json +5 -0
  33. package/templates/native-cpp/entry/src/main/resources/dark/element/color.json +8 -0
  34. package/templates/native-cpp/gitignore.txt +13 -0
  35. package/templates/native-cpp/hvigor/hvigor-config.json5 +23 -0
  36. package/templates/native-cpp/hvigorfile.ts +6 -0
  37. package/templates/native-cpp/oh-package.json5 +10 -0
  38. package/templates/native-cpp/template.json +8 -0
@@ -0,0 +1,32 @@
1
+ {
2
+ "files": [
3
+ "**/*.ets"
4
+ ],
5
+ "ignore": [
6
+ "**/src/ohosTest/**/*",
7
+ "**/src/test/**/*",
8
+ "**/src/mock/**/*",
9
+ "**/node_modules/**/*",
10
+ "**/oh_modules/**/*",
11
+ "**/build/**/*",
12
+ "**/.preview/**/*"
13
+ ],
14
+ "ruleSet": [
15
+ "plugin:@performance/recommended",
16
+ "plugin:@typescript-eslint/recommended"
17
+ ],
18
+ "rules": {
19
+ "@security/no-unsafe-aes": "error",
20
+ "@security/no-unsafe-hash": "error",
21
+ "@security/no-unsafe-mac": "warn",
22
+ "@security/no-unsafe-dh": "error",
23
+ "@security/no-unsafe-dsa": "error",
24
+ "@security/no-unsafe-ecdsa": "error",
25
+ "@security/no-unsafe-rsa-encrypt": "error",
26
+ "@security/no-unsafe-rsa-sign": "error",
27
+ "@security/no-unsafe-rsa-key": "error",
28
+ "@security/no-unsafe-dsa-key": "error",
29
+ "@security/no-unsafe-dh-key": "error",
30
+ "@security/no-unsafe-3des": "error"
31
+ }
32
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "apiType": "stageMode",
3
+ "buildOption": {
4
+ "resOptions": {
5
+ "copyCodeResource": {
6
+ "enable": false
7
+ }
8
+ },
9
+ "externalNativeOptions": {
10
+ "path": "./src/main/cpp/CMakeLists.txt",
11
+ "arguments": "",
12
+ "cppFlags": "",
13
+ "abiFilters": [
14
+ "arm64-v8a",
15
+ "x86_64"
16
+ ]
17
+ }
18
+ },
19
+ "buildOptionSet": [
20
+ {
21
+ "name": "release",
22
+ "arkOptions": {
23
+ "obfuscation": {
24
+ "ruleOptions": {
25
+ "enable": false,
26
+ "files": [
27
+ "./obfuscation-rules.txt"
28
+ ]
29
+ }
30
+ }
31
+ },
32
+ "nativeLib": {
33
+ "debugSymbol": {
34
+ "strip": true,
35
+ "exclude": []
36
+ }
37
+ }
38
+ },
39
+ ],
40
+ "targets": [
41
+ {
42
+ "name": "default"
43
+ },
44
+ {
45
+ "name": "ohosTest",
46
+ }
47
+ ]
48
+ }
@@ -0,0 +1,6 @@
1
+ /node_modules
2
+ /oh_modules
3
+ /.preview
4
+ /build
5
+ /.cxx
6
+ /.test
@@ -0,0 +1,6 @@
1
+ import { hapTasks } from '@ohos/hvigor-ohos-plugin';
2
+
3
+ export default {
4
+ system: hapTasks /* Built-in plugin of Hvigor. It cannot be modified. */,
5
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */,
6
+ };
@@ -0,0 +1,20 @@
1
+ # Define project specific obfuscation rules here.
2
+ # You can include the obfuscation configuration files in the current module's build-profile.json5.
3
+
4
+ # Obfuscation options:
5
+ # -disable-obfuscation: disable all obfuscations
6
+ # -enable-property-obfuscation: obfuscate the property names
7
+ # -enable-toplevel-obfuscation: obfuscate the names in the global scope
8
+ # -compact: remove unnecessary blank spaces and all line feeds
9
+ # -remove-log: remove all console.* statements
10
+ # -print-namecache: print the name cache that contains the mapping from the old names to new names
11
+ # -apply-namecache: reuse the given cache file
12
+
13
+ # Keep options:
14
+ # -keep-property-name: specifies property names that you want to keep
15
+ # -keep-global-name: specifies names that you want to keep in the global scope
16
+
17
+ -enable-property-obfuscation
18
+ -enable-toplevel-obfuscation
19
+ -enable-filename-obfuscation
20
+ -enable-export-obfuscation
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "entry",
3
+ "version": "1.0.0",
4
+ "description": "Please describe the basic information.",
5
+ "main": "",
6
+ "author": "",
7
+ "license": "",
8
+ "dependencies": {
9
+ "libentry.so": "file:./src/main/cpp/types/libentry"
10
+ }
11
+ }
@@ -0,0 +1,15 @@
1
+ # the minimum version of CMake.
2
+ cmake_minimum_required(VERSION 3.5.0)
3
+ project(MyApplication)
4
+
5
+ set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
6
+
7
+ if(DEFINED PACKAGE_FIND_FILE)
8
+ include(${PACKAGE_FIND_FILE})
9
+ endif()
10
+
11
+ include_directories(${NATIVERENDER_ROOT_PATH}
12
+ ${NATIVERENDER_ROOT_PATH}/include)
13
+
14
+ add_library(entry SHARED napi_init.cpp)
15
+ target_link_libraries(entry PUBLIC libace_napi.z.so)
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Copyright (c) 2026 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
+ */
15
+
16
+ #include "napi/native_api.h"
17
+
18
+ static napi_value Add(napi_env env, napi_callback_info info)
19
+ {
20
+ size_t argc = 2;
21
+ napi_value args[2] = {nullptr};
22
+
23
+ napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);
24
+
25
+ napi_valuetype valuetype0;
26
+ napi_typeof(env, args[0], &valuetype0);
27
+
28
+ napi_valuetype valuetype1;
29
+ napi_typeof(env, args[1], &valuetype1);
30
+
31
+ double value0;
32
+ napi_get_value_double(env, args[0], &value0);
33
+
34
+ double value1;
35
+ napi_get_value_double(env, args[1], &value1);
36
+
37
+ napi_value sum;
38
+ napi_create_double(env, value0 + value1, &sum);
39
+
40
+ return sum;
41
+ }
42
+
43
+ EXTERN_C_START
44
+ static napi_value Init(napi_env env, napi_value exports)
45
+ {
46
+ napi_property_descriptor desc[] = {
47
+ { "add", nullptr, Add, nullptr, nullptr, nullptr, napi_default, nullptr }
48
+ };
49
+ napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
50
+ return exports;
51
+ }
52
+ EXTERN_C_END
53
+
54
+ static napi_module demoModule = {
55
+ .nm_version = 1,
56
+ .nm_flags = 0,
57
+ .nm_filename = nullptr,
58
+ .nm_register_func = Init,
59
+ .nm_modname = "entry",
60
+ .nm_priv = ((void*)0),
61
+ .reserved = { 0 },
62
+ };
63
+
64
+ extern "C" __attribute__((constructor)) void RegisterEntryModule(void)
65
+ {
66
+ napi_module_register(&demoModule);
67
+ }
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright (c) 2026 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
+ */
15
+
16
+ export const add: (a: number, b: number) => number;
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "libentry.so",
3
+ "types": "./Index.d.ts",
4
+ "version": "1.0.0",
5
+ "description": "Please describe the basic information."
6
+ }
@@ -0,0 +1,63 @@
1
+ /*
2
+ * Copyright (c) 2026 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
+ */
15
+
16
+ import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit';
17
+ import { hilog } from '@kit.PerformanceAnalysisKit';
18
+ import { window } from '@kit.ArkUI';
19
+
20
+ const DOMAIN = 0x0000;
21
+
22
+ export default class EntryAbility extends UIAbility {
23
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
24
+ try {
25
+ this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
26
+ } catch (err) {
27
+ hilog.error(DOMAIN, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err));
28
+ }
29
+ hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate');
30
+ }
31
+
32
+ onDestroy(): void {
33
+ hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy');
34
+ }
35
+
36
+ onWindowStageCreate(windowStage: window.WindowStage): void {
37
+ // Main window is created, set main page for this ability
38
+ hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
39
+
40
+ windowStage.loadContent('pages/Index', (err) => {
41
+ if (err.code) {
42
+ hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err));
43
+ return;
44
+ }
45
+ hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.');
46
+ });
47
+ }
48
+
49
+ onWindowStageDestroy(): void {
50
+ // Main window is destroyed, release UI related resources
51
+ hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
52
+ }
53
+
54
+ onForeground(): void {
55
+ // Ability has brought to foreground
56
+ hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground');
57
+ }
58
+
59
+ onBackground(): void {
60
+ // Ability has back to background
61
+ hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground');
62
+ }
63
+ }
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Copyright (c) 2026 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
+ */
15
+
16
+ import { hilog } from '@kit.PerformanceAnalysisKit';
17
+ import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
18
+
19
+ const DOMAIN = 0x0000;
20
+
21
+ export default class EntryBackupAbility extends BackupExtensionAbility {
22
+ async onBackup() {
23
+ hilog.info(DOMAIN, 'testTag', 'onBackup ok');
24
+ await Promise.resolve();
25
+ }
26
+
27
+ async onRestore(bundleVersion: BundleVersion) {
28
+ hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
29
+ await Promise.resolve();
30
+ }
31
+ }
@@ -0,0 +1,26 @@
1
+ import { hilog } from '@kit.PerformanceAnalysisKit';
2
+ import testNapi from 'libentry.so';
3
+
4
+ const DOMAIN = 0x0000;
5
+
6
+ @Entry
7
+ @Component
8
+ struct Index {
9
+ @State message: string = 'Hello World';
10
+
11
+ build() {
12
+ Row() {
13
+ Column() {
14
+ Text(this.message)
15
+ .fontSize($r('app.float.page_text_font_size'))
16
+ .fontWeight(FontWeight.Bold)
17
+ .onClick(() => {
18
+ this.message = 'Welcome';
19
+ hilog.info(DOMAIN, 'testTag', 'Test NAPI 2 + 3 = %{public}d', testNapi.add(2, 3));
20
+ })
21
+ }
22
+ .width('100%')
23
+ }
24
+ .height('100%')
25
+ }
26
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "module": {
3
+ "name": "entry",
4
+ "type": "entry",
5
+ "description": "$string:module_desc",
6
+ "mainElement": "EntryAbility",
7
+ "deviceTypes": [
8
+ "phone"
9
+ ],
10
+ "deliveryWithInstall": true,
11
+ "installationFree": false,
12
+ "pages": "$profile:main_pages",
13
+ "abilities": [
14
+ {
15
+ "name": "EntryAbility",
16
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
17
+ "description": "$string:EntryAbility_desc",
18
+ "icon": "$media:layered_image",
19
+ "label": "$string:EntryAbility_label",
20
+ "startWindowIcon": "$media:startIcon",
21
+ "startWindowBackground": "$color:start_window_background",
22
+ "exported": true,
23
+ "skills": [
24
+ {
25
+ "entities": [
26
+ "entity.system.home"
27
+ ],
28
+ "actions": [
29
+ "ohos.want.action.home"
30
+ ]
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "extensionAbilities": [
36
+ {
37
+ "name": "EntryBackupAbility",
38
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
39
+ "type": "backup",
40
+ "exported": false,
41
+ "metadata": [
42
+ {
43
+ "name": "ohos.extension.backup",
44
+ "resource": "$profile:backup_config"
45
+ }
46
+ ],
47
+ }
48
+ ]
49
+ }
50
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "color": [
3
+ {
4
+ "name": "start_window_background",
5
+ "value": "#FFFFFF"
6
+ }
7
+ ]
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "float": [
3
+ {
4
+ "name": "page_text_font_size",
5
+ "value": "50fp"
6
+ }
7
+ ]
8
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "string": [
3
+ {
4
+ "name": "module_desc",
5
+ "value": "module description"
6
+ },
7
+ {
8
+ "name": "EntryAbility_desc",
9
+ "value": "description"
10
+ },
11
+ {
12
+ "name": "EntryAbility_label",
13
+ "value": "label"
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "layered-image":
3
+ {
4
+ "background" : "$media:background",
5
+ "foreground" : "$media:foreground"
6
+ }
7
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "allowToBackupRestore": true
3
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "src": [
3
+ "pages/Index"
4
+ ]
5
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "color": [
3
+ {
4
+ "name": "start_window_background",
5
+ "value": "#000000"
6
+ }
7
+ ]
8
+ }
@@ -0,0 +1,13 @@
1
+ /node_modules
2
+ /oh_modules
3
+ /local.properties
4
+ /.idea
5
+ **/build
6
+ /.hvigor
7
+ .cxx
8
+ /.clangd
9
+ /.clang-format
10
+ /.clang-tidy
11
+ **/.test
12
+ /.appanalyzer
13
+ /.cache
@@ -0,0 +1,23 @@
1
+ {
2
+ "modelVersion": "6.0.2",
3
+ "dependencies": {
4
+ },
5
+ "execution": {
6
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | "ultrafine" | false ]. Default: "normal" */
7
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
8
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
9
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
10
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
11
+ // "optimizationStrategy": "memory" /* Define the optimization strategy. Value: [ "memory" | "performance" ]. Default: "memory" */
12
+ },
13
+ "logging": {
14
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
15
+ },
16
+ "debugging": {
17
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
18
+ },
19
+ "nodeOptions": {
20
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
21
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
22
+ }
23
+ }
@@ -0,0 +1,6 @@
1
+ import { appTasks } from '@ohos/hvigor-ohos-plugin';
2
+
3
+ export default {
4
+ system: appTasks /* Built-in plugin of Hvigor. It cannot be modified. */,
5
+ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */,
6
+ };
@@ -0,0 +1,10 @@
1
+ {
2
+ "modelVersion": "6.0.2",
3
+ "description": "Please describe the basic information.",
4
+ "dependencies": {
5
+ },
6
+ "devDependencies": {
7
+ "@ohos/hypium": "1.0.25",
8
+ "@ohos/hamock": "1.0.0"
9
+ }
10
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "native-cpp",
3
+ "displayName": "Native C++",
4
+ "description": "C++ native project with NAPI integration.",
5
+ "deviceTypes": ["phone"],
6
+ "minApiLevel": 17,
7
+ "bundleType": "app"
8
+ }