├── .github └── workflows │ └── makefile.yml ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── completions └── projectdo.fish ├── docs ├── logo-dark.png ├── logo-light.png └── version_changer.sh ├── functions ├── projectdo_build.fish ├── projectdo_run.fish ├── projectdo_test.fish └── projectdo_tool.fish ├── man ├── projectdo.1 └── projectdo.1.md ├── package.json ├── projectdo ├── run-tests.sh └── tests ├── build_script └── build.sh ├── bun-lockb ├── bun.lockb └── package.json ├── bun ├── bun.lock └── package.json ├── cargo └── Cargo.toml ├── dotnet-csproj └── test.csproj ├── dotnet-fsproj └── test.fsproj ├── dotnet-sln └── test.sln ├── go └── go.mod ├── gradle └── build.gradle ├── just └── justfile ├── mage ├── go.mod └── magefile.go ├── make-check-with-check-file-and-target ├── Makefile └── check ├── make-check-with-check-file ├── Makefile └── check ├── make-check └── Makefile ├── make-with-npm ├── Makefile └── package.json ├── meson ├── CMakeLists.txt ├── meson.build └── meson.c ├── nix-flake └── flake.nix ├── nix └── default.nix ├── npm-without-test ├── Makefile └── package.json ├── npm └── package.json ├── pnpm ├── package.json └── pnpm-lock.yaml ├── poetry └── pyproject.toml ├── stack ├── package.yaml └── stack.yaml ├── tectonic └── Tectonic.toml ├── uv ├── pyproject.toml └── uv.lock └── yarn ├── package.json └── yarn.lock /.github/workflows/makefile.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Install tools used in tests 15 | run: | 16 | sudo apt install -y just nix-bin gradle 17 | npm install -g pnpm 18 | npm install -g bun 19 | - name: Run tests 20 | run: dash run-tests.sh 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | package-lock.json 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PREFIX ?= /usr 2 | MANDIR = $(PREFIX)/share/man 3 | BINARY_NAME = projectdo 4 | 5 | all: 6 | @echo RUN \'make install\' to install $(BINARY_NAME) 7 | @echo RUN \'make uninstall\' to uninstall $(BINARY_NAME) 8 | @echo RUN \'make manpage\' to generate manpage for $(BINARY_NAME) 9 | @echo RUN \'make test\' to run tests for $(BINARY_NAME) 10 | 11 | install: 12 | @install -Dm755 $(BINARY_NAME) $(DESTDIR)$(PREFIX)/bin/$(BINARY_NAME) 13 | @mkdir -p $(DESTDIR)$(MANDIR)/man1 14 | @cp -p man/$(BINARY_NAME).1 $(DESTDIR)$(MANDIR)/man1 15 | 16 | manpage: 17 | @if [ -n "$(shell command -v pandoc)" ]; then \ 18 | pandoc --standalone --to man man/$(BINARY_NAME).1.md --output man/$(BINARY_NAME).1; \ 19 | echo "SUCCESS: manpage generated"; \ 20 | else \ 21 | echo "ERROR: could not generate manpage. Pandoc not found."; \ 22 | fi 23 | 24 | version: 25 | @sh -c docs/version_changer.sh 26 | 27 | uninstall: 28 | @rm -f $(DESTDIR)$(PREFIX)/bin/$(BINARY_NAME) 29 | @rm -rf $(DESTDIR)$(MANDIR)/man1/$(BINARY_NAME).1* 30 | 31 | test: 32 | sh run-tests.sh 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | projectdo logo 10 | 11 | 12 | Context-aware single-letter project commands to speed up your command-line workflow. 13 | 14 | *   🏗   b to build/compile any project. 15 | *   🚀   r to run/start any project. 16 | *   🧪   t to test any project. 17 | 18 | https://user-images.githubusercontent.com/521604/231857437-12c14aff-585d-4817-8f44-59b40ecc32e0.mov 19 | 20 | * **Supports 20+ build and project tools** – Bun, Cabal, Cargo, CMake, .NET, Go, 21 | Gradle, Leiningen, Mage, Maven, Meson, Poetry, Stack, Tectonic, just, make, 22 | nix, npm, pnpm, and yarn. [More details](#supported-tools-and-languages). 23 | * **Portable** – Dependency free portable POSIX shell script. Supports Linux, 24 | macOS, WSL, etc. 25 | * **Shell Integration** – Works with aliases in any shell and for the Fish 26 | shell through a [Fish plugin](#fish-plugin). 27 | * **Simple** – Easy to extend with support for new tools. 28 | 29 | ## What 30 | 31 | `projectdo` is a command-line program that executes project actions (such as 32 | build, run, test, etc.) with the appropriate tool for current project in the 33 | working directory. The appropriate tool and the current project root is 34 | intelligently detected based on the context where `projectdo` is executed. For 35 | instance, `projectdo test` runs `cargo test` if a `Cargo.toml` is found and 36 | `npm test` if a `package.json` file is found. 37 | 38 | By combining `projectdo` with shell aliases or shell abbreviations project 39 | commands can be run in any project with less typing. As an example, with the 40 | alias `alias b='projectdo build'` one can build any project simply by typing 41 | b+enter. 42 | 43 | ## Install 44 | 45 | `projectdo` can be installed through a number of package managers or by 46 | manually downloading the shell script. 47 | 48 | ### Homebrew 49 | 50 | `projectdo` can be installed with Homebrew on macOS and Linux. 51 | 52 | ``` 53 | brew install paldepind/tap/projectdo 54 | ``` 55 | 56 | ### AUR (Arch Linux) 57 | 58 | The [AUR package](https://aur.archlinux.org/packages/projectdo) can be installed manually or using an AUR helper. 59 | 60 | ```sh 61 | yay -S projectdo 62 | ``` 63 | 64 | ### npm 65 | 66 | `projectdo` is not related to Node.js or JavaScript, but npm works perfectly 67 | fine for distributing shell scripts and can be a handy installation method if 68 | you're already using npm: 69 | 70 | 71 | ```sh 72 | npm i -g projectdo 73 | ``` 74 | 75 | ### From source 76 | 77 | Download the script and place it somewhere in your path. For instance if 78 | `~/bin` is in your path: 79 | 80 | ``` 81 | curl https://raw.githubusercontent.com/paldepind/projectdo/main/projectdo -o ~/bin/projectdo 82 | chmod +x ~/bin/projectdo 83 | ``` 84 | 85 | #### From repository 86 | 87 | Clone the project repository: 88 | 89 | ```sh 90 | git clone https://github.com/paldepind/projectdo; cd projectdo 91 | ``` 92 | 93 | Install it with this command: 94 | 95 | ```sh 96 | make install 97 | 98 | # Or to uninstall 99 | make uninstall 100 | ``` 101 | 102 | ## Shell integration 103 | 104 | For the Fish shell use [the Fish plugin](#fish-plugin). For Bash and Zsh setup 105 | [shell aliases](#aliases). 106 | 107 | ### Fish Plugin 108 | 109 | `projectdo` ships with a plugin for the Fish shell. The plugin includes 110 | auto-completion and functions for use with Fish's abbreviation feature. 111 | 112 | The Fish plugin can be installed manually or with 113 | [Fisher](https://github.com/jorgebucaran/fisher): 114 | 115 | ``` 116 | fisher install paldepind/projectdo 117 | ``` 118 | 119 | The plugin exposes four shell functions that should be configured with 120 | abbreviations as desired. For instance: 121 | 122 | ``` 123 | abbr -a b --function projectdo_build 124 | abbr -a r --function projectdo_run 125 | abbr -a t --function projectdo_test 126 | abbr -a p --function projectdo_tool 127 | ``` 128 | 129 | With the above `t` will expand to `cargo test`, `p` will expand to `cargo`, 130 | etc. depending on the project. 131 | 132 | _Note that you need to have the script in your path in order for the Fish plugin to work!_ 133 | 134 | ### Aliases 135 | 136 | `projectdo` can be configured with shell aliases in any shell. For instance: 137 | 138 | ```sh 139 | alias t='projectdo test' 140 | alias r='projectdo run' 141 | alias b='projectdo build' 142 | alias p='projectdo tool' 143 | ``` 144 | 145 | ## Usage 146 | 147 | **Note**: When executed with the `-d` flag `projectdo` performs a dry run and 148 | only prints information about what it would do without actually doing anything. 149 | It is a good idea to do a dry run when using `projectdo` in a project for the 150 | first time to verify that it does the right thing. 151 | 152 | ``` 153 | Usage: projectdo [options] [action] [tool-arguments] 154 | Options: 155 | -h, --help Display this help. 156 | -n, -d, --dry-run Do not execute any commands with side-effects. 157 | -q, --quiet Do not print commands as they are about to be executed. 158 | -v, --version Display the version of the program. 159 | 160 | Actions: 161 | build, run, test Build, run, or test the current project. 162 | tool Invoke the guessed tool for the current project. 163 | 164 | Tool arguments: 165 | Any arguments following [action] are passed along to the invoked tool. 166 | ``` 167 | 168 | ## Supported tools and languages 169 | 170 | **Note:** If a tool you are interested in is not supported please open an issue or a pull 171 | request. 172 | 173 | | Tool | Language | Detected by | Commands | 174 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 175 | | bun | JavaScript, etc | `package.json` and `bun.lock`/`bun.lockb` | `bun build`
`bun start`
`bun test` | 176 | | Cabal | Haskell | `*.cabal` | `cabal build`
`cabal run`
`cabal test` | 177 | | Cargo | Rust | `Cargo.toml` | `cargo build`
`cargo run`
`cargo test` | 178 | | CMake | C, C++ and Obj-C | `CMakeLists.txt` | `cmake --build . --target test` | 179 | | Go | Go | `go.mod` | `go test` | 180 | | Gradle | Java, etc. | `build.gradle` or `build.gradle.kts` | `gradle compile`
run n/a
`gradle test` | 181 | | just | Any | `justfile` | `just build`
`just run`
`just test` | 182 | | Leiningen | Clojure | `project.clj` | `lein test` | 183 | | Mage | Go | `magefile.go` with a `test`/`check` target | `mage test/check` | 184 | | make | Any | `Makefile` | `make`
`make test/check` | 185 | | Maven | Java, etc. | `pom.xml` | `mvn compile`
run n/a
`mvn test` | 186 | | Meson | C, C++, etc. | `meson.build` | `meson compile`
run n/a
`meson test` | 187 | | .NET | C# and F# | `*.csproj`, `*.fsproj` or `*.sln` | `dotnet build`
`dotnet run`
`dotnet test` | 188 | | nix (flake) | nix | `flake.nix` | `nix build`
`nix run`
`nix flake check` | 189 | | nix (non-flake) | nix | `default.nix` | `nix-build` | 190 | | npm | JavaScript, etc. | `package.json` | `npm build`
`npm start`
`npm test` | 191 | | pnpm | JavaScript, etc | `package.json` and `pnpm-lock.yaml` | `pnpm build`
`pnpm start`
`pnpm test` | 192 | | Poetry | Python | `pyproject.toml` with `[tool.poetry]` | `poetry build`
run n/a
`poetry run pytest` | 193 | | Shell script | Any | `build.sh` | `sh -c build.sh` | 194 | | Stack | Haskell | `stack.yaml` | `stack build`
`stack run`
`stack test` | 195 | | Tectonic | LaTeX | `Tectonic.toml` | `tectonic -X build` | 196 | | yarn | JavaScript, etc. | `package.json` and `yarn.lock` | `yarn build`
`yarn start`
`yarn test` | -------------------------------------------------------------------------------- /completions/projectdo.fish: -------------------------------------------------------------------------------- 1 | complete -c projectdo --no-files 2 | 3 | set -l commands build run test tool 4 | 5 | # Options 6 | complete -c projectdo -n "not __fish_seen_subcommand_from $commands" \ 7 | -s h -l help -d 'Display usage information' 8 | complete -c projectdo -n "not __fish_seen_subcommand_from $commands" \ 9 | -s d -l 'dry-run' -d 'Do not execute any commands with side-effects' 10 | complete -c projectdo -n "not __fish_seen_subcommand_from $commands" \ 11 | -s q -l quiet -d 'Do not print commands before execution' 12 | complete -c projectdo -n "not __fish_seen_subcommand_from $commands" \ 13 | -s v -l version -d 'Dsiplay the version' 14 | 15 | # Actions 16 | complete -c projectdo -n "not __fish_seen_subcommand_from $commands" \ 17 | -a build -d 'Build the current project' 18 | complete -c projectdo -n "not __fish_seen_subcommand_from $commands" \ 19 | -a run -d 'Run the current project' 20 | complete -c projectdo -n "not __fish_seen_subcommand_from $commands" \ 21 | -a test -d 'Test the current project' 22 | complete -c projectdo -n "not __fish_seen_subcommand_from $commands" \ 23 | -a tool -d 'Invoke the tool corresponding to the current project' 24 | -------------------------------------------------------------------------------- /docs/logo-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paldepind/projectdo/433b36d9fa81293ea9a915d6d21853d3f8bf36f3/docs/logo-dark.png -------------------------------------------------------------------------------- /docs/logo-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paldepind/projectdo/433b36d9fa81293ea9a915d6d21853d3f8bf36f3/docs/logo-light.png -------------------------------------------------------------------------------- /docs/version_changer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # Store current dir 5 | old_dir=$(pwd) 6 | 7 | # Get docs directoy the POSIX way 8 | DOCS_PATH="$0" 9 | if [ ! -e "$DOCS_PATH" ]; then 10 | case $DOCS_PATH in 11 | (*/*) exit 1;; 12 | (*) DOCS_PATH=$(command -v -- "$DOCS_PATH") || exit;; 13 | esac 14 | fi 15 | docs_dir=$( 16 | cd -P -- "$(dirname -- "$DOCS_PATH")" && pwd -P 17 | ) || exit 18 | 19 | # Go into docs dir 20 | cd "$docs_dir" 21 | cd .. 22 | 23 | # Define other dirs 24 | project_dir=$(pwd) 25 | man_dir="${project_dir}/man" 26 | 27 | date=$(date '+%B %d, %Y') 28 | version=$(sh -c "${project_dir}/./projectdo --version" | grep -Eo '[0-9]\.[0-9]\.[0-9]+') 29 | 30 | printf '%s is the current projectdo version.\n' "$version" 31 | printf "What version do you want to change it to?\n: "; read -r ver_choice 32 | 33 | sed -i "s/date\:.*/date: $date/g" "${man_dir}/projectdo.1.md" 34 | 35 | sed -i "s/VERSION=.*/VERSION=\"$ver_choice\"/" "${project_dir}/./projectdo" 36 | printf 'Successfully updated version number to %s in projectdo.\n' "$ver_choice" 37 | 38 | sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$ver_choice\"/g" "${project_dir}/package.json" 39 | printf 'Successfully updated version number to %s in package.json.\n' "$ver_choice" 40 | 41 | sed -i "s/footer\:.*/footer: projectdo $ver_choice/" "${man_dir}/projectdo.1.md" 42 | printf 'Successfully updated version number to %s in projectdo.1.md\n' "$ver_choice" 43 | 44 | printf "Do you want to generate new manpage?\n[Y/n]: "; read -r man_choice 45 | if ! [ "$man_choice" = "n" ]; then 46 | make manpage 47 | fi 48 | 49 | # Go back to the dir where user was before 50 | cd "$old_dir" 51 | 52 | exit 0 53 | -------------------------------------------------------------------------------- /functions/projectdo_build.fish: -------------------------------------------------------------------------------- 1 | function projectdo_build 2 | projectdo -d build 3 | end 4 | -------------------------------------------------------------------------------- /functions/projectdo_run.fish: -------------------------------------------------------------------------------- 1 | function projectdo_run 2 | projectdo -d run 3 | end 4 | -------------------------------------------------------------------------------- /functions/projectdo_test.fish: -------------------------------------------------------------------------------- 1 | function projectdo_test 2 | projectdo -d test 3 | end 4 | -------------------------------------------------------------------------------- /functions/projectdo_tool.fish: -------------------------------------------------------------------------------- 1 | function projectdo_tool 2 | projectdo -d tool 3 | end 4 | -------------------------------------------------------------------------------- /man/projectdo.1: -------------------------------------------------------------------------------- 1 | '\" t 2 | .\" Automatically generated by Pandoc 3.6.4 3 | .\" 4 | .TH "projectdo" "1" "April 24, 2024" "projectdo 0.2.2" "User Manual" 5 | .SH NAME 6 | projectdo \- build, run, test, and more with ease 7 | .SH SYNOPSIS 8 | \f[B]projectdo\f[R] [\f[I]OPTION\f[R]] [\f[I]ACTION\f[R]] \&... 9 | .SH DESCRIPTION 10 | projectdo is a command\-line program that executes project actions (such 11 | as build, run, test, etc.) 12 | with the appropriate tool for current project in the working directory. 13 | The appropriate tool and the current project root is intelligently 14 | detected based on the context where projectdo is executed. 15 | For instance, projectdo test runs cargo test if a Cargo.toml is found 16 | and npm test if a package.json file is found. 17 | .SH OPTIONS 18 | .TP 19 | \f[B]\-h, \f[CB]\-\-\f[B]help\f[R] 20 | display help message 21 | .TP 22 | \f[B]\-n, \-d, \f[CB]\-\-\f[B]dry\-run\f[R] 23 | do not execute any commands with side\-effects 24 | .TP 25 | \f[B]\-q, \f[CB]\-\-\f[B]quiet\f[R] 26 | do not print commands as they are about to be executed 27 | .TP 28 | \f[B]\-v, \f[CB]\-\-\f[B]version\f[R] 29 | prints installed projectdo version. 30 | .SH ACTIONS 31 | .TP 32 | \f[B]build\f[R] 33 | build project in working directory 34 | .TP 35 | \f[B]run\f[R] 36 | run the project in working directory 37 | .TP 38 | \f[B]test\f[R] 39 | test the project in working directory 40 | .TP 41 | \f[B]tool\f[R] 42 | Invoke the guessed tool for the current project 43 | .SH TOOL ARGUMENTS 44 | Any arguments following [action] are passed along to the invoked tool. 45 | .SH SHELL INTEGRATION 46 | .SS FISH 47 | projectdo ships with a plugin for the Fish shell. 48 | The plugin includes auto\-completion and functions for use with 49 | Fish\[cq]s abbreviation feature. 50 | .PP 51 | The Fish plugin can be installed manually or with Fisher (fish plugin 52 | manager): \f[CR]fisher install paldepind/projectdo\f[R] 53 | .PP 54 | The plugin exposes four shell functions that should be configured with 55 | abbreviations as desired. 56 | For instance: 57 | .IP 58 | .EX 59 | abbr \-a b \-\-function projectdo_build 60 | abbr \-a r \-\-function projectdo_run 61 | abbr \-a t \-\-function projectdo_test 62 | abbr \-a p \-\-function projectdo_tool 63 | .EE 64 | .PP 65 | With the above \f[CR]t\f[R] will expand to \f[CR]cargo test\f[R], 66 | \f[CR]p\f[R] will expand to \f[CR]cargo\f[R], etc. 67 | depending on the project. 68 | .SS BASH + OTHERS 69 | projectdo can be configured with shell aliases in any shell. 70 | For instance: 71 | .IP 72 | .EX 73 | alias t=\[aq]projectdo test\[aq] 74 | alias r=\[aq]projectdo run\[aq] 75 | alias b=\[aq]projectdo build\[aq] 76 | alias p=\[aq]projectdo tool\[aq] 77 | .EE 78 | .SH SUPPORTED TOOLS AND LANGUAGES 79 | .PP 80 | .TS 81 | tab(@); 82 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 83 | T{ 84 | Tool 85 | T}@T{ 86 | Language 87 | T}@T{ 88 | Detected by 89 | T}@T{ 90 | Commands 91 | T} 92 | _ 93 | .TE 94 | .PP 95 | .TS 96 | tab(@); 97 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 98 | T{ 99 | bun 100 | T}@T{ 101 | JavaScript, etc 102 | T}@T{ 103 | \f[CR]package.json\f[R] and \f[CR]bun.lock\f[R]/\f[CR]bun.lockb\f[R] 104 | T}@T{ 105 | \f[CR]bun build\f[R], \f[CR]bun start\f[R], \f[CR]bun test\f[R] 106 | T} 107 | _ 108 | .TE 109 | .PP 110 | .TS 111 | tab(@); 112 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 113 | T{ 114 | Cabal 115 | T}@T{ 116 | Haskell 117 | T}@T{ 118 | \f[CR]*.cabal\f[R] 119 | T}@T{ 120 | \f[CR]cabal build\f[R], \f[CR]cabal run\f[R], \f[CR]cabal test\f[R] 121 | T} 122 | _ 123 | .TE 124 | .PP 125 | .TS 126 | tab(@); 127 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 128 | T{ 129 | Cargo 130 | T}@T{ 131 | Rust 132 | T}@T{ 133 | \f[CR]Cargo.toml\f[R] 134 | T}@T{ 135 | \f[CR]cargo build\f[R], \f[CR]cargo run\f[R], \f[CR]cargo test\f[R] 136 | T} 137 | _ 138 | .TE 139 | .PP 140 | .TS 141 | tab(@); 142 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 143 | T{ 144 | CMake 145 | T}@T{ 146 | C, C++ and Obj\-C 147 | T}@T{ 148 | \f[CR]CMakeLists.txt\f[R] 149 | T}@T{ 150 | \f[CR]cmake \-\-build . \-\-target test\f[R] 151 | T} 152 | _ 153 | .TE 154 | .PP 155 | .TS 156 | tab(@); 157 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 158 | T{ 159 | Go 160 | T}@T{ 161 | Go 162 | T}@T{ 163 | \f[CR]go.mod\f[R] 164 | T}@T{ 165 | \f[CR]go test\f[R] 166 | T} 167 | _ 168 | .TE 169 | .PP 170 | .TS 171 | tab(@); 172 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 173 | T{ 174 | Gradle 175 | T}@T{ 176 | Java, etc. 177 | T}@T{ 178 | \f[CR]build.gradle\f[R] or \f[CR]build.gradle.kts\f[R] 179 | T}@T{ 180 | \f[CR]gradle compile\f[R], run n/a, \f[CR]gradle test\f[R] 181 | T} 182 | _ 183 | .TE 184 | .PP 185 | .TS 186 | tab(@); 187 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 188 | T{ 189 | just 190 | T}@T{ 191 | Any 192 | T}@T{ 193 | \f[CR]justfile\f[R] 194 | T}@T{ 195 | \f[CR]just build\f[R], \f[CR]just run\f[R], \f[CR]just test\f[R] 196 | T} 197 | _ 198 | .TE 199 | .PP 200 | .TS 201 | tab(@); 202 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 203 | T{ 204 | Leiningen 205 | T}@T{ 206 | Clojure 207 | T}@T{ 208 | \f[CR]project.clj\f[R] 209 | T}@T{ 210 | \f[CR]lein test\f[R] 211 | T} 212 | _ 213 | .TE 214 | .PP 215 | .TS 216 | tab(@); 217 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 218 | T{ 219 | Mage 220 | T}@T{ 221 | Go 222 | T}@T{ 223 | \f[CR]magefile.go\f[R] with a \f[CR]test\f[R]/\f[CR]check\f[R] target 224 | T}@T{ 225 | \f[CR]mage test/check\f[R] 226 | T} 227 | _ 228 | .TE 229 | .PP 230 | .TS 231 | tab(@); 232 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 233 | T{ 234 | make 235 | T}@T{ 236 | Any 237 | T}@T{ 238 | \f[CR]Makefile\f[R] 239 | T}@T{ 240 | \f[CR]make\f[R], \f[CR]make test/check\f[R] 241 | T} 242 | _ 243 | .TE 244 | .PP 245 | .TS 246 | tab(@); 247 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 248 | T{ 249 | Maven 250 | T}@T{ 251 | Java, etc. 252 | T}@T{ 253 | \f[CR]pom.xml\f[R] 254 | T}@T{ 255 | \f[CR]mvn compile\f[R], run n/a, \f[CR]mvn test\f[R] 256 | T} 257 | _ 258 | .TE 259 | .PP 260 | .TS 261 | tab(@); 262 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 263 | T{ 264 | Meson 265 | T}@T{ 266 | C, C++, etc. 267 | T}@T{ 268 | \f[CR]meson.build\f[R] 269 | T}@T{ 270 | \f[CR]meson compile\f[R], run n/a, \f[CR]meson test\f[R] 271 | T} 272 | _ 273 | .TE 274 | .PP 275 | .TS 276 | tab(@); 277 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 278 | T{ 279 | \&.NET 280 | T}@T{ 281 | C# and F# 282 | T}@T{ 283 | \f[CR]*.csproj\f[R], \f[CR]*.fsproj\f[R] or \f[CR]*.sln\f[R] 284 | T}@T{ 285 | \f[CR]dotnet build\f[R], \f[CR]dotnet run\f[R], \f[CR]dotnet test\f[R] 286 | T} 287 | _ 288 | .TE 289 | .PP 290 | .TS 291 | tab(@); 292 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 293 | T{ 294 | nix (flake) 295 | T}@T{ 296 | nix 297 | T}@T{ 298 | \f[CR]flake.nix\f[R] 299 | T}@T{ 300 | \f[CR]nix build\f[R], \f[CR]nix run\f[R], \f[CR]nix flake check\f[R] 301 | T} 302 | _ 303 | .TE 304 | .PP 305 | .TS 306 | tab(@); 307 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 308 | T{ 309 | nix (non\-flake) 310 | T}@T{ 311 | nix 312 | T}@T{ 313 | \f[CR]default.nix\f[R] 314 | T}@T{ 315 | \f[CR]nix\-build\f[R] 316 | T} 317 | _ 318 | .TE 319 | .PP 320 | .TS 321 | tab(@); 322 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 323 | T{ 324 | npm 325 | T}@T{ 326 | JavaScript, etc. 327 | T}@T{ 328 | \f[CR]package.json\f[R] 329 | T}@T{ 330 | \f[CR]npm build\f[R], \f[CR]npm start\f[R], \f[CR]npm test\f[R] 331 | T} 332 | _ 333 | .TE 334 | .PP 335 | .TS 336 | tab(@); 337 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 338 | T{ 339 | pnpm 340 | T}@T{ 341 | JavaScript, etc 342 | T}@T{ 343 | \f[CR]package.json\f[R] and \f[CR]pnpm\-lock.yaml\f[R] 344 | T}@T{ 345 | \f[CR]pnpm build\f[R], \f[CR]pnpm start\f[R], \f[CR]pnpm test\f[R] 346 | T} 347 | _ 348 | .TE 349 | .PP 350 | .TS 351 | tab(@); 352 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 353 | T{ 354 | Poetry 355 | T}@T{ 356 | Python 357 | T}@T{ 358 | \f[CR]pyproject.toml\f[R] with \f[CR][tool.poetry]\f[R] 359 | T}@T{ 360 | \f[CR]poetry build\f[R], run n/a, \f[CR]poetry run pytest\f[R] 361 | T} 362 | _ 363 | .TE 364 | .PP 365 | .TS 366 | tab(@); 367 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 368 | T{ 369 | Shell script 370 | T}@T{ 371 | Any 372 | T}@T{ 373 | \f[CR]build.sh\f[R] 374 | T}@T{ 375 | \f[CR]sh \-c build.sh\f[R] 376 | T} 377 | _ 378 | .TE 379 | .PP 380 | .TS 381 | tab(@); 382 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 383 | T{ 384 | Stack 385 | T}@T{ 386 | Haskell 387 | T}@T{ 388 | \f[CR]stack.yaml\f[R] 389 | T}@T{ 390 | \f[CR]stack build\f[R], \f[CR]stack run\f[R], \f[CR]stack test\f[R] 391 | T} 392 | _ 393 | .TE 394 | .PP 395 | .TS 396 | tab(@); 397 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 398 | T{ 399 | Tectonic 400 | T}@T{ 401 | LaTeX 402 | T}@T{ 403 | \f[CR]Tectonic.toml\f[R] 404 | T}@T{ 405 | \f[CR]tectonic \-X build\f[R] 406 | T} 407 | _ 408 | .TE 409 | .PP 410 | .TS 411 | tab(@); 412 | lw(8.8n) lw(9.3n) lw(22.8n) lw(29.0n). 413 | T{ 414 | yarn 415 | T}@T{ 416 | JavaScript, etc. 417 | T}@T{ 418 | \f[CR]package.json\f[R] and \f[CR]yarn.lock\f[R] 419 | T}@T{ 420 | \f[CR]yarn build\f[R], \f[CR]yarn start\f[R], \f[CR]yarn test\f[R] 421 | T} 422 | _ 423 | .TE 424 | .SH REPORTING BUGS 425 | Report any bugs you might find here: \c 426 | .UR https://github.com/paldepind/projectdo/issues 427 | .UE \c 428 | -------------------------------------------------------------------------------- /man/projectdo.1.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: projectdo 3 | section: 1 4 | header: User Manual 5 | footer: projectdo 0.2.2 6 | date: April 24, 2024 7 | --- 8 | 9 | # NAME 10 | 11 | projectdo - build, run, test, and more with ease 12 | 13 | # SYNOPSIS 14 | 15 | **projectdo** [*OPTION*] [*ACTION*] ... 16 | 17 | # DESCRIPTION 18 | 19 | projectdo is a command-line program that executes project actions (such as 20 | build, run, test, etc.) with the appropriate tool for current project in the 21 | working directory. The appropriate tool and the current project root is 22 | intelligently detected based on the context where projectdo is executed. For 23 | instance, projectdo test runs cargo test if a Cargo.toml is found and npm test 24 | if a package.json file is found. 25 | 26 | # OPTIONS 27 | 28 | **-h, `--`help** 29 | : display help message 30 | 31 | **-n, -d, `--`dry-run** 32 | : do not execute any commands with side-effects 33 | 34 | **-q, `--`quiet** 35 | : do not print commands as they are about to be executed 36 | 37 | **-v, `--`version** 38 | : prints installed projectdo version. 39 | 40 | # ACTIONS 41 | 42 | **build** 43 | : build project in working directory 44 | 45 | **run** 46 | : run the project in working directory 47 | 48 | **test** 49 | : test the project in working directory 50 | 51 | **tool** 52 | : Invoke the guessed tool for the current project 53 | 54 | # TOOL ARGUMENTS 55 | 56 | Any arguments following [action] are passed along to the invoked tool. 57 | 58 | # SHELL INTEGRATION 59 | 60 | ## FISH 61 | 62 | projectdo ships with a plugin for the Fish shell. The plugin includes 63 | auto-completion and functions for use with Fish's abbreviation feature. 64 | 65 | The Fish plugin can be installed manually or with Fisher (fish plugin manager): 66 | `fisher install paldepind/projectdo` 67 | 68 | The plugin exposes four shell functions that should be configured with 69 | abbreviations as desired. For instance: 70 | 71 | ``` 72 | abbr -a b --function projectdo_build 73 | abbr -a r --function projectdo_run 74 | abbr -a t --function projectdo_test 75 | abbr -a p --function projectdo_tool 76 | ``` 77 | 78 | With the above `t` will expand to `cargo test`, `p` will expand to `cargo`, etc. 79 | depending on the project. 80 | 81 | ## BASH + OTHERS 82 | 83 | projectdo can be configured with shell aliases in any shell. For instance: 84 | 85 | ``` 86 | alias t='projectdo test' 87 | alias r='projectdo run' 88 | alias b='projectdo build' 89 | alias p='projectdo tool' 90 | ``` 91 | 92 | # SUPPORTED TOOLS AND LANGUAGES 93 | 94 | | Tool | Language | Detected by | Commands | 95 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 96 | 97 | | bun | JavaScript, etc | `package.json` and `bun.lock`/`bun.lockb` | `bun build`, `bun start`, `bun test` | 98 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 99 | 100 | | Cabal | Haskell | `*.cabal` | `cabal build`, `cabal run`, `cabal test` | 101 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 102 | 103 | | Cargo | Rust | `Cargo.toml` | `cargo build`, `cargo run`, `cargo test` | 104 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 105 | 106 | | CMake | C, C++ and Obj-C | `CMakeLists.txt` | `cmake --build . --target test` | 107 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 108 | 109 | | Go | Go | `go.mod` | `go test` | 110 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 111 | 112 | | Gradle | Java, etc. | `build.gradle` or `build.gradle.kts` | `gradle compile`, run n/a, `gradle test` | 113 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 114 | 115 | | just | Any | `justfile` | `just build`, `just run`, `just test` | 116 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 117 | 118 | | Leiningen | Clojure | `project.clj` | `lein test` | 119 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 120 | 121 | | Mage | Go | `magefile.go` with a `test`/`check` target | `mage test/check` | 122 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 123 | 124 | | make | Any | `Makefile` | `make`, `make test/check` | 125 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 126 | 127 | | Maven | Java, etc. | `pom.xml` | `mvn compile`, run n/a, `mvn test` | 128 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 129 | 130 | | Meson | C, C++, etc. | `meson.build` | `meson compile`, run n/a, `meson test` | 131 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 132 | 133 | | .NET | C# and F# | `*.csproj`, `*.fsproj` or `*.sln` | `dotnet build`, `dotnet run`, `dotnet test` | 134 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 135 | 136 | | nix (flake) | nix | `flake.nix` | `nix build`, `nix run`, `nix flake check` | 137 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 138 | 139 | | nix (non-flake) | nix | `default.nix` | `nix-build` | 140 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 141 | 142 | | npm | JavaScript, etc. | `package.json` | `npm build`, `npm start`, `npm test` | 143 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 144 | 145 | | pnpm | JavaScript, etc | `package.json` and `pnpm-lock.yaml` | `pnpm build`, `pnpm start`, `pnpm test` | 146 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 147 | 148 | | Poetry | Python | `pyproject.toml` with `[tool.poetry]` | `poetry build`, run n/a, `poetry run pytest` | 149 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 150 | 151 | | Shell script | Any | `build.sh` | `sh -c build.sh` | 152 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 153 | 154 | | Stack | Haskell | `stack.yaml` | `stack build`, `stack run`, `stack test` | 155 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 156 | 157 | | Tectonic | LaTeX | `Tectonic.toml` | `tectonic -X build` | 158 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 159 | 160 | | yarn | JavaScript, etc. | `package.json` and `yarn.lock` | `yarn build`, `yarn start`, `yarn test` | 161 | |-----------------|------------------|--------------------------------------------|--------------------------------------------------------| 162 | 163 | # REPORTING BUGS 164 | 165 | Report any bugs you might find here: 166 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "projectdo", 3 | "version": "0.2.2", 4 | "description": "Context-aware single-letter project commands to speed up your terminal workflow.", 5 | "bin": { 6 | "projectdo": "./projectdo" 7 | }, 8 | "files": [ 9 | "projectdo" 10 | ], 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/paldepind/projectdo.git" 14 | }, 15 | "keywords": [ 16 | "test", 17 | "build", 18 | "run", 19 | "cli", 20 | "project", 21 | "command" 22 | ], 23 | "author": "Simon Friis Vindum", 24 | "license": "GPL-3.0-or-later", 25 | "bugs": { 26 | "url": "https://github.com/paldepind/projectdo/issues" 27 | }, 28 | "homepage": "https://github.com/paldepind/projectdo#readme", 29 | "dependencies": { 30 | "projectdo": "^0.2.0" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /projectdo: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # projectdo – universal project commands. 4 | # Copyright (C) 2019-present Simon Friis Vindum 5 | 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | VERSION="0.2.2" 20 | 21 | # Global mutable variables. 22 | QUIET=false 23 | DRY_RUN=false 24 | PROJECT_ROOT="${PROJECT_ROOT:-}" 25 | ACTION="" 26 | TOOL_ARGS="" # Arguments to pass along to the tool 27 | IS_TOOL=false # True if ACTION is 'tool' as this action is somewhat special. 28 | 29 | has_command() { 30 | command -v "$1" >/dev/null 2>&1 31 | } 32 | 33 | # When running the appropriate external tool this function is used which 34 | # evaluates the given command while respecting $QUIET and $DRY_RUN. 35 | execute() { 36 | if [ $QUIET = false ]; then 37 | echo "$1" $TOOL_ARGS 38 | fi 39 | if [ $DRY_RUN = false ]; then 40 | if [ $QUIET = false ]; then 41 | eval "$1" $TOOL_ARGS 42 | else 43 | eval "$1" $TOOL_ARGS > /dev/null 44 | fi 45 | fi 46 | } 47 | 48 | # Takes the name of a tool and an action. If the action is `tool` it is 49 | # ignored. It handles the common case where the tool is invoked as `tool 50 | # action`. 51 | execute_command() { 52 | if [ "$2" = tool ]; then 53 | execute "$1" 54 | else 55 | execute "$1 $2" 56 | fi 57 | exit 0 58 | } 59 | 60 | # Every supported tool requires a function `try_tool` where `tool` is a name 61 | # indicating what tool the function tries to detect. The function should: 62 | # 63 | # * Return if it does not detect that the tool is appropriate. 64 | # * Read the variables `ACTION` and `IS_TOOL` to determine the correct action 65 | # to run. 66 | # * When running an action is should use the `execute` function and _exit_ when 67 | # it is done. 68 | 69 | # Start list of tools 70 | 71 | # JavaScript + NodeJS 72 | 73 | try_nodejs() { 74 | if [ ! -f package.json ]; then 75 | return 1 76 | fi 77 | if [ -f bun.lock ] || [ -f bun.lockb ]; then 78 | tool=bun 79 | elif [ -f yarn.lock ]; then 80 | tool=yarn 81 | elif [ -f pnpm-lock.yaml ]; then 82 | tool=pnpm 83 | else 84 | tool=npm 85 | fi 86 | if ! has_command $tool; then 87 | echo "Found a package.json file but '$tool' is not installed." 88 | exit 1 89 | fi 90 | node_action="$ACTION" 91 | # Only the "run" action need translation, the others match 1-to-1 92 | if [ "$ACTION" = run ]; then 93 | node_action=start 94 | fi 95 | # We check if the package.json file contains an appropriate script. We use 96 | # grep for this. The check is not 100% bulletproof, but it's very close. We 97 | # could've used `npm run` to get the authorative list of the scripts but 98 | # invoking `npm` is two orders of magnitude slower which leads to a 99 | # noticeable delay. 100 | if ! $IS_TOOL && ! grep -q "^[[:space:]]*\"${node_action}\":" package.json; then 101 | return 0 102 | fi 103 | if [ "$ACTION" = build ]; then 104 | execute_command "$tool" "run build" 105 | else 106 | execute_command "$tool" "$node_action" 107 | fi 108 | } 109 | 110 | # Rust + Cargo 111 | 112 | try_cargo() { 113 | if [ -f Cargo.toml ]; then 114 | execute_command cargo "$ACTION" 115 | fi 116 | } 117 | 118 | # Meson 119 | 120 | try_meson() { 121 | if [ -f meson.build ]; then 122 | case $ACTION in 123 | build) 124 | execute "meson compile" 125 | exit ;; 126 | test) 127 | execute "meson test" 128 | exit ;; 129 | run) 130 | echo "projectdo does not know how to run a project with Meson." 131 | exit 132 | esac 133 | fi 134 | } 135 | 136 | # CMake 137 | 138 | try_cmake() { 139 | if [ -f CMakeLists.txt ] && [ "$ACTION" = test ]; then 140 | if [ -f build ]; then 141 | execute "cmake --build build --target test" 142 | else 143 | execute "cmake --build . --target test" 144 | fi 145 | exit 146 | fi 147 | } 148 | 149 | # Haskell + Stack 150 | 151 | try_stack() { 152 | if [ -f package.yaml ] && [ -f stack.yaml ]; then 153 | execute_command stack "$ACTION" 154 | fi 155 | } 156 | 157 | # Haskell + Cabal 158 | 159 | try_cabal() { 160 | cabal_file="$(find ./ -maxdepth 1 -name "*.cabal" 2> /dev/null | wc -l)" 161 | if [ "$cabal_file" -gt 0 ] && [ ! -f stack.yml ]; then 162 | execute_command cabal "$ACTION" 163 | fi 164 | } 165 | 166 | # Maven 167 | 168 | try_maven() { 169 | if [ -f pom.xml ]; then 170 | case $ACTION in 171 | build) 172 | execute "mvn compile" 173 | exit ;; 174 | test) 175 | execute "mvn test" 176 | exit ;; 177 | run) 178 | echo "projectdo does not know how to run a project with Maven." 179 | exit 180 | esac 181 | fi 182 | } 183 | 184 | # Gradle 185 | 186 | try_gradle() { 187 | if [ -f build.gradle ] || [ -f build.gradle.kts ]; then 188 | case $ACTION in 189 | build) 190 | execute "gradle build" 191 | exit ;; 192 | test) 193 | execute "gradle test" 194 | exit ;; 195 | run) 196 | echo "projectdo does not know how to run a project with Gradle." 197 | exit ;; 198 | esac 199 | fi 200 | } 201 | 202 | # Clojure + Leiningen 203 | 204 | try_lein() { 205 | if [ -f project.clj ] && [ "$ACTION" = test ]; then 206 | execute "lein test" 207 | fi 208 | } 209 | 210 | # justfile 211 | 212 | try_justfile() { 213 | if [ -f justfile ]; then 214 | if ! has_command "just"; then 215 | echo "Found a justfile but 'just' is not installed." 216 | exit 1 217 | fi 218 | execute_command just "$ACTION" 219 | fi 220 | } 221 | 222 | # Makefile 223 | 224 | has_make_target() { 225 | target="${1?}" 226 | output=$(make -n "${target}" 2>&1) 227 | exit_code=$? 228 | if [ $exit_code -ne 0 ]; then 229 | return $exit_code 230 | fi 231 | 232 | # If there is a file with the name of the target we're looking for but no 233 | # actual target with that name, make will exit successfully with that 234 | # message. We need to consider that case as a "target not found". Note that 235 | # the way the target is quoted in the output (`test' vs 'test') can differ 236 | # across OSes so we only check a prefix up to the problematic quotes. 237 | if expr "$output" : "make: Nothing to be done for" 1> /dev/null; then 238 | return 1 239 | fi 240 | 241 | return 0 242 | } 243 | 244 | try_makefile() { 245 | if [ -f Makefile ]; then 246 | if ! has_command "make"; then 247 | echo "Found a Makefile but 'make' is not installed." 248 | exit 1 249 | fi 250 | if $IS_TOOL || [ "$ACTION" = build ]; then 251 | # For make "build" is the default action when running `make` 252 | execute "make" 253 | exit 254 | elif [ "$ACTION" = test ]; then 255 | # Let's see if the makefile contains a test or check target 256 | if has_make_target "test"; then 257 | execute "make test" 258 | exit 259 | elif has_make_target "check"; then 260 | execute "make check" 261 | exit 262 | fi 263 | fi 264 | fi 265 | return 1 266 | } 267 | 268 | # Nix (Flake) 269 | 270 | try_nix_flake() { 271 | if [ -f flake.nix ]; then 272 | if ! has_command "nix"; then 273 | echo "Found a flake.nix file but 'nix' is not installed." 274 | exit 1 275 | fi 276 | if [ "$ACTION" = test ]; then 277 | execute "nix flake check" 278 | exit 279 | else 280 | execute_command nix $ACTION 281 | fi 282 | fi 283 | return 1 284 | } 285 | 286 | # Nix (package) 287 | 288 | try_nix_package() { 289 | if [ -f default.nix ]; then 290 | if ! has_command "nix-build"; then 291 | echo "Found a default.nix file but 'nix' is not installed." 292 | exit 1 293 | fi 294 | if [ "$ACTION" = build ]; then 295 | execute "nix-build" 296 | exit 297 | fi 298 | fi 299 | return 1 300 | } 301 | 302 | # Python 303 | 304 | try_python() { 305 | if [ -f pyproject.toml ]; then 306 | if grep -q -m 1 "^\[tool.poetry\]$" pyproject.toml; then 307 | case $ACTION in 308 | build) 309 | execute "poetry build" 310 | exit ;; 311 | test) 312 | # TODO: There are other Python test frameworks, it would be nice to 313 | # detect and run the right one. 314 | execute "poetry run pytest" 315 | exit ;; 316 | run) 317 | echo "projectdo does not know how to run a project with Poetry." 318 | exit 319 | esac 320 | else if [ -f uv.lock ]; then 321 | case $ACTION in 322 | build) 323 | echo "projectdo does not know how to run a project with uv." 324 | exit ;; 325 | test) 326 | echo "projectdo does not know how to run a project with uv." 327 | exit ;; 328 | run) 329 | execute "uv run" 330 | exit ;; 331 | esac 332 | else 333 | echo "Found a pyproject.toml file but projectdo is not sure how to run it." 334 | exit 335 | fi 336 | fi 337 | return 1 338 | fi 339 | } 340 | 341 | # Go 342 | 343 | try_go() { 344 | if [ -f go.mod ]; then 345 | if [ "$ACTION" = test ]; then 346 | # We detect Makefiles before we detect Go, so here we know that the Go 347 | # project is _not_ tested by a Makefile. 348 | 349 | # Check if the project uses Mage. A magefile could in theory have any name, 350 | # but `magefile.go` seems to be the convention. 351 | if [ -f magefile.go ]; then 352 | if grep -q -m 1 '^func Check(' magefile.go; then 353 | execute "mage check" 354 | exit 355 | elif grep -q -m 1 '^func Test(' magefile.go; then 356 | execute "mage test" 357 | exit 358 | fi 359 | fi 360 | execute "go test" 361 | exit 362 | else 363 | execute_command go "$ACTION" 364 | fi 365 | fi 366 | } 367 | 368 | # LaTeX 369 | 370 | try_latex() { 371 | if [ -f Tectonic.toml ] && [ "$ACTION" = build ]; then 372 | execute "tectonic -X build" 373 | exit 374 | fi 375 | } 376 | 377 | # .NET 378 | 379 | try_dotnet() { 380 | if [ -n "$(find . -maxdepth 1 \( -name '*.csproj' -o -name '*.fsproj' -o -name '*.sln' \) -print -quit)" ]; then 381 | execute_command dotnet "$ACTION" 382 | fi 383 | } 384 | 385 | # Any / Generic 386 | 387 | try_build_script() { 388 | if [ "$ACTION" = build ]; then 389 | if [ -f ./build.sh ]; then 390 | execute "sh -c build.sh" 391 | exit 392 | fi 393 | fi 394 | } 395 | 396 | # End of list of tools 397 | 398 | detect_and_run() { 399 | try_justfile 400 | try_makefile 401 | try_nodejs 402 | try_cargo 403 | try_stack 404 | try_cabal 405 | try_meson 406 | try_cmake 407 | try_maven 408 | try_gradle 409 | try_lein 410 | try_nix_flake 411 | try_nix_package 412 | try_python 413 | try_go 414 | try_latex 415 | try_dotnet 416 | try_build_script 417 | } 418 | 419 | set_project_root() { 420 | if [ -n "$PROJECT_ROOT" ]; then 421 | return 422 | fi 423 | 424 | if has_command git; then 425 | # Find the root of the git repository if we're inside one. If we're in a 426 | # git submodule then the root of the outer git repo is used. If we're not 427 | # in a git repo the git command will not output anything and $PROJECT_ROOT 428 | # is set to the empty string which is fine. 429 | PROJECT_ROOT=$(git rev-parse --show-superproject-working-tree --show-toplevel 2> /dev/null | head -n 1) 430 | fi 431 | } 432 | 433 | nothing_found() { 434 | echo "No way to $ACTION found :'(" 435 | exit 1 436 | } 437 | 438 | display_version() { 439 | echo "$(basename "$0") version $VERSION" 440 | } 441 | 442 | display_help() { 443 | echo "Usage: $(basename "$0") [options] [action] [tool-arguments] 444 | Options: 445 | -h, --help Display this help. 446 | -n, -d, --dry-run Do not execute any commands with side-effects. 447 | -q, --quiet Do not print commands as they are about to be executed. 448 | -v, --version Display the version of the program (which is $VERSION). 449 | 450 | Actions: 451 | build, run, test Build, run, or test the current project. 452 | tool Invoke the guessed tool for the current project. 453 | 454 | Tool arguments: 455 | Any arguments following [action] are passed along to the invoked tool." 456 | } 457 | 458 | # Main execution starts here 459 | 460 | while getopts dhnqv-: c 461 | do 462 | case $c in 463 | d) DRY_RUN=true ;; 464 | h) display_help; exit 0 ;; 465 | n) DRY_RUN=true ;; 466 | q) QUIET=true ;; 467 | v) display_version; exit 0 ;; 468 | -) case $OPTARG in 469 | help) display_help; exit 0 ;; 470 | dry-run) DRY_RUN=true ;; 471 | quiet) QUIET=true ;; 472 | version) display_version; exit 0 ;; 473 | '' ) break ;; # "--" should terminate argument processing 474 | * ) echo "Illegal option --$OPTARG" >&2; exit 1 ;; 475 | esac ;; 476 | \?) exit 1 ;; 477 | esac 478 | done 479 | 480 | shift $((OPTIND-1)) # Shift away the parsed option arguments 481 | 482 | if [ "$1" = test ] || 483 | [ "$1" = run ] || 484 | [ "$1" = build ] || 485 | [ "$1" = tool ]; then 486 | ACTION=$1 487 | if [ "$1" = tool ]; then 488 | IS_TOOL=true 489 | fi 490 | shift 1 # Remove the action from the arguments 491 | # shellcheck disable=SC2124 492 | TOOL_ARGS=$@ 493 | else 494 | if [ -z "$1" ]; then 495 | echo "No action specified." 496 | else 497 | echo "$1 is not a valid action." 498 | fi 499 | echo "" 500 | echo "The valid actions are: build, run, test, tool" 501 | echo "" 502 | echo "Example: projectdo test" 503 | exit 1 504 | fi 505 | 506 | set_project_root 507 | 508 | while : 509 | do 510 | # We don't want to do anything if we are in the home or root directory 511 | if [ "$PWD" = "$HOME" ] || [ "$PWD" = / ]; then 512 | nothing_found 513 | fi 514 | detect_and_run 515 | # If we didn't detect a tool to run in this directory we go up one directory 516 | # while ensuring that we don't leave the project root 517 | if [ "$PWD" = "$PROJECT_ROOT" ]; then 518 | nothing_found 519 | fi 520 | cd .. 521 | done 522 | -------------------------------------------------------------------------------- /run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Colors 4 | RED=$(tput setaf 1) 5 | BOLD=$(tput bold) 6 | RESET=$(tput sgr0) 7 | 8 | ANY_ERRORS=false 9 | 10 | # Make sets this variable when we run it and can influence the test results. 11 | # Since this script is run through `make`, we need to unset it. 12 | unset MAKELEVEL 13 | 14 | # Get the directory of the current script, in a POSIX compatible way 15 | # https://stackoverflow.com/a/29835459 16 | script_directory=$(CDPATH="$(cd -- "$(dirname -- "$0")")" && pwd -P) 17 | 18 | # Set this variable to ensure top level Makefile doesn't affect the results. 19 | export PROJECT_ROOT="${script_directory}/tests" 20 | 21 | describe() { 22 | printf "\n%s%s%s" "$BOLD" "$1" "$RESET" 23 | } 24 | 25 | it() { 26 | printf "\n %s" "$1" 27 | } 28 | 29 | assert() { 30 | if [ $RUN_EXIT -eq 0 ]; then 31 | printf " ✓" 32 | else 33 | printf "\n Fail\n" 34 | ANY_ERRORS=true 35 | fi 36 | } 37 | 38 | assertFails() { 39 | if [ $RUN_EXIT -ne 0 ]; then 40 | printf " ✓" 41 | else 42 | printf "\n Fail\n" 43 | ANY_ERRORS=true 44 | fi 45 | } 46 | 47 | assertEqual() { 48 | if [ "$1" = "$2" ]; then 49 | printf " ✓" 50 | else 51 | printf "\n %s%s Error:%s Expected \"%s\" to equal \"%s\"\n" "$BOLD" "$RED" "$RESET" "$1" "$2" 52 | ANY_ERRORS=true 53 | fi 54 | } 55 | RUN_EXIT=0 56 | 57 | do_build_in() { 58 | RUN_RESULT=$(cd tests/"$1" && ../../projectdo -n build) 59 | RUN_EXIT=$? 60 | } 61 | 62 | do_run_in() { 63 | RUN_RESULT=$(cd tests/"$1" && ../../projectdo -n run) 64 | RUN_EXIT=$? 65 | } 66 | 67 | do_test_in() { 68 | RUN_RESULT=$(cd tests/"$1" && ../../projectdo -n test) 69 | RUN_EXIT=$? 70 | } 71 | 72 | do_print_tool_in() { 73 | RUN_RESULT=$(cd tests/"$1" && ../../projectdo -n tool) 74 | RUN_EXIT=$? 75 | } 76 | 77 | if describe "cargo"; then 78 | if it "can run build"; then 79 | do_build_in "cargo"; assert 80 | assertEqual "$RUN_RESULT" "cargo build" 81 | fi 82 | if it "can run run"; then 83 | do_run_in "cargo"; assert 84 | assertEqual "$RUN_RESULT" "cargo run" 85 | fi 86 | if it "can run test"; then 87 | do_test_in "cargo"; assert 88 | assertEqual "$RUN_RESULT" "cargo test" 89 | fi 90 | if it "can print tool"; then 91 | do_print_tool_in "cargo"; assert 92 | assertEqual "$RUN_RESULT" "cargo" 93 | fi 94 | if it "passes additional arguments to the tool"; then 95 | RUN_RESULT=$(cd tests/cargo && ../../projectdo -n build --release) 96 | assertEqual "$RUN_RESULT" "cargo build --release" 97 | fi 98 | fi 99 | 100 | if describe "stack"; then 101 | if it "can run build"; then 102 | do_build_in "stack"; assert 103 | assertEqual "$RUN_RESULT" "stack build" 104 | fi 105 | if it "can run run"; then 106 | do_run_in "stack"; assert 107 | assertEqual "$RUN_RESULT" "stack run" 108 | fi 109 | if it "can run test"; then 110 | do_test_in "stack"; assert 111 | assertEqual "$RUN_RESULT" "stack test" 112 | fi 113 | if it "can print tool"; then 114 | do_print_tool_in "stack"; assert 115 | assertEqual "$RUN_RESULT" "stack" 116 | fi 117 | fi 118 | 119 | if describe "npm / yarn / pnpm / bun"; then 120 | if it "can run npm build if package.json with build script"; then 121 | do_build_in "npm"; assert 122 | assertEqual "$RUN_RESULT" "npm run build" 123 | fi 124 | if it "can run npm start if package.json with start script"; then 125 | do_run_in "npm"; assert 126 | assertEqual "$RUN_RESULT" "npm start" 127 | fi 128 | if it "can run npm test if package.json with test script"; then 129 | do_test_in "npm"; assert 130 | assertEqual "$RUN_RESULT" "npm test" 131 | fi 132 | if it "uses yarn if yarn.lock is present"; then 133 | do_test_in "yarn"; assert 134 | assertEqual "$RUN_RESULT" "yarn test" 135 | fi 136 | if it "uses pnpm if pnpm-lock.yaml is present"; then 137 | do_test_in "pnpm"; assert 138 | assertEqual "$RUN_RESULT" "pnpm test" 139 | fi 140 | if it "uses bun if bun.lock is present"; then 141 | do_test_in "bun"; assert 142 | assertEqual "$RUN_RESULT" "bun test" 143 | fi 144 | if it "uses bun if bun.lockb is present"; then 145 | do_test_in "bun-lockb"; assert 146 | assertEqual "$RUN_RESULT" "bun test" 147 | fi 148 | if it "can run bun build if package.json with build script"; then 149 | do_build_in "bun"; assert 150 | assertEqual "$RUN_RESULT" "bun run build" 151 | fi 152 | if it "can run bun start if package.json with start script"; then 153 | do_run_in "bun"; assert 154 | assertEqual "$RUN_RESULT" "bun start" 155 | fi 156 | if it "can run bun test if package.json with test script"; then 157 | do_test_in "bun"; assert 158 | assertEqual "$RUN_RESULT" "bun test" 159 | fi 160 | if it "can run pnpm build if package.json with build script"; then 161 | do_build_in "pnpm"; assert 162 | assertEqual "$RUN_RESULT" "pnpm run build" 163 | fi 164 | if it "can run pnpm start if package.json with start script"; then 165 | do_run_in "pnpm"; assert 166 | assertEqual "$RUN_RESULT" "pnpm start" 167 | fi 168 | if it "can run pnpm test if package.json with test script"; then 169 | do_test_in "pnpm"; assert 170 | assertEqual "$RUN_RESULT" "pnpm test" 171 | fi 172 | if it "does not use npm if package.json contains no test script"; then 173 | do_test_in "npm-without-test"; assert 174 | assertEqual "$RUN_RESULT" "make test" 175 | fi 176 | if it "can print tool"; then 177 | do_print_tool_in "npm"; assert 178 | assertEqual "$RUN_RESULT" "npm" 179 | do_print_tool_in "yarn"; assert 180 | assertEqual "$RUN_RESULT" "yarn" 181 | do_print_tool_in "pnpm"; assert 182 | assertEqual "$RUN_RESULT" "pnpm" 183 | do_print_tool_in "bun"; assert 184 | assertEqual "$RUN_RESULT" "bun" 185 | fi 186 | fi 187 | 188 | if describe "just"; then 189 | if it "finds test target"; then 190 | do_test_in "just"; assert 191 | assertEqual "$RUN_RESULT" "just test" 192 | fi 193 | if it "finds build target"; then 194 | do_build_in "just"; assert 195 | assertEqual "$RUN_RESULT" "just build" 196 | fi 197 | if it "finds run target"; then 198 | do_run_in "just"; assert 199 | assertEqual "$RUN_RESULT" "just run" 200 | fi 201 | if it "can print tool"; then 202 | do_print_tool_in "just"; assert 203 | assertEqual "$RUN_RESULT" "just" 204 | fi 205 | fi 206 | 207 | if describe "make"; then 208 | if it "finds check target"; then 209 | do_test_in "make-check"; assert 210 | assertEqual "$RUN_RESULT" "make check" 211 | fi 212 | if it "ignores file named check"; then 213 | do_test_in "make-check-with-check-file"; assertFails 214 | assertEqual "$RUN_RESULT" "No way to test found :'(" 215 | fi 216 | if it "finds check target if both target and file named check"; then 217 | do_test_in "make-check-with-check-file-and-target"; assert 218 | assertEqual "$RUN_RESULT" "make check" 219 | fi 220 | if it "finds check target despite package.json"; then 221 | do_test_in "make-with-npm"; assert 222 | assertEqual "$RUN_RESULT" "make check" 223 | fi 224 | fi 225 | 226 | if describe "nix-flake"; then 227 | if it "can build with nix"; then 228 | do_build_in "nix-flake"; assert 229 | assertEqual "$RUN_RESULT" "nix build" 230 | fi 231 | if it "can run with nix"; then 232 | do_run_in "nix-flake"; assert 233 | assertEqual "$RUN_RESULT" "nix run" 234 | fi 235 | if it "can test with nix"; then 236 | do_test_in "nix-flake"; assert 237 | assertEqual "$RUN_RESULT" "nix flake check" 238 | fi 239 | fi 240 | 241 | if describe "nix"; then 242 | if it "can build with nix-build"; then 243 | do_build_in "nix"; assert 244 | assertEqual "$RUN_RESULT" "nix-build" 245 | fi 246 | fi 247 | 248 | if describe "go"; then 249 | if it "finds check target in magefile"; then 250 | do_test_in "mage"; assert 251 | assertEqual "$RUN_RESULT" "mage check" 252 | fi 253 | if it "runs go test without magefile"; then 254 | do_test_in "go"; assert 255 | assertEqual "$RUN_RESULT" "go test" 256 | fi 257 | if it "can run go run"; then 258 | do_run_in "go"; assert 259 | assertEqual "$RUN_RESULT" "go run" 260 | fi 261 | if it "can run go build"; then 262 | do_build_in "go"; assert 263 | assertEqual "$RUN_RESULT" "go build" 264 | fi 265 | if it "can print tool"; then 266 | do_print_tool_in "go"; assert 267 | assertEqual "$RUN_RESULT" "go" 268 | fi 269 | fi 270 | 271 | if describe "python"; then 272 | if it "can build with poetry"; then 273 | do_build_in "poetry"; assert 274 | assertEqual "$RUN_RESULT" "poetry build" 275 | fi 276 | if it "runs pytest with poetry"; then 277 | do_test_in "poetry"; assert 278 | assertEqual "$RUN_RESULT" "poetry run pytest" 279 | fi 280 | if it "can run with uv"; then 281 | do_run_in "uv"; assert 282 | assertEqual "$RUN_RESULT" "uv run" 283 | fi 284 | fi 285 | 286 | if describe "latex"; then 287 | if it "can build with tectonic"; then 288 | do_build_in "tectonic"; assert 289 | assertEqual "$RUN_RESULT" "tectonic -X build" 290 | fi 291 | fi 292 | 293 | if describe "meson"; then 294 | if it "can build with meson"; then 295 | do_build_in "meson"; assert 296 | assertEqual "$RUN_RESULT" "meson compile" 297 | fi 298 | if it "can test with meson"; then 299 | do_test_in "meson"; assert 300 | assertEqual "$RUN_RESULT" "meson test" 301 | fi 302 | fi 303 | 304 | if describe "gradle"; then 305 | if it "can build with gradle"; then 306 | do_build_in "gradle"; assert 307 | assertEqual "$RUN_RESULT" "gradle build" 308 | fi 309 | if it "can test with gradle"; then 310 | do_test_in "gradle"; assert 311 | assertEqual "$RUN_RESULT" "gradle test" 312 | fi 313 | fi 314 | 315 | if describe "dotnet csproj"; then 316 | if it "can build with dotnet"; then 317 | do_build_in "dotnet-csproj"; assert 318 | assertEqual "$RUN_RESULT" "dotnet build" 319 | fi 320 | if it "can run with dotnet"; then 321 | do_run_in "dotnet-csproj"; assert 322 | assertEqual "$RUN_RESULT" "dotnet run" 323 | fi 324 | if it "can test with dotnet"; then 325 | do_test_in "dotnet-csproj"; assert 326 | assertEqual "$RUN_RESULT" "dotnet test" 327 | fi 328 | fi 329 | 330 | if describe "dotnet fsproj"; then 331 | if it "can build with dotnet"; then 332 | do_build_in "dotnet-fsproj"; assert 333 | assertEqual "$RUN_RESULT" "dotnet build" 334 | fi 335 | if it "can run with dotnet"; then 336 | do_run_in "dotnet-fsproj"; assert 337 | assertEqual "$RUN_RESULT" "dotnet run" 338 | fi 339 | if it "can test with dotnet"; then 340 | do_test_in "dotnet-fsproj"; assert 341 | assertEqual "$RUN_RESULT" "dotnet test" 342 | fi 343 | fi 344 | 345 | if describe "dotnet sln"; then 346 | if it "can build with dotnet"; then 347 | do_build_in "dotnet-sln"; assert 348 | assertEqual "$RUN_RESULT" "dotnet build" 349 | fi 350 | if it "can run with dotnet"; then 351 | do_run_in "dotnet-sln"; assert 352 | assertEqual "$RUN_RESULT" "dotnet run" 353 | fi 354 | if it "can test with dotnet"; then 355 | do_test_in "dotnet-sln"; assert 356 | assertEqual "$RUN_RESULT" "dotnet test" 357 | fi 358 | fi 359 | 360 | if describe "build script"; then 361 | if it "can build with build script"; then 362 | do_build_in "build_script"; assert 363 | assertEqual "$RUN_RESULT" "sh -c build.sh" 364 | fi 365 | fi 366 | 367 | echo "" 368 | 369 | if [ $ANY_ERRORS = true ]; then 370 | exit 1 371 | fi 372 | -------------------------------------------------------------------------------- /tests/build_script/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "Build successful" 4 | -------------------------------------------------------------------------------- /tests/bun-lockb/bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paldepind/projectdo/433b36d9fa81293ea9a915d6d21853d3f8bf36f3/tests/bun-lockb/bun.lockb -------------------------------------------------------------------------------- /tests/bun-lockb/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "test": "echo \"Error: no test specified\" && exit 1", 4 | "build": "echo \"Error: no build specified\" && exit 1", 5 | "start": "echo \"Error: no start specified\" && exit 1" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/bun/bun.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paldepind/projectdo/433b36d9fa81293ea9a915d6d21853d3f8bf36f3/tests/bun/bun.lock -------------------------------------------------------------------------------- /tests/bun/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "test": "echo \"Error: no test specified\" && exit 1", 4 | "build": "echo \"Error: no build specified\" && exit 1", 5 | "start": "echo \"Error: no start specified\" && exit 1" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/cargo/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cargo" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | -------------------------------------------------------------------------------- /tests/dotnet-csproj/test.csproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paldepind/projectdo/433b36d9fa81293ea9a915d6d21853d3f8bf36f3/tests/dotnet-csproj/test.csproj -------------------------------------------------------------------------------- /tests/dotnet-fsproj/test.fsproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paldepind/projectdo/433b36d9fa81293ea9a915d6d21853d3f8bf36f3/tests/dotnet-fsproj/test.fsproj -------------------------------------------------------------------------------- /tests/dotnet-sln/test.sln: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paldepind/projectdo/433b36d9fa81293ea9a915d6d21853d3f8bf36f3/tests/dotnet-sln/test.sln -------------------------------------------------------------------------------- /tests/go/go.mod: -------------------------------------------------------------------------------- 1 | module go 2 | 3 | go 1.19 4 | -------------------------------------------------------------------------------- /tests/gradle/build.gradle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paldepind/projectdo/433b36d9fa81293ea9a915d6d21853d3f8bf36f3/tests/gradle/build.gradle -------------------------------------------------------------------------------- /tests/just/justfile: -------------------------------------------------------------------------------- 1 | test: 2 | @echo "Tests passed" 3 | 4 | build: 5 | @echo "Built" 6 | 7 | run: 8 | @echo "Ran" 9 | -------------------------------------------------------------------------------- /tests/mage/go.mod: -------------------------------------------------------------------------------- 1 | module mage-test 2 | 3 | go 1.19 4 | -------------------------------------------------------------------------------- /tests/mage/magefile.go: -------------------------------------------------------------------------------- 1 | //go:build mage 2 | 3 | package main 4 | 5 | import ( 6 | "github.com/magefile/mage/sh" 7 | ) 8 | 9 | func Build() error { 10 | if err := sh.Run("go", "mod", "download"); err != nil { 11 | return err 12 | } 13 | return sh.Run("go", "install", "./...") 14 | } 15 | 16 | func Check() error { 17 | if err := sh.Run("go", "mod", "download"); err != nil { 18 | return err 19 | } 20 | return sh.Run("go", "test", "./...") 21 | } 22 | -------------------------------------------------------------------------------- /tests/make-check-with-check-file-and-target/Makefile: -------------------------------------------------------------------------------- 1 | check: 2 | @echo "Tests passed." 3 | -------------------------------------------------------------------------------- /tests/make-check-with-check-file-and-target/check: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paldepind/projectdo/433b36d9fa81293ea9a915d6d21853d3f8bf36f3/tests/make-check-with-check-file-and-target/check -------------------------------------------------------------------------------- /tests/make-check-with-check-file/Makefile: -------------------------------------------------------------------------------- 1 | some-target: 2 | @echo "Tests passed." 3 | -------------------------------------------------------------------------------- /tests/make-check-with-check-file/check: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paldepind/projectdo/433b36d9fa81293ea9a915d6d21853d3f8bf36f3/tests/make-check-with-check-file/check -------------------------------------------------------------------------------- /tests/make-check/Makefile: -------------------------------------------------------------------------------- 1 | check: 2 | @echo "Tests passed." 3 | -------------------------------------------------------------------------------- /tests/make-with-npm/Makefile: -------------------------------------------------------------------------------- 1 | check: 2 | @echo "Tests passed." 3 | -------------------------------------------------------------------------------- /tests/make-with-npm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "test": "echo \"Error: no test specified\" && exit 1", 4 | "build": "echo \"Error: no build specified\" && exit 1", 5 | "start": "echo \"Error: no start specified\" && exit 1" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/meson/CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paldepind/projectdo/433b36d9fa81293ea9a915d6d21853d3f8bf36f3/tests/meson/CMakeLists.txt -------------------------------------------------------------------------------- /tests/meson/meson.build: -------------------------------------------------------------------------------- 1 | project('meson', 'c', 2 | version : '0.1', 3 | default_options : ['warning_level=3']) 4 | 5 | exe = executable('meson', 'meson.c', 6 | install : true) 7 | 8 | test('basic', exe) 9 | -------------------------------------------------------------------------------- /tests/meson/meson.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define PROJECT_NAME "meson" 4 | 5 | int main(int argc, char **argv) { 6 | if(argc != 1) { 7 | printf("%s takes no arguments.\n", argv[0]); 8 | return 1; 9 | } 10 | printf("This is project %s.\n", PROJECT_NAME); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /tests/nix-flake/flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "A very basic flake"; 3 | 4 | inputs = { 5 | nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; 6 | }; 7 | 8 | outputs = { self, nixpkgs }: { 9 | 10 | packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello; 11 | 12 | packages.x86_64-linux.default = self.packages.x86_64-linux.hello; 13 | 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /tests/nix/default.nix: -------------------------------------------------------------------------------- 1 | { ... }: null 2 | -------------------------------------------------------------------------------- /tests/npm-without-test/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | @echo "Tests passed." 3 | -------------------------------------------------------------------------------- /tests/npm-without-test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "test-not": "echo \"Error: no test specified\" && exit 1", 4 | "not-test": "echo \"Error: no test specified\" && exit 1" 5 | }, 6 | "files": [ 7 | "test" 8 | ], 9 | "keywords": [ 10 | "test" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /tests/npm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "test": "echo \"Error: no test specified\" && exit 1", 4 | "build": "echo \"Error: no build specified\" && exit 1", 5 | "start": "echo \"Error: no start specified\" && exit 1" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/pnpm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "build": "echo \"Error: no build specified\" && exit 1", 4 | "start": "echo \"Error: no start specified\" && exit 1", 5 | "test": "echo \"Error: no test specified\" && exit 1" 6 | } 7 | } -------------------------------------------------------------------------------- /tests/pnpm/pnpm-lock.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paldepind/projectdo/433b36d9fa81293ea9a915d6d21853d3f8bf36f3/tests/pnpm/pnpm-lock.yaml -------------------------------------------------------------------------------- /tests/poetry/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "poetry" 3 | version = "0.1.0" 4 | description = "" 5 | authors = ["Your Name "] 6 | readme = "README.md" 7 | 8 | [tool.poetry.dependencies] 9 | python = "^3.10" 10 | 11 | 12 | [build-system] 13 | requires = ["poetry-core"] 14 | build-backend = "poetry.core.masonry.api" 15 | -------------------------------------------------------------------------------- /tests/stack/package.yaml: -------------------------------------------------------------------------------- 1 | name: stack 2 | version: 0.1.0.0 3 | github: "githubuser/stack" 4 | license: BSD3 5 | author: "Author name here" 6 | maintainer: "example@example.com" 7 | copyright: "2023 Author name here" 8 | 9 | extra-source-files: 10 | - README.md 11 | - CHANGELOG.md 12 | 13 | # Metadata used when publishing your package 14 | # synopsis: Short description of your package 15 | # category: Web 16 | 17 | # To avoid duplicated efforts in documentation and dealing with the 18 | # complications of embedding Haddock markup inside cabal files, it is 19 | # common to point users to the README.md file. 20 | description: Please see the README on GitHub at 21 | 22 | dependencies: 23 | - base >= 4.7 && < 5 24 | 25 | ghc-options: 26 | - -Wall 27 | - -Wcompat 28 | - -Widentities 29 | - -Wincomplete-record-updates 30 | - -Wincomplete-uni-patterns 31 | - -Wmissing-export-lists 32 | - -Wmissing-home-modules 33 | - -Wpartial-fields 34 | - -Wredundant-constraints 35 | 36 | library: 37 | source-dirs: src 38 | 39 | executables: 40 | stack-exe: 41 | main: Main.hs 42 | source-dirs: app 43 | ghc-options: 44 | - -threaded 45 | - -rtsopts 46 | - -with-rtsopts=-N 47 | dependencies: 48 | - stack 49 | 50 | tests: 51 | stack-test: 52 | main: Spec.hs 53 | source-dirs: test 54 | ghc-options: 55 | - -threaded 56 | - -rtsopts 57 | - -with-rtsopts=-N 58 | dependencies: 59 | - stack 60 | -------------------------------------------------------------------------------- /tests/stack/stack.yaml: -------------------------------------------------------------------------------- 1 | # This file was automatically generated by 'stack init' 2 | # 3 | # Some commonly used options have been documented as comments in this file. 4 | # For advanced use and comprehensive documentation of the format, please see: 5 | # https://docs.haskellstack.org/en/stable/yaml_configuration/ 6 | 7 | # Resolver to choose a 'specific' stackage snapshot or a compiler version. 8 | # A snapshot resolver dictates the compiler version and the set of packages 9 | # to be used for project dependencies. For example: 10 | # 11 | # resolver: lts-3.5 12 | # resolver: nightly-2015-09-21 13 | # resolver: ghc-7.10.2 14 | # 15 | # The location of a snapshot can be provided as a file or url. Stack assumes 16 | # a snapshot provided as a file might change, whereas a url resource does not. 17 | # 18 | # resolver: ./custom-snapshot.yaml 19 | # resolver: https://example.com/snapshots/2018-01-01.yaml 20 | resolver: 21 | url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/13.yaml 22 | 23 | # User packages to be built. 24 | # Various formats can be used as shown in the example below. 25 | # 26 | # packages: 27 | # - some-directory 28 | # - https://example.com/foo/bar/baz-0.0.2.tar.gz 29 | # subdirs: 30 | # - auto-update 31 | # - wai 32 | packages: 33 | - . 34 | # Dependency packages to be pulled from upstream that are not in the resolver. 35 | # These entries can reference officially published versions as well as 36 | # forks / in-progress versions pinned to a git hash. For example: 37 | # 38 | # extra-deps: 39 | # - acme-missiles-0.3 40 | # - git: https://github.com/commercialhaskell/stack.git 41 | # commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a 42 | # 43 | # extra-deps: [] 44 | 45 | # Override default flag values for local packages and extra-deps 46 | # flags: {} 47 | 48 | # Extra package databases containing global packages 49 | # extra-package-dbs: [] 50 | 51 | # Control whether we use the GHC we find on the path 52 | # system-ghc: true 53 | # 54 | # Require a specific version of stack, using version ranges 55 | # require-stack-version: -any # Default 56 | # require-stack-version: ">=2.7" 57 | # 58 | # Override the architecture used by stack, especially useful on Windows 59 | # arch: i386 60 | # arch: x86_64 61 | # 62 | # Extra directories used by stack for building 63 | # extra-include-dirs: [/path/to/dir] 64 | # extra-lib-dirs: [/path/to/dir] 65 | # 66 | # Allow a newer minor version of GHC than the snapshot specifies 67 | # compiler-check: newer-minor 68 | -------------------------------------------------------------------------------- /tests/tectonic/Tectonic.toml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paldepind/projectdo/433b36d9fa81293ea9a915d6d21853d3f8bf36f3/tests/tectonic/Tectonic.toml -------------------------------------------------------------------------------- /tests/uv/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "uvproject" 3 | version = "0.1.0" 4 | description = "Add your description here" 5 | readme = "README.md" 6 | requires-python = ">=3.13" 7 | dependencies = [] 8 | -------------------------------------------------------------------------------- /tests/uv/uv.lock: -------------------------------------------------------------------------------- 1 | version = 1 2 | revision = 1 3 | requires-python = ">=3.13" 4 | 5 | [[package]] 6 | name = "uvproject" 7 | version = "0.1.0" 8 | source = { virtual = "." } 9 | -------------------------------------------------------------------------------- /tests/yarn/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "test": "echo \"Error: no test specified\" && exit 1" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/yarn/yarn.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paldepind/projectdo/433b36d9fa81293ea9a915d6d21853d3f8bf36f3/tests/yarn/yarn.lock --------------------------------------------------------------------------------