# makescript

> A javascript-based make tool

Latest version **0.1.4** (published 2015-02-13) · 0 weekly downloads

## Install

```sh
npm install makescript
pnpm add makescript
yarn add makescript
bun add makescript
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2015-02-13 |
| First published | 2015-02-12 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Gary Guo |
| Maintainers | nbdd0121 |

## Links

- npm: https://www.npmjs.com/package/makescript
- Repository: http://github.com/nbdd0121/make.js
- Homepage: https://github.com/nbdd0121/make.js
- Issues: https://github.com/nbdd0121/make.js/issues
- npm.io page: https://npm.io/package/makescript

## Dependencies (3)

- [fibers](https://npm.io/package/fibers.md) 1.0.5
- [promise](https://npm.io/package/promise.md) 6.1.0
- [node-getopt](https://npm.io/package/node-getopt.md) 0.2.3

## Recent versions

- 0.1.4 (latest) — 2015-02-13
- 0.1.3 — 2015-02-13
- 0.1.2 — 2015-02-13
- 0.1.1 — 2015-02-13
- 0.1.0 — 2015-02-12

## README

Makescript v0.1.3
=================


INSTALLING
----------
* `git clone git://github.com/nbdd0121/make.js.git`
* `cd make.js`
* `npm install`

OR SIMPLY

* `npm install -g makescript`


USAGE
-----
1. Create your own makescript file
2. Execute `makejs`
3. Should work as expected

MAKESCRIPT
----------
This tool organizes libraries by modules.
Currently there are 4 modules:

basic 			|---
----------------|-------
log(TEXT)		|Display TEXT
chdir(PATH)     |Change working directory to PATH
cwd()			|Return current working directory
exit(CODE)		|Exit process with error code CODE
await(PROMISE)	|Wait until PROMISE finishes
sleep$(TIME)	|Create a promise which will resolve after TIME millseconds
sleep(TIME)		|Sleep for TIME millseconds
exec$(CMD, ARG) |Create a promise which will resolve or reject according to the result of executing CMD with argument ARG
exec(CMD, ARG)	|Execute CMD with argument ARG
make$(ARG) 		|Create a promise which will resolve or reject according to the result of executing makescript with argument ARG
make(ARG)		|Execute makescript with argument ARG

file 				|---
--------------------|-------
exists(PATH)		|Determine whether PATH exists
parentDir(PATH)		|Get parent directory of PATH
isDir(PATH)			|Determine whether PATH is a directory
ls(PATH)			|List all files under PATH
recursiveList(PATH)	|List all files and files in subdirectory under PATH
rm(PATH, OPT)		|Remove files specified by PATH, using option specified in OPT (nothing, 'r', 'f' or ['r', 'f'])
rmdir(PATH)			|Remove directory PATH
mkdir(PATH, OPT)	|Make directory PATH using option OPT (nothing or 'p')

### make
#### target(TARGET, DEP, ACTIONS)
Create a rule that will make TARGET using dependency DEP.
TARGET will only be made if one of DEP needs making or
one of DEP is newer than TARGET. If made, ACTIONS will
performed.
> TARGET can be string, regexp, or function
>>	string means exact match<br/>
>>	regexp will match target if regexp.exec(target) returns trusy value<br/>
>>	function will match target if function(target) returns trusy value
>
> DEP can be string or function
>>	string means a specified dependency<br/>
>>	function will create a dependency list according to return value of function(target)
>
>ACTIONS are a list of function
>>	function(target, dependency) will be executed when target is judged is make-needed

#### phony(TARGET, DEP, ACTIONS)
Create a rule, while TARGET is not considered a file, but only a name of rule.
Phony targets will always be made.

#### makeTarget(TARGET)
Explicitly make TARGET.

#### asDefault(TARGET)
Set TARGET as the default target. TARGET will be made when no target is specified to make in the command line arguments

### file-helper
#### makeParentDirIfNotExist(PATHS)
Create all PATHS' parent directory if they did not exist

Of the 4 modules, `basic`, `make` and `file` are loaded by default.<br/>
When modules are loaded, its functions are added to the global object, so you can use them directly.<br/>
Loaded modules can be accessed by `loadedModules`.

To load a module explicitly, use `use('module_name')`.<br/>
For example, if you want to use module `file-helper`, write code `use('file-helper')`.


EXAMPLE MAKESCRIPT
------------------
```js
use('file-helper');
log(loadedModules); // Output will be ['basic', 'make', 'file', 'file-helper']
function linker(target, dep) {
	exec('gcc', '-o', target, dep);
}
function cc(target, dep) {
	exec('gcc', '-c', '-o', target, dep);
}
var OBJECTS = recursiveList('src').filter(function(name) {
	return /\.c$/.exec(name);
}).map(function(name) {
	return 'bin/' + name.replace(/\.(c|asm)$/, '.o');
});	// Powerful customed making using regular expression and JavaScript built-in functions
makeParentDirIfNotExist(OBJECTS);
target(/bin\/.*\.o$/, function(target) {
	return target.replace('bin/', 'src/').replace(/\.o$/, '.c');
}, cc);	// Regexp as target and function as dependency generator
target('output', OBJECTS, linker); // Basic kind of target
asDefault('output');
```


COMMAND LINE OPTIONS
--------------------
Short|Long                 |Description
-----|---------------------|-----------
-B   |--always-make        |Unconditionally make all targets
-C   |--directory=DIRECTORY|Use DIRECTORY as work directory
-d   |--debug              |Print debug information and will not reduce stack trace on error
-f   |--file=FILE          |Read FILE as a makescript
-h   |--help               |Print this message and exit
-j   |--jobs=N             |Allow N jobs at once; infinte jobs with argument 0
-s   |--silent             |Don't echo recipes
-S   |--no-stdout          |Do not show messages written to stdout
-v   |--verbose            |Print verbose messages for debugging

---
_Source: https://npm.io/package/makescript · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
