Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions .github/workflows/addon-sonar-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Addon sonar analysis

on:
workflow_dispatch:
pull_request:
paths: ['packages/addon/**']
types: [opened, synchronize, reopened]
Expand All @@ -17,9 +16,6 @@ jobs:
run:
working-directory: packages/addon

env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -38,13 +34,12 @@ jobs:
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@1a6d90ebcb0e6a6b1d87e37ba693fe453195ae25 # v5.3.1

- name: Run build wrapper
run: build-wrapper-win-x86-64.exe --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmd /c "node-gyp configure build"

- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@1a6d90ebcb0e6a6b1d87e37ba693fe453195ae25 # v5.3.1
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
--define sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json

run: build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory cmd /c "node-gyp configure build"

# The sonar analysis does not work because the sonar project points to the node-win repo so it cannot find the PR
# - name: SonarQube Scan
# uses: SonarSource/sonarqube-scan-action@1a6d90ebcb0e6a6b1d87e37ba693fe453195ae25 # v5.3.1
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# with:
# projectBaseDir: packages/addon
5 changes: 2 additions & 3 deletions .github/workflows/check-pr-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ on:
jobs:
check_pr_size:
# Ignore PRs with name merge-X-X-X-release
if: false
# if: |
# !(startsWith(github.head_ref, 'merge-') && endsWith(github.head_ref, '-release') && github.base_ref == 'main')
if: |
!(startsWith(github.head_ref, 'merge-') && endsWith(github.head_ref, '-release') && github.base_ref == 'main')
runs-on: ubuntu-latest
timeout-minutes: 1

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/core-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish
name: Core publish

on:
workflow_dispatch:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/core-sonar-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ jobs:
- name: Run tests
run: npm run test:cov

# The sonar analysis does not work because the sonar project points to the node-win repo so it cannot find the PR
# - name: SonarQube Scan
# uses: SonarSource/sonarqube-scan-action@1a6d90ebcb0e6a6b1d87e37ba693fe453195ae25 # v5.3.1
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# with:
# projectBaseDir: packages/core
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
"dependencies": {
"@headlessui/react": "^1.4.2",
"@iconscout/react-unicons": "^1.1.6",
"@internxt/drive-desktop-core": "^0.1.13",
"@internxt/drive-desktop-core": "file:packages/core/internxt-drive-desktop-core-0.1.13.tgz",
"@internxt/inxt-js": "2.2.9",
"@internxt/scan": "1.0.7",
"@packages/addon": "file:packages/addon/packages-addon-1.0.0.tgz",
Expand Down
12 changes: 4 additions & 8 deletions packages/addon/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
"native-src/virtual_drive/create_folder_placeholder.cpp",
"native-src/virtual_drive/dehydrate_file.cpp",
"native-src/virtual_drive/disconnect_sync_root.cpp",
"native-src/virtual_drive/get_placeholder_state/get_placeholder_state_wrapper.cpp",
"native-src/virtual_drive/get_placeholder_state.cpp",
"native-src/virtual_drive/get_registered_sync_roots/get_registered_sync_roots.cpp",
"native-src/virtual_drive/get_registered_sync_roots/get_registered_sync_roots_wrapper.cpp",
"native-src/virtual_drive/hydrate_file.cpp",
"native-src/virtual_drive/register_sync_root/register_sync_root.cpp",
"native-src/virtual_drive/register_sync_root.cpp",
"native-src/virtual_drive/set_pin_state.cpp",
"native-src/virtual_drive/unregister_sync_root_wrapper.cpp",
"native-src/virtual_drive/unregister_sync_root.cpp",
"native-src/virtual_drive/update_placeholder.cpp",
"native-src/virtual_drive/update_sync_status/update_sync_status_wrapper.cpp"
"native-src/virtual_drive/update_sync_status.cpp"
],
"include_dirs": [
"include",
Expand All @@ -44,10 +44,6 @@
"include/sync_root_interface",
"include/sync_root_interface/callbacks",
"include/virtual_drive",
"include/virtual_drive/get_placeholder_state",
"include/virtual_drive/get_registered_sync_roots",
"include/virtual_drive/register_sync_root",
"include/virtual_drive/update_sync_status",
"include/virtual_drive/watcher"
],
"libraries": [
Expand Down
Binary file modified packages/addon/dist/addon.node
Binary file not shown.
5 changes: 0 additions & 5 deletions packages/addon/include/virtual_drive/connect_sync_root.h

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions packages/addon/include/virtual_drive/dehydrate_file.h

This file was deleted.

5 changes: 0 additions & 5 deletions packages/addon/include/virtual_drive/disconnect_sync_root.h

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions packages/addon/include/virtual_drive/hydrate_file.h

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 13 additions & 0 deletions packages/addon/include/virtual_drive/virtual_drive.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,18 @@

#include <node_api.h>

napi_value connect_sync_root_impl(napi_env env, napi_callback_info args);
napi_value convert_to_placeholder_wrapper(napi_env env, napi_callback_info args);
napi_value create_file_placeholder_wrapper(napi_env env, napi_callback_info args);
napi_value create_folder_placeholder_wrapper(napi_env env, napi_callback_info args);
napi_value dehydrate_file_wrapper(napi_env env, napi_callback_info info);
napi_value disconnect_sync_root_wrapper(napi_env env, napi_callback_info args);
napi_value get_placeholder_state_wrapper(napi_env env, napi_callback_info info);
napi_value get_registered_sync_roots_wrapper(napi_env env, napi_callback_info args);
napi_value hydrate_file_wrapper(napi_env env, napi_callback_info args);
napi_value register_sync_root_wrapper(napi_env env, napi_callback_info args);
napi_value set_pin_state_wrapper(napi_env env, napi_callback_info info);
napi_value unregister_sync_root_wrapper(napi_env env, napi_callback_info args);
napi_value update_placeholder_wrapper(napi_env env, napi_callback_info info);
napi_value update_sync_status_wrapper(napi_env info, napi_callback_info args);
void convert_to_placeholder(const std::wstring& path, const std::wstring& placeholderId);
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include <Placeholders.h>
#include <Utilities.h>
#include <check_hresult.h>
#include <convert_to_placeholder.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <stdafx.h>
#include <virtual_drive.h>
#include <winbase.h>
#include <windows.h>
#include <winrt/base.h>
Expand Down
12 changes: 0 additions & 12 deletions packages/addon/native-src/virtual_drive/Wrappers.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
#include <NAPI_SAFE_WRAP.h>
#include <connect_sync_root.h>
#include <convert_to_placeholder.h>
#include <create_file_placeholder.h>
#include <create_folder_placeholder.h>
#include <dehydrate_file.h>
#include <disconnect_sync_root.h>
#include <get_placeholder_state_wrapper.h>
#include <get_registered_sync_roots_wrapper.h>
#include <hydrate_file.h>
#include <internal.h>
#include <register_sync_root.h>
#include <unregister_sync_root_wrapper.h>
#include <update_sync_status_wrapper.h>
#include <virtual_drive.h>

napi_value CreateFilePlaceholderWrapper(napi_env env, napi_callback_info args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include <Windows.h>
#include <async_wrapper.h>
#include <check_hresult.h>
#include <convert_to_placeholder.h>
#include <napi_extract_args.h>
#include <virtual_drive.h>

#include <filesystem>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include <Windows.h>
#include <async_wrapper.h>
#include <check_hresult.h>
#include <convert_to_placeholder.h>
#include <napi_extract_args.h>
#include <virtual_drive.h>

#include <filesystem>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <Windows.h>
#include <async_wrapper.h>
#include <napi_extract_args.h>
#include <register_sync_root.h>
#include <stdafx.h>

#include <filesystem>
Expand Down
1 change: 1 addition & 0 deletions packages/addon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"dist"
],
"scripts": {
"========== Build ==========": "",
"compile": "node gyp.config.js && node-gyp clean && node-gyp configure build",
"refresh": "npm pack && cd ../.. && npm update @packages/addon",
"build": "npm run compile && npm run refresh"
Expand Down
Binary file modified packages/addon/packages-addon-1.0.0.tgz
Binary file not shown.
1 change: 1 addition & 0 deletions packages/addon/sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sonar.projectKey=internxt_node-win
sonar.organization=internxt
sonar.cfamily.compile-commands=build_wrapper_output_directory/compile_commands.json
Binary file not shown.
5 changes: 4 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
"build"
],
"scripts": {
"build": "rimraf build && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
"start": "nodemon",
"init:dev": "npm install && node node_modules/electron/install.js",
"========== Build ==========": "",
"compile": "rimraf build && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
"refresh": "npm pack && cd ../.. && npm update @internxt/drive-desktop-core",
"build": "npm run compile && npm run refresh",
"========== Code style ==========": "",
"lint": "eslint . --ext .ts,.tsx",
"lint:fix": "npm run lint -- --fix",
Expand Down
22 changes: 12 additions & 10 deletions src/infra/inxt-js/file-uploader/upload-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function uploadFile({ ctx, fn, readable, size, path }: Props) {
const state = fn(ctx.bucket, {
source: readable,
fileSize: size,
progressCallback: (progress) => void progressCallback(progress),
finishedCallback: (error, contentsId) => {
readable.close();

Expand All @@ -35,18 +36,19 @@ export function uploadFile({ ctx, fn, readable, size, path }: Props) {
processError({ path, error });
return resolve();
},
progressCallback: async (progress) => {
const { data: stats } = await fileSystem.stat({ absolutePath: path });
});

if (stats && stats.size !== size) {
logger.debug({ msg: 'Upload file aborted on change size', path, oldSize: size, newSize: stats.size });
stopUpload(state);
return resolve();
}
async function progressCallback(progress: number) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just because a sonar error, since progressCalback accepts a sync function and we were sending an async function.

const { data: stats } = await fileSystem.stat({ absolutePath: path });

LocalSync.SyncState.addItem({ action: 'UPLOADING', path, progress });
},
});
if (stats && stats.size !== size) {
logger.debug({ msg: 'Upload file aborted on change size', path, oldSize: size, newSize: stats.size });
stopUpload(state);
return resolve();
}

LocalSync.SyncState.addItem({ action: 'UPLOADING', path, progress });
}

ctx.abortController.signal.addEventListener('abort', () => {
logger.debug({ msg: 'Aborting upload', path });
Expand Down
Loading