integración oclazyload y ui router

This commit is contained in:
nelo 2016-10-05 15:19:28 +02:00
parent d1a86633fc
commit f42d6273eb
18 changed files with 131 additions and 40 deletions

View File

@ -1,3 +1,6 @@
import {bootstrap} from './bootstrap'; import {bootstrap} from './bootstrap';
import * as spliting from './spliting' import * as spliting from './spliting';
import * as routes from './routes';
bootstrap(); bootstrap();

View File

@ -0,0 +1,10 @@
{
"name": "@salix/core",
"version": "0.0.0",
"description": "",
"main": "index.js",
"repository": {
"type": "git",
"url": "http://git.verdnatura.es:/salix"
}
}

24
@salix/app/src/routes.js Normal file
View File

@ -0,0 +1,24 @@
import * as core from '@salix/core';
import * as spliting from './spliting';
core.module.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise("/");
$stateProvider
.state('index', {
url: "/index",
component:'customer.add',
templateProvider: function(){
console.log("hello");
},
resolve: {
loader: function($ocLazyLoad, $q){
return $q((resolve) => {
spliting.crud($ocLazyLoad, resolve);
});
}
}
})
});

View File

@ -1,19 +1,20 @@
const crud = () => { export const crud = (lazy, resolve) => {
require.ensure([], () => { require.ensure([], () => {
require('@salix/crud') var module = require('@salix/crud');
resolve(lazy.load({name:'crud'}));
}, "salix.crud"); }, "salix.crud");
}; };
const compras = () => { export const compras = () => {
require.ensure([], () => { require.ensure([], () => {
require('@salix/compras') require('@salix/compras')
}, "salix.compras"); }, "salix.compras");
}; };
const ventas = () => { export const ventas = () => {
require.ensure([], () => { require.ensure([], () => {
require('@salix/ventas') require('@salix/ventas')
}, "salix.ventas"); }, "salix.ventas");
}; };
const pagos = () => { export const pagos = () => {
require.ensure([], () => { require.ensure([], () => {
require('@salix/pagos') require('@salix/pagos')
}, "salix.pagos"); }, "salix.pagos");

View File

@ -1,7 +1,7 @@
/** /**
* export public module * export public module
*/ */
export {NAME} from './module'; export * from './module';
export * from './util'; export * from './util';
export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents' export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents'
export {NAME as INTERPOLATE,Interpolate} from './interpolate' export {NAME as INTERPOLATE,Interpolate} from './interpolate'

View File

@ -5,3 +5,4 @@ const DEPENDENCIES = getVendorDependencies(vendors)
export const NAME = getModuleName('core'); export const NAME = getModuleName('core');
export const module = vendors.ng.module(NAME,DEPENDENCIES); export const module = vendors.ng.module(NAME,DEPENDENCIES);

1
@salix/crud/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

View File

@ -1,3 +1 @@
import * as vendors from '@salix/vendor' export * from './src/crud';
import * as core from '@salix/core'
console.log('crud');

10
@salix/crud/package.json Normal file
View File

@ -0,0 +1,10 @@
{
"name": "@salix/crud",
"version": "0.0.0",
"description": "",
"main": "index.js",
"repository": {
"type": "git",
"url": "http://git.verdnatura.es:/salix"
}
}

4
@salix/crud/src/crud.js Normal file
View File

@ -0,0 +1,4 @@
export * from './module';
export * from './customer/routes';
export {NAME as CUSTOMER_INDEX, COMPONENT as CUSTOMER_INDEX_COMPONENT} from './customer/index'

View File

@ -0,0 +1 @@
<div>index</div>

View File

@ -0,0 +1,16 @@
import template from './index.html';
import {module} from '../../module';
export const NAME = 'customer.add';
export const COMPONENT = {
template: template,
controller: function() {
this.user = {name: 'world'};
}
};
module.component(NAME, COMPONENT);
module.factory('hello',function(){return true});
module.controller('pepito',function(hello){
console.log(hello);
});

View File

@ -0,0 +1,31 @@
import * as core from '@salix/core';
import * as index from './index';
core.module.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise("/");
$stateProvider
.state('index', {
url: "/index",
component: index.CUSTOMER_INDEX,
resolve:{
load:function(){
console.log('hello');
}
}
})
.state('add', {
url: "/add",
template: "<div>add</div>"
})
.state('edit', {
url: "/edit",
template: "<div>edit</div>"
})
.state('delete', {
url: "/delete",
template: "<div>delete</div>"
})
});

12
@salix/crud/src/module.js Normal file
View File

@ -0,0 +1,12 @@
import * as vendors from '@salix/vendor';
import * as core from '@salix/core';
//import {getModuleName,getVendorDependencies} from './util';
export const NAME = 'crud';
export const module = vendors.ng.module(NAME,[]);

View File

@ -7,6 +7,11 @@
<body> <body>
<div id="app"> <div id="app">
{{1+1}} {{1+1}}
<div ui-view></div>
<a ui-sref="index">index</a>
<a ui-sref="add">add</a>
<a ui-sref="edit">edit</a>
<a ui-sref="delete">delete</a>
</div> </div>
<script type="text/javascript" src="build/salix.app.js" selector="#app"></script> <script type="text/javascript" src="build/salix.app.js" selector="#app"></script>
</body> </body>

View File

@ -1,26 +0,0 @@
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'run', 'dev' ]
2 info using npm@1.4.21
3 info using node@v4.4.7
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info predev salix-app@1.0.0
6 info dev salix-app@1.0.0
7 verbose unsafe-perm in lifecycle true
8 info salix-app@1.0.0 Failed to exec dev script
9 error salix-app@1.0.0 dev: `webpack --progress --colors --watch`
9 error Exit status 1
10 error Failed at the salix-app@1.0.0 dev script.
10 error This is most likely a problem with the salix-app package,
10 error not with npm itself.
10 error Tell the author that this fails on your system:
10 error webpack --progress --colors --watch
10 error You can get their info via:
10 error npm owner ls salix-app
10 error There is likely additional logging output above.
11 error System Linux 4.7.0-1-amd64
12 error command "/usr/bin/nodejs" "/usr/bin/npm" "run" "dev"
13 error cwd /home/juan/Proyectos/salix
14 error node -v v4.4.7
15 error npm -v 1.4.21
16 error code ELIFECYCLE
17 verbose exit [ 1, true ]

View File

@ -9,9 +9,9 @@
"url": "http://git.verdnatura.es:/salix" "url": "http://git.verdnatura.es:/salix"
}, },
"dependencies": { "dependencies": {
"angular": "^1.5.8", "angular": "^1.4.1",
"angular-ui-router": "^0.3.1", "angular-ui-router": "^0.2.15",
"oclazyload": "^1.0.9" "oclazyload": "^0.6.3"
}, },
"devDependencies": { "devDependencies": {
"webpack": "*", "webpack": "*",