@hurshb50/setup-ubuntu 2.0.4 → 3.0.0

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.
package/README.md CHANGED
@@ -18,7 +18,7 @@ Vite+ defaults to pnpm, which can hold back freshly published releases. The setu
18
18
  Open a new terminal, then:
19
19
 
20
20
  - Log out and back in to use Docker without `sudo`.
21
- - Sign in to Zed, 1Password, and Chrome.
21
+ - Sign in to Zed, 1Password, and Brave.
22
22
  - Run `gh auth login` to authenticate the GitHub CLI.
23
23
  - Pick a wallpaper in HydraPaper.
24
24
  - Put personal shell config in `~/.custom.bashrc`, not `~/.bashrc`.
@@ -1,7 +1,3 @@
1
- [user]
2
- name = Hursh Patel
3
- email = hurshb50@gmail.com
4
-
5
1
  [core]
6
2
  editor = zed --wait
7
3
 
@@ -29,3 +25,13 @@
29
25
  [credential "https://github.com"]
30
26
  helper =
31
27
  helper = !/usr/bin/gh auth git-credential
28
+
29
+ [credential "https://gist.github.com"]
30
+ helper =
31
+ helper = !/usr/bin/gh auth git-credential
32
+
33
+ [includeIf "hasconfig:remote.*.url:https://github.com/rai-inst/**"]
34
+ path = ~/.config/git/work.gitconfig
35
+
36
+ [includeIf "hasconfig:remote.*.url:https://github.com/hurshb50/**"]
37
+ path = ~/.config/git/personal.gitconfig
@@ -0,0 +1,3 @@
1
+ [user]
2
+ name = Hursh Patel
3
+ email = hurshb50@gmail.com
@@ -0,0 +1,3 @@
1
+ [user]
2
+ name = Hursh Patel
3
+ email = hpatel@theaiinstitute.com
@@ -7,6 +7,7 @@
7
7
  "model": "deepseek-flash",
8
8
  "provider": "deepseek"
9
9
  },
10
+ "dock": "right",
10
11
  "enable_feedback": false,
11
12
  "notify_when_agent_waiting": "never",
12
13
  "sandbox_permissions": { "allow_unsandboxed": true, "allow_all_hosts": true, "allow_fs_write_all": true },
@@ -51,6 +52,7 @@
51
52
  }
52
53
  },
53
54
  "git_panel": {
55
+ "dock": "left",
54
56
  "tree_view": true
55
57
  },
56
58
  "gutter": {
@@ -73,6 +75,7 @@
73
75
  "project_panel": {
74
76
  "auto_fold_dirs": false,
75
77
  "bold_folder_labels": false,
78
+ "dock": "left",
76
79
  "folder_indicator": "icon",
77
80
  "git_status": false,
78
81
  "hide_gitignore": false,
@@ -11,7 +11,7 @@ import util from "util";
11
11
  import childProcess from "child_process";
12
12
  //#region package.json
13
13
  var name = "@hurshb50/setup-ubuntu";
14
- var version = "2.0.3";
14
+ var version = "2.0.5";
15
15
  //#endregion
16
16
  //#region source/modules/logger/logger.ts
17
17
  var Logger = class Logger {
@@ -367,28 +367,48 @@ var Browser = class {
367
367
  const task = new Task("Browser");
368
368
  context.logger.add(task);
369
369
  task.start();
370
- const dependencies = ["google-chrome-stable"];
371
- if (await context.dependencyManager.isInstalled(dependencies)) {
372
- task.finish();
373
- return;
370
+ const dependencies = ["brave-browser"];
371
+ const isInstalled = await context.dependencyManager.isInstalled(dependencies);
372
+ const keyringFilePath = path.join("/", "usr", "share", "keyrings", "brave-browser-archive-keyring.gpg");
373
+ const sourceFilePath = path.join("/", "etc", "apt", "sources.list.d", "brave-browser-release.sources");
374
+ const sourceFilePaths = [keyringFilePath, sourceFilePath];
375
+ const sourceFilesExist = (await Promise.all(sourceFilePaths.map(async (filePath) => {
376
+ const statistics = await fs.stat(filePath, { throwIfNoEntry: false });
377
+ return statistics !== void 0 && statistics.size > 0;
378
+ }))).every(Boolean);
379
+ if (!isInstalled || !sourceFilesExist) {
380
+ task.continue("Update package manager");
381
+ await context.dependencyManager.update(task);
382
+ const systemDependencies = ["curl", "unattended-upgrades"];
383
+ task.continue(`Installing dependencies: ${systemDependencies.join(", ")}`);
384
+ await context.dependencyManager.install(systemDependencies, task);
385
+ task.continue("Set up Brave sources");
386
+ const exec = util.promisify(childProcess.exec);
387
+ await exec(`sudo curl -fsSLo ${keyringFilePath} https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg`);
388
+ await exec(`sudo curl -fsSLo ${sourceFilePath} https://brave-browser-apt-release.s3.brave.com/brave-browser.sources`);
389
+ await exec(`sudo rm -f /etc/apt/sources.list.d/brave-browser-*.list`);
390
+ task.continue("Update package manager");
391
+ await context.dependencyManager.update(task);
392
+ if (!isInstalled) {
393
+ task.continue(`Installing dependencies: ${dependencies.join(", ")}`);
394
+ await context.dependencyManager.install(dependencies, task);
395
+ }
374
396
  }
375
- task.continue("Update package manager");
376
- await context.dependencyManager.update(task);
377
- const systemDependencies = ["gnupg"];
378
- task.continue(`Installing dependencies: ${systemDependencies.join(", ")}`);
379
- await context.dependencyManager.install(systemDependencies, task);
380
- const keyringFilePath = path.join("/", "usr", "share", "keyrings", "google-chrome.gpg");
381
- const sourceFilePath = path.join("/", "etc", "apt", "sources.list.d", "google-chrome.list");
382
- task.continue("Set up google chrome sources");
383
- const exec = util.promisify(childProcess.exec);
384
- await exec(`curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor --yes -o ${keyringFilePath}`);
385
- await exec(`echo 'deb [arch=amd64 signed-by=${keyringFilePath}] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee ${sourceFilePath} > /dev/null`);
386
- task.continue("Update package manager");
387
- await context.dependencyManager.update(task);
388
- task.continue(`Installing dependencies: ${dependencies.join(", ")}`);
389
- await context.dependencyManager.install(dependencies, task);
397
+ await this.configureAutomaticUpdates(context, task);
390
398
  task.finish();
391
399
  }
400
+ async configureAutomaticUpdates(context, task) {
401
+ const dependencies = ["unattended-upgrades"];
402
+ if (!await context.dependencyManager.isInstalled(dependencies)) {
403
+ task.continue("Update package manager");
404
+ await context.dependencyManager.update(task);
405
+ task.continue(`Installing dependencies: ${dependencies.join(", ")}`);
406
+ await context.dependencyManager.install(dependencies, task);
407
+ }
408
+ const configurationFilePath = path.join("/", "etc", "apt", "apt.conf.d", "51unattended-upgrades-brave");
409
+ task.continue("Configure automatic updates");
410
+ await util.promisify(childProcess.exec)(`printf '%s\\n' 'Unattended-Upgrade::Allowed-Origins {' ' "Brave Software:stable";' '};' | sudo tee ${configurationFilePath} > /dev/null`);
411
+ }
392
412
  };
393
413
  //#endregion
394
414
  //#region source/modules/clipboard/clipboard.ts
@@ -662,7 +682,28 @@ var VersionControlSystem = class {
662
682
  const sourceFilePath = path.join(context.directories.assets, ".gitconfig");
663
683
  const destinationFilePath = path.join(context.directories.home, ".gitconfig");
664
684
  task.continue("Copy configuration");
665
- await fs.copyFile(sourceFilePath, destinationFilePath);
685
+ const sourceConfiguration = await fs.readFile(sourceFilePath, "utf8");
686
+ let existingConfiguration = "";
687
+ try {
688
+ existingConfiguration = await fs.readFile(destinationFilePath, "utf8");
689
+ } catch (error) {
690
+ if (error.code !== "ENOENT") throw error;
691
+ }
692
+ const userConfigurations = [];
693
+ let currentSection = [];
694
+ let preserveCurrentSection = false;
695
+ for (const line of existingConfiguration.match(/[^\r\n]*(?:\r?\n|$)/g) ?? []) if (/^[ \t]*\[/.test(line)) {
696
+ if (preserveCurrentSection) userConfigurations.push(currentSection.join(""));
697
+ preserveCurrentSection = (line.match(/^[ \t]*\[([^\s\]]+)/)?.[1])?.toLowerCase() === "user";
698
+ currentSection = preserveCurrentSection ? [line] : [];
699
+ } else if (preserveCurrentSection) currentSection.push(line);
700
+ if (preserveCurrentSection) userConfigurations.push(currentSection.join(""));
701
+ const configuration = [...userConfigurations.map((value) => value.trim()), sourceConfiguration.trimEnd()].filter(Boolean).join("\n\n");
702
+ await fs.writeFile(destinationFilePath, `${configuration}\n`);
703
+ task.continue("Copy identity profiles");
704
+ const profilesDirectoryPath = path.join(context.directories.home, ".config", "git");
705
+ await fs.mkdir(profilesDirectoryPath, { recursive: true });
706
+ for (const fileName of ["work.gitconfig", "personal.gitconfig"]) await fs.copyFile(path.join(context.directories.assets, "git", fileName), path.join(profilesDirectoryPath, fileName));
666
707
  task.finish();
667
708
  }
668
709
  };
@@ -723,7 +764,7 @@ program.name(name).version(version).description("Sets up a fresh Ubuntu machine
723
764
  assets: path.join(import.meta.dirname, "assets"),
724
765
  home: os.homedir()
725
766
  };
726
- const installations = packages.map(({ install }) => install({
767
+ const installations = packages.map((entry) => entry.install({
727
768
  dependencyManager,
728
769
  directories,
729
770
  logger
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hurshb50/setup-ubuntu",
3
- "version": "2.0.4",
3
+ "version": "3.0.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "distribution"