зеркало из https://github.com/microsoft/just.git
Updates
This commit is contained in:
Коммит
2f48d315d7
|
@ -0,0 +1 @@
|
|||
Keep
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>just ___</title>
|
||||
<meta name="generator" content="VuePress 1.6.0">
|
||||
|
||||
<meta name="description" content="The task library that just works">
|
||||
<link rel="preload" href="/just/assets/css/0.styles.fa0e83ef.css" as="style"><link rel="preload" href="/just/assets/js/app.c5a00080.js" as="script"><link rel="preload" href="/just/assets/js/6.8c106c09.js" as="script"><link rel="prefetch" href="/just/assets/js/10.ec3a00de.js"><link rel="prefetch" href="/just/assets/js/11.1f0fc780.js"><link rel="prefetch" href="/just/assets/js/12.cded3740.js"><link rel="prefetch" href="/just/assets/js/13.28b831d4.js"><link rel="prefetch" href="/just/assets/js/14.b6d97962.js"><link rel="prefetch" href="/just/assets/js/15.2cfa3b64.js"><link rel="prefetch" href="/just/assets/js/16.d5ac0dc2.js"><link rel="prefetch" href="/just/assets/js/17.89a044ce.js"><link rel="prefetch" href="/just/assets/js/18.67474a9a.js"><link rel="prefetch" href="/just/assets/js/19.0ffe278b.js"><link rel="prefetch" href="/just/assets/js/2.15fb4ba8.js"><link rel="prefetch" href="/just/assets/js/3.66bc1145.js"><link rel="prefetch" href="/just/assets/js/4.c52e5a5e.js"><link rel="prefetch" href="/just/assets/js/5.5ba86e9f.js"><link rel="prefetch" href="/just/assets/js/7.f49975cf.js"><link rel="prefetch" href="/just/assets/js/8.abe6bde1.js"><link rel="prefetch" href="/just/assets/js/9.6ad6edaa.js">
|
||||
<link rel="stylesheet" href="/just/assets/css/0.styles.fa0e83ef.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-server-rendered="true"><div class="theme-container"><div class="theme-default-content"><h1>404</h1> <blockquote>There's nothing here.</blockquote> <a href="/just/" class="router-link-active">
|
||||
Take me home.
|
||||
</a></div></div><div class="global-ui"></div></div>
|
||||
<script src="/just/assets/js/app.c5a00080.js" defer></script><script src="/just/assets/js/6.8c106c09.js" defer></script>
|
||||
</body>
|
||||
</html>
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="12" height="13"><g stroke-width="2" stroke="#aaa" fill="none"><path d="M11.29 11.71l-4-4"/><circle cx="5" cy="5" r="4"/></g></svg>
|
После Ширина: | Высота: | Размер: 216 B |
|
@ -0,0 +1 @@
|
|||
(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{364:function(t,s,n){"use strict";n.r(s);var a=n(25),e=Object(a.a)({},(function(){var t=this,s=t.$createElement,n=t._self._c||s;return n("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[n("p",[t._v("TypeScript is a very popular compiler. But as the amount of code grows, developers need a way to keep the code looking consistent. "),n("code",[t._v("tslint")]),t._v(" is the de facto linter for TS code.")]),t._v(" "),n("div",{staticClass:"language-tsx extra-class"},[n("pre",{pre:!0,attrs:{class:"language-tsx"}},[n("code",[n("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// just-task.js")]),t._v("\n"),n("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),n("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" tslintTask "),n("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),n("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),n("span",{pre:!0,attrs:{class:"token string"}},[t._v("'just-scripts'")]),n("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),n("span",{pre:!0,attrs:{class:"token function"}},[t._v("task")]),n("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),n("span",{pre:!0,attrs:{class:"token string"}},[t._v("'tslint'")]),n("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),n("span",{pre:!0,attrs:{class:"token function"}},[t._v("tslintTask")]),n("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),n("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),n("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),n("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])])])}),[],!1,null,null,null);s.default=e.exports}}]);
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -0,0 +1 @@
|
|||
(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{321:function(t,e,n){},354:function(t,e,n){"use strict";var i=n(321);n.n(i).a},374:function(t,e,n){"use strict";n.r(e);var i={functional:!0,props:{type:{type:String,default:"tip"},text:String,vertical:{type:String,default:"top"}},render:function(t,e){var n=e.props,i=e.slots;return t("span",{class:["badge",n.type],style:{verticalAlign:n.vertical}},n.text||i().default)}},r=(n(354),n(25)),a=Object(r.a)(i,void 0,void 0,!1,null,"15b7b770",null);e.default=a.exports}}]);
|
|
@ -0,0 +1 @@
|
|||
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{322:function(e,t,c){},355:function(e,t,c){"use strict";var i=c(322);c.n(i).a},360:function(e,t,c){"use strict";c.r(t);var i={name:"CodeBlock",props:{title:{type:String,required:!0},active:{type:Boolean,default:!1}}},n=(c(355),c(25)),a=Object(n.a)(i,(function(){var e=this.$createElement;return(this._self._c||e)("div",{staticClass:"theme-code-block",class:{"theme-code-block__active":this.active}},[this._t("default")],2)}),[],!1,null,"6d04095e",null);t.default=a.exports}}]);
|
|
@ -0,0 +1 @@
|
|||
(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{323:function(e,t,o){},356:function(e,t,o){"use strict";var a=o(323);o.n(a).a},361:function(e,t,o){"use strict";o.r(t);o(20),o(67),o(65),o(69);var a={name:"CodeGroup",data:function(){return{codeTabs:[],activeCodeTabIndex:-1}},watch:{activeCodeTabIndex:function(e){this.codeTabs.forEach((function(e){e.elm.classList.remove("theme-code-block__active")})),this.codeTabs[e].elm.classList.add("theme-code-block__active")}},mounted:function(){var e=this;this.codeTabs=(this.$slots.default||[]).filter((function(e){return Boolean(e.componentOptions)})).map((function(t,o){return""===t.componentOptions.propsData.active&&(e.activeCodeTabIndex=o),{title:t.componentOptions.propsData.title,elm:t.elm}})),-1===this.activeCodeTabIndex&&this.codeTabs.length>0&&(this.activeCodeTabIndex=0)},methods:{changeCodeTab:function(e){this.activeCodeTabIndex=e}}},n=(o(356),o(25)),c=Object(n.a)(a,(function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"theme-code-group"},[o("div",{staticClass:"theme-code-group__nav"},e._l(e.codeTabs,(function(t,a){return o("button",{key:t.title,staticClass:"theme-code-group__nav-tab",class:{"theme-code-group__nav-tab-active":a===e.activeCodeTabIndex},on:{click:function(t){return e.changeCodeTab(a)}}},[e._v("\n "+e._s(t.title)+"\n ")])})),0),e._v(" "),e._t("default"),e._v(" "),e.codeTabs.length<1?o("pre",{staticClass:"pre-blank"},[e._v("// Make sure to add code blocks to your code group")]):e._e()],2)}),[],!1,null,"996f6ed8",null);t.default=c.exports}}]);
|
|
@ -0,0 +1 @@
|
|||
(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{359:function(t,e,s){"use strict";s.r(e);var n=["There's nothing here.","How did we get here?","That's a Four-Oh-Four.","Looks like we've got some broken links."],o={methods:{getMsg:function(){return n[Math.floor(Math.random()*n.length)]}}},i=s(25),h=Object(i.a)(o,(function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"theme-container"},[e("div",{staticClass:"theme-default-content"},[e("h1",[this._v("404")]),this._v(" "),e("blockquote",[this._v(this._s(this.getMsg()))]),this._v(" "),e("RouterLink",{attrs:{to:"/"}},[this._v("\n Take me home.\n ")])],1)])}),[],!1,null,null,null);e.default=h.exports}}]);
|
|
@ -0,0 +1 @@
|
|||
(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{363:function(t,e,n){"use strict";n.r(e);var s=n(25),l=Object(s.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}})}),[],!1,null,null,null);e.default=l.exports}}]);
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>just ___</title>
|
||||
<meta name="generator" content="VuePress 1.6.0">
|
||||
|
||||
<meta name="description" content="The task library that just works">
|
||||
<link rel="preload" href="/just/assets/css/0.styles.fa0e83ef.css" as="style"><link rel="preload" href="/just/assets/js/app.c5a00080.js" as="script"><link rel="preload" href="/just/assets/js/2.15fb4ba8.js" as="script"><link rel="preload" href="/just/assets/js/7.f49975cf.js" as="script"><link rel="prefetch" href="/just/assets/js/10.ec3a00de.js"><link rel="prefetch" href="/just/assets/js/11.1f0fc780.js"><link rel="prefetch" href="/just/assets/js/12.cded3740.js"><link rel="prefetch" href="/just/assets/js/13.28b831d4.js"><link rel="prefetch" href="/just/assets/js/14.b6d97962.js"><link rel="prefetch" href="/just/assets/js/15.2cfa3b64.js"><link rel="prefetch" href="/just/assets/js/16.d5ac0dc2.js"><link rel="prefetch" href="/just/assets/js/17.89a044ce.js"><link rel="prefetch" href="/just/assets/js/18.67474a9a.js"><link rel="prefetch" href="/just/assets/js/19.0ffe278b.js"><link rel="prefetch" href="/just/assets/js/3.66bc1145.js"><link rel="prefetch" href="/just/assets/js/4.c52e5a5e.js"><link rel="prefetch" href="/just/assets/js/5.5ba86e9f.js"><link rel="prefetch" href="/just/assets/js/6.8c106c09.js"><link rel="prefetch" href="/just/assets/js/8.abe6bde1.js"><link rel="prefetch" href="/just/assets/js/9.6ad6edaa.js">
|
||||
<link rel="stylesheet" href="/just/assets/css/0.styles.fa0e83ef.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-server-rendered="true"><div class="theme-container no-sidebar"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/just/" aria-current="page" class="home-link router-link-exact-active router-link-active"><!----> <span class="site-name">just ___</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/just/" aria-current="page" class="nav-link router-link-exact-active router-link-active">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/just/" aria-current="page" class="nav-link router-link-exact-active router-link-active">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><a href="/just/" aria-current="page" class="active sidebar-link">Home</a></li><li><section class="sidebar-group depth-0"><a href="/just/tasks" class="sidebar-heading clickable"><span>Tasks</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/tasks/composition.html" class="sidebar-link">Composition of tasks</a></li><li><a href="/just/tasks/logging.html" class="sidebar-link">Logging</a></li><li><a href="/just/tasks/args.html" class="sidebar-link">Command line arguments</a></li><li><a href="/just/tasks/condition.html" class="sidebar-link">Controlling Task Flow with Conditionals</a></li><li><a href="/just/tasks/thunk.html" class="sidebar-link">Higher Order Task Functions</a></li></ul></section></li><li><section class="sidebar-group depth-0"><a href="/just/scripts" class="sidebar-heading clickable"><span>Scripts</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/scripts/typescript.html" class="sidebar-link">TypeScript</a></li><li><a href="/just/scripts/webpack.html" class="sidebar-link">Webpack</a></li><li><a href="/just/scripts/lint.html" class="sidebar-link">TypeScript Lint</a></li><li><a href="/just/scripts/jest.html" class="sidebar-link">Jest</a></li></ul></section></li></ul> </aside> <main aria-labelledby="main-title" class="home"><header class="hero"><!----> <h1 id="main-title">
|
||||
The task library that just works
|
||||
</h1> <p class="description">
|
||||
A sensible set of task to build, test, and lint your frontend projects
|
||||
</p> <p class="action"><a href="/just/tasks/" class="nav-link action-button">
|
||||
Get Started →
|
||||
</a></p></header> <div class="features"><div class="feature"><h2>Flexible</h2> <p>Unlike create-react-app, just gives sensible defaults but does not hide config files</p></div><div class="feature"><h2>Task orchestration</h2> <p>Like gulp, just provides parallel() and series() to fine tune task runs</p></div><div class="feature"><h2>No waiting for latest devDependencies</h2> <p>just-scripts knows how to run tools, but it does not prescribe versions of the dependencies - you upgrade at your own timing!</p></div><div class="feature"><h2>TypeScript suport</h2> <p>just-scripts configurations are TypeScript-enabled, so you don't have to have a separate build step to use your build tools</p></div><div class="feature"><h2>Lightweight task orchestration</h2> <p>just-task is a lightweight task orchestrator that has no streaming file system abstraction</p></div><div class="feature"><h2>Battle tested</h2> <p>just is built upon just the right abstraction from the gulp ecosystem, which is used by many repos</p></div></div> <div class="theme-default-content custom content__default"></div> <div class="footer">
|
||||
MIT Licensed | Copyright © 2020-present Microsoft
|
||||
</div></main></div><div class="global-ui"></div></div>
|
||||
<script src="/just/assets/js/app.c5a00080.js" defer></script><script src="/just/assets/js/2.15fb4ba8.js" defer></script><script src="/just/assets/js/7.f49975cf.js" defer></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Just Scripts | just ___</title>
|
||||
<meta name="generator" content="VuePress 1.6.0">
|
||||
|
||||
<meta name="description" content="The task library that just works">
|
||||
<link rel="preload" href="/just/assets/css/0.styles.fa0e83ef.css" as="style"><link rel="preload" href="/just/assets/js/app.c5a00080.js" as="script"><link rel="preload" href="/just/assets/js/2.15fb4ba8.js" as="script"><link rel="preload" href="/just/assets/js/8.abe6bde1.js" as="script"><link rel="prefetch" href="/just/assets/js/10.ec3a00de.js"><link rel="prefetch" href="/just/assets/js/11.1f0fc780.js"><link rel="prefetch" href="/just/assets/js/12.cded3740.js"><link rel="prefetch" href="/just/assets/js/13.28b831d4.js"><link rel="prefetch" href="/just/assets/js/14.b6d97962.js"><link rel="prefetch" href="/just/assets/js/15.2cfa3b64.js"><link rel="prefetch" href="/just/assets/js/16.d5ac0dc2.js"><link rel="prefetch" href="/just/assets/js/17.89a044ce.js"><link rel="prefetch" href="/just/assets/js/18.67474a9a.js"><link rel="prefetch" href="/just/assets/js/19.0ffe278b.js"><link rel="prefetch" href="/just/assets/js/3.66bc1145.js"><link rel="prefetch" href="/just/assets/js/4.c52e5a5e.js"><link rel="prefetch" href="/just/assets/js/5.5ba86e9f.js"><link rel="prefetch" href="/just/assets/js/6.8c106c09.js"><link rel="prefetch" href="/just/assets/js/7.f49975cf.js"><link rel="prefetch" href="/just/assets/js/9.6ad6edaa.js">
|
||||
<link rel="stylesheet" href="/just/assets/css/0.styles.fa0e83ef.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/just/" class="home-link router-link-active"><!----> <span class="site-name">just ___</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><a href="/just/" aria-current="page" class="sidebar-link">Home</a></li><li><section class="sidebar-group depth-0"><a href="/just/tasks" class="sidebar-heading clickable"><span>Tasks</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/tasks/composition.html" class="sidebar-link">Composition of tasks</a></li><li><a href="/just/tasks/logging.html" class="sidebar-link">Logging</a></li><li><a href="/just/tasks/args.html" class="sidebar-link">Command line arguments</a></li><li><a href="/just/tasks/condition.html" class="sidebar-link">Controlling Task Flow with Conditionals</a></li><li><a href="/just/tasks/thunk.html" class="sidebar-link">Higher Order Task Functions</a></li></ul></section></li><li><section class="sidebar-group depth-0"><a href="/just/scripts" aria-current="page" class="sidebar-heading clickable router-link-exact-active router-link-active"><span>Scripts</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/scripts/typescript.html" class="sidebar-link">TypeScript</a></li><li><a href="/just/scripts/webpack.html" class="sidebar-link">Webpack</a></li><li><a href="/just/scripts/lint.html" class="sidebar-link">TypeScript Lint</a></li><li><a href="/just/scripts/jest.html" class="sidebar-link">Jest</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><p>Unlike other build libraries, Just strives to be useful from the beginning. You can choose to write your own tasks that call other Node.js tools like TypeScript, jest, and webpack. However, Just includes some script functions to get you up and running immediately. The included tasks are enough to have a very productive environment without dictating a certain stack to be used with Just.</p> <blockquote><p>NOTE: even though <code>just-scripts</code> interacts with <code>typescript</code>, it does not take <code>typescript</code> as a dependency. It assumes that the developers will include that in their own projects. This gives <code>just-scripts</code> the flexibility of targeting many different versions of individual build tools without imposing a version on the consumers.</p></blockquote> <p>These scripts are coded as higher order task functions. Each of these script functions return a task function to be registered as a task in your own <code>just-task.js</code> like this:</p> <div class="language-ts extra-class"><pre class="language-ts"><code><span class="token comment">// just-task.js</span>
|
||||
<span class="token keyword">import</span> <span class="token punctuation">{</span> tscTask <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'just-scripts'</span><span class="token punctuation">;</span>
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'ts'</span><span class="token punctuation">,</span> <span class="token function">tscTask</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><p>Generally, these higher order functions also take an <code>options</code> argument to generate a specific task function preconfigured according to the options. For example:</p> <div class="language-ts extra-class"><pre class="language-ts"><code><span class="token comment">// just-task.js</span>
|
||||
<span class="token keyword">import</span> <span class="token punctuation">{</span> tscTask <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'just-scripts'</span><span class="token punctuation">;</span>
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'ts:commonjs'</span><span class="token punctuation">,</span> <span class="token function">tscTask</span><span class="token punctuation">(</span><span class="token punctuation">{</span> <span class="token keyword">module</span><span class="token operator">:</span> <span class="token string">'commonjs'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'ts:esnext'</span><span class="token punctuation">,</span> <span class="token function">tscTask</span><span class="token punctuation">(</span><span class="token punctuation">{</span> <span class="token keyword">module</span><span class="token operator">:</span> <span class="token string">'esnext'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><p>Something like this will give you two separate TypeScript compilation task functions that produce different kinds of module output format.</p></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"></div></div>
|
||||
<script src="/just/assets/js/app.c5a00080.js" defer></script><script src="/just/assets/js/2.15fb4ba8.js" defer></script><script src="/just/assets/js/8.abe6bde1.js" defer></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Jest | just ___</title>
|
||||
<meta name="generator" content="VuePress 1.6.0">
|
||||
|
||||
<meta name="description" content="The task library that just works">
|
||||
<link rel="preload" href="/just/assets/css/0.styles.fa0e83ef.css" as="style"><link rel="preload" href="/just/assets/js/app.c5a00080.js" as="script"><link rel="preload" href="/just/assets/js/2.15fb4ba8.js" as="script"><link rel="preload" href="/just/assets/js/9.6ad6edaa.js" as="script"><link rel="prefetch" href="/just/assets/js/10.ec3a00de.js"><link rel="prefetch" href="/just/assets/js/11.1f0fc780.js"><link rel="prefetch" href="/just/assets/js/12.cded3740.js"><link rel="prefetch" href="/just/assets/js/13.28b831d4.js"><link rel="prefetch" href="/just/assets/js/14.b6d97962.js"><link rel="prefetch" href="/just/assets/js/15.2cfa3b64.js"><link rel="prefetch" href="/just/assets/js/16.d5ac0dc2.js"><link rel="prefetch" href="/just/assets/js/17.89a044ce.js"><link rel="prefetch" href="/just/assets/js/18.67474a9a.js"><link rel="prefetch" href="/just/assets/js/19.0ffe278b.js"><link rel="prefetch" href="/just/assets/js/3.66bc1145.js"><link rel="prefetch" href="/just/assets/js/4.c52e5a5e.js"><link rel="prefetch" href="/just/assets/js/5.5ba86e9f.js"><link rel="prefetch" href="/just/assets/js/6.8c106c09.js"><link rel="prefetch" href="/just/assets/js/7.f49975cf.js"><link rel="prefetch" href="/just/assets/js/8.abe6bde1.js">
|
||||
<link rel="stylesheet" href="/just/assets/css/0.styles.fa0e83ef.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/just/" class="home-link router-link-active"><!----> <span class="site-name">just ___</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><a href="/just/" aria-current="page" class="sidebar-link">Home</a></li><li><section class="sidebar-group depth-0"><a href="/just/tasks" class="sidebar-heading clickable"><span>Tasks</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/tasks/composition.html" class="sidebar-link">Composition of tasks</a></li><li><a href="/just/tasks/logging.html" class="sidebar-link">Logging</a></li><li><a href="/just/tasks/args.html" class="sidebar-link">Command line arguments</a></li><li><a href="/just/tasks/condition.html" class="sidebar-link">Controlling Task Flow with Conditionals</a></li><li><a href="/just/tasks/thunk.html" class="sidebar-link">Higher Order Task Functions</a></li></ul></section></li><li><section class="sidebar-group depth-0"><a href="/just/scripts" class="sidebar-heading clickable router-link-active open"><span>Scripts</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/scripts/typescript.html" class="sidebar-link">TypeScript</a></li><li><a href="/just/scripts/webpack.html" class="sidebar-link">Webpack</a></li><li><a href="/just/scripts/lint.html" class="sidebar-link">TypeScript Lint</a></li><li><a href="/just/scripts/jest.html" aria-current="page" class="active sidebar-link">Jest</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/just/scripts/jest.html#available-options" class="sidebar-link">Available Options</a></li></ul></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><p>Jest is one of the most popular testing libraries in the Javascript ecosystem. It is also a preset supported out of the box inside the <code>just-scripts</code> library. Similar to the other presets, this task function assumes that you have a <code>jest.config.js</code> at the root of the project.</p> <div class="language-tsx extra-class"><pre class="language-tsx"><code><span class="token comment">// just-task.js</span>
|
||||
<span class="token keyword">import</span> <span class="token punctuation">{</span> jestTask <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'just-scripts'</span><span class="token punctuation">;</span>
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'test'</span><span class="token punctuation">,</span> <span class="token function">jestTask</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><p>You can pass in a few options like any another preset tasks in the <code>just-scripts</code> library.</p> <div class="language-tsx extra-class"><pre class="language-tsx"><code><span class="token comment">// just-task.js</span>
|
||||
<span class="token keyword">import</span> <span class="token punctuation">{</span> jestTask <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'just-scripts'</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token keyword">const</span> options <span class="token operator">=</span> <span class="token punctuation">{</span>
|
||||
runInBand<span class="token operator">:</span> <span class="token boolean">true</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'test'</span><span class="token punctuation">,</span> <span class="token function">jestTask</span><span class="token punctuation">(</span>options<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><h2 id="available-options"><a href="#available-options" class="header-anchor">#</a> Available Options</h2> <h3 id="config"><a href="#config" class="header-anchor">#</a> config</h3> <p>You can pass in a different <code>jest.config.js</code> file to the <code>jestTask()</code>.</p> <h3 id="runinband"><a href="#runinband" class="header-anchor">#</a> runInBand</h3> <p>This causes the <code>jest</code> runner to run the tests in a single thread.</p> <h3 id="coverage"><a href="#coverage" class="header-anchor">#</a> coverage</h3> <p>This causes <code>jest</code> to collect coverage information. It is much slower, and therefore is turned OFF by default.</p> <h3 id="updatesnapshots"><a href="#updatesnapshots" class="header-anchor">#</a> updateSnapshots</h3> <p>This causes the <code>jestTask()</code> to update snapshots. Configuration of the snapshot location is subject to the <code>jest.config.js</code> file.</p></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
|
||||
←
|
||||
<a href="/just/scripts/lint.html" class="prev">
|
||||
TypeScript Lint
|
||||
</a></span> <!----></p></div> </main></div><div class="global-ui"></div></div>
|
||||
<script src="/just/assets/js/app.c5a00080.js" defer></script><script src="/just/assets/js/2.15fb4ba8.js" defer></script><script src="/just/assets/js/9.6ad6edaa.js" defer></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>TypeScript Lint | just ___</title>
|
||||
<meta name="generator" content="VuePress 1.6.0">
|
||||
|
||||
<meta name="description" content="The task library that just works">
|
||||
<link rel="preload" href="/just/assets/css/0.styles.fa0e83ef.css" as="style"><link rel="preload" href="/just/assets/js/app.c5a00080.js" as="script"><link rel="preload" href="/just/assets/js/2.15fb4ba8.js" as="script"><link rel="preload" href="/just/assets/js/10.ec3a00de.js" as="script"><link rel="prefetch" href="/just/assets/js/11.1f0fc780.js"><link rel="prefetch" href="/just/assets/js/12.cded3740.js"><link rel="prefetch" href="/just/assets/js/13.28b831d4.js"><link rel="prefetch" href="/just/assets/js/14.b6d97962.js"><link rel="prefetch" href="/just/assets/js/15.2cfa3b64.js"><link rel="prefetch" href="/just/assets/js/16.d5ac0dc2.js"><link rel="prefetch" href="/just/assets/js/17.89a044ce.js"><link rel="prefetch" href="/just/assets/js/18.67474a9a.js"><link rel="prefetch" href="/just/assets/js/19.0ffe278b.js"><link rel="prefetch" href="/just/assets/js/3.66bc1145.js"><link rel="prefetch" href="/just/assets/js/4.c52e5a5e.js"><link rel="prefetch" href="/just/assets/js/5.5ba86e9f.js"><link rel="prefetch" href="/just/assets/js/6.8c106c09.js"><link rel="prefetch" href="/just/assets/js/7.f49975cf.js"><link rel="prefetch" href="/just/assets/js/8.abe6bde1.js"><link rel="prefetch" href="/just/assets/js/9.6ad6edaa.js">
|
||||
<link rel="stylesheet" href="/just/assets/css/0.styles.fa0e83ef.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/just/" class="home-link router-link-active"><!----> <span class="site-name">just ___</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><a href="/just/" aria-current="page" class="sidebar-link">Home</a></li><li><section class="sidebar-group depth-0"><a href="/just/tasks" class="sidebar-heading clickable"><span>Tasks</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/tasks/composition.html" class="sidebar-link">Composition of tasks</a></li><li><a href="/just/tasks/logging.html" class="sidebar-link">Logging</a></li><li><a href="/just/tasks/args.html" class="sidebar-link">Command line arguments</a></li><li><a href="/just/tasks/condition.html" class="sidebar-link">Controlling Task Flow with Conditionals</a></li><li><a href="/just/tasks/thunk.html" class="sidebar-link">Higher Order Task Functions</a></li></ul></section></li><li><section class="sidebar-group depth-0"><a href="/just/scripts" class="sidebar-heading clickable router-link-active open"><span>Scripts</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/scripts/typescript.html" class="sidebar-link">TypeScript</a></li><li><a href="/just/scripts/webpack.html" class="sidebar-link">Webpack</a></li><li><a href="/just/scripts/lint.html" aria-current="page" class="active sidebar-link">TypeScript Lint</a></li><li><a href="/just/scripts/jest.html" class="sidebar-link">Jest</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><p>TypeScript is a very popular compiler. But as the amount of code grows, developers need a way to keep the code looking consistent. <code>tslint</code> is the de facto linter for TS code.</p> <div class="language-tsx extra-class"><pre class="language-tsx"><code><span class="token comment">// just-task.js</span>
|
||||
<span class="token keyword">import</span> <span class="token punctuation">{</span> tslintTask <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'just-scripts'</span><span class="token punctuation">;</span>
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'tslint'</span><span class="token punctuation">,</span> <span class="token function">tslintTask</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
|
||||
←
|
||||
<a href="/just/scripts/webpack.html" class="prev">
|
||||
Webpack
|
||||
</a></span> <span class="next"><a href="/just/scripts/jest.html">
|
||||
Jest
|
||||
</a>
|
||||
→
|
||||
</span></p></div> </main></div><div class="global-ui"></div></div>
|
||||
<script src="/just/assets/js/app.c5a00080.js" defer></script><script src="/just/assets/js/2.15fb4ba8.js" defer></script><script src="/just/assets/js/10.ec3a00de.js" defer></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>TypeScript | just ___</title>
|
||||
<meta name="generator" content="VuePress 1.6.0">
|
||||
|
||||
<meta name="description" content="The task library that just works">
|
||||
<link rel="preload" href="/just/assets/css/0.styles.fa0e83ef.css" as="style"><link rel="preload" href="/just/assets/js/app.c5a00080.js" as="script"><link rel="preload" href="/just/assets/js/2.15fb4ba8.js" as="script"><link rel="preload" href="/just/assets/js/11.1f0fc780.js" as="script"><link rel="prefetch" href="/just/assets/js/10.ec3a00de.js"><link rel="prefetch" href="/just/assets/js/12.cded3740.js"><link rel="prefetch" href="/just/assets/js/13.28b831d4.js"><link rel="prefetch" href="/just/assets/js/14.b6d97962.js"><link rel="prefetch" href="/just/assets/js/15.2cfa3b64.js"><link rel="prefetch" href="/just/assets/js/16.d5ac0dc2.js"><link rel="prefetch" href="/just/assets/js/17.89a044ce.js"><link rel="prefetch" href="/just/assets/js/18.67474a9a.js"><link rel="prefetch" href="/just/assets/js/19.0ffe278b.js"><link rel="prefetch" href="/just/assets/js/3.66bc1145.js"><link rel="prefetch" href="/just/assets/js/4.c52e5a5e.js"><link rel="prefetch" href="/just/assets/js/5.5ba86e9f.js"><link rel="prefetch" href="/just/assets/js/6.8c106c09.js"><link rel="prefetch" href="/just/assets/js/7.f49975cf.js"><link rel="prefetch" href="/just/assets/js/8.abe6bde1.js"><link rel="prefetch" href="/just/assets/js/9.6ad6edaa.js">
|
||||
<link rel="stylesheet" href="/just/assets/css/0.styles.fa0e83ef.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/just/" class="home-link router-link-active"><!----> <span class="site-name">just ___</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><a href="/just/" aria-current="page" class="sidebar-link">Home</a></li><li><section class="sidebar-group depth-0"><a href="/just/tasks" class="sidebar-heading clickable"><span>Tasks</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/tasks/composition.html" class="sidebar-link">Composition of tasks</a></li><li><a href="/just/tasks/logging.html" class="sidebar-link">Logging</a></li><li><a href="/just/tasks/args.html" class="sidebar-link">Command line arguments</a></li><li><a href="/just/tasks/condition.html" class="sidebar-link">Controlling Task Flow with Conditionals</a></li><li><a href="/just/tasks/thunk.html" class="sidebar-link">Higher Order Task Functions</a></li></ul></section></li><li><section class="sidebar-group depth-0"><a href="/just/scripts" class="sidebar-heading clickable router-link-active open"><span>Scripts</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/scripts/typescript.html" aria-current="page" class="active sidebar-link">TypeScript</a></li><li><a href="/just/scripts/webpack.html" class="sidebar-link">Webpack</a></li><li><a href="/just/scripts/lint.html" class="sidebar-link">TypeScript Lint</a></li><li><a href="/just/scripts/jest.html" class="sidebar-link">Jest</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><p>TypeScript is a very popular compiler that allows developers to use modern ES6 features as well as a very mature typing system. The benefits are so great that it has become one of the first presets supported by the <code>just-scripts</code> library.</p> <p>Given a library with TypeScript source code, it might be desirable to have multiple output formats for different audiences. By default, the <code>tscTask()</code> function looks for the <code>tsconfig.json</code> present in the project root. The preset higher order function can take in an option that overrides compilation options. The TypeScript compiler options are passed to the <code>tsc.js</code> script.</p> <p>A list of available options are located at the <a href="http://www.typescriptlang.org/docs/handbook/compiler-options.html" target="_blank" rel="noopener noreferrer">TypeScript documentation site<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>. The options passed into the preset function will be passed in as command line arguments as a string.</p> <div class="language-tsx extra-class"><pre class="language-tsx"><code><span class="token comment">// just-task.js</span>
|
||||
<span class="token keyword">import</span> <span class="token punctuation">{</span> tscTask <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'just-scripts'</span><span class="token punctuation">;</span>
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'ts'</span><span class="token punctuation">,</span> <span class="token function">tscTask</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><p>For variety, try having two kinds of output at the same time (built in parallel)</p> <div class="language-tsx extra-class"><pre class="language-tsx"><code><span class="token comment">// just-task.js</span>
|
||||
<span class="token keyword">import</span> <span class="token punctuation">{</span> parallel <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'just-task'</span><span class="token punctuation">;</span>
|
||||
<span class="token keyword">import</span> <span class="token punctuation">{</span> tscTask <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'just-scripts'</span><span class="token punctuation">;</span>
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'ts:commonjs'</span><span class="token punctuation">,</span> <span class="token function">tscTask</span><span class="token punctuation">(</span><span class="token punctuation">{</span> <span class="token keyword">module</span><span class="token operator">:</span> <span class="token string">'commonjs'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'ts:esnext'</span><span class="token punctuation">,</span> <span class="token function">tscTask</span><span class="token punctuation">(</span><span class="token punctuation">{</span> <span class="token keyword">module</span><span class="token operator">:</span> <span class="token string">'esnext'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'ts'</span><span class="token punctuation">,</span> <span class="token function">parallel</span><span class="token punctuation">(</span><span class="token string">'ts:commonjs'</span><span class="token punctuation">,</span> <span class="token string">'ts:esnext'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
|
||||
←
|
||||
<a href="/just/tasks/thunk.html" class="prev">
|
||||
Higher Order Task Functions
|
||||
</a></span> <span class="next"><a href="/just/scripts/webpack.html">
|
||||
Webpack
|
||||
</a>
|
||||
→
|
||||
</span></p></div> </main></div><div class="global-ui"></div></div>
|
||||
<script src="/just/assets/js/app.c5a00080.js" defer></script><script src="/just/assets/js/2.15fb4ba8.js" defer></script><script src="/just/assets/js/11.1f0fc780.js" defer></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Webpack | just ___</title>
|
||||
<meta name="generator" content="VuePress 1.6.0">
|
||||
|
||||
<meta name="description" content="The task library that just works">
|
||||
<link rel="preload" href="/just/assets/css/0.styles.fa0e83ef.css" as="style"><link rel="preload" href="/just/assets/js/app.c5a00080.js" as="script"><link rel="preload" href="/just/assets/js/2.15fb4ba8.js" as="script"><link rel="preload" href="/just/assets/js/12.cded3740.js" as="script"><link rel="prefetch" href="/just/assets/js/10.ec3a00de.js"><link rel="prefetch" href="/just/assets/js/11.1f0fc780.js"><link rel="prefetch" href="/just/assets/js/13.28b831d4.js"><link rel="prefetch" href="/just/assets/js/14.b6d97962.js"><link rel="prefetch" href="/just/assets/js/15.2cfa3b64.js"><link rel="prefetch" href="/just/assets/js/16.d5ac0dc2.js"><link rel="prefetch" href="/just/assets/js/17.89a044ce.js"><link rel="prefetch" href="/just/assets/js/18.67474a9a.js"><link rel="prefetch" href="/just/assets/js/19.0ffe278b.js"><link rel="prefetch" href="/just/assets/js/3.66bc1145.js"><link rel="prefetch" href="/just/assets/js/4.c52e5a5e.js"><link rel="prefetch" href="/just/assets/js/5.5ba86e9f.js"><link rel="prefetch" href="/just/assets/js/6.8c106c09.js"><link rel="prefetch" href="/just/assets/js/7.f49975cf.js"><link rel="prefetch" href="/just/assets/js/8.abe6bde1.js"><link rel="prefetch" href="/just/assets/js/9.6ad6edaa.js">
|
||||
<link rel="stylesheet" href="/just/assets/css/0.styles.fa0e83ef.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/just/" class="home-link router-link-active"><!----> <span class="site-name">just ___</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><a href="/just/" aria-current="page" class="sidebar-link">Home</a></li><li><section class="sidebar-group depth-0"><a href="/just/tasks" class="sidebar-heading clickable"><span>Tasks</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/tasks/composition.html" class="sidebar-link">Composition of tasks</a></li><li><a href="/just/tasks/logging.html" class="sidebar-link">Logging</a></li><li><a href="/just/tasks/args.html" class="sidebar-link">Command line arguments</a></li><li><a href="/just/tasks/condition.html" class="sidebar-link">Controlling Task Flow with Conditionals</a></li><li><a href="/just/tasks/thunk.html" class="sidebar-link">Higher Order Task Functions</a></li></ul></section></li><li><section class="sidebar-group depth-0"><a href="/just/scripts" class="sidebar-heading clickable router-link-active open"><span>Scripts</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/scripts/typescript.html" class="sidebar-link">TypeScript</a></li><li><a href="/just/scripts/webpack.html" aria-current="page" class="active sidebar-link">Webpack</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/just/scripts/webpack.html#example-webpack-config-js-and-webpack-serve-config-js" class="sidebar-link">Example webpack.config.js and webpack.serve.config.js</a></li><li class="sidebar-sub-header"><a href="/just/scripts/webpack.html#overlays" class="sidebar-link">Overlays</a></li></ul></li><li><a href="/just/scripts/lint.html" class="sidebar-link">TypeScript Lint</a></li><li><a href="/just/scripts/jest.html" class="sidebar-link">Jest</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><p>Webpack is the Javascript, CSS and asset bundler that powers some of the largest Web applications. Just Scripts comes with great integration with Webpack out of the box. All of the power of Webpack comes at the cost of complexity in its configuration. The bundler actually comes with great defaults. However, it takes some non-trivial amount of config to make it work with transpilers like TypeScript.</p> <p><code>just-scripts</code> exports a flexible Webpack <code>just-task</code> task function. Unlike <code>create-react-app</code>, <code>just-scripts</code> does not require ejecting to allow customizations of the Webpack configuration. <code>just-scripts</code> abstracts the complexity of the configuration with what is known as "Overlays". For example, to add support of TypeScript transpilation, several parts of the configuration needs to be changed to support the various parts of building with TypeScript.</p> <p>This task function will look for two files at the root of the project:</p> <ul><li>webpack.config.js</li> <li>webpack.serve.config.js</li></ul> <p>The Webpack task function will use <code>webpack.config.js</code> for its optimized production builds. It will use the <code>webpack.serve.config.js</code> for innerloop development.</p> <h2 id="example-webpack-config-js-and-webpack-serve-config-js"><a href="#example-webpack-config-js-and-webpack-serve-config-js" class="header-anchor">#</a> Example <code>webpack.config.js</code> and <code>webpack.serve.config.js</code></h2> <p>The <code>webpack.config.js</code> and <code>webpack.serve.config.js</code> can be completely customized to your own needs. However, some great utilities from <code>just-scripts</code> make it really easy to get going. Take a look at an example <code>webpack.config.js</code> that uses these utilities:</p> <div class="language-ts extra-class"><pre class="language-ts"><code><span class="token keyword">const</span> <span class="token punctuation">{</span> webpackMerge<span class="token punctuation">,</span> htmlOverlay<span class="token punctuation">,</span> webpackServeConfig <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">require</span><span class="token punctuation">(</span><span class="token string">'just-scripts'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token keyword">module</span><span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token function">webpackMerge</span><span class="token punctuation">(</span>webpackServeConfig<span class="token punctuation">,</span> htmlOverlay<span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><p>From this example, several concepts are illustrated. First, you can see that <code>just-scripts</code> exposes:</p> <ul><li><code>webpackMerge</code>: this is just a thin wrapper on top of the excellent <code>webpack-merge</code> package</li> <li><code>webpackServeConfig</code>: this a very basic preset configuration that you can use as a baseline, there is also a <code>webpackConfig</code> module exported that you can use for your <code>webpack.config.js</code></li> <li><code>htmlOverlay</code>: this is one of the overlays that adds some functionality to Webpack to be merged by the <code>webpack-merge</code> utility</li></ul> <h2 id="overlays"><a href="#overlays" class="header-anchor">#</a> Overlays</h2> <p>These overlays are not configurable (for now), but they do provide a great baseline to start from.</p> <ul><li><code>fileOverlay</code>: This adds the <code>file-loader</code> to allow loading SVG, PNG, GIF, JPG files</li> <li><code>htmlOverlay</code>: This adds the <code>html-webpack-plugin</code> that generates the right code to include scripts and other assets into your <code>index.html</code></li> <li><code>stylesOverlay</code>: This adds styling support for both CSS and Sass</li> <li><code>tsOverlay</code>: This adds a <code>ts-loader</code> transpilation support for TypeScript files while configuring a <code>fork-ts-checker-webpack-plugin</code> for typechecking in a separate process for the fastest compilation experience</li></ul></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
|
||||
←
|
||||
<a href="/just/scripts/typescript.html" class="prev">
|
||||
TypeScript
|
||||
</a></span> <span class="next"><a href="/just/scripts/lint.html">
|
||||
TypeScript Lint
|
||||
</a>
|
||||
→
|
||||
</span></p></div> </main></div><div class="global-ui"></div></div>
|
||||
<script src="/just/assets/js/app.c5a00080.js" defer></script><script src="/just/assets/js/2.15fb4ba8.js" defer></script><script src="/just/assets/js/12.cded3740.js" defer></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Command line arguments | just ___</title>
|
||||
<meta name="generator" content="VuePress 1.6.0">
|
||||
|
||||
<meta name="description" content="The task library that just works">
|
||||
<link rel="preload" href="/just/assets/css/0.styles.fa0e83ef.css" as="style"><link rel="preload" href="/just/assets/js/app.c5a00080.js" as="script"><link rel="preload" href="/just/assets/js/2.15fb4ba8.js" as="script"><link rel="preload" href="/just/assets/js/14.b6d97962.js" as="script"><link rel="prefetch" href="/just/assets/js/10.ec3a00de.js"><link rel="prefetch" href="/just/assets/js/11.1f0fc780.js"><link rel="prefetch" href="/just/assets/js/12.cded3740.js"><link rel="prefetch" href="/just/assets/js/13.28b831d4.js"><link rel="prefetch" href="/just/assets/js/15.2cfa3b64.js"><link rel="prefetch" href="/just/assets/js/16.d5ac0dc2.js"><link rel="prefetch" href="/just/assets/js/17.89a044ce.js"><link rel="prefetch" href="/just/assets/js/18.67474a9a.js"><link rel="prefetch" href="/just/assets/js/19.0ffe278b.js"><link rel="prefetch" href="/just/assets/js/3.66bc1145.js"><link rel="prefetch" href="/just/assets/js/4.c52e5a5e.js"><link rel="prefetch" href="/just/assets/js/5.5ba86e9f.js"><link rel="prefetch" href="/just/assets/js/6.8c106c09.js"><link rel="prefetch" href="/just/assets/js/7.f49975cf.js"><link rel="prefetch" href="/just/assets/js/8.abe6bde1.js"><link rel="prefetch" href="/just/assets/js/9.6ad6edaa.js">
|
||||
<link rel="stylesheet" href="/just/assets/css/0.styles.fa0e83ef.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/just/" class="home-link router-link-active"><!----> <span class="site-name">just ___</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><a href="/just/" aria-current="page" class="sidebar-link">Home</a></li><li><section class="sidebar-group depth-0"><a href="/just/tasks" class="sidebar-heading clickable router-link-active open"><span>Tasks</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/tasks/composition.html" class="sidebar-link">Composition of tasks</a></li><li><a href="/just/tasks/logging.html" class="sidebar-link">Logging</a></li><li><a href="/just/tasks/args.html" aria-current="page" class="active sidebar-link">Command line arguments</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/just/tasks/args.html#reading-arguments" class="sidebar-link">Reading arguments</a></li><li class="sidebar-sub-header"><a href="/just/tasks/args.html#describe-the-task-with-option" class="sidebar-link">Describe the task with option()</a></li><li class="sidebar-sub-header"><a href="/just/tasks/args.html#automatically-generated-task-help-usage" class="sidebar-link">Automatically Generated Task Help Usage</a></li></ul></li><li><a href="/just/tasks/condition.html" class="sidebar-link">Controlling Task Flow with Conditionals</a></li><li><a href="/just/tasks/thunk.html" class="sidebar-link">Higher Order Task Functions</a></li></ul></section></li><li><section class="sidebar-group depth-0"><a href="/just/scripts" class="sidebar-heading clickable"><span>Scripts</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/scripts/typescript.html" class="sidebar-link">TypeScript</a></li><li><a href="/just/scripts/webpack.html" class="sidebar-link">Webpack</a></li><li><a href="/just/scripts/lint.html" class="sidebar-link">TypeScript Lint</a></li><li><a href="/just/scripts/jest.html" class="sidebar-link">Jest</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><p><code>just-task</code> uses the best pirate themed command line argument library ever: <code>yargs</code>, matey! So, rigs get documented pretty much automatically. However, tasks can customize the arguments that are accepted. <code>just-task</code> exposes these via <code>this.argv</code> inside a task function.</p> <h2 id="reading-arguments"><a href="#reading-arguments" class="header-anchor">#</a> Reading arguments</h2> <p>To read the arguments passed in from command line, use the <code>argv()</code> function provided by <code>yargs</code>.</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">const</span> <span class="token punctuation">{</span> task<span class="token punctuation">,</span> argv <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-task'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'pillageMeArgs'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
logger<span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token string">'a bunch of aarrrrrrgs'</span><span class="token punctuation">,</span> <span class="token function">argv</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><h2 id="describe-the-task-with-option"><a href="#describe-the-task-with-option" class="header-anchor">#</a> Describe the task with <code>option()</code></h2> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">const</span> <span class="token punctuation">{</span> task<span class="token punctuation">,</span> logger<span class="token punctuation">,</span> option<span class="token punctuation">,</span> argv <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-task'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">option</span><span class="token punctuation">(</span><span class="token string">'name'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'blimey'</span><span class="token punctuation">,</span> <span class="token string">'An exclamation of surprise.'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
logger<span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">blimey! </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span><span class="token function">argv</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>name<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><p>The <code>option()</code> function is the same one exposed by <code>yargs.option()</code> - so you can look up that <a href="http://yargs.js.org/docs/#api-optionkey-opt" target="_blank" rel="noopener noreferrer"><code>option()</code> documentation<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> for what is possible.</p> <h2 id="automatically-generated-task-help-usage"><a href="#automatically-generated-task-help-usage" class="header-anchor">#</a> Automatically Generated Task Help Usage</h2> <p>If you describe the task in this fashion, you can get a list of tasks with descriptions like this:</p> <div class="language- extra-class"><pre class="language-text"><code>just --help
|
||||
just blimey --help
|
||||
</code></pre></div></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
|
||||
←
|
||||
<a href="/just/tasks/logging.html" class="prev">
|
||||
Logging
|
||||
</a></span> <span class="next"><a href="/just/tasks/condition.html">
|
||||
Controlling Task Flow with Conditionals
|
||||
</a>
|
||||
→
|
||||
</span></p></div> </main></div><div class="global-ui"></div></div>
|
||||
<script src="/just/assets/js/app.c5a00080.js" defer></script><script src="/just/assets/js/2.15fb4ba8.js" defer></script><script src="/just/assets/js/14.b6d97962.js" defer></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,70 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Composition of tasks | just ___</title>
|
||||
<meta name="generator" content="VuePress 1.6.0">
|
||||
|
||||
<meta name="description" content="The task library that just works">
|
||||
<link rel="preload" href="/just/assets/css/0.styles.fa0e83ef.css" as="style"><link rel="preload" href="/just/assets/js/app.c5a00080.js" as="script"><link rel="preload" href="/just/assets/js/2.15fb4ba8.js" as="script"><link rel="preload" href="/just/assets/js/15.2cfa3b64.js" as="script"><link rel="prefetch" href="/just/assets/js/10.ec3a00de.js"><link rel="prefetch" href="/just/assets/js/11.1f0fc780.js"><link rel="prefetch" href="/just/assets/js/12.cded3740.js"><link rel="prefetch" href="/just/assets/js/13.28b831d4.js"><link rel="prefetch" href="/just/assets/js/14.b6d97962.js"><link rel="prefetch" href="/just/assets/js/16.d5ac0dc2.js"><link rel="prefetch" href="/just/assets/js/17.89a044ce.js"><link rel="prefetch" href="/just/assets/js/18.67474a9a.js"><link rel="prefetch" href="/just/assets/js/19.0ffe278b.js"><link rel="prefetch" href="/just/assets/js/3.66bc1145.js"><link rel="prefetch" href="/just/assets/js/4.c52e5a5e.js"><link rel="prefetch" href="/just/assets/js/5.5ba86e9f.js"><link rel="prefetch" href="/just/assets/js/6.8c106c09.js"><link rel="prefetch" href="/just/assets/js/7.f49975cf.js"><link rel="prefetch" href="/just/assets/js/8.abe6bde1.js"><link rel="prefetch" href="/just/assets/js/9.6ad6edaa.js">
|
||||
<link rel="stylesheet" href="/just/assets/css/0.styles.fa0e83ef.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/just/" class="home-link router-link-active"><!----> <span class="site-name">just ___</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><a href="/just/" aria-current="page" class="sidebar-link">Home</a></li><li><section class="sidebar-group depth-0"><a href="/just/tasks" class="sidebar-heading clickable router-link-active open"><span>Tasks</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/tasks/composition.html" aria-current="page" class="active sidebar-link">Composition of tasks</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/just/tasks/composition.html#running-tasks-in-a-series" class="sidebar-link">Running tasks in a series</a></li><li class="sidebar-sub-header"><a href="/just/tasks/composition.html#running-tasks-in-parallel" class="sidebar-link">Running tasks in parallel</a></li><li class="sidebar-sub-header"><a href="/just/tasks/composition.html#nesting-tasks-in-series-and-parallel" class="sidebar-link">Nesting tasks in series and parallel</a></li></ul></li><li><a href="/just/tasks/logging.html" class="sidebar-link">Logging</a></li><li><a href="/just/tasks/args.html" class="sidebar-link">Command line arguments</a></li><li><a href="/just/tasks/condition.html" class="sidebar-link">Controlling Task Flow with Conditionals</a></li><li><a href="/just/tasks/thunk.html" class="sidebar-link">Higher Order Task Functions</a></li></ul></section></li><li><section class="sidebar-group depth-0"><a href="/just/scripts" class="sidebar-heading clickable"><span>Scripts</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/scripts/typescript.html" class="sidebar-link">TypeScript</a></li><li><a href="/just/scripts/webpack.html" class="sidebar-link">Webpack</a></li><li><a href="/just/scripts/lint.html" class="sidebar-link">TypeScript Lint</a></li><li><a href="/just/scripts/jest.html" class="sidebar-link">Jest</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><p>Once a project gets a bit more complex, a build step might consist of multiple sub tasks. This can be achieved with composition. This is the main reason <code>just-task</code> was made. It simplifies the composition of tasks.</p> <h2 id="running-tasks-in-a-series"><a href="#running-tasks-in-a-series" class="header-anchor">#</a> Running tasks in a series</h2> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">const</span> <span class="token punctuation">{</span> task<span class="token punctuation">,</span> series <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-task'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'clean'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
<span class="token comment">// clean stuff</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'babel'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
<span class="token comment">// run babel over some files</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'build'</span><span class="token punctuation">,</span> <span class="token function">series</span><span class="token punctuation">(</span><span class="token string">'clean'</span><span class="token punctuation">,</span> <span class="token string">'babel'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><p>When you trigger <code>just build</code>, the <code>clean</code> task will run and complete before <code>babel</code> task is run.</p> <h2 id="running-tasks-in-parallel"><a href="#running-tasks-in-parallel" class="header-anchor">#</a> Running tasks in parallel</h2> <p>To take advantage of multi-core CPUs on our machines, we can run several tasks in parallel. Simply use the <code>parallel()</code> function.</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">const</span> <span class="token punctuation">{</span> task<span class="token punctuation">,</span> parallel <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-task'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'babel'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
<span class="token comment">// run babel babel over some files</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'lint'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
<span class="token comment">// run eslint over some files</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'build'</span><span class="token punctuation">,</span> <span class="token function">parallel</span><span class="token punctuation">(</span><span class="token string">'babel'</span><span class="token punctuation">,</span> <span class="token string">'lint'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><h2 id="nesting-tasks-in-series-and-parallel"><a href="#nesting-tasks-in-series-and-parallel" class="header-anchor">#</a> Nesting tasks in series and parallel</h2> <p>The most powerful feature of <code>just-task</code> is its ability to compose tasks by nesting tasks in series and parallel. Let's combine the previous examples.</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">const</span> <span class="token punctuation">{</span> task<span class="token punctuation">,</span> parallel<span class="token punctuation">,</span> series <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-task'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'babel'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
<span class="token comment">// run babel babel over some files</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'lint'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
<span class="token comment">// run eslint over some files</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'build'</span><span class="token punctuation">,</span> <span class="token function">series</span><span class="token punctuation">(</span><span class="token string">'clean'</span><span class="token punctuation">,</span> <span class="token function">parallel</span><span class="token punctuation">(</span><span class="token string">'babel'</span><span class="token punctuation">,</span> <span class="token string">'lint'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
|
||||
←
|
||||
<a href="/just/" class="prev router-link-active">
|
||||
Home
|
||||
</a></span> <span class="next"><a href="/just/tasks/logging.html">
|
||||
Logging
|
||||
</a>
|
||||
→
|
||||
</span></p></div> </main></div><div class="global-ui"></div></div>
|
||||
<script src="/just/assets/js/app.c5a00080.js" defer></script><script src="/just/assets/js/2.15fb4ba8.js" defer></script><script src="/just/assets/js/15.2cfa3b64.js" defer></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,78 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Controlling Task Flow with Conditionals | just ___</title>
|
||||
<meta name="generator" content="VuePress 1.6.0">
|
||||
|
||||
<meta name="description" content="The task library that just works">
|
||||
<link rel="preload" href="/just/assets/css/0.styles.fa0e83ef.css" as="style"><link rel="preload" href="/just/assets/js/app.c5a00080.js" as="script"><link rel="preload" href="/just/assets/js/2.15fb4ba8.js" as="script"><link rel="preload" href="/just/assets/js/16.d5ac0dc2.js" as="script"><link rel="prefetch" href="/just/assets/js/10.ec3a00de.js"><link rel="prefetch" href="/just/assets/js/11.1f0fc780.js"><link rel="prefetch" href="/just/assets/js/12.cded3740.js"><link rel="prefetch" href="/just/assets/js/13.28b831d4.js"><link rel="prefetch" href="/just/assets/js/14.b6d97962.js"><link rel="prefetch" href="/just/assets/js/15.2cfa3b64.js"><link rel="prefetch" href="/just/assets/js/17.89a044ce.js"><link rel="prefetch" href="/just/assets/js/18.67474a9a.js"><link rel="prefetch" href="/just/assets/js/19.0ffe278b.js"><link rel="prefetch" href="/just/assets/js/3.66bc1145.js"><link rel="prefetch" href="/just/assets/js/4.c52e5a5e.js"><link rel="prefetch" href="/just/assets/js/5.5ba86e9f.js"><link rel="prefetch" href="/just/assets/js/6.8c106c09.js"><link rel="prefetch" href="/just/assets/js/7.f49975cf.js"><link rel="prefetch" href="/just/assets/js/8.abe6bde1.js"><link rel="prefetch" href="/just/assets/js/9.6ad6edaa.js">
|
||||
<link rel="stylesheet" href="/just/assets/css/0.styles.fa0e83ef.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/just/" class="home-link router-link-active"><!----> <span class="site-name">just ___</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><a href="/just/" aria-current="page" class="sidebar-link">Home</a></li><li><section class="sidebar-group depth-0"><a href="/just/tasks" class="sidebar-heading clickable router-link-active open"><span>Tasks</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/tasks/composition.html" class="sidebar-link">Composition of tasks</a></li><li><a href="/just/tasks/logging.html" class="sidebar-link">Logging</a></li><li><a href="/just/tasks/args.html" class="sidebar-link">Command line arguments</a></li><li><a href="/just/tasks/condition.html" aria-current="page" class="active sidebar-link">Controlling Task Flow with Conditionals</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/just/tasks/condition.html#running-tasks-in-a-series" class="sidebar-link">Running tasks in a series</a></li></ul></li><li><a href="/just/tasks/thunk.html" class="sidebar-link">Higher Order Task Functions</a></li></ul></section></li><li><section class="sidebar-group depth-0"><a href="/just/scripts" class="sidebar-heading clickable"><span>Scripts</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/scripts/typescript.html" class="sidebar-link">TypeScript</a></li><li><a href="/just/scripts/webpack.html" class="sidebar-link">Webpack</a></li><li><a href="/just/scripts/lint.html" class="sidebar-link">TypeScript Lint</a></li><li><a href="/just/scripts/jest.html" class="sidebar-link">Jest</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><p>Sometimes a <code>just-task.js</code> includes tasks that are skipped depending on the arguments that are given. Use a <code>condition()</code> function to decide to run a task or to skip it.</p> <h2 id="running-tasks-in-a-series"><a href="#running-tasks-in-a-series" class="header-anchor">#</a> Running tasks in a series</h2> <p>As we have seen, tasks can be run in a series.</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">const</span> <span class="token punctuation">{</span> task<span class="token punctuation">,</span> series <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-task'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'clean'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
<span class="token comment">// clean stuff</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'babel'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
<span class="token comment">// run babel over some files</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'test'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
<span class="token comment">// run babel over some files</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'build'</span><span class="token punctuation">,</span> <span class="token function">series</span><span class="token punctuation">(</span><span class="token string">'clean'</span><span class="token punctuation">,</span> <span class="token string">'babel'</span><span class="token punctuation">,</span> <span class="token string">'test'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><p>We can conditionally skip the <code>test</code> task by some argument like <code>--skip-test</code></p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">const</span> <span class="token punctuation">{</span> task<span class="token punctuation">,</span> series<span class="token punctuation">,</span> option<span class="token punctuation">,</span> argv<span class="token punctuation">,</span> condition <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-task'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token comment">// First define a 'skip-test' option</span>
|
||||
<span class="token function">option</span><span class="token punctuation">(</span><span class="token string">'skip-test'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'clean'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
<span class="token comment">// clean stuff</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'babel'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
<span class="token comment">// run babel over some files</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'test'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
<span class="token comment">// run babel over some files</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span>
|
||||
<span class="token string">'build'</span><span class="token punctuation">,</span>
|
||||
<span class="token function">series</span><span class="token punctuation">(</span>
|
||||
<span class="token string">'clean'</span><span class="token punctuation">,</span>
|
||||
<span class="token string">'babel'</span><span class="token punctuation">,</span>
|
||||
<span class="token function">condition</span><span class="token punctuation">(</span><span class="token string">'test'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token operator">!</span><span class="token function">argv</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token string">'skip-test'</span><span class="token punctuation">]</span><span class="token punctuation">)</span>
|
||||
<span class="token punctuation">)</span>
|
||||
<span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><p>Now you can skip the test task by passing an argument like this:</p> <div class="language-sh extra-class"><pre class="language-sh"><code>$ just build --skip-test
|
||||
</code></pre></div></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
|
||||
←
|
||||
<a href="/just/tasks/args.html" class="prev">
|
||||
Command line arguments
|
||||
</a></span> <span class="next"><a href="/just/tasks/thunk.html">
|
||||
Higher Order Task Functions
|
||||
</a>
|
||||
→
|
||||
</span></p></div> </main></div><div class="global-ui"></div></div>
|
||||
<script src="/just/assets/js/app.c5a00080.js" defer></script><script src="/just/assets/js/2.15fb4ba8.js" defer></script><script src="/just/assets/js/16.d5ac0dc2.js" defer></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Getting Started with Just | just ___</title>
|
||||
<meta name="generator" content="VuePress 1.6.0">
|
||||
|
||||
<meta name="description" content="The task library that just works">
|
||||
<link rel="preload" href="/just/assets/css/0.styles.fa0e83ef.css" as="style"><link rel="preload" href="/just/assets/js/app.c5a00080.js" as="script"><link rel="preload" href="/just/assets/js/2.15fb4ba8.js" as="script"><link rel="preload" href="/just/assets/js/13.28b831d4.js" as="script"><link rel="prefetch" href="/just/assets/js/10.ec3a00de.js"><link rel="prefetch" href="/just/assets/js/11.1f0fc780.js"><link rel="prefetch" href="/just/assets/js/12.cded3740.js"><link rel="prefetch" href="/just/assets/js/14.b6d97962.js"><link rel="prefetch" href="/just/assets/js/15.2cfa3b64.js"><link rel="prefetch" href="/just/assets/js/16.d5ac0dc2.js"><link rel="prefetch" href="/just/assets/js/17.89a044ce.js"><link rel="prefetch" href="/just/assets/js/18.67474a9a.js"><link rel="prefetch" href="/just/assets/js/19.0ffe278b.js"><link rel="prefetch" href="/just/assets/js/3.66bc1145.js"><link rel="prefetch" href="/just/assets/js/4.c52e5a5e.js"><link rel="prefetch" href="/just/assets/js/5.5ba86e9f.js"><link rel="prefetch" href="/just/assets/js/6.8c106c09.js"><link rel="prefetch" href="/just/assets/js/7.f49975cf.js"><link rel="prefetch" href="/just/assets/js/8.abe6bde1.js"><link rel="prefetch" href="/just/assets/js/9.6ad6edaa.js">
|
||||
<link rel="stylesheet" href="/just/assets/css/0.styles.fa0e83ef.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/just/" class="home-link router-link-active"><!----> <span class="site-name">just ___</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><a href="/just/" aria-current="page" class="sidebar-link">Home</a></li><li><section class="sidebar-group depth-0"><a href="/just/tasks" aria-current="page" class="sidebar-heading clickable router-link-exact-active router-link-active"><span>Tasks</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/tasks/composition.html" class="sidebar-link">Composition of tasks</a></li><li><a href="/just/tasks/logging.html" class="sidebar-link">Logging</a></li><li><a href="/just/tasks/args.html" class="sidebar-link">Command line arguments</a></li><li><a href="/just/tasks/condition.html" class="sidebar-link">Controlling Task Flow with Conditionals</a></li><li><a href="/just/tasks/thunk.html" class="sidebar-link">Higher Order Task Functions</a></li></ul></section></li><li><section class="sidebar-group depth-0"><a href="/just/scripts" class="sidebar-heading clickable"><span>Scripts</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/scripts/typescript.html" class="sidebar-link">TypeScript</a></li><li><a href="/just/scripts/webpack.html" class="sidebar-link">Webpack</a></li><li><a href="/just/scripts/lint.html" class="sidebar-link">TypeScript Lint</a></li><li><a href="/just/scripts/jest.html" class="sidebar-link">Jest</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><p><code>Just</code> simplifies your life in managing build tasks. It stands on the shoulders of excellent and well tested libraries: undertaker, yargs, and plop.js. We encourage developers to make <code>just-scripts</code> available locally instead of installing <code>just-scripts</code> as a global tool.</p> <div class="language-sh extra-class"><pre class="language-sh"><code><span class="token function">npm</span> i -D just-scripts
|
||||
</code></pre></div><h2 id="defining-tasks"><a href="#defining-tasks" class="header-anchor">#</a> Defining Tasks</h2> <p>Place some task definitions inside <code>just.config.js</code> in your root folder (next to package.json):</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token comment">// CommonJS style</span>
|
||||
<span class="token keyword">const</span> <span class="token punctuation">{</span> task<span class="token punctuation">,</span> option<span class="token punctuation">,</span> logger<span class="token punctuation">,</span> argv <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-scripts'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">option</span><span class="token punctuation">(</span><span class="token string">'name'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> <span class="token keyword">default</span><span class="token operator">:</span> <span class="token string">'world'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'sayhello'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
logger<span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token function">argv</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><h2 id="defining-tasks-in-style-with-typescript"><a href="#defining-tasks-in-style-with-typescript" class="header-anchor">#</a> Defining Tasks in Style with TypeScript</h2> <ol><li>Install <code>ts-node</code> and <code>typescript</code>:</li></ol> <div class="language- extra-class"><pre class="language-text"><code>npm i -D ts-node typescript
|
||||
</code></pre></div><ol start="2"><li>Place tasks inside <code>just.config.ts</code> in your root folder (next to package.json):</li></ol> <div class="language-js extra-class"><pre class="language-js"><code><span class="token comment">// ES Module style</span>
|
||||
<span class="token keyword">import</span> <span class="token punctuation">{</span> task<span class="token punctuation">,</span> option<span class="token punctuation">,</span> logger<span class="token punctuation">,</span> argv <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'just-scripts'</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">option</span><span class="token punctuation">(</span><span class="token string">'name'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> <span class="token keyword">default</span><span class="token operator">:</span> <span class="token string">'world'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'sayhello'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
logger<span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token function">argv</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><h2 id="run-it"><a href="#run-it" class="header-anchor">#</a> Run It!</h2> <p>Then run it! It is best to either place <code>just</code> inside a npm run script or run it with <code>npx</code>:</p> <div class="language-sh extra-class"><pre class="language-sh"><code>$ npx just sayhello
|
||||
$ npx just sayhello --name me
|
||||
</code></pre></div><p>That's all!</p></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"></div></div>
|
||||
<script src="/just/assets/js/app.c5a00080.js" defer></script><script src="/just/assets/js/2.15fb4ba8.js" defer></script><script src="/just/assets/js/13.28b831d4.js" defer></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Logging | just ___</title>
|
||||
<meta name="generator" content="VuePress 1.6.0">
|
||||
|
||||
<meta name="description" content="The task library that just works">
|
||||
<link rel="preload" href="/just/assets/css/0.styles.fa0e83ef.css" as="style"><link rel="preload" href="/just/assets/js/app.c5a00080.js" as="script"><link rel="preload" href="/just/assets/js/2.15fb4ba8.js" as="script"><link rel="preload" href="/just/assets/js/17.89a044ce.js" as="script"><link rel="prefetch" href="/just/assets/js/10.ec3a00de.js"><link rel="prefetch" href="/just/assets/js/11.1f0fc780.js"><link rel="prefetch" href="/just/assets/js/12.cded3740.js"><link rel="prefetch" href="/just/assets/js/13.28b831d4.js"><link rel="prefetch" href="/just/assets/js/14.b6d97962.js"><link rel="prefetch" href="/just/assets/js/15.2cfa3b64.js"><link rel="prefetch" href="/just/assets/js/16.d5ac0dc2.js"><link rel="prefetch" href="/just/assets/js/18.67474a9a.js"><link rel="prefetch" href="/just/assets/js/19.0ffe278b.js"><link rel="prefetch" href="/just/assets/js/3.66bc1145.js"><link rel="prefetch" href="/just/assets/js/4.c52e5a5e.js"><link rel="prefetch" href="/just/assets/js/5.5ba86e9f.js"><link rel="prefetch" href="/just/assets/js/6.8c106c09.js"><link rel="prefetch" href="/just/assets/js/7.f49975cf.js"><link rel="prefetch" href="/just/assets/js/8.abe6bde1.js"><link rel="prefetch" href="/just/assets/js/9.6ad6edaa.js">
|
||||
<link rel="stylesheet" href="/just/assets/css/0.styles.fa0e83ef.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/just/" class="home-link router-link-active"><!----> <span class="site-name">just ___</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><a href="/just/" aria-current="page" class="sidebar-link">Home</a></li><li><section class="sidebar-group depth-0"><a href="/just/tasks" class="sidebar-heading clickable router-link-active open"><span>Tasks</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/tasks/composition.html" class="sidebar-link">Composition of tasks</a></li><li><a href="/just/tasks/logging.html" aria-current="page" class="active sidebar-link">Logging</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/just/tasks/logging.html#usage" class="sidebar-link">Usage</a></li></ul></li><li><a href="/just/tasks/args.html" class="sidebar-link">Command line arguments</a></li><li><a href="/just/tasks/condition.html" class="sidebar-link">Controlling Task Flow with Conditionals</a></li><li><a href="/just/tasks/thunk.html" class="sidebar-link">Higher Order Task Functions</a></li></ul></section></li><li><section class="sidebar-group depth-0"><a href="/just/scripts" class="sidebar-heading clickable"><span>Scripts</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/scripts/typescript.html" class="sidebar-link">TypeScript</a></li><li><a href="/just/scripts/webpack.html" class="sidebar-link">Webpack</a></li><li><a href="/just/scripts/lint.html" class="sidebar-link">TypeScript Lint</a></li><li><a href="/just/scripts/jest.html" class="sidebar-link">Jest</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><p><code>just-task</code> is simple, but it is opinionated. One of the built-in capabilities of <code>just-task</code> is logging. We feel that this is an important enough of a feature to be available by the library.</p> <p>Typically, logging tasks look like the following:</p> <p><img src="assets/typical.png" alt=""></p> <h2 id="usage"><a href="#usage" class="header-anchor">#</a> Usage</h2> <p>To log within the task, simply use the <code>info()</code> function off of the <code>logger</code> object inside a task function.</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">const</span> <span class="token punctuation">{</span> task<span class="token punctuation">,</span> logger <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-task'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'needsLogging'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
logger<span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token string">'log something'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><p>If you want to log an error or warning do it with the <code>logger</code> object's <code>warn()</code> and <code>error()</code> functions. It looks like this following:</p> <p><img src="assets/failure.png" alt=""></p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">const</span> <span class="token punctuation">{</span> task<span class="token punctuation">,</span> logger <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-task'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'needsLogging'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
logger<span class="token punctuation">.</span><span class="token function">warn</span><span class="token punctuation">(</span><span class="token string">'a warning'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
logger<span class="token punctuation">.</span><span class="token function">error</span><span class="token punctuation">(</span><span class="token string">'an error'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><p>If your error is meant to stop the tasks, simply throw an Error:</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">const</span> <span class="token punctuation">{</span> task<span class="token punctuation">,</span> logger <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-task'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'needsLogging'</span><span class="token punctuation">,</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
<span class="token keyword">throw</span> <span class="token keyword">new</span> <span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">'an error'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
|
||||
←
|
||||
<a href="/just/tasks/composition.html" class="prev">
|
||||
Composition of tasks
|
||||
</a></span> <span class="next"><a href="/just/tasks/args.html">
|
||||
Command line arguments
|
||||
</a>
|
||||
→
|
||||
</span></p></div> </main></div><div class="global-ui"></div></div>
|
||||
<script src="/just/assets/js/app.c5a00080.js" defer></script><script src="/just/assets/js/2.15fb4ba8.js" defer></script><script src="/just/assets/js/17.89a044ce.js" defer></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Higher Order Task Functions | just ___</title>
|
||||
<meta name="generator" content="VuePress 1.6.0">
|
||||
|
||||
<meta name="description" content="The task library that just works">
|
||||
<link rel="preload" href="/just/assets/css/0.styles.fa0e83ef.css" as="style"><link rel="preload" href="/just/assets/js/app.c5a00080.js" as="script"><link rel="preload" href="/just/assets/js/2.15fb4ba8.js" as="script"><link rel="preload" href="/just/assets/js/18.67474a9a.js" as="script"><link rel="prefetch" href="/just/assets/js/10.ec3a00de.js"><link rel="prefetch" href="/just/assets/js/11.1f0fc780.js"><link rel="prefetch" href="/just/assets/js/12.cded3740.js"><link rel="prefetch" href="/just/assets/js/13.28b831d4.js"><link rel="prefetch" href="/just/assets/js/14.b6d97962.js"><link rel="prefetch" href="/just/assets/js/15.2cfa3b64.js"><link rel="prefetch" href="/just/assets/js/16.d5ac0dc2.js"><link rel="prefetch" href="/just/assets/js/17.89a044ce.js"><link rel="prefetch" href="/just/assets/js/19.0ffe278b.js"><link rel="prefetch" href="/just/assets/js/3.66bc1145.js"><link rel="prefetch" href="/just/assets/js/4.c52e5a5e.js"><link rel="prefetch" href="/just/assets/js/5.5ba86e9f.js"><link rel="prefetch" href="/just/assets/js/6.8c106c09.js"><link rel="prefetch" href="/just/assets/js/7.f49975cf.js"><link rel="prefetch" href="/just/assets/js/8.abe6bde1.js"><link rel="prefetch" href="/just/assets/js/9.6ad6edaa.js">
|
||||
<link rel="stylesheet" href="/just/assets/css/0.styles.fa0e83ef.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/just/" class="home-link router-link-active"><!----> <span class="site-name">just ___</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/just/" class="nav-link">
|
||||
Home
|
||||
</a></div><div class="nav-item"><a href="/just/guide/" class="nav-link">
|
||||
Guide
|
||||
</a></div><div class="nav-item"><a href="https://github.com/microsoft/just" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
||||
Github
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="outbound-link-title" role="img" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><title id="outbound-link-title">(opens new window)</title> <path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><a href="/just/" aria-current="page" class="sidebar-link">Home</a></li><li><section class="sidebar-group depth-0"><a href="/just/tasks" class="sidebar-heading clickable router-link-active open"><span>Tasks</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/tasks/composition.html" class="sidebar-link">Composition of tasks</a></li><li><a href="/just/tasks/logging.html" class="sidebar-link">Logging</a></li><li><a href="/just/tasks/args.html" class="sidebar-link">Command line arguments</a></li><li><a href="/just/tasks/condition.html" class="sidebar-link">Controlling Task Flow with Conditionals</a></li><li><a href="/just/tasks/thunk.html" aria-current="page" class="active sidebar-link">Higher Order Task Functions</a></li></ul></section></li><li><section class="sidebar-group depth-0"><a href="/just/scripts" class="sidebar-heading clickable"><span>Scripts</span> <!----></a> <ul class="sidebar-links sidebar-group-items"><li><a href="/just/scripts/typescript.html" class="sidebar-link">TypeScript</a></li><li><a href="/just/scripts/webpack.html" class="sidebar-link">Webpack</a></li><li><a href="/just/scripts/lint.html" class="sidebar-link">TypeScript Lint</a></li><li><a href="/just/scripts/jest.html" class="sidebar-link">Jest</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><p>When a project truly gets big enough to have multiple variants of a build, a simple task function might be reused as variants. For example, the <code>just-task-preset</code> package includes a useful collection of task functions like <code>tscTask</code>. However, these tasks tend to be very generic. <code>tscTask()</code> is a task function factory. Calling it will generate a task function. But sometimes variations of the same preconfigured task function is needed. We will use a concept called <code>thunk</code> to create a task function that creates a task function on the fly!</p> <p>Here is an example of a simple usage of a preset task function factory:</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">const</span> <span class="token punctuation">{</span> task <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-task'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token keyword">const</span> <span class="token punctuation">{</span> tscTask <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-task-preset'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'build'</span><span class="token punctuation">,</span> <span class="token function">tscTask</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><p>Now, let's try to preconfigure this task based on something we can pass in from the arguments:</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">const</span> <span class="token punctuation">{</span> task<span class="token punctuation">,</span> argv<span class="token punctuation">,</span> option <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-task'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token keyword">const</span> <span class="token punctuation">{</span> tscTask <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'just-task-preset'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">option</span><span class="token punctuation">(</span><span class="token string">'amd'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
|
||||
<span class="token function">task</span><span class="token punctuation">(</span><span class="token string">'build'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token function">tscTask</span><span class="token punctuation">(</span><span class="token punctuation">{</span> module<span class="token operator">:</span> <span class="token function">argv</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>amd <span class="token operator">?</span> <span class="token string">'amd'</span> <span class="token operator">:</span> <span class="token string">'commonjs'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
</code></pre></div><p>Now the build task can take in an argument and perform TypeScript compilation for different modes:</p> <div class="language-sh extra-class"><pre class="language-sh"><code>$ just build --amd
|
||||
$ just build --commonjs
|
||||
</code></pre></div></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
|
||||
←
|
||||
<a href="/just/tasks/condition.html" class="prev">
|
||||
Controlling Task Flow with Conditionals
|
||||
</a></span> <span class="next"><a href="/just/scripts/typescript.html">
|
||||
TypeScript
|
||||
</a>
|
||||
→
|
||||
</span></p></div> </main></div><div class="global-ui"></div></div>
|
||||
<script src="/just/assets/js/app.c5a00080.js" defer></script><script src="/just/assets/js/2.15fb4ba8.js" defer></script><script src="/just/assets/js/18.67474a9a.js" defer></script>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче