Angularjs 将linemanjs angular 1应用程序迁移到angular 2的最佳方法是什么

Angularjs 将linemanjs angular 1应用程序迁移到angular 2的最佳方法是什么,angularjs,angular,migration,linemanjs,Angularjs,Angular,Migration,Linemanjs,我用Linenanjs构建了一个Angular 1应用程序。我正在将它迁移到Angular 2。我集成了Typescript并删除了ng应用程序。下一步是集成Angular 2库并开始实际迁移 在此之前,我想看看是否有人已经这样做了,并就将Angular 2模块集成到Angular 1应用程序的最佳实践提出了建议/食谱。简介 我开始这一旅程的目的是将新的NG2与现有的NG1构建过程相结合;这似乎是合理的,因为我的目标是为混合NG1/NG2应用开发环境 NG1和NG2的构建方式存在根本区别: T

我用Linenanjs构建了一个Angular 1应用程序。我正在将它迁移到Angular 2。我集成了Typescript并删除了ng应用程序。下一步是集成Angular 2库并开始实际迁移

在此之前,我想看看是否有人已经这样做了,并就将Angular 2模块集成到Angular 1应用程序的最佳实践提出了建议/食谱。

简介 我开始这一旅程的目的是将新的NG2与现有的NG1构建过程相结合;这似乎是合理的,因为我的目标是为混合NG1/NG2应用开发环境

NG1和NG2的构建方式存在根本区别:

  • TypeScript:NG2将TypeScript添加到现有的JavaScript和DART语言选项中。TypeScript是对JavaScript的巨大改进,我不打算使用DART
  • 模块管理:NG2采用ES5模块管理,放弃NG1自己的模块管理。应用程序和供应商文件现在作为模块提供,模块管理器(我使用SystemJS,但很快将升级到Webpack)根据应用程序的需要加载这些模块
  • 组件:NG2组件体系结构强烈建议,所有工件(css、html、less、png等)都应该放在同一个模块文件夹中,由模块管理器在开发人员的帮助下,承担必要时加载这些文件的角色
方法 在构建NG1/NG2集成构建环境的过程中,我得出结论,正确的做法是将NG2环境与NG1环境完全分离,但共存。一旦我得出这个结论,很明显这是正确的方法,因为一旦我们将所有NG1软件迁移到NG2,我们还希望无缝地删除所有NG1构建工件和软件,如果两者紧密结合,这将很难做到

考虑到这一点,进行了以下更改:

  • config/files-创建了调用NG2文件的定义;其想法是,所有NG2任务都将在这些文件定义上运行,同时避免使用现有的文件定义,因此保留删除未使用的NG1文件定义的选项
  • 配置/应用程序-有两组基本更改: **任务-同样,我努力创建任务来完成特定的NG2工作。 **工作流-这里是NG1和NG2任务混合共存的地方
文件夹 有关我的config/files.js代码和随后的一些注释,请参见下文:

module.exports = function(lineman) {
    //Override file patterns here
    return {
        dlabs: {
            targetIq: "../../../target/iq"
        },
        js: {
            vendor: [
                "vendor/js/hmac-md5.js",
                "vendor/js/hmac-sha1.js",
                "vendor/js/hmac-core-min.js",
                "vendor/js/hmac-enc-utf16-min.js",
                "vendor/js/hmac-enc-base64-min.js",
                "vendor/js/jquery.js",
                "vendor/js/bootstrap.js",
                "vendor/js/angular.js",
                "vendor/js/**/*.js"
            ],
            app: [
                "app/js/app.js",
                "app/js/**/*.js"
            ],
            concatenatedVendor: "generated/js/appVendor.js",
            "minifiedVendor": "dist/js/appVendor.js",
        },

        less: {
            compile: {
                options: {
                    paths: [
                        "vendor/css/angular-strap-docs.min.css",
                        "vendor/css/angular-strap-libs.min.css",
                        "vendor/css/bootstrap.css",
                        "vendor/css/**/*.css",
                        "vendor/components/**/*.css",
                        "app/ng2/styles.less",
                        "app/css/**/*.less"
                    ]
                }
            }
        },

        ng2: {
            libs: [
                "systemjs.config.js",
                "node_modules/@angular/**",
                "node_modules/systemjs/**",
                "node_modules/core-js/**",
                "node_modules/reflect-metadata/**",
                "node_modules/rxjs/**",
                "node_modules/zone.js/**",
                "node_modules/angular2-in-memory-web-api/**"
            ],
            css: [
                // used in conjunction with the CWD option
                "**/*.css"
            ],
            html: [
                // used in conjunction with the CWD option
                "**/*.html"
            ],
            "systemjs": {
                generated: "generated/",
                dist: "dist/"
            },
            ts: [
                // used in conjunction with the CWD option
                "**/*.ts"
            ],
            generated: "generated/ng2",
            dist: "dist/ng2"
        },

        webfonts: {
            root: "fonts"
        }
    };
};
/* Exports a function which returns an object that overrides the default &
 *   plugin grunt configuration object.
 *
 * You can familiarize yourself with Lineman"s defaults by checking out:
 *
 *   - https://github.com/linemanjs/lineman/blob/master/config/application.coffee
 *   - https://github.com/linemanjs/lineman/blob/master/config/plugins
 *
 * You can also ask Lineman"s about config from the command line:
 *
 *   $ lineman config #=> to print the entire config
 *   $ lineman config concat.js #=> to see the JS config for the concat task.
 */
module.exports = function(lineman) {
    // DO NOT REMOVE
    var app = lineman.config.application;


    //Override application configuration here. Common examples follow in the comments.
    return {
        // grunt-angular-templates assumes your module is named "app", but
        // you can override it like so:
        //
        // ngtemplates: {
        //   options: {
        //     module: "myModuleName"
        //   }
        // }

        server: {
            pushState: true
            // API Proxying
            //
            // During development, you"ll likely want to make XHR (AJAX) requests to an API on the same
            // port as your lineman development server. By enabling the API proxy and setting the port, all
            // requests for paths that don"t match a static asset in ./generated will be forwarded to
            // whatever service might be running on the specified port.
            //
            // apiProxy: {
            //   enabled: true,
            //   host: "localhost",
            //   port: 3000
            // }
        },

        loadNpmTasks: lineman.config.application.loadNpmTasks.concat("grunt-contrib-copy", "grunt-exec", "grunt-contrib-clean", "grunt-ts"),

        /* *************************************************************************************************************
         * Task Definition
         ************************************************************************************************************ */

        clean: {
            "vendor": ["vendor"],
            "generated": {
                src: "<%= files.ng2.generated %>" + "/*",
                options: {
                    force: true
                }
            },
            "targetIq": {
                src: "<%= files.dlabs.targetIq %>" + "/*",
                options: {
                    force: true
                }
            }
        },

        "concat_sourcemap": {
            "js": {
                "src": [
                    "<%= files.js.app %>",
                    "<%= files.coffee.generated %>",
                    "<%= files.template.generated %>"
                ],
                "dest": "<%= files.js.concatenated %>"
            },
            "vendor": {
                "src": [
                    "<%= files.js.vendor %>"
                ],
                "dest": "<%= files.js.concatenatedVendor %>"
            }
        },

        copy: {
            "dl-deploy-dev": {
                files: [
                    {
                        expand: true,
                        cwd: "generated/",
                        src: ["**"],
                        dest: "<%= files.dlabs.targetIq %>"
                    },
                    {
                        expand: true,
                        flatten: true,
                        dest: "../../../target/iq/css",
                        src: [
                            "vendor/static/fonts/ui-grid.ttf",
                            "vendor/static/fonts/ui-grid.woff"
                        ]
                    }
                ]
            },
            // Copies the ng2 libraries to the target folder, instead of generated.
            // Copying to generated and then to target is too expensive while watching.
            "ng2-libs-to-target": {
                files: [
                    {expand: true, src: "<%= files.ng2.libs %>", dest: "../../../target/iq/" }
                ]
            },
            "ng2-css-files-to-generated": {
                // See Copy files to different directory (https://github.com/gruntjs/grunt-contrib-copy/issues/58)
                // I used to ensure that the compiled ts files (js / map) and their companions (ts / html / css) landed on the same folder
                expand: true,
                cwd: "app/ng2",
                src: "<%= files.ng2.css %>",
                dest: "<%= files.ng2.generated %>"
             },
            "ng2-files-to-generated": {
                // See Copy files to different directory (https://github.com/gruntjs/grunt-contrib-copy/issues/58)
                // I used to ensure that the compiled ts files (js / map) and their companions (ts / html / css) landed on the same folder
                expand: true,
                cwd: "app/ng2",
                src: ["<%= files.ng2.css %>", "<%= files.ng2.html %>"],
                dest: "<%= files.ng2.generated %>"
            },
            "ng2-html-files-to-generated": {
                // See Copy files to different directory (https://github.com/gruntjs/grunt-contrib-copy/issues/58)
                // I used to ensure that the compiled ts files (js / map) and their companions (ts / html / css) landed on the same folder
                expand: true,
                cwd: "app/ng2",
                src: "<%= files.ng2.html %>",
                dest: "<%= files.ng2.generated %>"
            },
            "ng2-ts-files-to-generated": {
                // See Copy files to different directory (https://github.com/gruntjs/grunt-contrib-copy/issues/58)
                // I used to ensure that the compiled ts files (js / map) and their companions (ts / html / css) landed on the same folder
                expand: true,
                cwd: "app/ng2",
                src: "<%= files.ng2.ts %>",
                dest: "<%= files.ng2.generated %>"
            },
            "ng2-files-to-dist": {
                // See Copy files to different directory (https://github.com/gruntjs/grunt-contrib-copy/issues/58)
                // I used to ensure that the compiled ts files (js / map) and their companions (ts / html / css) landed on the same folder
                expand: true,
                cwd: "app/ng2",
                src: ["<%= files.ng2.css %>", "<%= files.ng2.html %>"],
                dest: "<%= files.ng2.dist %>"
            },
            // Copies the angular 2 libraries to the dist folder.
            // Executed by the "lineman build" command
            "ng2-libs-to-dist": {
                files: [
                    {expand: true, src: "<%= files.ng2.libs %>", dest: "dist/"}
                ]
            },
            "systemjs-to-dist": {
                src: "systemjs.config.js",
                dest: "<%= files.ng2.systemjs.dist %>"
            },
            "systemjs-to-generated": {
                src: "systemjs.config.js",
                dest: "<%= files.ng2.systemjs.generated %>"
            }
        },

        // Added this to fix the following error:
        // Warning: Path must be a string. Received null Use --force to continue.
        // found out about this error here: https://github.com/jshint/jshint/issues/2922
        jshint: {
            options: {
                reporterOutput: ""
            }
        },

        // Task to compile typescript files
        // Look here for config options: https://www.npmjs.com/package/grunt-ts
        ts: {
            development: {
                "src": "app/ng2/**/*.ts",
                "outDir": "<%= files.ng2.generated %>",
                "options": {
                    "emitDecoratorMetadata": true,
                    "module": "system",
                    "moduleResolution": "node",
                    "noImplicitAny": false,
                    "removeComments": false,
                    "sourceMap": true,
                    // using es5 is problematic with NG2-beta
                    // http://stackoverflow.com/questions/33332394/angular-2-typescript-cant-find-names
                    "target": "es6"
                }
            },
            production: {
                "src": "app/ng2/**/*.ts",
                "outDir": "<%= files.ng2.dist %>",
                "options": {
                    "emitDecoratorMetadata": true,
                    "module": "system",
                    "moduleResolution": "node",
                    "noImplicitAny": false,
                    "removeComments": false,
                    "sourceMap": false,
                    // using es5 is problematic with NG2-beta
                    // http://stackoverflow.com/questions/33332394/angular-2-typescript-cant-find-names
                    "target": "es6"
                }
            }
        },

        uglify: {
            vendor: {
                files: {
                    "<%= files.js.minifiedVendor %>": "<%= files.js.concatenatedVendor %>"
                }
            }
        },

        /*
         Custom watch to copy changed files to the target folder based on suggestion by justin@testdouble.com
         */
        watch: {
            "systemjs-config-js": {
                "files": "systemjs.config.js",
                "tasks": ["copy:systemjs-to-generated"]
            },
            // renamed & deleted files remain in place, restarting lineman run will fix it
            "ng2-css": {
                "files": "<%= files.ng2.css %>",
                "tasks": ["copy:ng2-css-files-to-generated"]
            },
            // renamed & deleted files remain in place, restarting lineman run will fix it
            "ng2-html": {
                "files": "<%= files.ng2.html %>",
                "tasks": ["copy:ng2-html-files-to-generated"]
            },
            // renamed & deleted files remain in place, restarting lineman run will fix it
            "ng2-ts": {
                "files": "<%= files.ng2.ts %>",
                "tasks": ["ts:development"]
            },
            target: {
                "files": [
                    "systemjs.config.js",
                    "app/**/*",
                    "spec/**/*",
                    "spec-e2e/**/*"],
                "tasks": "copy:dl-deploy-dev"
            }
        },

        webfonts: {
            files: {
                "vendor/components/FontAwesome/fonts/": "vendor/static/fonts/FontAwesome.*",
                "vendor/components/fontawesome-webfont/fonts/": "vendor/static/fonts/fontawesome-webfont.*",
                "vendor/components/glypicons-halflings-regular/fonts/": "vendor/static/fonts/glypicons-halflings-regular.*",
                "vendor/components/ui-grid/fonts/": "vendor/static/fonts/ui-grid.*"
            }
        },

        /* *************************************************************************************************************
         * Workflow Definition
         ************************************************************************************************************ */

        /*
         I struggled with getting this right. I got it to work after carefully reading:
         - Creating Lineman Plugins http://linemanjs.com/#creating-lineman-plugins
         - https://github.com/linemanjs/lineman-dogescript/blob/master/config/plugins/dogescript.coffee#L13-L14
         */
        prependTasks: {
            dev: [
                "clean:targetIq",
                "clean:generated",
                "copy:ng2-libs-to-target",
                "ts:development",
                "copy:ng2-files-to-generated",
                "copy:dl-deploy-dev"].concat(app.prependTasks.dev),
            common: ["concat_sourcemap:vendor", "dl-install-libs"].concat(app.prependTasks.common),
            dist: [
                "copy:ng2-libs-to-dist",
                "ts:production"].concat(app.prependTasks.dist)
        },
        appendTasks: {
            dist: [
                "uglify:vendor",
                "copy:systemjs-to-dist",
                "copy:ng2-files-to-dist"].concat(app.appendTasks.dist)
        },
        removeTasks: {
            dev: ["server"]
        }
    };
};
注:

  • files.ng2-是包含所有ng2相关文件定义的对象
  • files.ng2.libs-是一个数组,包含需要复制到服务器目标文件夹的支持文件(非应用程序)的源位置;如图所示,NG2要求供应商模块可由模块管理器加载
  • files.ng2.css:定义要监视更改的css文件;注意,我选择不处理更少的文件;如果您对此感兴趣,请使用用于处理ts文件的模式
  • files.ng2.html:定义要监视更改的html文件
  • files.ng2.generated:开发过程中放置文件的目标文件夹;copy:dl deploy dev任务(参见config/application.js文件)用于将这些文件复制到my server(wildfly)目标文件夹
  • files.ng2.dist:运行buid时放置文件的目标文件夹
应用 有关我的config/application.js代码和随后的一些注释,请参见下文:

module.exports = function(lineman) {
    //Override file patterns here
    return {
        dlabs: {
            targetIq: "../../../target/iq"
        },
        js: {
            vendor: [
                "vendor/js/hmac-md5.js",
                "vendor/js/hmac-sha1.js",
                "vendor/js/hmac-core-min.js",
                "vendor/js/hmac-enc-utf16-min.js",
                "vendor/js/hmac-enc-base64-min.js",
                "vendor/js/jquery.js",
                "vendor/js/bootstrap.js",
                "vendor/js/angular.js",
                "vendor/js/**/*.js"
            ],
            app: [
                "app/js/app.js",
                "app/js/**/*.js"
            ],
            concatenatedVendor: "generated/js/appVendor.js",
            "minifiedVendor": "dist/js/appVendor.js",
        },

        less: {
            compile: {
                options: {
                    paths: [
                        "vendor/css/angular-strap-docs.min.css",
                        "vendor/css/angular-strap-libs.min.css",
                        "vendor/css/bootstrap.css",
                        "vendor/css/**/*.css",
                        "vendor/components/**/*.css",
                        "app/ng2/styles.less",
                        "app/css/**/*.less"
                    ]
                }
            }
        },

        ng2: {
            libs: [
                "systemjs.config.js",
                "node_modules/@angular/**",
                "node_modules/systemjs/**",
                "node_modules/core-js/**",
                "node_modules/reflect-metadata/**",
                "node_modules/rxjs/**",
                "node_modules/zone.js/**",
                "node_modules/angular2-in-memory-web-api/**"
            ],
            css: [
                // used in conjunction with the CWD option
                "**/*.css"
            ],
            html: [
                // used in conjunction with the CWD option
                "**/*.html"
            ],
            "systemjs": {
                generated: "generated/",
                dist: "dist/"
            },
            ts: [
                // used in conjunction with the CWD option
                "**/*.ts"
            ],
            generated: "generated/ng2",
            dist: "dist/ng2"
        },

        webfonts: {
            root: "fonts"
        }
    };
};
/* Exports a function which returns an object that overrides the default &
 *   plugin grunt configuration object.
 *
 * You can familiarize yourself with Lineman"s defaults by checking out:
 *
 *   - https://github.com/linemanjs/lineman/blob/master/config/application.coffee
 *   - https://github.com/linemanjs/lineman/blob/master/config/plugins
 *
 * You can also ask Lineman"s about config from the command line:
 *
 *   $ lineman config #=> to print the entire config
 *   $ lineman config concat.js #=> to see the JS config for the concat task.
 */
module.exports = function(lineman) {
    // DO NOT REMOVE
    var app = lineman.config.application;


    //Override application configuration here. Common examples follow in the comments.
    return {
        // grunt-angular-templates assumes your module is named "app", but
        // you can override it like so:
        //
        // ngtemplates: {
        //   options: {
        //     module: "myModuleName"
        //   }
        // }

        server: {
            pushState: true
            // API Proxying
            //
            // During development, you"ll likely want to make XHR (AJAX) requests to an API on the same
            // port as your lineman development server. By enabling the API proxy and setting the port, all
            // requests for paths that don"t match a static asset in ./generated will be forwarded to
            // whatever service might be running on the specified port.
            //
            // apiProxy: {
            //   enabled: true,
            //   host: "localhost",
            //   port: 3000
            // }
        },

        loadNpmTasks: lineman.config.application.loadNpmTasks.concat("grunt-contrib-copy", "grunt-exec", "grunt-contrib-clean", "grunt-ts"),

        /* *************************************************************************************************************
         * Task Definition
         ************************************************************************************************************ */

        clean: {
            "vendor": ["vendor"],
            "generated": {
                src: "<%= files.ng2.generated %>" + "/*",
                options: {
                    force: true
                }
            },
            "targetIq": {
                src: "<%= files.dlabs.targetIq %>" + "/*",
                options: {
                    force: true
                }
            }
        },

        "concat_sourcemap": {
            "js": {
                "src": [
                    "<%= files.js.app %>",
                    "<%= files.coffee.generated %>",
                    "<%= files.template.generated %>"
                ],
                "dest": "<%= files.js.concatenated %>"
            },
            "vendor": {
                "src": [
                    "<%= files.js.vendor %>"
                ],
                "dest": "<%= files.js.concatenatedVendor %>"
            }
        },

        copy: {
            "dl-deploy-dev": {
                files: [
                    {
                        expand: true,
                        cwd: "generated/",
                        src: ["**"],
                        dest: "<%= files.dlabs.targetIq %>"
                    },
                    {
                        expand: true,
                        flatten: true,
                        dest: "../../../target/iq/css",
                        src: [
                            "vendor/static/fonts/ui-grid.ttf",
                            "vendor/static/fonts/ui-grid.woff"
                        ]
                    }
                ]
            },
            // Copies the ng2 libraries to the target folder, instead of generated.
            // Copying to generated and then to target is too expensive while watching.
            "ng2-libs-to-target": {
                files: [
                    {expand: true, src: "<%= files.ng2.libs %>", dest: "../../../target/iq/" }
                ]
            },
            "ng2-css-files-to-generated": {
                // See Copy files to different directory (https://github.com/gruntjs/grunt-contrib-copy/issues/58)
                // I used to ensure that the compiled ts files (js / map) and their companions (ts / html / css) landed on the same folder
                expand: true,
                cwd: "app/ng2",
                src: "<%= files.ng2.css %>",
                dest: "<%= files.ng2.generated %>"
             },
            "ng2-files-to-generated": {
                // See Copy files to different directory (https://github.com/gruntjs/grunt-contrib-copy/issues/58)
                // I used to ensure that the compiled ts files (js / map) and their companions (ts / html / css) landed on the same folder
                expand: true,
                cwd: "app/ng2",
                src: ["<%= files.ng2.css %>", "<%= files.ng2.html %>"],
                dest: "<%= files.ng2.generated %>"
            },
            "ng2-html-files-to-generated": {
                // See Copy files to different directory (https://github.com/gruntjs/grunt-contrib-copy/issues/58)
                // I used to ensure that the compiled ts files (js / map) and their companions (ts / html / css) landed on the same folder
                expand: true,
                cwd: "app/ng2",
                src: "<%= files.ng2.html %>",
                dest: "<%= files.ng2.generated %>"
            },
            "ng2-ts-files-to-generated": {
                // See Copy files to different directory (https://github.com/gruntjs/grunt-contrib-copy/issues/58)
                // I used to ensure that the compiled ts files (js / map) and their companions (ts / html / css) landed on the same folder
                expand: true,
                cwd: "app/ng2",
                src: "<%= files.ng2.ts %>",
                dest: "<%= files.ng2.generated %>"
            },
            "ng2-files-to-dist": {
                // See Copy files to different directory (https://github.com/gruntjs/grunt-contrib-copy/issues/58)
                // I used to ensure that the compiled ts files (js / map) and their companions (ts / html / css) landed on the same folder
                expand: true,
                cwd: "app/ng2",
                src: ["<%= files.ng2.css %>", "<%= files.ng2.html %>"],
                dest: "<%= files.ng2.dist %>"
            },
            // Copies the angular 2 libraries to the dist folder.
            // Executed by the "lineman build" command
            "ng2-libs-to-dist": {
                files: [
                    {expand: true, src: "<%= files.ng2.libs %>", dest: "dist/"}
                ]
            },
            "systemjs-to-dist": {
                src: "systemjs.config.js",
                dest: "<%= files.ng2.systemjs.dist %>"
            },
            "systemjs-to-generated": {
                src: "systemjs.config.js",
                dest: "<%= files.ng2.systemjs.generated %>"
            }
        },

        // Added this to fix the following error:
        // Warning: Path must be a string. Received null Use --force to continue.
        // found out about this error here: https://github.com/jshint/jshint/issues/2922
        jshint: {
            options: {
                reporterOutput: ""
            }
        },

        // Task to compile typescript files
        // Look here for config options: https://www.npmjs.com/package/grunt-ts
        ts: {
            development: {
                "src": "app/ng2/**/*.ts",
                "outDir": "<%= files.ng2.generated %>",
                "options": {
                    "emitDecoratorMetadata": true,
                    "module": "system",
                    "moduleResolution": "node",
                    "noImplicitAny": false,
                    "removeComments": false,
                    "sourceMap": true,
                    // using es5 is problematic with NG2-beta
                    // http://stackoverflow.com/questions/33332394/angular-2-typescript-cant-find-names
                    "target": "es6"
                }
            },
            production: {
                "src": "app/ng2/**/*.ts",
                "outDir": "<%= files.ng2.dist %>",
                "options": {
                    "emitDecoratorMetadata": true,
                    "module": "system",
                    "moduleResolution": "node",
                    "noImplicitAny": false,
                    "removeComments": false,
                    "sourceMap": false,
                    // using es5 is problematic with NG2-beta
                    // http://stackoverflow.com/questions/33332394/angular-2-typescript-cant-find-names
                    "target": "es6"
                }
            }
        },

        uglify: {
            vendor: {
                files: {
                    "<%= files.js.minifiedVendor %>": "<%= files.js.concatenatedVendor %>"
                }
            }
        },

        /*
         Custom watch to copy changed files to the target folder based on suggestion by justin@testdouble.com
         */
        watch: {
            "systemjs-config-js": {
                "files": "systemjs.config.js",
                "tasks": ["copy:systemjs-to-generated"]
            },
            // renamed & deleted files remain in place, restarting lineman run will fix it
            "ng2-css": {
                "files": "<%= files.ng2.css %>",
                "tasks": ["copy:ng2-css-files-to-generated"]
            },
            // renamed & deleted files remain in place, restarting lineman run will fix it
            "ng2-html": {
                "files": "<%= files.ng2.html %>",
                "tasks": ["copy:ng2-html-files-to-generated"]
            },
            // renamed & deleted files remain in place, restarting lineman run will fix it
            "ng2-ts": {
                "files": "<%= files.ng2.ts %>",
                "tasks": ["ts:development"]
            },
            target: {
                "files": [
                    "systemjs.config.js",
                    "app/**/*",
                    "spec/**/*",
                    "spec-e2e/**/*"],
                "tasks": "copy:dl-deploy-dev"
            }
        },

        webfonts: {
            files: {
                "vendor/components/FontAwesome/fonts/": "vendor/static/fonts/FontAwesome.*",
                "vendor/components/fontawesome-webfont/fonts/": "vendor/static/fonts/fontawesome-webfont.*",
                "vendor/components/glypicons-halflings-regular/fonts/": "vendor/static/fonts/glypicons-halflings-regular.*",
                "vendor/components/ui-grid/fonts/": "vendor/static/fonts/ui-grid.*"
            }
        },

        /* *************************************************************************************************************
         * Workflow Definition
         ************************************************************************************************************ */

        /*
         I struggled with getting this right. I got it to work after carefully reading:
         - Creating Lineman Plugins http://linemanjs.com/#creating-lineman-plugins
         - https://github.com/linemanjs/lineman-dogescript/blob/master/config/plugins/dogescript.coffee#L13-L14
         */
        prependTasks: {
            dev: [
                "clean:targetIq",
                "clean:generated",
                "copy:ng2-libs-to-target",
                "ts:development",
                "copy:ng2-files-to-generated",
                "copy:dl-deploy-dev"].concat(app.prependTasks.dev),
            common: ["concat_sourcemap:vendor", "dl-install-libs"].concat(app.prependTasks.common),
            dist: [
                "copy:ng2-libs-to-dist",
                "ts:production"].concat(app.prependTasks.dist)
        },
        appendTasks: {
            dist: [
                "uglify:vendor",
                "copy:systemjs-to-dist",
                "copy:ng2-files-to-dist"].concat(app.appendTasks.dist)
        },
        removeTasks: {
            dev: ["server"]
        }
    };
};
/*导出一个函数,该函数返回覆盖默认值的对象&
*插件grunt配置对象。
*
*通过签出以下内容,您可以熟悉Lineman的默认设置:
*
*   - https://github.com/linemanjs/lineman/blob/master/config/application.coffee
*   - https://github.com/linemanjs/lineman/blob/master/config/plugins
*
*您还可以从命令行询问线路员关于配置的信息:
*
*$lineman config#=>以打印整个配置
*$lineman config concat.js#=>以查看concat任务的js配置。
*/
module.exports=函数(线路员){
//不要移除
var app=lineman.config.application;
//此处覆盖应用程序配置。注释中有常见示例。
返回{
//grunt angular templates假定您的模块名为“app”,但
//您可以这样覆盖它:
//
//NGB模板:{
//选项:{
//模块:“myModuleName”
//   }
// }
服务器:{
国家:对
//API代理
//
//在开发过程中,您可能希望在同一平台上向API发出XHR(AJAX)请求
//端口作为lineman开发服务器。通过启用API代理并设置端口,所有
//对与./generated中的静态资产不匹配的路径的请求将转发到
//指定端口上可能正在运行的任何服务。
//
//apiProxy:{
//启用:对,
//主机:“本地主机”,
//港口:3000
// }
},
loadNpmTasks:lineman.config.application.loadNpmTasks.concat(“grunt contrib copy”、“grunt exec”、“grunt contrib clean”、“grunt ts”),
/* *************************************************************************************************************
*任务定义
************************************************************************************************************ */
清洁:{
“卖方”:[“卖方”],
“生成”:{