repo_name
stringlengths
1
62
dataset
stringclasses
1 value
lang
stringclasses
11 values
pr_id
int64
1
20.1k
owner
stringlengths
2
34
reviewer
stringlengths
2
39
diff_hunk
stringlengths
15
262k
code_review_comment
stringlengths
1
99.6k
v-analyzer
github_2023
others
74
v-analyzer
spytheman
@@ -18,7 +18,6 @@ const PREC = { or: 1, resolve: 1, composite_literal: -1, - empty_array: -2, strictly_expression_list: -3,
should not removing ` empty_array: -2,`, make `strictly_expression_list` be -2 now?
v-analyzer
github_2023
others
74
v-analyzer
spytheman
@@ -116,7 +116,7 @@ mut: Interface with field with default type and attribute ================================================================================ interface Foo { - name string [json: 'Name'] = '' + name string = '' [json: 'Name']
```suggestion name string = '' @[json: 'Name'] ```
v-analyzer
github_2023
others
74
v-analyzer
spytheman
@@ -447,8 +447,8 @@ Simple struct with fields with attributes and default values ================================================================================ struct Foo { name string [attr] - age int [attr] = 10 - other f32 [attr; omitempty] = 3.14
these are valid for the old attributes (before `@[attr]`)
v-analyzer
github_2023
others
73
v-analyzer
spytheman
@@ -18,8 +19,8 @@ jobs: - os: windows-latest target: windows-x86_64 bin_ext: .exe - cc: msvc - - os: ubuntu-20.04 + cc: gcc
why use gcc on windows, instead of msvc?
v-analyzer
github_2023
others
65
v-analyzer
spytheman
@@ -0,0 +1,1269 @@ +/**
What is the difference between a .cjs and a .js file in this context?
v-analyzer
github_2023
others
47
v-analyzer
spytheman
@@ -34,7 +34,7 @@ pub const ( vroot_is_deprecated_message = '@VROOT is deprecated, use @VMODROOT or @VEXEROOT instead' ) -[heap; minify] +@[heap; minify]
afaik stuff under `tests/testdata/` should not be formatted for now, since it is used by `v-analyzer` itself, while it has no support yet for the @[attribute] syntax.
v-analyzer
github_2023
others
47
v-analyzer
spytheman
@@ -57,7 +57,7 @@ mut: // runes returns an array of all the utf runes in the string `s` // which is useful if you want random access to them -[direct_array_access] +@[direct_array_access]
same; do not format the files under tests/testdata/ for now
tchMaterial-parser
github_2023
others
16
happycola233
wuziqian211
@@ -108,38 +147,44 @@ def download_file(url: str, save_path: str) -> None: # 下载文件 download_states.append(current_state) try: + # 确保目标目录存在 + os.makedirs(os.path.dirname(save_path), exist_ok=True) + with open(save_path, "wb") as file: - for chunk in response.iter_cont...
此处建议还是恢复到原来的显示对话框,因为我们最终编译的程序不会显示命令行窗口,`print` 的内容并不会被显示😂
tchMaterial-parser
github_2023
others
2
happycola233
ourines
@@ -8,7 +8,7 @@ 电子课本预览页面的网址格式如 <https://basic.smartedu.cn/tchMaterial/detail?contentType=assets_document&contentId=b8e9a3fe-dae7-49c0-86cb-d146f883fd8e&catalogType=tchMaterial&subCatalog=tchMaterial>。 -**本工具暂时仅支持 Windows 操作系统。** +本工具支持 Windows、Linux 等操作系统。
为啥要加个“等”?
nix-flatpak
github_2023
others
127
gmodena
gmodena
@@ -61,6 +61,37 @@ let updateOptions = _: { options = { + restartDelay = mkOption {
Why do you declare these options under `update`? Regular activation could benefit from retry-on-error too IMHO. How about we move this retry-on-error logic into a dedicated attrset? E.g. `services.flatpak.onServiceFailure = { restartDelay = "60s", ... }` I'm bad at naming things; let's bikeshed on...
nix-flatpak
github_2023
others
35
gmodena
gmodena
@@ -64,7 +64,7 @@ Using flake, installing `nix-flatpak` as a NixOs module would look something lik ``` Depending on how config and inputs are derived `homeManagerModules` import can be flaky. Here's an example of how `homeManagerModules` is imported on my nixos systems config in [modules/home-manager/desktop/nixos/...
In this case I'd rather keep pointing to the specific commit id. The purpose is to avoid changes to main (e.g. refactoring my config) would break the example. FYI: in the future I plan to avoid linking to my config (it's a bit messy), and add examples to `testing-base`.
nix-flatpak
github_2023
others
23
gmodena
gmodena
@@ -43,7 +43,7 @@ in }; home.activation = { - start-service = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + flatpak-managed-install = lib.hm.dag.entryAfter [ "reloadSystemd" ] ''
Already left a comment in thread. Great catch!
nix-flatpak
github_2023
others
23
gmodena
gmodena
@@ -1,20 +1,28 @@ { cfg, pkgs, lib, installation ? "system", ... }: let + gcroots =
Could you maybe add a comment here wrt the risk of stateFile not getting GCed? Not a concern for now IMHO (see comments in thread), but I'd like to be reminded of this..
nix-flatpak
github_2023
others
10
gmodena
gmodena
@@ -1,13 +1,20 @@ -{ config, lib, pkgs, osConfig, ... }: +{ config, lib, pkgs, ... }@args: let cfg = config.services.flatpak; installation = "user"; in { - options.services.flatpak = import ./options.nix { inherit cfg lib pkgs; }; + options.services.flatpak = (import ./options.nix { inherit cfg lib pkgs; }...
Nice. I wonder if we could move this block to `options.nix`, but that's not a blocker for merging. I think the `or false` clause can be omitted here? `osConfig.services.flatpak.enable` is declared via a `mkEnableOption` https://github.com/NixOS/nixpkgs/blob/70ccb0dec2983e576833de94fe35081dd5d60b5b/nixos/modules/se...
sessionic
github_2023
others
103
navorite
navorite
@@ -378,5 +378,21 @@ "shortcutDeleteSelected":{ "message": "Delete selected session", "description": "The label for deleting selected session keyboard shortcut" + }, + "aboutTranslationsLabel":{ + "message": "Translations", + "description": "The label for Translations in About page" + }, + "about...
```suggestion ``` Remove all of this, it was already added.
sessionic
github_2023
others
116
navorite
navorite
@@ -119,8 +119,8 @@ <div class="session-card" use:tooltip={{ - title: `${$session?.windows?.length} Window${ - $session?.windows?.length > 0 ? 's' : '' + title: `${$session?.windows?.length} ${ + $session?.windows?.length > 1 ? i18n.getMessage('WindowsTitle'), : i18n.g...
```suggestion i18n.getMessage($session?.windows?.length > 1 ? 'labelWindows' : 'labelWindow') ```
sessionic
github_2023
others
116
navorite
navorite
@@ -131,8 +131,8 @@ <div class="session-card" use:tooltip={{ - title: `${$session?.tabsNumber} Tab${ - $session?.tabsNumber > 0 ? 's' : '' + title: `${$session?.tabsNumber} ${ + $session?.tabsNumber > 1 ? i18n.getMessage('TabsTitle'), : i18n.getMessage('TabTitle')
```suggestion i18n.getMessage($session?.tabsNumber > 1 ? 'labelTabs' : 'labelTab') ```
sessionic
github_2023
others
116
navorite
navorite
@@ -88,7 +90,7 @@ type="text" minlength="1" maxlength="15" - placeholder="e.g. Personal" + placeholder={i18n.getMessage('NewTagInputPlaceholder')}
```suggestion placeholder={i18n.getMessage('tagPlaceholder')} ```
sessionic
github_2023
others
116
navorite
navorite
@@ -31,7 +31,7 @@ <Section title={i18n.getMessage('settingsAutosaveHeading')}> <Switch title={i18n.getMessage('settingsAutosave')} - description="Greatly reduce memory usage by not loading tab until selected" + description={i18n.getMessage('settingsAutosaveDescription')}
```suggestion ``` Oops, seems like I forgot to remove this description while adding it to settings. This has nothing to do with autosave.
sessionic
github_2023
others
104
navorite
navorite
@@ -67,6 +67,10 @@ You can contribute to the localization of the extension at [Weblate](https://hos <img src="https://hosted.weblate.org/widgets/sessionic/-/multi-auto.svg" alt="Translation status"/> </a> +## Common Questions and Answers + +You can read the project's Common Questions and Answers [here](https:...
```suggestion You can read the extension's Common Questions and Answers [here](https://github.com/navorite/sessionic/discussions/69). ```
sessionic
github_2023
others
64
navorite
navorite
@@ -24,7 +24,7 @@ body: label: Alternatives considered description: "Please provide a clear and concise description of any alternative solutions or features you've considered."
Maybe change it so that it is more concise ```suggestion description: "Please provide any alternative solutions or features you've considered." ```
chatgpt-demo
github_2023
typescript
346
anse-app
ddiu8081
@@ -20,7 +21,7 @@ export const post: APIRoute = async(context) => { }, }), { status: 400 }) } - if (sitePassword && sitePassword !== pass) { + if (sitePassword && (sitePassword !== pass || !passList.includes(pass))) {
wrong logic, should use `sitePassword !== pass && !passList.includes(pass))` or I prefer `!(sitePassword === pass || passList.includes(pass))`
chatgpt-demo
github_2023
others
256
anse-app
ddiu8081
@@ -10,10 +10,23 @@ ></path></svg > </button> - +<button id="backbottom_btn" class="gpt-back-bottom-btn"> + <svg + xmlns="http://www.w3.org/2000/svg" + width="1.2em" + height="1.2em" + viewBox="0 0 32 32" + ><path + fill="currentColor" + d="M16 4L6 14l1.41 1.41L15 7.83V28h2V7.83l7.59 ...
I think the button should be hidden when the page scrolls to the bottom.
chatgpt-demo
github_2023
others
256
anse-app
yzh990918
@@ -22,7 +35,11 @@ backtop_btn.style.display = "none"; } }); - + backbottom_btn.onclick = () => { + const scrollHeight = document.documentElement.scrollHeight + console.log(scrollHeight);
debug code should be removed.
chatgpt-demo
github_2023
typescript
199
anse-app
yzh990918
@@ -1,25 +1,34 @@ import type { ChatMessage } from '@/types' -import { createSignal, Index, Show } from 'solid-js' +import { createSignal, Index, Show, onMount } from 'solid-js' import IconClear from './icons/Clear' import MessageItem from './MessageItem' import SystemRoleSettings from './SystemRoleSettings' impor...
I think our local api-key should be encrypted.
chatgpt-demo
github_2023
others
188
anse-app
ddiu8081
@@ -32,8 +32,14 @@ </style> <script> - const darkSchema = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches - document.documentElement.classList.toggle('dark', darkSchema) + const initTheme = () => { + const darkSchema = window.matchMedia && window.matchMedia('(prefers-color...
1. I think it would potentially set the className twice if `localStorage.theme === 'dark'`. Try to set it once time. 2. If the user's mediaSchema is `dark` but manually set light theme in localStorage, it will stay in the dark. It may be necessary to add `else` condition.
chatgpt-demo
github_2023
typescript
107
anse-app
cyio
@@ -3,6 +3,7 @@ import { createSignal, Index, Show } from 'solid-js' import IconClear from './icons/Clear' import MessageItem from './MessageItem' import SystemRoleSettings from './SystemRoleSettings' +import _ from 'lodash'
改成按需引入好些
chatgpt-demo
github_2023
typescript
126
anse-app
ddiu8081
@@ -1,26 +1,33 @@ +import { sha256 } from "js-sha256";
Do not change the code format, please keep **single quotes** and **no semicolons**.
chatgpt-demo
github_2023
typescript
126
anse-app
ddiu8081
@@ -1,26 +1,33 @@ +import { sha256 } from "js-sha256"; + + interface AuthPayload { - t: number - m: string + t: number; + m: string; } async function digestMessage(message: string) { - const msgUint8 = new TextEncoder().encode(message); - const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8); - ...
Before solving the issue #117, it is necessary to comment out timestamp verification.
anse
github_2023
typescript
115
anse-app
ddiu8081
@@ -0,0 +1,14 @@ +export interface GoogleFetchPayload { + apiKey: string + body: Record<string, any> +} + +export const fetchChatCompletion = async(payload: GoogleFetchPayload) => { + const { apiKey, body } = payload || {} + const initOptions = { + headers: { 'Content-Type': 'application/json' }, + ...
I think you might want to use `models/gemini-pro` instead of `models/text-bison-001`? See https://ai.google.dev/models and curl: ``` curl https://generativelanguage.googleapis.com/v1/models/gemini-pro:generateContent?key=$API_KEY \ -H 'Content-Type: application/json' \ -X POST \ -d '{ "contents":[...
anse
github_2023
others
79
anse-app
yzh990918
@@ -39,7 +33,6 @@ const { title } = Astro.props; (function() { const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches const setting = localStorage.getItem('theme') || 'auto' - if (setting === 'dark' || (prefersDark && setting !== 'light')) - document.documentElemen...
This formatting code may need to be removed.
anse
github_2023
others
4
anse-app
Sysamin478
@@ -0,0 +1,71 @@ +--- +import Layout from '../layouts/Layout.astro' +--- + +<Layout title="Password Protection">
Protect
anse
github_2023
others
4
anse-app
Sysamin478
@@ -21,3 +21,23 @@ import BuildStores from '@/components/client-only/BuildStores' <ModalsLayer client:only /> <BuildStores client:only /> </Layout> + + +<script> + async function checkCurrentAuth() { + const password = localStorage.getItem('pass') + const response = await fetch('/api/auth', { + metho...
Protect
anse
github_2023
others
4
anse-app
Sysamin478
@@ -0,0 +1,71 @@ +--- +import Layout from '../layouts/Layout.astro' +--- + +<Layout title="Password Protection"> + <main class="h-screen col-fcc"> + <div class="op-30">Please input password</div> + <div id="input_container" class="flex mt-4"> + <input id="password_input" type="password" class="gpt-password-...
Protect
cargo-packager
github_2023
others
289
crabnebula-dev
lucasfernog-crabnebula
@@ -72,6 +72,13 @@ pub(crate) fn package(ctx: &Context) -> crate::Result<Vec<PathBuf>> { tracing::debug!("Copying resources"); config.copy_resources(&resources_dir)?; + tracing::debug!("Copying embedded.provisionprofile"); + #[cfg(target_os = "macos")]
we can do this on non-macOS platforms too
cargo-packager
github_2023
others
289
crabnebula-dev
lucasfernog-crabnebula
@@ -697,7 +697,7 @@ pub struct MacOsConfig { /// /// - arranging for the compiled binary to link against those frameworks (e.g. by emitting lines like `cargo:rustc-link-lib=framework=SDL2` from your `build.rs` script) /// - /// - embedding the correct rpath in your binary (e.g. by running `install_nam...
this should indeed refer to rpath, it's not a typo :)
cargo-packager
github_2023
others
271
crabnebula-dev
amr-crabnebula
@@ -52,22 +52,15 @@ pub fn current_format() -> crate::Result<PackageFormat> { // maybe having a special crate for the Config struct, // that both packager and resource-resolver could be a // better alternative - if cfg!(CARGO_PACKAGER_FORMAT = "app") { - Ok(PackageFormat::App) - } else if cf...
yeah I did remove the whole build script
cargo-packager
github_2023
others
254
crabnebula-dev
amr-crabnebula
@@ -288,6 +299,49 @@ impl DebianConfig { } } + +/// A list of dependencies specified as either a list of Strings +/// or as a path to a file that lists the dependencies, one per line. +#[derive(Debug, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(untagge...
This seems a bit unconventional, how about adding support for specifying dependencies as environment variables, `CARGO_PACKAGER_DEB_DEPS="dep1,dep2,dep3"` and `CARGO_PACKAGER_PACMAN_DEPS="dep1,dep2,dep3"`?
cargo-packager
github_2023
others
256
crabnebula-dev
amr-crabnebula
@@ -133,6 +141,11 @@ fn generate_desktop_file(config: &Config, data_dir: &Path) -> crate::Result<()> } if let Some(protocols) = &config.deep_link_protocols { + if !protocols.is_empty() { + // Use "%U" even if file associations were already provided, + // as it can also accommoda...
can't we use `%U` for both? will that make file associations be passed as `file://path/to/file`? because I know on macOS you can either handle file associations or handle urls and if you chose urls, file associations will be passed as `file://<path>` URL, hopefully this is the case on Linux too?
cargo-packager
github_2023
others
256
crabnebula-dev
amr-crabnebula
@@ -203,6 +203,21 @@ pub struct DebianConfig { /// MimeType={{mime_type}} /// {{/if}} /// ``` + /// + /// The `exec_arg` will be set to:
```suggestion /// The `{{exec_arg}}` will be set to: ```
cargo-packager
github_2023
others
256
crabnebula-dev
amr-crabnebula
@@ -203,6 +203,21 @@ pub struct DebianConfig { /// MimeType={{mime_type}} /// {{/if}} /// ``` + /// + /// The `exec_arg` will be set to: + /// * "%U", if at least one [Config::deep_link_protocols] was specified. + /// * This means that your application can accommodate being invoked with mul...
I would switch the order of these, i.e explain `%F` first and then `%U` and should also mention that `%U` will make file paths into file urls
cargo-packager
github_2023
others
246
crabnebula-dev
amr-crabnebula
@@ -158,6 +158,7 @@ pub(crate) fn package(ctx: &Context) -> crate::Result<Vec<PathBuf>> { m.notarization_credentials .clone() .ok_or_else(|| crate::Error::MissingNotarizeAuthVars) + .or_else(|_| codesign::notarize_auth())
instead of duplicating the call here we can just make the option fall through by using `.and_then` instead of `.map`, ```rs match config .macos() .and_then(|m| m.notarization_credentials.clone()) .unwrap_or_else(codesign::notarize_auth) ```
cargo-packager
github_2023
others
246
crabnebula-dev
amr-crabnebula
@@ -154,12 +154,9 @@ pub(crate) fn package(ctx: &Context) -> crate::Result<Vec<PathBuf>> { // notarization is required for distribution match config .macos() - .map(|m| { - m.notarization_credentials - .clone() - .ok_or_else(...
No need to add an error variant here, since if `notarization_credentials` is not set, it will fallback to `codesign::notarize_auth` and that one returns `crate::Error::MissingNotarizeAuthVars` if the needed environment variables are not set. ```suggestion .and_then(|m| m.notarization_credentials.clone())...
cargo-packager
github_2023
others
196
crabnebula-dev
amr-crabnebula
@@ -285,6 +285,9 @@ where if !cli.quite { init_tracing_subscriber(cli.verbose); + if std::env::var_os("CARGO_TERM_COLOR").is_none() { + std::env::set_var("CARGO_TERM_COLOR", "always"); + }
shouldn't this be set by the user invoking the packager? or at least kept as `auto` so it automatically detects whether the current terminal has color support or not?
cargo-packager
github_2023
others
196
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,5 @@ +--- +"cargo-packager": patch +--- + +Always show command output and enhance formatting.
```suggestion --- "cargo-packager": patch "@crabnebula/packager": patch --- Show shell commands output (ex: `beforePackageCommand`) if it fails. ```
cargo-packager
github_2023
others
106
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,77 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
this is now a replica of `updater/src/starting_binary.rs`, we should pull it into a common crate so we don't have duplicate code on our hand. Probably `cargo-packager-utils`
cargo-packager
github_2023
others
106
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,192 @@ +use error::Result; +use std::{env, path::PathBuf}; + +mod error; +mod starting_binary; + +pub use error::Error; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum PackageFormat { + /// When no format is used (`cargo run`) + None, + /// The macOS application bundle (.app). + App, + ///...
ditto
cargo-packager
github_2023
others
106
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,8 @@ +# cargo-packager-resource-resolver + +Most of the code in this crate comes from [tauri-utils](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-utils).
We should remove this and document what this crate does and how to use it. We should also mention it in `cargo-packager` rust docs and README.md
cargo-packager
github_2023
others
106
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,192 @@ +use error::Result; +use std::{env, path::PathBuf}; + +mod error; +mod starting_binary; + +pub use error::Error; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum PackageFormat { + /// When no format is used (`cargo run`) + None, + /// The macOS application bundle (.app). + App, + ///...
```suggestion pub fn resources_dir(package_format: PackageFormat) -> Result<PathBuf> { ```
cargo-packager
github_2023
others
106
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,192 @@ +use error::Result; +use std::{env, path::PathBuf}; + +mod error; +mod starting_binary; + +pub use error::Error; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum PackageFormat { + /// When no format is used (`cargo run`) + None, + /// The macOS application bundle (.app). + App, + ///...
let's rename this ```suggestion pub fn resolve_resource<P: AsRef<Path>>(package_format: PackageFormat, path: P) -> Result<PathBuf> { ```
cargo-packager
github_2023
others
106
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,192 @@ +use error::Result;
Missing documentation for the crate
cargo-packager
github_2023
others
106
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,192 @@ +use error::Result; +use std::{env, path::PathBuf}; + +mod error; +mod starting_binary; + +pub use error::Error; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum PackageFormat { + /// When no format is used (`cargo run`) + None, + /// The macOS application bundle (.app). + App, + ///...
`CARGO_MANIFEST_DIR` is a build time only environment variable. We should ignore this format and return the path as is.
cargo-packager
github_2023
others
106
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,192 @@ +use error::Result; +use std::{env, path::PathBuf}; + +mod error; +mod starting_binary; + +pub use error::Error; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum PackageFormat { + /// When no format is used (`cargo run`) + None, + /// The macOS application bundle (.app). + App, + ///...
This should be the same as `Nsis` format.
cargo-packager
github_2023
others
106
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,192 @@ +use error::Result; +use std::{env, path::PathBuf}; + +mod error; +mod starting_binary; + +pub use error::Error; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum PackageFormat { + /// When no format is used (`cargo run`) + None, + /// The macOS application bundle (.app). + App, + ///...
@lucasfernog-crabnebula what do you think about this?
cargo-packager
github_2023
others
106
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,13 @@ +use std::env; + +fn main() { + track_var("CARGO_PACKAGER_FORMAT"); + track_var("CARGO_PACKAGER_MAIN_BINARY_NAME"); +} + +fn track_var(key: &str) { + println!("cargo:rerun-if-env-changed={}", key); + if let Ok(var) = env::var(key) { + println!("cargo:rustc-cfg={}=\"{}\"", key, var); ...
let's simplify this since we only need to track `CARGO_PACKAGER_FORMAT`, also this tracking should be done only if `auto-detect-format` feature is active.
cargo-packager
github_2023
others
106
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,17 @@ +[package] +name = "cargo-packager-resource-resolver" +description = "Cargo packager resource resolver" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +readme = "README.md" + +[dependencies] +thiserror = "1" +ctor = "0.2" + ...
```suggestion auto-detect-format = [ ] ```
cargo-packager
github_2023
others
106
crabnebula-dev
amr-crabnebula
@@ -182,6 +182,10 @@ fn run_before_each_packaging_command_hook( let output = cmd .env("CARGO_PACKAGER_FORMATS", formats_comma_separated) .env("CARGO_PACKAGER_FORMAT", format) + .env( + "CARGO_PACKAGER_MAIN_BINARY_NAME", + config.main_binary_nam...
Let's remove this for now since it doesn't have a usecase atm.
cargo-packager
github_2023
others
106
crabnebula-dev
lucasfernog-crabnebula
@@ -0,0 +1,24 @@ +// Copyright 2023-2023 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +/// The result type of `resource-resolver`. +pub type Result<T> = std::result::Result<T, Error>; + +/// The error type of `resource-resolver`. +#[derive(Debug, thiserror::Error)] +#[non_e...
```suggestion /// Environment error ```
cargo-packager
github_2023
others
106
crabnebula-dev
lucasfernog-crabnebula
@@ -0,0 +1,24 @@ +// Copyright 2023-2023 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +/// The result type of `resource-resolver`. +pub type Result<T> = std::result::Result<T, Error>; + +/// The error type of `resource-resolver`. +#[derive(Debug, thiserror::Error)] +#[non_e...
```suggestion /// Environment variable error ```
cargo-packager
github_2023
others
106
crabnebula-dev
lucasfernog-crabnebula
@@ -0,0 +1,149 @@ +// Copyright 2023-2023 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +//! # cargo-packager-updater +//! +//! Resource resolver for apps that was packaged by [`cargo-packager`](https://docs.rs/cargo-packager).
```suggestion //! Resource resolver for apps that were packaged by [`cargo-packager`](https://docs.rs/cargo-packager). ```
cargo-packager
github_2023
others
106
crabnebula-dev
lucasfernog-crabnebula
@@ -0,0 +1,149 @@ +// Copyright 2023-2023 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +//! # cargo-packager-updater +//! +//! Resource resolver for apps that was packaged by [`cargo-packager`](https://docs.rs/cargo-packager). +//! +//! It resolves the root path which conta...
we should add an example here of the detect feature
cargo-packager
github_2023
others
106
crabnebula-dev
lucasfernog-crabnebula
@@ -0,0 +1,149 @@ +// Copyright 2023-2023 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +//! # cargo-packager-updater +//! +//! Resource resolver for apps that was packaged by [`cargo-packager`](https://docs.rs/cargo-packager). +//! +//! It resolves the root path which conta...
```suggestion /// Retrieve the resource path of your app, packaged with cargo packager. ```
cargo-packager
github_2023
others
106
crabnebula-dev
lucasfernog-crabnebula
@@ -0,0 +1,149 @@ +// Copyright 2023-2023 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +//! # cargo-packager-updater +//! +//! Resource resolver for apps that was packaged by [`cargo-packager`](https://docs.rs/cargo-packager). +//! +//! It resolves the root path which conta...
```suggestion /// Retrieve the resource path of your app, packaged with cargo packager. ```
cargo-packager
github_2023
others
106
crabnebula-dev
lucasfernog-crabnebula
@@ -0,0 +1,149 @@ +// Copyright 2023-2023 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +//! # cargo-packager-updater +//! +//! Resource resolver for apps that was packaged by [`cargo-packager`](https://docs.rs/cargo-packager). +//! +//! It resolves the root path which conta...
```suggestion /// and when the `before-each-package-command` Cargo feature is enabled. ```
cargo-packager
github_2023
others
106
crabnebula-dev
lucasfernog-crabnebula
@@ -0,0 +1,16 @@ +[package] +name = "cargo-packager-resource-resolver" +description = "Cargo packager resource resolver" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true
```suggestion repository.workspace = true [package.metadata.docs.rs] features = [ "auto-detect-format " ] ```
cargo-packager
github_2023
others
106
crabnebula-dev
lucasfernog-crabnebula
@@ -0,0 +1,149 @@ +// Copyright 2023-2023 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +//! # cargo-packager-updater +//! +//! Resource resolver for apps that was packaged by [`cargo-packager`](https://docs.rs/cargo-packager). +//! +//! It resolves the root path which conta...
```suggestion Error::Env("PackageFormat::None was use, but CARGO_MANIFEST_DIR environnement variable was not defined".to_string()) ```
cargo-packager
github_2023
others
106
crabnebula-dev
lucasfernog-crabnebula
@@ -0,0 +1,149 @@ +// Copyright 2023-2023 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +//! # cargo-packager-updater +//! +//! Resource resolver for apps that was packaged by [`cargo-packager`](https://docs.rs/cargo-packager). +//! +//! It resolves the root path which conta...
```suggestion _ => Error::Var("Can't access CARGO_MANIFEST_DIR environnement variable".to_string(), e) ```
cargo-packager
github_2023
others
106
crabnebula-dev
lucasfernog-crabnebula
@@ -0,0 +1,149 @@ +// Copyright 2023-2023 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +//! # cargo-packager-updater +//! +//! Resource resolver for apps that was packaged by [`cargo-packager`](https://docs.rs/cargo-packager). +//! +//! It resolves the root path which conta...
this function name is kinda weird, in Tauri it appends the `path` to the resources path, but here it's more of a fallback for the None package format.. can't we force the user to provide that path via the None variant itself? like `PackageFormat::None { local_resources_path: &'static str }`
cargo-packager
github_2023
others
106
crabnebula-dev
lucasfernog-crabnebula
@@ -0,0 +1,149 @@ +// Copyright 2023-2023 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +//! # cargo-packager-updater +//! +//! Resource resolver for apps that was packaged by [`cargo-packager`](https://docs.rs/cargo-packager). +//! +//! It resolves the root path which conta...
tauri supports it: https://github.com/tauri-apps/tauri/blob/97e334129956159bbd60e1c531b6acd3bc6139a6/core/tauri-utils/src/platform.rs#L226
cargo-packager
github_2023
others
106
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,129 @@ +// Copyright 2023-2023 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +//! # cargo-packager-updater +//! +//! Resource resolver for apps that were packaged by [`cargo-packager`](https://docs.rs/cargo-packager). +//! +//! It resolves the root path which cont...
we should port the implementation for this from https://github.com/tauri-apps/tauri/blob/97e334129956159bbd60e1c531b6acd3bc6139a6/core/tauri-utils/src/platform.rs#L226
cargo-packager
github_2023
others
106
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,19 @@ +[package] +name = "cargo-packager-resource-resolver" +description = "Cargo packager resource resolver" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true + +[package.metadata.docs.rs] +features = [ "auto-detect-format " ]
```suggestion features = [ "auto-detect-format" ] ```
cargo-packager
github_2023
others
148
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,6 @@ +--- +"cargo-packager": minor +"@crabnebula/packager": minor +--- + +Added config feature to control excluded libs in build_appimage.sh
```suggestion Added config option to control excluded libs when packaging AppImage ```
cargo-packager
github_2023
others
148
crabnebula-dev
lucasfernog-crabnebula
@@ -267,6 +267,10 @@ pub struct AppImageConfig { /// you'd specify `gtk` as the key and its url as the value. #[serde(alias = "linuxdeploy-plugins", alias = "linuxdeploy_plugins")] pub linuxdeploy_plugins: Option<HashMap<String, String>>, + /// List of globs of libraries to exclude from the final APpI...
```suggestion /// List of globs of libraries to exclude from the final AppImage. ```
cargo-packager
github_2023
others
140
crabnebula-dev
amr-crabnebula
@@ -145,12 +146,64 @@ pub fn delete_keychain() { .output_ok(); } -#[derive(Debug)] +#[derive(Debug, PartialEq, Eq)] pub struct SignTarget { pub path: PathBuf, pub is_native_binary: bool, } +impl Ord for SignTarget { + fn cmp(&self, other: &Self) -> Ordering { + // This ordering imple...
Can't we just check the components count? if higher, path is longer, less, path is shorter, otherwise equal
cargo-packager
github_2023
others
143
crabnebula-dev
lucasfernog-crabnebula
@@ -0,0 +1,5 @@ +--- +"@crabnebula/updater": minor
```suggestion "@crabnebula/updater": patch ```
cargo-packager
github_2023
others
143
crabnebula-dev
lucasfernog-crabnebula
@@ -178,94 +179,196 @@ impl Update { } } +type TaskCallbackFunction<T> = Option<ThreadsafeFunction<T, ErrorStrategy::Fatal>>; + +pub struct DownloadTask { + update: cargo_packager_updater::Update, + on_chunk: TaskCallbackFunction<(u32, Option<u32>)>, + on_download_finished: TaskCallbackFunction<()>, +}...
could use a `#[derive(napi_derive::napi)] impl Task for T` instead of the `ts_return_type` hack but it's still not perfect for the JsArrayBuffer type, so doesn't matter
cargo-packager
github_2023
others
136
crabnebula-dev
naman-crabnebula
@@ -90,8 +90,15 @@ pub(crate) fn package(ctx: &Context) -> crate::Result<Vec<PathBuf>> { let mut buffer = [0; 4]; std::io::Read::read_exact(&mut open_file, &mut buffer)?; - const MACH_O_MAGIC_NUMBERS: [u32; 5] = - [0xfeedface, 0xfeedfacf, 0xcafebabe,...
Replace this with [u32; 7]
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -488,6 +509,84 @@ impl AppImageConfig { } } +/// The Linux pacman configuration. +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +#[non_exhaustive] +pub struct PacmanConfig { + ...
```suggestion ```
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -488,6 +509,84 @@ impl AppImageConfig { } } +/// The Linux pacman configuration. +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +#[non_exhaustive] +pub struct PacmanConfig { + ...
Should sidecars (external binaries) be included in this or rather what does this option do?
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -488,6 +509,84 @@ impl AppImageConfig { } } +/// The Linux pacman configuration. +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +#[non_exhaustive] +pub struct PacmanConfig { + ...
Can we give a bit of more information about each option and add some links to the official docs?
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,145 @@ +// Copyright 2024-2024 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use super::{ + deb::{copy_custom_files, generate_data, tar_and_gzip_dir}, + Context, +}; +use crate::{config::Config, util}; +use heck::AsKebabCase; +use sha2::{Digest, Sha512}; +u...
we shouldn't depend on `deb` config here, if a `files` option is needed, we should add it under `pacman` config
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,145 @@ +// Copyright 2024-2024 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use super::{ + deb::{copy_custom_files, generate_data, tar_and_gzip_dir}, + Context, +}; +use crate::{config::Config, util}; +use heck::AsKebabCase; +use sha2::{Digest, Sha512}; +u...
why do we need to make it kebab case? and also why do we add `-bin` suffix?
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,145 @@ +// Copyright 2024-2024 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use super::{ + deb::{copy_custom_files, generate_data, tar_and_gzip_dir}, + Context, +}; +use crate::{config::Config, util}; +use heck::AsKebabCase; +use sha2::{Digest, Sha512}; +u...
we should add an option to control this
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,145 @@ +// Copyright 2024-2024 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use super::{ + deb::{copy_custom_files, generate_data, tar_and_gzip_dir}, + Context, +}; +use crate::{config::Config, util}; +use heck::AsKebabCase; +use sha2::{Digest, Sha512}; +u...
do we need to set this?
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,145 @@ +// Copyright 2024-2024 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use super::{ + deb::{copy_custom_files, generate_data, tar_and_gzip_dir}, + Context, +}; +use crate::{config::Config, util}; +use heck::AsKebabCase; +use sha2::{Digest, Sha512}; +u...
do we need to join with a new line, shouldn't a space be enough?
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,145 @@ +// Copyright 2024-2024 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use super::{ + deb::{copy_custom_files, generate_data, tar_and_gzip_dir}, + Context, +}; +use crate::{config::Config, util}; +use heck::AsKebabCase; +use sha2::{Digest, Sha512}; +u...
ditto
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,145 @@ +// Copyright 2024-2024 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use super::{ + deb::{copy_custom_files, generate_data, tar_and_gzip_dir}, + Context, +}; +use crate::{config::Config, util}; +use heck::AsKebabCase; +use sha2::{Digest, Sha512}; +u...
ditto
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,145 @@ +// Copyright 2024-2024 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use super::{ + deb::{copy_custom_files, generate_data, tar_and_gzip_dir}, + Context, +}; +use crate::{config::Config, util}; +use heck::AsKebabCase; +use sha2::{Digest, Sha512}; +u...
ditto
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,145 @@ +// Copyright 2024-2024 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use super::{ + deb::{copy_custom_files, generate_data, tar_and_gzip_dir}, + Context, +}; +use crate::{config::Config, util}; +use heck::AsKebabCase; +use sha2::{Digest, Sha512}; +u...
do we need to set this if not provided by user?
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,145 @@ +// Copyright 2024-2024 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use super::{ + deb::{copy_custom_files, generate_data, tar_and_gzip_dir}, + Context, +}; +use crate::{config::Config, util}; +use heck::AsKebabCase; +use sha2::{Digest, Sha512}; +u...
instead of cloning the whole object, we can do ```suggestion let dependencies = config .pacman() .and_then(|d| d.depends.as_ref()) .cloned() .unwrap_or_default(); ``` I realize, this is a mistake I made in `deb/mod.rs` as well, so feel free to change that too.
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,145 @@ +// Copyright 2024-2024 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use super::{ + deb::{copy_custom_files, generate_data, tar_and_gzip_dir}, + Context, +}; +use crate::{config::Config, util}; +use heck::AsKebabCase; +use sha2::{Digest, Sha512}; +u...
ditto
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,145 @@ +// Copyright 2024-2024 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use super::{ + deb::{copy_custom_files, generate_data, tar_and_gzip_dir}, + Context, +}; +use crate::{config::Config, util}; +use heck::AsKebabCase; +use sha2::{Digest, Sha512}; +u...
ditto
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,145 @@ +// Copyright 2024-2024 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use super::{ + deb::{copy_custom_files, generate_data, tar_and_gzip_dir}, + Context, +}; +use crate::{config::Config, util}; +use heck::AsKebabCase; +use sha2::{Digest, Sha512}; +u...
ditto
cargo-packager
github_2023
others
137
crabnebula-dev
amr-crabnebula
@@ -0,0 +1,145 @@ +// Copyright 2024-2024 CrabNebula Ltd. +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use super::{ + deb::{copy_custom_files, generate_data, tar_and_gzip_dir}, + Context, +}; +use crate::{config::Config, util}; +use heck::AsKebabCase; +use sha2::{Digest, Sha512}; +u...
ditto
cargo-packager
github_2023
others
132
crabnebula-dev
amr-crabnebula
@@ -52,6 +52,77 @@ pub(crate) fn package(ctx: &Context) -> crate::Result<Vec<PathBuf>> { tracing::debug!("Copying frameworks"); let framework_paths = copy_frameworks_to_bundle(&contents_directory, config)?; + + // All dylib files and native executables should be signed manually + // It is highly disco...
Let's merge these into a single `warn!` call
cargo-packager
github_2023
others
132
crabnebula-dev
amr-crabnebula
@@ -52,6 +52,77 @@ pub(crate) fn package(ctx: &Context) -> crate::Result<Vec<PathBuf>> { tracing::debug!("Copying frameworks"); let framework_paths = copy_frameworks_to_bundle(&contents_directory, config)?; + + // All dylib files and native executables should be signed manually + // It is highly disco...
We can just use flatten, don't think we need log these errors, we can just skip them ```suggestion let files = files.flatten(); ```
cargo-packager
github_2023
others
132
crabnebula-dev
amr-crabnebula
@@ -52,6 +52,77 @@ pub(crate) fn package(ctx: &Context) -> crate::Result<Vec<PathBuf>> { tracing::debug!("Copying frameworks"); let framework_paths = copy_frameworks_to_bundle(&contents_directory, config)?; + + // All dylib files and native executables should be signed manually + // It is highly disco...
this is not needed, since `fs::metadata` can accept `PathBuf` just fine
cargo-packager
github_2023
others
132
crabnebula-dev
amr-crabnebula
@@ -52,6 +52,77 @@ pub(crate) fn package(ctx: &Context) -> crate::Result<Vec<PathBuf>> { tracing::debug!("Copying frameworks"); let framework_paths = copy_frameworks_to_bundle(&contents_directory, config)?; + + // All dylib files and native executables should be signed manually + // It is highly disco...
we should match here and append the error to the log message ```rs let metadata = match std::fs::metadata(file) { Ok(f) => f, Err(err) => { tracing::warn!("Failed to get metadata for {}: {err}, this file will not be scanned for Mach-O header!", file); continue; } }; ```
cargo-packager
github_2023
others
132
crabnebula-dev
amr-crabnebula
@@ -52,6 +52,77 @@ pub(crate) fn package(ctx: &Context) -> crate::Result<Vec<PathBuf>> { tracing::debug!("Copying frameworks"); let framework_paths = copy_frameworks_to_bundle(&contents_directory, config)?; + + // All dylib files and native executables should be signed manually + // It is highly disco...
same here
cargo-packager
github_2023
others
132
crabnebula-dev
amr-crabnebula
@@ -52,6 +52,77 @@ pub(crate) fn package(ctx: &Context) -> crate::Result<Vec<PathBuf>> { tracing::debug!("Copying frameworks"); let framework_paths = copy_frameworks_to_bundle(&contents_directory, config)?; + + // All dylib files and native executables should be signed manually + // It is highly disco...
let's use a const here ```suggestion const MACH_O_MAGIC_NUMBERS: [u32; 5] = [0xfeedface, 0xfeedfacf, 0xcafebabe, 0xcefaedfe, 0xcffaedfe]; ```