{"componentChunkName":"component---src-templates-post-template-js","path":"/note-delete-file-by-makefile-en","result":{"data":{"markdownRemark":{"id":"36a0ca5d-9592-5bcb-9dfa-3454578ac9b9","html":"<blockquote>\n<p>This page has been machine-translated from the <a href=\"/note-delete-file-by-makefile\">original page</a>.</p>\n</blockquote>\n<p>Have you ever wanted to <strong>compile all TypeScript files in a directory at once</strong> or <strong>delete the compiled JS files</strong> before pushing to GitHub?</p>\n<p>This time, I am sharing a note on the Makefile script I use to achieve that.<br>\nThe script I use is as follows.</p>\n<p><strong><code class=\"language-text\">clear</code> is the script that deletes all JavaScript files under the <code class=\"language-text\">src</code> directory.</strong><br>\nAlso, <strong><code class=\"language-text\">ts_compile</code> is the script that compiles all TypeScript files under the <code class=\"language-text\">src</code> directory.</strong></p>\n<div class=\"gatsby-highlight\" data-language=\"makefile\"><pre class=\"language-makefile\"><code class=\"language-makefile\">SHELL<span class=\"token operator\">=</span>/bin/bash\n\n<span class=\"token target symbol\">clear</span><span class=\"token punctuation\">:</span>\n-find src/ -name *.js -exec rm <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span> \\<span class=\"token punctuation\">;</span>\n\n<span class=\"token target symbol\">ts_compile</span><span class=\"token punctuation\">:</span>\n-find src/ -name *.ts -exec tsc <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span> \\<span class=\"token punctuation\">;</span></code></pre></div>\n<p>By having <code class=\"language-text\">find</code> pass the filenames it finds to <code class=\"language-text\">exec</code>, if no target files are found, the command is skipped without raising an error.</p>\n<h2 id=\"summary\" style=\"position:relative;\"><a href=\"#summary\" aria-label=\"summary permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Summary</h2>\n<p>That is the Makefile script I use in a TypeScript environment.</p>","fields":{"slug":"/note-delete-file-by-makefile-en","tagSlugs":["/tag/notes/","/tag/makefile/","/tag/english/"]},"frontmatter":{"date":"2020-06-23","description":"This is a note about the Makefile script I use to compile TypeScript files in a directory all at once and delete the compiled JS files before pushing to GitHub.","tags":["Notes","Makefile","English"],"title":"A Note on a Makefile for Easily Running TypeScript Compilation and JS File Deletion in Bulk","socialImage":{"publicURL":"/static/dc4d8b7f8795f3c3d3489d9957d155f2/no-image.png"}}}},"pageContext":{"slug":"/note-delete-file-by-makefile-en"}},"staticQueryHashes":["251939775","401334301","825871152"]}