简体   繁体   English

Sencha Cmd 5共享软件包集成工作流程

[英]Sencha Cmd 5 shared package integration workflow

Can anyone explain how to implement the shared package feature in Sencha Cmd 5 with ExtJs 5? 谁能解释如何使用ExtJs 5在Sencha Cmd 5中实现共享软件包功能? I created a workspace containing two applications. 我创建了一个包含两个应用程序的工作区。 These applications share javascript code, which was placed in the proper packages folder, and the application's respective app.json was modified as instructed here . 这些应用程序共享javascript代码,该代码位于适当的packages文件夹中,并且按照此处的说明修改了应用程序各自的app.json。

The shared code is not being implemented after running the "sencha app refresh" command. 运行“ sencha应用刷新”命令后,共享代码未实现。 I have been at this for days now. 我已经来这几天了。 Below are the steps I took to create the workspace, apps and package: 以下是我创建工作区,应用程序和程序包所采取的步骤:

Step 1: Create Workspace 步骤1:创建工作区

sencha generate workspace ./

Step 2: Create Apps 步骤2:建立应用程式

sencha generate app -ext -path ./testapp1/ -name testapp1
sencha generate app -ext -path ./testapp2/ -name testapp2

Step 3: Create Package Called "common" 步骤3:创建名为“ common”的软件包

sencha generate package -name common

Step 4: Drop basic ExtJs class file in packages/common/src folder 步骤4:将基本ExtJs类文件拖放到packages / common / src文件夹中

Step 5: Modify app.json code in both applications to include newly dropped ExtJs class 步骤5:在两个应用程序中修改app.json代码以包括新删除的ExtJs类

Step 6: Refresh 第6步:刷新

sencha app refresh

After running refresh, I expect to be able to use the code, or at least reference it using FireBug. 运行刷新后,我希望能够使用该代码,或者至少使用FireBug引用它。 Am I missing a step??? 我错过了一步吗??? Any help would be greatly appreciated. 任何帮助将不胜感激。

You basically have it correct. 您基本上是正确的。 the app.json file needs to have the requires property set to include your common package. app.json文件需要有requires的属性集,包括您的common包。

"requires" : [ "common" ]

Then be sure to use requires on any class in your application to include the source files from your package. 然后,请确保在应用程序中的任何类上使用requires ,以包括包中的源文件。

Ext.define('MyApp.foo.Bar', {
    requires : [
        'Common.Util' //or whatever it's called
    ],

    //...
});

And finally the sencha app refresh so that the bootstrap paths are correctly updated. 最后, sencha app refresh以便正确更新引导路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM