UNPKG

1.94 kBMarkdownView Raw
1# N Judah Builder
2
3This is a build tool for applying transforms to files.
4
5# How Do I use It?
6
7You specify your build using (generic) JSX:
8
9```JavaScript
10const { build, transform } = require("@njudah/builder");
11const babel = require("@njudah/builder/transform/babel");
12
13<build path = "/path/to/your/project"
14 destination = "/path/to/build/folder"
15 ignore = "**/node_modules" >
16 <transform match = "**/*.js" >
17 <babel options = { { presets: ["es2015-node4", "stage-0"] } } />
18 </transform>
19</build>
20
21```
22
23Use the promisified interface to run the build and grab the final location:
24
25```JavaScript
26
27require("@njudah/builder/promisifed")(
28 <build path = "/path/to/your/project"
29 destination = "/path/to/build/folder"
30 ignore = "**/node_modules" >
31 <transform match = "**/*.js" >
32 <babel options = { { presets: ["es2015-node4", "stage-0"] } } />
33 </transform>
34 </build>
35)
36 .then(function (x)
37 {
38 console.log(x);
39 });
40
41```
42
43If you do not have access to generic JSX, you can use the alternative array syntax:
44
45```JavaScript
46
47require("@njudah/builder/promisifed")(
48 [build,
49 {
50 path: "/path/to/your/project",
51 destination: "/path/to/build/folder"
52 ignore: "**/node_modules"
53 },
54 [transform, { match: "**/*.js" },
55 [babel, { options: { presets: ["es2015-node4", "stage-0"] } }
56 ]
57 ]
58)
59 .then(function (x)
60 {
61 console.log(x);
62 });
63
64```
65
66## build attributes
67
68- **path**: source path
69- **destination**: destination folder
70- **ignore**: files to ignore. Can be glob string, or array of glob strings.
71
72## transform attributes
73
74- **match** - files to match. Can be glob string, or array of glob strings.
75
76## transform child
77
78Transform expects one child, the actual transform function to run. *babel* is the only currently supported one.
79
80## babel attributes
81
82- **options** - Babel options.
83