linkedin-resume 0.3.2 → 0.3.3

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.
@@ -6511,7 +6511,7 @@ var packageVersion;
6511
6511
  var init_version = __esm({
6512
6512
  "../../node_modules/puppeteer-core/lib/esm/puppeteer/util/version.js"() {
6513
6513
  "use strict";
6514
- packageVersion = "24.37.3";
6514
+ packageVersion = "24.37.4";
6515
6515
  }
6516
6516
  });
6517
6517
 
@@ -7559,13 +7559,7 @@ async function getReadableFromProtocolStream(client, handle) {
7559
7559
  }
7560
7560
  function validateDialogType(type) {
7561
7561
  let dialogType = null;
7562
- const validDialogTypes = /* @__PURE__ */ new Set([
7563
- "alert",
7564
- "confirm",
7565
- "prompt",
7566
- "beforeunload"
7567
- ]);
7568
- if (validDialogTypes.has(type)) {
7562
+ if (VALID_DIALOG_TYPES.has(type)) {
7569
7563
  dialogType = type;
7570
7564
  }
7571
7565
  assert(dialogType, `Unknown javascript dialog type: ${type}`);
@@ -7676,7 +7670,7 @@ function filterAsync(predicate) {
7676
7670
  }));
7677
7671
  });
7678
7672
  }
7679
- var debugError, DEFAULT_VIEWPORT, SOURCE_URL, PuppeteerURL, withSourcePuppeteerURLIfNone, getSourcePuppeteerURLIfAvailable, isString, isNumber, isPlainObject, isRegExp, isDate, UTILITY_WORLD_NAME, SOURCE_URL_REGEX, NETWORK_IDLE_TIME, unitToPixels;
7673
+ var debugError, DEFAULT_VIEWPORT, SOURCE_URL, PuppeteerURL, withSourcePuppeteerURLIfNone, getSourcePuppeteerURLIfAvailable, isString, isNumber, isPlainObject, isRegExp, isDate, VALID_DIALOG_TYPES, UTILITY_WORLD_NAME, SOURCE_URL_REGEX, NETWORK_IDLE_TIME, unitToPixels;
7680
7674
  var init_util = __esm({
7681
7675
  "../../node_modules/puppeteer-core/lib/esm/puppeteer/common/util.js"() {
7682
7676
  "use strict";
@@ -7766,6 +7760,12 @@ var init_util = __esm({
7766
7760
  __name(evaluationString, "evaluationString");
7767
7761
  __name(getReadableAsTypedArray, "getReadableAsTypedArray");
7768
7762
  __name(getReadableFromProtocolStream, "getReadableFromProtocolStream");
7763
+ VALID_DIALOG_TYPES = /* @__PURE__ */ new Set([
7764
+ "alert",
7765
+ "confirm",
7766
+ "prompt",
7767
+ "beforeunload"
7768
+ ]);
7769
7769
  __name(validateDialogType, "validateDialogType");
7770
7770
  __name(timeout, "timeout");
7771
7771
  UTILITY_WORLD_NAME = "__puppeteer_utility_world__" + packageVersion;
@@ -84960,7 +84960,7 @@ var init_CLI = __esm({
84960
84960
  init_launch();
84961
84961
  __name(isValidBrowser, "isValidBrowser");
84962
84962
  __name(isValidPlatform, "isValidPlatform");
84963
- packageVersion2 = "2.12.1";
84963
+ packageVersion2 = "2.13.0";
84964
84964
  CLI = class {
84965
84965
  static {
84966
84966
  __name(this, "CLI");
@@ -85050,7 +85050,7 @@ var init_CLI = __esm({
85050
85050
  #build(yargs) {
85051
85051
  const latestOrPinned = this.#pinnedBrowsers ? "pinned" : "latest";
85052
85052
  const browserArgType = this.#pinnedBrowsers ? "[browser]" : "<browser>";
85053
- return yargs.command(`install ${browserArgType}`, "Download and install the specified browser. If successful, the command outputs the actual browser buildId that was installed and the absolute path to the browser executable (format: <browser>@<buildID> <path>).", (yargs2) => {
85053
+ return yargs.command(`install ${browserArgType}`, "Download and install the specified browser. If successful, the command outputs the actual browser buildId that was installed and the absolute path to the browser executable (see --format).", (yargs2) => {
85054
85054
  if (this.#pinnedBrowsers) {
85055
85055
  yargs2.example("$0 install", "Install all pinned browsers");
85056
85056
  }
@@ -85067,6 +85067,10 @@ var init_CLI = __esm({
85067
85067
  type: "boolean",
85068
85068
  desc: "Whether to attempt installing system dependencies (only supported on Linux, requires root privileges).",
85069
85069
  default: false
85070
+ }).option("format", {
85071
+ type: "string",
85072
+ desc: "Format to use for the output. Supported placeholders: {{browser}}, {{buildId}}, {{path}}, {{platform}}",
85073
+ default: "{{browser}}@{{buildId}} {{path}}"
85070
85074
  });
85071
85075
  }, async (args) => {
85072
85076
  if (this.#pinnedBrowsers && !args.browser) {
@@ -85200,12 +85204,13 @@ var init_CLI = __esm({
85200
85204
  buildIdAlias: originalBuildId !== args.browser.buildId ? originalBuildId : void 0,
85201
85205
  installDeps: args.installDeps
85202
85206
  });
85203
- console.log(`${args.browser.name}@${args.browser.buildId} ${computeExecutablePath({
85207
+ const executablePath3 = computeExecutablePath({
85204
85208
  browser: args.browser.name,
85205
85209
  buildId: args.browser.buildId,
85206
85210
  cacheDir: args.path ?? this.#cachePath,
85207
85211
  platform: args.platform
85208
- })}`);
85212
+ });
85213
+ console.log(args.format.replace(/{{browser}}/g, args.browser.name).replace(/{{buildId}}/g, args.browser.buildId).replace(/{{path}}/g, executablePath3).replace(/{{platform}}/g, args.platform));
85209
85214
  }
85210
85215
  };
85211
85216
  }
@@ -313796,7 +313801,7 @@ var FrameManager = class extends EventEmitter {
313796
313801
  frame.updateClient(target._session());
313797
313802
  }
313798
313803
  this.setupEventListeners(target._session());
313799
- void this.initialize(target._session(), frame);
313804
+ void this.initialize(target._session(), frame).catch(debugError);
313800
313805
  }
313801
313806
  _deviceRequestPromptManager(client) {
313802
313807
  let manager = this.#deviceRequestPromptManagerMap.get(client);
@@ -318773,9 +318778,9 @@ init_XPathQueryHandler();
318773
318778
 
318774
318779
  // ../../node_modules/puppeteer-core/lib/esm/puppeteer/revisions.js
318775
318780
  var PUPPETEER_REVISIONS = Object.freeze({
318776
- chrome: "145.0.7632.67",
318777
- "chrome-headless-shell": "145.0.7632.67",
318778
- firefox: "stable_147.0.3"
318781
+ chrome: "145.0.7632.76",
318782
+ "chrome-headless-shell": "145.0.7632.76",
318783
+ firefox: "stable_147.0.4"
318779
318784
  });
318780
318785
 
318781
318786
  // ../../node_modules/puppeteer-core/lib/esm/puppeteer/util/util.js
@@ -327630,8 +327635,8 @@ import_fs_extra2.default.ensureDirSync(DIST_PATH);
327630
327635
  // src/userConfigFile.ts
327631
327636
  var UserConfigSchema = Type.Object(
327632
327637
  {
327633
- linkedInUsername: Type.String({ default: "" }),
327634
- outputFilepath: Type.String({ default: "$USERPROFILE/Desktop/resume.pdf" }),
327638
+ username: Type.String({ default: "" }),
327639
+ outpath: Type.String({ default: "$USERPROFILE/Desktop/resume.pdf" }),
327635
327640
  profiles: Type.Array(
327636
327641
  Type.Object({
327637
327642
  network: Type.String({ default: "" }),
@@ -327771,7 +327776,7 @@ var _ = userConfigFile.load();
327771
327776
  // src/loadUserConfig.ts
327772
327777
  async function loadUserConfig() {
327773
327778
  const config2 = userConfigFile.load();
327774
- if (config2.linkedInUsername) {
327779
+ if (config2.username) {
327775
327780
  return config2;
327776
327781
  }
327777
327782
  const rl = (0, import_promises5.createInterface)({ input: process.stdin, output: process.stdout });
@@ -327781,14 +327786,14 @@ async function loadUserConfig() {
327781
327786
  console.error("LinkedIn username is required.");
327782
327787
  process.exit(1);
327783
327788
  }
327784
- return userConfigFile.update((config3) => ({ ...config3, linkedInUsername: username }));
327789
+ return userConfigFile.update((config3) => ({ ...config3, username }));
327785
327790
  }
327786
327791
  __name(loadUserConfig, "loadUserConfig");
327787
327792
 
327788
327793
  // src/linkedin/utils/getLinkedInUsername.ts
327789
327794
  var getLinkedInUsername = onetime_default(async () => {
327790
327795
  const userConfig = await loadUserConfig();
327791
- return userConfig.linkedInUsername;
327796
+ return userConfig.username;
327792
327797
  });
327793
327798
 
327794
327799
  // src/linkedin/scrapeProfile.ts
@@ -329535,8 +329540,8 @@ async function renderResumeJson() {
329535
329540
  if (!userConfig.profiles.some((p) => p.network.toLowerCase() === "linkedin")) {
329536
329541
  userConfig.profiles.push({
329537
329542
  network: "LinkedIn",
329538
- username: userConfig.linkedInUsername,
329539
- url: `https://www.linkedin.com/in/${userConfig.linkedInUsername}`
329543
+ username: userConfig.username,
329544
+ url: `https://www.linkedin.com/in/${userConfig.username}`
329540
329545
  });
329541
329546
  }
329542
329547
  const basics = {
@@ -329580,7 +329585,7 @@ function expandEnvVars(filepath) {
329580
329585
  __name(expandEnvVars, "expandEnvVars");
329581
329586
 
329582
329587
  // src/renderPdfFromHtml.ts
329583
- async function renderPdfFromHtml(outputFilepath, options) {
329588
+ async function renderPdfFromHtml(options) {
329584
329589
  const htmlPath = import_upath4.default.join(DIST_PATH, "resume.html");
329585
329590
  const pdfPath = import_upath4.default.join(DIST_PATH, "resume.pdf");
329586
329591
  const htmlFileUrl = (0, import_url2.pathToFileURL)(htmlPath).href;
@@ -329613,10 +329618,10 @@ async function renderPdfFromHtml(outputFilepath, options) {
329613
329618
  }
329614
329619
  console.log(`output: ${pdfPath}`);
329615
329620
  const userConfig = await loadUserConfig();
329616
- const outputFilepathToUse = expandEnvVars(outputFilepath || userConfig.outputFilepath);
329617
- await import_fs_extra11.default.ensureDir(import_upath4.default.dirname(outputFilepathToUse));
329618
- await import_fs_extra11.default.copy(pdfPath, outputFilepathToUse);
329619
- console.log("\nPDF:", outputFilepathToUse, "\n");
329621
+ const outpathToUse = expandEnvVars(options.outpath || userConfig.outpath);
329622
+ await import_fs_extra11.default.ensureDir(import_upath4.default.dirname(outpathToUse));
329623
+ await import_fs_extra11.default.copy(pdfPath, outpathToUse);
329624
+ console.log("\nPDF:", outpathToUse, "\n");
329620
329625
  }
329621
329626
  __name(renderPdfFromHtml, "renderPdfFromHtml");
329622
329627
 
@@ -329626,6 +329631,33 @@ var import_child_process = __toESM(require("child_process"), 1);
329626
329631
 
329627
329632
  // src/linkedin/ensureUserLoggedInToLinkedIn.ts
329628
329633
  async function ensureUserLoggedInToLinkedIn() {
329634
+ const headlessBrowser = await puppeteer_default.launch({
329635
+ headless: "shell",
329636
+ userDataDir: CHROME_PROFILE_PATH
329637
+ });
329638
+ let isLoggedIn = false;
329639
+ try {
329640
+ const page = await headlessBrowser.newPage();
329641
+ await page.goto("https://www.linkedin.com/feed/?locale=en_US", {
329642
+ waitUntil: "domcontentloaded",
329643
+ timeout: 2e4
329644
+ });
329645
+ const url = page.url();
329646
+ isLoggedIn = !url.includes("/login") && !url.includes("/authwall");
329647
+ } finally {
329648
+ for (const page of await headlessBrowser.pages()) {
329649
+ await page.close().catch(() => {
329650
+ });
329651
+ }
329652
+ await headlessBrowser.close();
329653
+ }
329654
+ if (isLoggedIn) {
329655
+ console.log("Already logged in to LinkedIn.");
329656
+ return;
329657
+ }
329658
+ console.log("You are not logged in to LinkedIn.");
329659
+ console.log("Please log in using the browser window that will open.");
329660
+ console.log("The process will continue once you are logged in...");
329629
329661
  const browser = await puppeteer_default.launch({
329630
329662
  headless: false,
329631
329663
  userDataDir: CHROME_PROFILE_PATH,
@@ -329638,18 +329670,10 @@ async function ensureUserLoggedInToLinkedIn() {
329638
329670
  waitUntil: "domcontentloaded",
329639
329671
  timeout: 2e4
329640
329672
  });
329641
- const url = page.url();
329642
- if (url.includes("/login") || url.includes("/authwall")) {
329643
- console.log("You are not logged in to LinkedIn.");
329644
- console.log("Please log in using the browser window that just opened.");
329645
- console.log("The process will continue once you are logged in...");
329646
- await page.waitForFunction(() => window.location.href.includes("/feed"), {
329647
- timeout: 0
329648
- });
329649
- console.log("LinkedIn login detected. You are now logged in.");
329650
- } else {
329651
- console.log("Already logged in to LinkedIn.");
329652
- }
329673
+ await page.waitForFunction(() => window.location.href.includes("/feed"), {
329674
+ timeout: 0
329675
+ });
329676
+ console.log("LinkedIn login detected. You are now logged in.");
329653
329677
  } finally {
329654
329678
  for (const page of await browser.pages()) {
329655
329679
  await page.close().catch(() => {
@@ -329664,13 +329688,14 @@ __name(ensureUserLoggedInToLinkedIn, "ensureUserLoggedInToLinkedIn");
329664
329688
  var description_default = "A CLI tool to generate a LinkedIn resume in PDF format.";
329665
329689
 
329666
329690
  // src/core/version.ts
329667
- var version_default = `0.3.2`;
329691
+ var version_default = `0.3.3`;
329668
329692
 
329669
329693
  // src/main.ts
329670
- var cli = new Command("linkedin-resume").version(version_default).description(description_default).argument("[outputFilepath]", "Optional filepath. Defaults to value set in config file.").option("--debug", "enable debug output").option("--render", "skip scraping, only render").option("--no-headless", "show scraping browser window").option("--keep-open", "keep browser open after scraping").action(async (outputFilepath, options) => {
329694
+ var cli = new Command("linkedin-resume").version(version_default).description(description_default).option("-o, --outpath <filepath>", "output filepath (overrides config)").option("-d, --debug", "enable debug output").option("-r, --render", "skip scraping, only render").option("-n, --no-headless", "show scraping browser window").option("-k, --keep-open", "keep browser open after scraping").action(async (options) => {
329695
+ const config2 = await loadUserConfig();
329671
329696
  if (options.debug) {
329672
329697
  console.log({ argv: process.argv });
329673
- console.dir({ config: await loadUserConfig() }, { depth: null });
329698
+ console.dir({ config: config2 }, { depth: null });
329674
329699
  }
329675
329700
  if (!options.render) {
329676
329701
  console.log("\nEnsuring logged in to LinkedIn...");
@@ -329683,7 +329708,7 @@ var cli = new Command("linkedin-resume").version(version_default).description(de
329683
329708
  console.log("\nRendering resume...");
329684
329709
  await renderResumeJson();
329685
329710
  await renderResumeHtml();
329686
- await renderPdfFromHtml(outputFilepath, options);
329711
+ await renderPdfFromHtml(options);
329687
329712
  });
329688
329713
  cli.command("config").description("Create or update config file with LinkedIn username and other settings").option("--path", "print the path to the config file and exit").action(async (options) => {
329689
329714
  await loadUserConfig();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "linkedin-resume",
3
3
  "description": "A CLI tool to generate a LinkedIn resume in PDF format.",
4
- "version": "0.3.2",
4
+ "version": "0.3.3",
5
5
  "packageManager": "yarn@4.3.1",
6
6
  "type": "module",
7
7
  "main": "dist/cli.mjs",
@@ -32,7 +32,6 @@
32
32
  "url": "https://github.com/bemoje/mono.git",
33
33
  "directory": "apps/linkedin-resume"
34
34
  },
35
- "homepage": "https://github.com/bemoje/mono/blob/main/apps/linkedin-resume/README.md",
36
35
  "scripts": {
37
36
  "build": "node esbuild.mjs"
38
37
  }