1 | ![](https://raw.githubusercontent.com/purplecalm/alien/master/alien.png)
|
2 | ===
|
3 |
|
4 | ## Require
|
5 | * rsync (http://rsync.samba.org/)
|
6 |
|
7 | ## Installation
|
8 | ```bash
|
9 | $ npm install alien -g
|
10 | ```
|
11 |
|
12 | ## Quick Start
|
13 | before we run the commands of alien, we should have a project first
|
14 |
|
15 | ### create a project
|
16 | (directory structure)
|
17 | ```
|
18 | project
|
19 | ├─┬src
|
20 | │ ├─┬scripts
|
21 | │ │ └──...
|
22 | │ └─┬styles
|
23 | │ └──...
|
24 | └─.config
|
25 | ```
|
26 | you can checkout (https://github.com/purplecalm/alien.git) to get a test case
|
27 |
|
28 | ### start a server
|
29 | before start server, make sure the working directory contains project
|
30 | ```bash
|
31 | $ alien server
|
32 | ```
|
33 |
|
34 | server has three modes, [SRC|DEV|PRD]
|
35 | * SRC: source mode, return every file, esay to debug
|
36 | * DEV: package mode, return files' package
|
37 | * PRD: product mode, return minified code
|
38 |
|
39 | ```bash
|
40 | $ alien server -m DEV
|
41 | ```
|
42 |
|
43 | ### pack
|
44 | packing exports files
|
45 |
|
46 | (File .config) e.g
|
47 | ```javascript
|
48 | {
|
49 | "exports": [
|
50 | "scripts/index.js",
|
51 | "styles/index.css"
|
52 | ]
|
53 | }
|
54 | ```
|
55 |
|
56 | before run pack, make sure the project is working directory
|
57 | ```bash
|
58 | $ alien pack
|
59 | ```
|
60 |
|
61 | result
|
62 | ```
|
63 | project
|
64 | ├─┬dev(package directory)
|
65 | │ ├─┬scripts
|
66 | │ │ └──index@dev.js
|
67 | │ └─┬styles
|
68 | │ └──index@dev.css
|
69 | ├─┬src
|
70 | │ ├─┬scripts
|
71 | │ │ └──...
|
72 | │ └─┬styles
|
73 | │ └──...
|
74 | └─.config
|
75 | ```
|
76 |
|
77 | ### min
|
78 | minify exports files
|
79 |
|
80 | (File .config) e.g
|
81 | ```javascript
|
82 | {
|
83 | "exports": [
|
84 | "scripts/index.js",
|
85 | "styles/index.css"
|
86 | ]
|
87 | }
|
88 | ```
|
89 |
|
90 | before run min, make sure the project is working directory
|
91 | ```bash
|
92 | $ alien min
|
93 | ```
|
94 |
|
95 | result
|
96 | ```
|
97 | project
|
98 | ├─┬prd(product directory)
|
99 | │ ├─┬scripts
|
100 | │ │ └──index@bc23723a6ebdd528a774264d37173293.js
|
101 | │ └─┬styles
|
102 | │ └──index@db47495f5329bd6a6df53228034d4746.css
|
103 | ├─┬ver(versions directory)
|
104 | │ ├─┬scripts
|
105 | │ │ └──index.js.ver (bc23723a6ebdd528a774264d37173293)
|
106 | │ └─┬styles
|
107 | │ └──index.css.ver (db47495f5329bd6a6df53228034d4746)
|
108 | ├─┬src
|
109 | │ ├─┬scripts
|
110 | │ │ └──...
|
111 | │ └─┬styles
|
112 | │ └──...
|
113 | └─.config
|
114 | ```
|
115 |
|
116 | ### sync
|
117 | sync all package to target server
|
118 |
|
119 | *make sure you installed rsync* (find it here http://rsync.samba.org/)
|
120 |
|
121 | set dev environment in .config
|
122 | (File .config) e.g
|
123 | ```javascript
|
124 | {
|
125 | "dev": {
|
126 | "host": "127.0.0.1",
|
127 | "path": "/home/q/www/project/"
|
128 | }
|
129 | }
|
130 | ```
|
131 |
|
132 | before run sync
|
133 | * make sure the project is working directory
|
134 | * make sure you packed your project before
|
135 | ```bash
|
136 | $ alien sync
|
137 | ```
|
138 | we also run pack and sync together
|
139 | ```bash
|
140 | $ alien pack && alien sync
|
141 | ```
|
142 |
|
143 | ### help
|
144 | ```
|
145 | Aha!
|
146 | ``` |
\ | No newline at end of file |