shrinkwrap-packer
Shrinkwrap server for cortex
Server
var app = ; // app.use('/mod',express.static('mod')); app; app; app;
Configurations
root
: module root directory for cortex
pack
: zip package root directory
File Structure
/root
|-- a
|-- 0.1.0
|-- a.js
|-- cortex-shrinkwrap.json
|-- 0.1.2
|-- b.js
...
Routes
full package
/zip/a/0.1.0.zip
: full package zip
the zip file will contains self and all it's packages
patch package
/zip/a/0.1.0~0.1.1.zip
/a/0.1.0/afile.js
/a/0.2.0/bfile.js
/c/0.3.0/cfile.js
directives.txt
directives
- R rename one origin file to another
- C copy one origin file to another
- M modified, use patch version to cover origin one
- A add new file from patch folder
- D remove from origin folder
checksum
/zip/a/0.1.0-checksum
: checksum of the final folder
min file
/zip/a/0.1.0.min-checksum
/zip/a/0.1.0~0.1.1.min.zip
/zip/a/0.1.1.min.zip
will filter files ends with .min
or will filter files that not ends with .min
zip header
Content-MD5: <md5 of zip file>
Deployment
- clone this project
git clone https://github.com/cortexjs/shrinkwrap-packer.git
- copy server.js to some other path to prevent pull conflict
cd shrinkwrap-packer && cp server.js _server.js
- edit
_server.js
configpack
(folder to store zip file) androot
(folder to search static files), feel free to changeport
- install pm2
npm install pm2 -g
- prepare start script
echo 'pm2 start _server.js -i max --name "shrinkwrap-packer"' > start.sh && chmod +x start.sh
- prepare restart script
echo 'npm install && pm2 restart "shrinkwrap-packer"' > restart.sh && chmod +x restart.sh
- start server
./start.sh
- config nginx
location /zip {
proxy_pass http://127.0.0.1:3000;
}