
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
generator-angular-flow
Advanced tools
AngularJS app generator for large applications with maintainable and clear file structure (simulation of web components).
GENERATOR-ANGULAR-FLOW
Avoid boilerplate and improve productivity and consistency.
public/scrips
, public/components
, public/modals
and public/states
and styles in public/styles
will be automatically included in minifiers, index.html and tests. Specify configuration once and share it between all the things. Need more control? Check out resources.json.grunt server
Maintainer: Piotr Błaszczak inspired by angular-xl.
Install Node.js with npm FIRST!!!
then run:
npm install -g generator-angular-flow
Make a new directory, and cd
into it:
mkdir my-new-project
cd my-new-project
Run yo angular-flow
, with your application name:
yo angular-flow app-name
Run grunt server
to start the local server.
OR
Run grunt
if you use your own web serwer (apache, nginx etc.)
grunt (default) to watch files for compass and live reload.
grunt server to run a test server with live reload.
grunt server-dist to run a test server of builded version of your app.
grunt link links newly added files (css, js) to index.html
Available generators:
Note: Generators are to be run from the root directory of your app.
public/config/module.js
contains the applications main module definition. All dependancies for your application needs to be specified here.
Sets up a new AngularJS app, generating all the boilerplate you need to get started. The app generator also installs Twitter Bootstrap and additional AngularJS modules.
Example:
yo angular-flow
States are located under public/states
. A state basically is a controller, with a view and state specific styling. Routes are specified using the powerful Angular-UI Route API in the config section in the controller.
Example:
yo angular-flow:state user
Produces public/states/user/user-state.js
, public/states/user/user-state.html
and public/states/user/_user-state.scss
Routes are configured in public/config/routes.js
. Each individual controller registers its own route.
Generates a controller in public/scripts/controllers
.
Example:
yo angular-flow:controller user
Generates a directive in public/scripts/directives
.
Example:
yo angular-flow:directive myDirective
Produces public/scripts/directives/my-directive.js
:
angular.module('myMod').directive('myDirective', function () {
return {
template: '<div></div>',
restrict: 'E',
link: function postLink(scope, element, attrs) {
element.text('this is the myDirective directive');
}
};
});
A component is basically a element directive that by convention use a view located in public/components/<component-name>/<component-name>.html
.
This helps keep complexity low, and makes it easy to separate parts of your application into smaller and more maintainable parts.
Example:
yo angular-flow:component awesomeUnicorn
Produces these files:
public/components/navbar.js
:
angular.module('yourModule')
.directive('navbarComp', function () {
return {
restrict: 'E',
templateUrl: '/components/navbar/navbar.html',
controller: 'navbarComp'
};
})
.controller('navbarComp', function ($scope) {
});
public/components/navbar/_navbar.scss
(and adds an import statement to it in public/styles/_components.scss
)
public/components/navbar/navbar.html
<div class="navbar-comp">
<p>This is the navbar component.</p>
</div>
Witch in turn lets you specify custom HTML tags like this to invoke a completely self contained component:
<navbar-comp></navbar-comp>
The view has specified a component name as a class, helping you avoid CSS collisions. Specify your styles specific for this component in SCSS under a .navbar-comp
class wrapper, and only this component is targeted. This is an OK approach until shadow DOMs and web components become widely supported.
Generates a filter in public/scripts/filters
.
Example:
yo angular-flow:filter myFilter
Produces public/scripts/filters/my-filter.js
:
angular.module('myMod').filter('myFilter', function () {
return function (input) {
return 'myFilter filter:' + input;
};
});
Generates an AngularJS service.
Example:
yo angular-flow:service myService
Produces public/scripts/services/my-service.js
:
angular.module('myMod').service('myService', function () {
// ...
});
The following packages are always installed by the app generator:
The following additional modules are optional:
All of these can be updated with bower update
as new versions of AngularJS are released.
When you install new dependancies you have to add a reference to the script files in resources.json
under external
. The build task will inject this into index.html
during runtime, and when you build the project it will by convention use the minified version of the source file, that should be located in the same folder, with the exact same filename with a .min
suffix. This will be concatenated without minification.
Yeoman generated projects can be further tweaked according to your needs by modifying project files appropriately.
You can change the app
directory by adding a appPath
property to bower.json
. For instance, if you wanted to easily integrate with Express.js, you could add the following:
{
"name": "yo-test",
"version": "0.0.0",
...
"appPath": "public"
}
This will cause Yeoman-generated client-side files to be placed in public
.
All configuration about what files and in what order the files are supposed to be loaded is specified in resources.json
.
This configuration is shared between both jasmine, minifiers and index.html.
Resource.json contains two sections. One for JS and one for SCSS.
"config/routes.js",
"scripts/**/*.js"
Files will be matched only once, so in the aforementioned example the routes config will be loaded before everything else is included.
Add a reference in resource to the unminified version of the library you want to use, as it will automatically use the library suffixed with .min
during build time.
FAQs
AngularJS+Webpack app generator for large applications with maintainable and clear file structure
The npm package generator-angular-flow receives a total of 3 weekly downloads. As such, generator-angular-flow popularity was classified as not popular.
We found that generator-angular-flow demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.