yamlresume 0.2.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023–Present PPResume (https://ppresume.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to
7
+ deal in the Software without restriction, including without limitation the
8
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9
+ sell copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21
+ IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ ## YAMLResume CLI
2
+
3
+ The YAMLResume CLI is the command-line interface for
4
+ [YAMLResume](https://yamlresume.dev).
5
+
6
+ ![YAMLResume YAML and PDF](https://yamlresume.dev/static/assets/images/yamlresume-yaml-and-pdf.webp)
7
+
8
+ - [installation](http://yamlresume.dev/docs/getting-started#installation)
9
+ - [manual docs](http://yamlresume.dev/docs/cli)
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/cli.js ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ import {Command}from'commander';import y from'node:child_process';import a from'node:fs';import {LocaleLanguageOption,getLocaleLanguageOptionDetail,TemplateOption,getTemplateOptionDetail,MarkdownParser,getResumeRenderer}from'@yamlresume/core';import b from'which';import C from'yaml';import d from'node:path';import {fileURLToPath}from'node:url';import {markdownTable}from'markdown-table';var l={version:"0.2.2"};function u(e){if(e.endsWith(".yaml")||e.endsWith(".yml")||e.endsWith(".json"))return e.replace(/\.yaml|\.yml|\.json$/,".tex");throw new Error(`Unsupported file extension: ${e}`)}function c(e){try{return !!b.sync(e)}catch{return false}}function L(){if(c("xelatex"))return "xelatex";if(c("tectonic"))return "tectonic";throw new Error("neither xelatex nor tectonic is installed")}function v(e){let t=L(),m=u(e);return `${t} -halt-on-error ${m}`}function T(e){let t=u(e),m=a.readFileSync(e,"utf8"),_=new MarkdownParser,g=getResumeRenderer(C.parse(m),_).render();a.writeFileSync(t,g);}function R(e){T(e);let t=v(e);console.log(`-> generating resume PDF with command: \`${t}\`...`),y.execSync(t),console.log("-> resume PDF generated successfully.");}function E(e){R(e);}var s=new Command().name("build").description("build a resume to LaTeX and PDF").argument("<source>","the source resume file").action(e=>{E(e);});var i=new Command().name("new").description("create a new resume").argument("[filename]","output filename","resume.yml").action(e=>{try{if(a.existsSync(e))throw new Error([`File "${e}" already exists.`,"Please choose a different name or remove the existing file."].join(" "));let t=d.join(d.dirname(fileURLToPath(import.meta.url)),import.meta.url.includes("dist")?"../resources/software-engineer.yml":"../../resources/software-engineer.yml");a.writeFileSync(e,a.readFileSync(t,"utf8")),console.log(`-> Successfully created ${e}.`);}catch(t){console.error("Error creating resume template:",t),process.exit(1);}});function O(){return markdownTable([["`layout.locale.language`","Language Name"],...Object.values(LocaleLanguageOption).map(e=>[e,getLocaleLanguageOptionDetail(e).name])])}var n=new Command().name("languages").description("i18n and l10n support");n.command("list").description("list all supported languages").action(()=>{console.log(O());});function Y(){return markdownTable([["`layout.template`","Template Name","Description"],...Object.values(TemplateOption).map(e=>{let t=getTemplateOptionDetail(e);return [e,t.name,t.description]})])}var o=new Command().name("templates").description("manage resume templates");o.command("list").description("list all supported templates").action(()=>{console.log(Y());});var r=new Command,I=`
3
+ __ __ _ __ __ _ ____
4
+ \\ \\ / // \\ | \\/ | | | _ \\ ___ ___ _ _ ___ ___ ___
5
+ \\ V // _ \\ | |\\/| | | | |_) / _ \\/ __| | | / _ \\/ _ \\ / _ \\
6
+ | |/ ___ \\| | | | |___| _ < __/\\__ \\ |_| | | | | | | __/
7
+ |_/_/ \\_\\_| |_|_____|_| \\_\\___||___/\\____|_| |_| |_|\\___|
8
+ `;r.name("yamlresume").description(["YAMLResume \u2014 Resume as Code in YAML",I].join(`
9
+ `)).version(l.version);r.addCommand(i);r.addCommand(s);r.addCommand(n);r.addCommand(o);r.parse();//# sourceMappingURL=cli.js.map
10
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../package.json","../src/commands/build.ts","../src/commands/new.ts","../src/commands/languages.ts","../src/commands/templates.ts","../src/program.ts","../src/cli.ts"],"names":["package_default","inferOutput","source","isCommandAvailable","command","which","inferLaTeXEnvironment","inferLaTeXCommand","environment","destination","generateTeX","texFile","resume","fs","summaryParser","MarkdownParser","tex","getResumeRenderer","yaml","generatePDF","child_process","buildResume","buildCommand","Command","newCommand","filename","templatePath","path","fileURLToPath","error","listLanguages","markdownTable","LocaleLanguageOption","value","getLocaleLanguageOptionDetail","languagesCommand","listTemplates","TemplateOption","details","getTemplateOptionDetail","templatesCommand","program","banner"],"mappings":";qYAAA,IAAAA,EAAA,CAEE,OAAA,CAAW,OAsEb,CAAA,CC3BO,SAASC,CAAYC,CAAAA,CAAAA,CAAwB,CAClD,GACEA,CAAAA,CAAO,QAAS,CAAA,OAAO,CACvBA,EAAAA,CAAAA,CAAO,QAAS,CAAA,MAAM,GACtBA,CAAO,CAAA,QAAA,CAAS,OAAO,CAAA,CAEvB,OAAOA,CAAAA,CAAO,OAAQ,CAAA,sBAAA,CAAwB,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;AAAA,CAQfD,CAAAA,CAAAA,CACG,KAAK,YAAY,CAAA,CACjB,YAAY,CAAC,0CAAA,CAAuCC,CAAM,CAAA,CAAE,IAAK,CAAA;AAAA,CAAI,CAAC,EACtE,OAAQ1C,CAAAA,CAAAA,CAAY,OAAO,CAE9ByC,CAAAA,CAAAA,CAAQ,UAAWjB,CAAAA,CAAU,CAC7BiB,CAAAA,CAAAA,CAAQ,WAAWnB,CAAY,CAAA,CAC/BmB,CAAQ,CAAA,UAAA,CAAWN,CAAgB,CAAA,CACnCM,EAAQ,UAAWD,CAAAA,CAAgB,CCzBnCC,CAAAA,CAAAA,CAAQ,KAAM,EAAA","file":"cli.js","sourcesContent":["{\n \"name\": \"yamlresume\",\n \"version\": \"0.2.2\",\n \"description\": \"The CLI interface for YAMLResume's engine\",\n \"license\": \"MIT\",\n \"author\": {\n \"name\": \"YAMLResume\",\n \"email\": \"support@yamlresume.com\",\n \"url\": \"https://yamlresume.dev\"\n },\n \"keywords\": [\n \"YAMLResume\",\n \"CV\",\n \"Resume\",\n \"LaTeX\",\n \"Typesetting\",\n \"PDF\",\n \"YAML\",\n \"JSON\"\n ],\n \"type\": \"module\",\n \"bin\": {\n \"yamlresume\": \"./dist/cli.js\"\n },\n \"files\": [\n \"dist\",\n \"README.md\",\n \"LICENSE\",\n \"resources/resume.yml\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"build:watch\": \"tsup --watch\",\n \"build:clean\": \"rm -rf dist\",\n \"build:prod\": \"tsup --dts --minify --sourcemap\",\n \"prepublishOnly\": \"pnpm test\",\n \"coverage\": \"vitest --coverage --run\",\n \"dev\": \"tsx src/cli.ts\",\n \"test\": \"vitest --run\",\n \"test:watch\": \"vitest\"\n },\n \"dependencies\": {\n \"@yamlresume/core\": \"workspace:*\",\n \"commander\": \"^11.0.0\",\n \"extensionless\": \"^1.9.9\",\n \"lodash-es\": \"^4.17.21\",\n \"markdown-table\": \"^3.0.4\",\n \"tslib\": \"^2.8.1\",\n \"which\": \"^5.0.0\",\n \"yaml\": \"^2.7.1\"\n },\n \"devDependencies\": {\n \"@types/commander\": \"^2.12.5\",\n \"@types/lodash-es\": \"^4.17.12\",\n \"@types/which\": \"^3.0.4\",\n \"tsx\": \"^4.19.3\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/yamlresume/yamlresume.git\",\n \"directory\": \"packages/cli\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/yamlresume/yamlresume/issues\"\n },\n \"homepage\": \"https://github.com/yamlresume/yamlresume/tree/main/packages/cli#readme\",\n \"engines\": {\n \"node\": \">=20.0.0\"\n }\n}\n","/**\n * MIT License\n *\n * Copyright (c) 2023–Present PPResume (https://ppresume.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport child_process from 'node:child_process'\nimport fs from 'node:fs'\nimport {\n MarkdownParser,\n type Resume,\n getResumeRenderer,\n} from '@yamlresume/core'\nimport { Command } from 'commander'\nimport which from 'which'\nimport yaml from 'yaml'\n\n/**\n * Infer the output file name from the source file name\n *\n * For now we support yaml, yml and json file extensions, and the output file\n * will have a `.tex` extension.\n *\n * @param source - The source resume file\n * @returns The output file name\n * @throws {Error} If the source file has an unsupported extension.\n */\nexport function inferOutput(source: string): string {\n if (\n source.endsWith('.yaml') ||\n source.endsWith('.yml') ||\n source.endsWith('.json')\n ) {\n return source.replace(/\\.yaml|\\.yml|\\.json$/, '.tex')\n }\n\n throw new Error(`Unsupported file extension: ${source}`)\n}\n\ntype LaTeXEnvironment = 'xelatex' | 'tectonic'\n\n/**\n * Check if a command is available\n *\n * @param command - The command to check\n * @returns True if the command is available, false otherwise\n */\nexport function isCommandAvailable(command: string): boolean {\n try {\n return !!which.sync(command)\n } catch {\n return false\n }\n}\n\n/**\n * Infer the LaTeX environment to use\n *\n * We support xelatex and tectonic, if both are installed we will prioritize\n * xelatex.\n *\n * @returns The LaTeX environment PATH.\n * @throws {Error} If neither 'xelatex' nor 'tectonic' is found in system PATH.\n */\nexport function inferLaTeXEnvironment(): LaTeXEnvironment {\n if (isCommandAvailable('xelatex')) {\n return 'xelatex'\n }\n\n if (isCommandAvailable('tectonic')) {\n return 'tectonic'\n }\n\n throw new Error('neither xelatex nor tectonic is installed')\n}\n\n/**\n * Infer the LaTeX command to use based on the LaTeX environment\n *\n * @param source - The source resume file\n * @returns The LaTeX command\n * @throws {Error} If the LaTeX environment cannot be inferred or the source\n * file extension is unsupported.\n */\nexport function inferLaTeXCommand(source: string): string {\n const environment = inferLaTeXEnvironment()\n const destination = inferOutput(source)\n\n return `${environment} -halt-on-error ${destination}`\n}\n\n/**\n * Compiles the resume source file to a LaTeX file.\n *\n * @param source - The source resume file path (YAML, YML, or JSON).\n * @remarks This function performs file I/O: reads the source file and writes a\n * .tex file.\n * @throws {Error} Can throw if file reading, parsing, rendering, or writing\n * fails, or if the source file extension is unsupported.\n */\nexport function generateTeX(source: string) {\n // make sure the file has an valid extension, i.e, '.json', '.yml' or '.yaml'\n const texFile = inferOutput(source)\n\n const resume = fs.readFileSync(source, 'utf8')\n const summaryParser = new MarkdownParser()\n\n const renderer = getResumeRenderer(\n yaml.parse(resume) as Resume,\n summaryParser\n )\n const tex = renderer.render()\n\n fs.writeFileSync(texFile, tex)\n}\n\n/**\n * Compiles the resume source file to a PDF file.\n *\n * It first generates the .tex file (using `generateTeX`) and then runs the\n * inferred LaTeX command (e.g., xelatex or tectonic) to produce the PDF.\n *\n * @param source - The source resume file path (YAML, YML, or JSON).\n * @remarks This function performs file I/O (via `generateTeX`) and executes an\n * external process (LaTeX compiler).\n * @throws {Error} Can throw if .tex generation, LaTeX command inference, or the\n * LaTeX compilation process fails.\n */\nexport function generatePDF(source: string) {\n generateTeX(source)\n\n const command = inferLaTeXCommand(source)\n console.log(`-> generating resume PDF with command: \\`${command}\\`...`)\n\n child_process.execSync(command)\n console.log('-> resume PDF generated successfully.')\n}\n\n/**\n * Build a resume to LaTeX & PDF\n *\n * This function will read a resume from a file in yaml or json format, and then\n * Steps:\n * 1. read the resume from the source file\n * 2. infer the LaTeX command to use\n * 2.1. infer the LaTeX environment to use\n * 2.2. infer the output destination\n * 3. [TODO] check the resume format and make sure it aligns with YAMLResume\n * schema\n * 4. build the resume to LaTeX and PDF at the same time\n *\n * This function will throw an exception if any error\n *\n * @param source - The source resume file\n * @throws {Error} If any part of the PDF generation process fails (forwarded\n * from `generatePDF`).\n * @todo Check the resume format against YAMLResume schema before compilation.\n */\nexport function buildResume(source: string) {\n generatePDF(source)\n}\n\n/**\n * Commander command instance to build a YAML resume to LaTeX and PDF\n *\n * @param source - The source resume file\n * @throws {Error} If any part of the PDF generation process fails (forwarded\n * from `generatePDF`).\n */\nexport const buildCommand = new Command()\n .name('build')\n .description('build a resume to LaTeX and PDF')\n .argument('<source>', 'the source resume file')\n .action((source: string) => {\n buildResume(source)\n })\n","/**\n * MIT License\n *\n * Copyright (c) 2023–Present PPResume (https://ppresume.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { Command } from 'commander'\n\n/**\n * Commander command instance to create a new YAML resume\n *\n * @param filename - The output filename for the new resume\n * @throws {Error} If file creation fails\n */\nexport const newCommand = new Command()\n .name('new')\n .description('create a new resume')\n .argument('[filename]', 'output filename', 'resume.yml')\n .action((filename) => {\n try {\n if (fs.existsSync(filename)) {\n throw new Error(\n [\n `File \"${filename}\" already exists.`,\n 'Please choose a different name or remove the existing file.',\n ].join(' ')\n )\n }\n\n const templatePath = path.join(\n path.dirname(fileURLToPath(import.meta.url)),\n /* v8 ignore start */\n // I din't find a way to mock `import.meta.url` in tests so we have to\n // ignore the following lines for coverage calculation\n import.meta.url.includes('dist')\n ? '../resources/software-engineer.yml'\n : '../../resources/software-engineer.yml'\n /* v8 ignore stop */\n )\n\n fs.writeFileSync(filename, fs.readFileSync(templatePath, 'utf8'))\n console.log(`-> Successfully created ${filename}.`)\n } catch (error) {\n console.error('Error creating resume template:', error)\n process.exit(1)\n }\n })\n","/**\n * MIT License\n *\n * Copyright (c) 2023–Present PPResume (https://ppresume.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport {\n LocaleLanguageOption,\n getLocaleLanguageOptionDetail,\n} from '@yamlresume/core'\nimport { Command } from 'commander'\nimport { markdownTable } from 'markdown-table'\n\n/**\n * Generates a markdown table listing all supported locale languages.\n *\n * The table includes columns for the language code (enum key) and the language\n * name (enum value).\n *\n * @returns A string containing the formatted markdown table.\n */\nexport function listLanguages() {\n return markdownTable([\n ['`layout.locale.language`', 'Language Name'],\n ...Object.values(LocaleLanguageOption).map((value) => [\n value,\n getLocaleLanguageOptionDetail(value).name,\n ]),\n ])\n}\n\n/**\n * Commander command instance to list supported languages\n *\n * Provides subcommands like 'list' to interact with language settings or\n * information.\n */\nexport const languagesCommand = new Command()\n .name('languages')\n .description('i18n and l10n support')\n\nlanguagesCommand\n .command('list')\n .description('list all supported languages')\n .action(() => {\n console.log(listLanguages())\n })\n","/**\n * MIT License\n *\n * Copyright (c) 2023–Present PPResume (https://ppresume.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { TemplateOption, getTemplateOptionDetail } from '@yamlresume/core'\nimport { Command } from 'commander'\nimport { markdownTable } from 'markdown-table'\n\n/**\n * Generates a markdown table listing all supported templates.\n *\n * The table includes columns for the template id, name and description.\n *\n * @returns A string containing the formatted markdown table.\n */\nexport function listTemplates() {\n return markdownTable([\n ['`layout.template`', 'Template Name', 'Description'],\n ...Object.values(TemplateOption).map((value) => {\n const details = getTemplateOptionDetail(value)\n return [value, details.name, details.description]\n }),\n ])\n}\n\n/**\n * Commander command instance to list supported templates\n *\n * Provides subcommands like 'list' to interact with template information.\n */\nexport const templatesCommand = new Command()\n .name('templates')\n .description('manage resume templates')\n\ntemplatesCommand\n .command('list')\n .description('list all supported templates')\n .action(() => {\n console.log(listTemplates())\n })\n","/**\n * MIT License\n *\n * Copyright (c) 2023–Present PPResume (https://ppresume.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { Command } from 'commander'\n\nimport packageJson from '../package.json' with { type: 'json' }\nimport {\n buildCommand,\n languagesCommand,\n newCommand,\n templatesCommand,\n} from './commands'\n\nexport const program = new Command()\n\nconst banner = `\n __ __ _ __ __ _ ____\n \\\\ \\\\ / // \\\\ | \\\\/ | | | _ \\\\ ___ ___ _ _ ___ ___ ___\n \\\\ V // _ \\\\ | |\\\\/| | | | |_) / _ \\\\/ __| | | / _ \\\\/ _ \\\\ / _ \\\\\n | |/ ___ \\\\| | | | |___| _ < __/\\\\__ \\\\ |_| | | | | | | __/\n |_/_/ \\\\_\\\\_| |_|_____|_| \\\\_\\\\___||___/\\\\____|_| |_| |_|\\\\___|\n`\n\nprogram\n .name('yamlresume')\n .description(['YAMLResume — Resume as Code in YAML', banner].join('\\n'))\n .version(packageJson.version)\n\nprogram.addCommand(newCommand)\nprogram.addCommand(buildCommand)\nprogram.addCommand(languagesCommand)\nprogram.addCommand(templatesCommand)\n","#!/usr/bin/env node\n/**\n * MIT License\n *\n * Copyright (c) 2023–Present PPResume (https://ppresume.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport { program } from './program'\n\nprogram.parse()\n"]}
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "yamlresume",
3
+ "version": "0.2.2",
4
+ "description": "The CLI interface for YAMLResume's engine",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "YAMLResume",
8
+ "email": "support@yamlresume.com",
9
+ "url": "https://yamlresume.dev"
10
+ },
11
+ "keywords": [
12
+ "YAMLResume",
13
+ "CV",
14
+ "Resume",
15
+ "LaTeX",
16
+ "Typesetting",
17
+ "PDF",
18
+ "YAML",
19
+ "JSON"
20
+ ],
21
+ "type": "module",
22
+ "bin": {
23
+ "yamlresume": "./dist/cli.js"
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "README.md",
28
+ "LICENSE",
29
+ "resources/resume.yml"
30
+ ],
31
+ "dependencies": {
32
+ "commander": "^11.0.0",
33
+ "extensionless": "^1.9.9",
34
+ "lodash-es": "^4.17.21",
35
+ "markdown-table": "^3.0.4",
36
+ "tslib": "^2.8.1",
37
+ "which": "^5.0.0",
38
+ "yaml": "^2.7.1",
39
+ "@yamlresume/core": "0.2.2"
40
+ },
41
+ "devDependencies": {
42
+ "@types/commander": "^2.12.5",
43
+ "@types/lodash-es": "^4.17.12",
44
+ "@types/which": "^3.0.4",
45
+ "tsx": "^4.19.3"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "repository": {
51
+ "type": "git",
52
+ "url": "https://github.com/yamlresume/yamlresume.git",
53
+ "directory": "packages/cli"
54
+ },
55
+ "bugs": {
56
+ "url": "https://github.com/yamlresume/yamlresume/issues"
57
+ },
58
+ "homepage": "https://github.com/yamlresume/yamlresume/tree/main/packages/cli#readme",
59
+ "engines": {
60
+ "node": ">=20.0.0"
61
+ },
62
+ "scripts": {
63
+ "build": "tsup",
64
+ "build:watch": "tsup --watch",
65
+ "build:clean": "rm -rf dist",
66
+ "build:prod": "tsup --dts --minify --sourcemap",
67
+ "coverage": "vitest --coverage --run",
68
+ "dev": "tsx src/cli.ts",
69
+ "test": "vitest --run",
70
+ "test:watch": "vitest"
71
+ }
72
+ }
@@ -0,0 +1,230 @@
1
+ ---
2
+ content:
3
+ basics:
4
+ name: Andy Dufresne
5
+ headline: Headed for the Pacific
6
+ phone: "(213) 555-9876"
7
+ email: hi@ppresume.com
8
+ url: https://ppresume.com/gallery
9
+ # All summary fields supports a limited rich text capabilities in markdown
10
+ # syntax:
11
+ #
12
+ # - bold, (e.g, `**bold**`)
13
+ # - italic, (e.g, `*italic*`)
14
+ # - ordered list, unordored list and nested sub list
15
+ # - links (e.g. `[link](https://ppresume.com)`)
16
+ summary: |
17
+ - Computer Science major with strong foundation in data structures, algorithms, and software development
18
+ - Pixel perfect full stack web developer, specialised in creating high-quality, visually appealing websites
19
+ - Experiened in databases (SQL, NoSQL), familiar with server-side technologies (Node.js, Express, etc.)
20
+ - Team player, with detail-oriented mindset and a keen eye for design and user experiences
21
+ location:
22
+ address: 123 Main Street
23
+ city: Sacramento
24
+ region: California
25
+ country: United States
26
+ postalCode: "95814"
27
+ profiles:
28
+ - network: Line
29
+ url: https://line.com/PPResumeX
30
+ username: PPResumeX
31
+ - network: Twitter
32
+ url: https://twitter.com/PPResumeX
33
+ username: PPResumeX
34
+ education:
35
+ - institution: University of Southern California
36
+ url: https://www.cs.usc.edu/
37
+ # Valid degree options:
38
+ #
39
+ # - 'Middle School'
40
+ # - 'High School'
41
+ # - 'Diploma'
42
+ # - 'Associate'
43
+ # - 'Bachelor'
44
+ # - 'Master'
45
+ # - 'Doctor'
46
+ degree: Bachelor
47
+ area: Computer Engineering and Computer Science
48
+ score: "3.8"
49
+ # Should be a valid date string that can be parsed by `new Date(dateStr)`
50
+ # in JavaScript, eg. '2020-01', '2020-02-03', 'Jul 1, 2023' etc.
51
+ #
52
+ # The date part would be removed in the final output as most of the time
53
+ # people won't really care about the exact date for your working
54
+ # experience or education background, etc.
55
+ # ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date
56
+ startDate: Sep 1, 2016
57
+ # Leave endDate blank to indicate "Present"
58
+ endDate: Jul 1, 2020
59
+ courses:
60
+ - Discrete Methods in Computer Science
61
+ - Programming Language Concepts
62
+ - Data Structures and Object-Oriented Design
63
+ - Operating Systems
64
+ - Computer Architecture
65
+ - Database Systems
66
+ - Computer Networking
67
+ - Introduction to the Theory of Computing
68
+ summary: |
69
+ - Developed proficiency in programming languages such as Java, C++, and Python
70
+ - Gained hands-on experience in software development through various projects and assignments
71
+ - Strong communication and teamwork skills acquired through group projects and presentations
72
+ work:
73
+ - name: PPResume
74
+ url: https://ppresume.com
75
+ startDate: Dec 1, 2022
76
+ endDate: ""
77
+ position: Senior Software Engineer
78
+ summary: |
79
+ - Developed and implemented efficient and scalable code, ensuring high-quality and maintainable web applications
80
+ - Collaborated with cross-functional teams to gather project requirements and translate them into technical solutions
81
+ - Conducted thorough testing and debugging to identify and resolve any issues or bugs in the software
82
+ - Actively participated in code reviews, providing valuable feedback to improve code quality and adherence to best practices
83
+ - Mentored and guided junior developers, fostering a collaborative and growth-oriented team environment
84
+ keywords:
85
+ - Scalibility
86
+ - Growth
87
+ - Quality
88
+ - Mentorship
89
+ - name: PPResume
90
+ url: https://ppresume.com
91
+ startDate: Sep 1, 2020
92
+ endDate: Dec 1, 2022
93
+ position: Software Engineer
94
+ summary: |
95
+ - Created reusable React components to ensure code efficiency and maintainability
96
+ - Integrated with RESTful APIs to fetch and display dynamic data on the frontend
97
+ - Implemented client-side routing using React Router for smooth navigation between pages
98
+ - Actively participated in Agile development methodologies, attending daily stand-up meetings and sprint planning sessions
99
+ keywords:
100
+ - RESTful
101
+ - React
102
+ - Agile
103
+ languages:
104
+ # Valid language fluency options:
105
+ #
106
+ # - 'Elementary Proficiency'
107
+ # - 'Limited Working Proficiency'
108
+ # - 'Minimum Professional Proficiency'
109
+ # - 'Full Professional Proficiency'
110
+ # - 'Native or Bilingual Proficiency'
111
+ - language: English
112
+ fluency: Native or Bilingual Proficiency
113
+ keywords:
114
+ - TOEFL 110
115
+ - IELTS 7.5
116
+ - language: Chinese
117
+ fluency: Elementary Proficiency
118
+ keywords: []
119
+ skills:
120
+ # Valid skill level options:
121
+ #
122
+ # - 'Novice'
123
+ # - 'Beginner'
124
+ # - 'Intermediate'
125
+ # - 'Advanced'
126
+ # - 'Expert'
127
+ # - 'Master'
128
+ - name: Web Development
129
+ level: Expert
130
+ keywords:
131
+ - Python
132
+ - Ruby
133
+ - CSS
134
+ - React
135
+ - JavaScript
136
+ - name: DevOps
137
+ level: Intermediate
138
+ keywords:
139
+ - Python
140
+ - Kubernetes
141
+ - Docker
142
+ - Shell
143
+ - Ansible
144
+ - name: Design
145
+ level: Intermediate
146
+ keywords:
147
+ - Sketch
148
+ - Figma
149
+ - Photoshop
150
+ awards:
151
+ - title: Dean's List
152
+ awarder: University of Southern California
153
+ date: Oct 2016
154
+ summary: |
155
+ Awarded to students who achieve a high academic standing by maintaining a specified grade point average (GPA) during a semester.
156
+ certificates:
157
+ - name: AWS Certified Developer - Associate
158
+ url: https://aws.amazon.com/certification/
159
+ issuer: AWS
160
+ date: Mar 2021
161
+ publications:
162
+ - publisher: ACM Transactions on Interactive Intelligent Systems
163
+ url: https://dl.acm.org/journal/tiis
164
+ name: Enhancing Human-Computer Interaction through Augmented Reality
165
+ releaseDate: Dec 2017
166
+ summary: |
167
+ - Explores the potential of augmented reality (AR) in improving interaction between humans and computers
168
+ - Highlights benefits of AR in various areas such as gaming, education, healthcare, and design
169
+ - Discusses challenges and future directions of AR technology in enhancing user experience
170
+ references:
171
+ - name: Dr. Amanda Reynolds
172
+ phone: "(555) 123-4567"
173
+ relationship: Computer Science Professor
174
+ email: amanda.reynolds@usc.edu
175
+ summary: |
176
+ Andy Dufresne shows exceptional problem-solving skills and a solid understanding of programming concepts, he would bring immense value to any team or organization he becomes a part of.
177
+ projects:
178
+ - name: EduWeb
179
+ url: https://www.eduweb.xyz/
180
+ description: A web-based educational platform for interactive learning
181
+ startDate: Sep 2016
182
+ endDate: Dec 2016
183
+ summary: |
184
+ - Designed to enhance online learning experiences
185
+ - Facilitates students' engagement and collaboration through interactive features and user-friendly interface
186
+ - Offers a wide range of courses across various subjects
187
+ - Aims to improve the way students learn through the power of the web
188
+ keywords:
189
+ - Education
190
+ - Online Learning
191
+ - HCI
192
+ interests:
193
+ - name: Sports
194
+ keywords:
195
+ - Soccer
196
+ - Swimming
197
+ - Bicycling
198
+ - Hiking
199
+ - name: Music
200
+ keywords:
201
+ - Piano
202
+ - Guitar
203
+ volunteer:
204
+ - organization: USC Computer Science and Engineering Society
205
+ url: https://www.usccsesociety.org/
206
+ position: Tech Mentor
207
+ startDate: Sep 2015
208
+ endDate: Jul 2023
209
+ summary: |
210
+ - Volunteered as a Tech Mentor at USC Computer Science and Engineering Society
211
+ - Provided guidance and assistance to fellow students in their technical projects and coursework
212
+ - Assisted in organizing workshops, coding competitions, and networking events for the society members
213
+ - Contributed to fostering a collaborative and supportive environment within the student community
214
+
215
+ layout:
216
+ locale:
217
+ # Use `yamlresume languages list` to get the list of supported languages
218
+ language: en
219
+ margins:
220
+ top: 2.5cm
221
+ left: 1.5cm
222
+ right: 1.5cm
223
+ bottom: 2.5cm
224
+ page:
225
+ showPageNumbers: true
226
+ # Use `yamlresume templates list` to get the list of available templates
227
+ template: moderncv-banking
228
+ typography:
229
+ # LaTeX engine only supports 10pt, 11pt, and 12pt
230
+ fontSize: 11pt