osnova-module-template
v0.3.13
Published
Client+Server module template for node.js and browsers with built-in ES6 syntax support.
Downloads
5
Readme
#OSNOVA: Client+Server module template
###bI Client+Server module template for node.js and browsers with built-in ES6 syntax support. Wow such ready-to-go much time to watch anime.
###Philosophy Decoupling is good in a theory. On a practice you sometimes need to add a feature both to client and server. Client-server OSNOVA's modules is a fast way to accomplish this task. It is reusable, ES6-ready (thanks Babel) components. Components transpiles to ES5 code and can be used in most every enviroments without ES6 support as CommonJS module.
###Install
####via git (preferable)
git clone [email protected]:Noviel/osnova-module-template.git <your-module-name>
####or via download
https://github.com/Noviel/osnova-module-template/archive/master.zip
and uznip to new project directory.
####or via npm
npm install osnova-module-template
and then cut'n'paste content of /node_modules/osnova-module-template
to the root of your project.
###Prepare
- Go to
<your-module-name>
root directory. - Delete
.git
directory. npm install
for dependencies.- Set in
package.json
information about your module.
###Usage
- Write some cool code in
src/code
folder.
Client-side code is located in src/code/client
, server-side in src/code/server
.
index.js
in both directories are entry points for client/server.
This system is server-first in some aspects.
Common code used at server and at client is treated as more server-side and located in src/code/server/common
.
There are two sample sub-modules for client and server. If sub-module is big - you better give him his own directory.
- Run
npm run build
to build your revolutionary changes in code. This will put transpiled to ES5 code toclient
andserver
directories - Run some tests.
- Share your brilliant brand-new module with the whole world! or selfishly use it by yourself as
local module
without publication.
###Usage of your OSNOVA's module
To run your module without contamination of it you need a Host.
There is some hosts examples in hosts
directory for quick tests of your module, for example.
Mainly host for your OSNOVA's module is a project in which it was installed.
Host just do:
- At client
require('your-osnova-module/client');
- At server
require('your-osnova-module/server');
orrequire('your-osnova-module');
Webpack
or Browserify
or any other build system that supports CommonJS modules is required to include your module at a client-side.
####via Inner-Host
node ./hosts/<hostname.js>
####via npm
npm install your-osnova-module
.
####as Local Module
TBA in June
###Publish
Order for commands:
- build
- npm
- git
First of all to transpile your code:
npm run build
####to npm Npm won't allow you to publish the same version of module that is already exist in its registry.
There is useful scripts in package.json
for automatic bumping of version before publication to npm:
patch-release
, minor-release
, major-release
.
More about version system: https://github.com/npm/node-semver#functions
Ensure that you are logged-in into your npm account and located in module's root directory and:
npm run <patch|minor|major>-release or update version in package.json by your own and:
npm publish
#####to GitHub
Create new repository on GitHub.
git init git remote add origin git add . git commit -m "first commit" git push -u origin master
####Publish commands sample
npm run build
npm run patch-release
git add .
git commit -m "wow hidden genius has been revealed!"
git push -u origin master
###Bugs
Babel es-2015 export default
feature is not working :() I am investigating the situation!