2.2.0 • Published 7 years ago

asset-pipe-build-server v2.2.0

Weekly downloads
10
License
MIT
Repository
github
Last release
7 years ago

Greenkeeper badge

Usage

Install

npm install asset-pipe-build-server

Configure

Configuration of the server is done via environment variables.

The following configuration options are available:

VariableDescriptionOptionsDefault
NODE_ENVApplicaton environmentdevelopment, productiondevelopment
LOG_LEVELWhich level the console transport log should log atdebug, info, warn, errordebug
PORTThe port the server should bind to-7100

Start

asset-pipe-server

OR with configuration options:

PORT=3321 LOG_LEVEL=info NODE_ENV=production asset-pipe-server

Endpoints

The server provides the following endpoints:

VerbEndpointDescriptionurl paramspayloadresponse
POST/feed/jsUpload a javascript asset feed-js feedfeed response
POST/feed/cssUpload a css asset feed-css feedfeed response
GET/feed/:idDownload an asset feedfeed id-feed
POST/bundle/jsRequest bundling of a list of js feeds-js bundlebundle response
POST/bundle/cssRequest bundling of a list of css feeds-css bundlebundle response
GET/bundle/:idDownload an asset bundlebundle id-bundle

See below for explanation and additional detail regarding the various url params, payloads and responses.

Url params

feed id

A js or css feed filename. (Depending on endpoint)

Examples

GET /feed/js/acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json
GET /feed/css/bcd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json

bundle id

A js or css bundle filename. (Depending on endpoint)

Examples

GET /bundle/js/acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json
GET /bundle/css/bcd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json

Payloads

js feed

An array of feed objects as produced by asset-pipe-js-writer

Example

[
    {
        "id":"c645cf572a8f5acf8716e4846b408d3b1ca45c58",
        "source":"\"use strict\";module.exports.world=function(){return\"world\"};",
        "deps":{},
        "file":"./assets/js/bar.js"
    }
]

css feed

An array of feed objects as produced by asset-pipe-css-writer

Example

[
    {
        id: '4f32a8e1c6cf6e5885241f3ea5fee583560b2dfde38b21ec3f9781c91d58f42e',
        name: 'my-module-1',
        version: '1.0.1',
        file: 'my-module-1/main.css',
        content: '/* ... */'
    }
]

js bundle

An ordered array of js feed filenames.

Example

[
    'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json',
    'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json',
    'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json'
]

css bundle

An ordered array of css feed filenames.

Example

[
    'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json',
    'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json',
    'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json'
]

Responses

feed response

After a feed is uploaded, the server will respond with a json body containing the keys file and uri where file is the name of the feed file that was saved on the server and uri is the same as file but with the server address prepended.

Example

{
    file: 'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json',
    uri: 'http://127.0.0.1:7100/acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json'
}

feed

Feed is the original js or css feed content that was saved on the server during a feed upload (via POST /feed/js or POST /feed/css)

Example

[
    {
        "id":"c645cf572a8f5acf8716e4846b408d3b1ca45c58",
        "source":"\"use strict\";module.exports.world=function(){return\"world\"};",
        "deps":{},
        "file":"./assets/js/bar.js"
    }
]

bundle response

After a bundling is complete, the server will respond with a json body containing the keys file and uri where file is the name of the file for the bundled content that was saved on the server and uri is the same as file but with the server address prepended.

Example

{
    file: 'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json',
    uri: 'http://127.0.0.1:7100/acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json'
}

bundle

Bundle is a piece of bundled javascript or css content.

Contributing

The contribution process is as follows:

  • Fork this repository.
  • Make your changes as desired.
  • Run the tests using npm test. This will also check to ensure that 100% code coverage is maintained. If not you may need to add additional tests.
  • Stage your changes.
  • Run git commit or, if you are not familiar with semantic commit messages, please run npm run cm and follow the prompts instead which will help you write a correct semantic commit message.
  • Push your changes and submit a PR.
2.2.0

7 years ago

2.1.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.0-beta.13

7 years ago

1.0.0-beta.12

7 years ago

1.0.0-beta.11

7 years ago

1.0.0-beta.10

7 years ago

1.0.0-beta.9

7 years ago

1.0.0-beta.8

7 years ago

1.0.0-beta.7

7 years ago

1.0.0-beta.6

7 years ago

1.0.0-beta.5

7 years ago

1.0.0-beta.4

7 years ago

1.0.0-beta.3

7 years ago

1.0.0-beta.2

7 years ago

1.0.0-beta.1

7 years ago

1.0.0-alpha.9

7 years ago

1.0.0-alpha.8

7 years ago

1.0.0-alpha.7

7 years ago

1.0.0-alpha.6

7 years ago

1.0.0-alpha.5

7 years ago

1.0.0-alpha.4

7 years ago

1.0.0-alpha.3

7 years ago

1.0.0-alpha.2

8 years ago

1.0.0-alpha.1

8 years ago

1.0.0

8 years ago