Skip to content

Commit 30e9532

Browse files
author
Francois-Xavier KOWALSKI
committed
ENYO-3012: use packagejs: instead of source: in deploy.json
- the `source:` property of `deploy.json` did not make sense as it was always refering to the folder where `deploy.json` is. it is now replaced by a `packagejs:` property (default: `"package.js"`) which indicates where is the relative location of the top-level `package.js` from the project root folder. Enyo-DCO-1.1-Signed-off-by: Francois-Xavier KOWALSKI <[email protected]>
1 parent 7e6a0b0 commit 30e9532

File tree

2 files changed

+85
-20
lines changed

2 files changed

+85
-20
lines changed

deploy.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"enyo": "enyo",
3-
"source": ".",
4-
"assets": ["icon.png", "index.html", "assets"],
5-
"libs": ["lib/onyx", "lib/layout"]
2+
"enyo": "./enyo",
3+
"packagejs": "./package.js",
4+
"assets": ["./icon.png", "./index.html", "./assets"],
5+
"libs": ["./lib/onyx", "./lib/layout"]
66
}

deploy.md

Lines changed: 81 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,99 @@ Instead, the CSS url paths are fixed up to reference the new path from the build
1919

2020
### How to compress
2121

22-
To compress your application, you must run the Node.js script named `deploy.js` that comes with Enyo, as `enyo/tools/deploy.js`.
22+
To compress your application, you must run the script named `deploy.js` that comes with Enyo, as `node enyo/tools/deploy.js`. Bootplate provides 2 wrappers scripts to shorten the minification learning curve. You can just run:
2323

24-
$ node enyo/tools/deploy.js -h
24+
C:\path\to\bootplate\> cd tools
25+
C:\path\to\bootplate\tools> deploy.bat
26+
27+
or (on Mac & Linux):
28+
29+
$ cd /path/to/bootplate/tools
30+
$ bash ./deploy.sh
2531

26-
This script will run the minification tool located in `enyo/tools/minifier/minify.js`, and make a build of enyo, then a build of your app.
32+
This script will run the minification tool located in `enyo/tools/minifier/deploy.js`, and make a build of enyo, then a build of your app.
2733

2834
Any libraries referenced in your `package.js` manifest will be built into your app's built code.
2935

30-
**NOTE:** `deploy.js` expects to find a `package.js` in the root-folder of your application. It only references your app's `package.js` to keep paths correct. Do not modify this.
36+
**NOTE:** `deploy.js` expects to find a `deploy.json` manifest in the root-folder of your application. This manifest then defines where are (1) the top-level `package.js`, (2) the location of the Enyo framework within the applicatio source & what are the various libraries & assets. A typical default `package.json` contains:
37+
38+
```json
39+
{
40+
"enyo": "./enyo",
41+
"packagejs": "./package.js",
42+
"assets": ["./icon.png", "./index.html", "./assets"],
43+
"libs": ["./lib/onyx", "./lib/layout"]
44+
}
45+
```
3146

3247
### What comes out?
3348

34-
After running the `deploy.js` script, a new folder `build` (you change this using the `-b` flag of the `deploy.js` script) will be located next to your `source` directory.
49+
After running the `deploy.bat|sh` script, two new folders (`build` and `deploy`) will be located next to your `source` directory.
50+
51+
#### Minification test folder - build
52+
53+
```
54+
build
55+
├── app.css
56+
├── app.js
57+
├── enyo.css
58+
└── enyo.js
59+
```
3560

36-
In it will be 4 files:
37-
- enyo.css
38-
- enyo.js
39-
- app.css
40-
- app.js
61+
These generated files will be loaded in the given order by `index.html`.
4162

42-
These files will be loaded in the given order by `index.html`.
63+
#### Deployment folder - deploy
4364

44-
The output of the `deploy` scripts will minify your appliaction, and copy the necessary files into `deploy/<appname>/`.
65+
The `deploy` folder contains a ready-to-be-shipped minified version of your application, including its declared assets & libraries in addition to the content of the `build folder`.
4566

46-
If the libraries have a compatible `deploy.sh` or `deploy.bat` script, they will be executed, and a minimal copy will be placed in the deployment's lib folder.
67+
If the libraries have a compatible `deploy.json` (use to be `deploy.sh` or `deploy.bat` scripts), they will be used, and a minimal copy will be placed in the deployment's `./lib` folder.
4768

48-
If no `deploy.(sh|bat)` script is found for the library, all of the library is copied into the lib folder to provide maximum safety.
69+
If no `deploy.(json|sh|bat)` script is found for the libraries, all of each library is copied into the `deploy/lib` folder to provide maximum safety.
4970

50-
If you are adding a library, please add a `deploy.sh` file and `deploy.bat` file similar to the ones in `lib/onyx`.
71+
If you are adding a library, please add a `deploy.json` file similar to the ones in `lib/onyx` or `lib/layout`.
72+
73+
If no images or files are needed from the library, just include the following (the same as `lib/layout`):
74+
75+
```json
76+
{
77+
"packagejs": "./package.js",
78+
"assets": [],
79+
"libs": []
80+
}
81+
```
82+
83+
**NOTE:** In case you want full control of the minification process (target folders... etc), get familiar with the underlying Node.js script using:
84+
85+
$ node enyo/tools/deploy.js -h
5186

52-
If no images or files are needed from the library, just include blank (and executable) copies of the deploy scripts.
87+
**NOTE:** For reference, the minification of an un-modified `bootplate` results in the following `deploy/` tree:
88+
89+
```
90+
deploy
91+
├── assets
92+
│   └── favicon.ico
93+
├── build
94+
│   ├── app.css
95+
│   ├── app.js
96+
│   ├── enyo.css
97+
│   └── enyo.js
98+
├── icon.png
99+
├── index.html
100+
└── lib
101+
└── onyx
102+
├── LICENSE-2.0.txt
103+
└── images
104+
├── checkbox.png
105+
├── close-active.png
106+
├── close-inactive.png
107+
├── grabbutton.png
108+
├── gradient-invert.png
109+
├── gradient.png
110+
├── more.png
111+
├── progress-button-cancel.png
112+
├── search-input-cancel.png
113+
├── search-input-search.png
114+
├── slider-handle.png
115+
├── spinner-dark.gif
116+
└── spinner-light.gif
117+
```

0 commit comments

Comments
 (0)