1.0.0 • Published 8 years ago

fsdk v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

fsdk

NPM version Build Status Coverage Status

Managing your front-end sdk. Cuts source code by environment.

Install

npm install fsdk

Usage

var fsdk = require('fsdk');

fsdk.compile({
  src: './sdk/**/*.*',
  dest: './dist/',
  env: 'user-part'
});

or using with gulp:

var gulp = require('gulp');
var fsdk = require('fsdk');

gulp.task('compileSDK', function () {
  return gulp.src('sdk/*.*')
    .pipe(fsdk.parseFile('user-part'))
    .pipe(gulp.dest('dist/sdk'))
});

Example source file:

function User () {

}

User.prototype.get = function() {

};

User.prototype.update = function() {

};

// fsdk:start(admin-part)
User.prototype.delete = function(first_argument) {

};
// fsdk:end

Result:

function User () {

}

User.prototype.get = function() {

};

User.prototype.update = function() {

};

Supported comments

  • JS: // fsdk:start(env)
  • CoffeeScript: # fsdk:start(env)

API

fsdk.compile(options)

options

Type: object

All options is required

options.src

Type: string or array

Glob or array of globs to read (node-glob syntax). More info

options.dest

Type: string

The path (output folder) to write files to. More info

options.env

Type: string

Source code environment

fsdk.parseFile(env)

Returns a stream

env

Type: string

Source code environment

License

The MIT License

1.0.0

8 years ago