Total Pageviews

Wednesday, 8 April 2020

Node-Webkit-Packager

Node-webkit打包工具。
完成MacOS上Node-webkit的App自动打包脚本,支持打包Mac AppWin32 App
1.Node-webkit项目目录为resources;
2.脚本文件tool/builder.sh, 参数有一个为Resources绝对路径,不给出,为默认为项目下resources目录;
3.将Node-Webkit的核心文件放到node-webkit目录下,分macwin两个目录,mac下应有node-webkit.app,而win下应有nw.exenwsnapshot.exenw.pakicudt.dllffmpegsumo.dlllibEGL.dlllibGLESv2
4.配置文件config/app.config:
app_name=Demo  //APP的名称
app_class=demo  //APP的Class
app_package=me.edwon.nw  //APP的Package
app_site=http://edwon.sinaapp.com  //APP的官方地址
app_type=all  //需要打包的类型 all|mac|win
对于Mac,需要在config/mac下增加app.icnsInfo.plist
Info.plist代码:




    CFBundleDevelopmentRegion
    en
    CFBundleDisplayName
    NAME
    CFBundleDocumentTypes
    
        
            CFBundleTypeIconFile
            app.icns
            CFBundleTypeName
            NAME
            CFBundleTypeRole
            Viewer
            LSHandlerRank
            Owner
            LSItemContentTypes
            
                PACKAGE.CLASS
            
        
        
            CFBundleTypeName
            Folder
            CFBundleTypeOSTypes
            
                fold
            
            CFBundleTypeRole
            Viewer
            LSHandlerRank
            None
        
    
    CFBundleExecutable
    node-webkit
    CFBundleIconFile
    app.icns
    CFBundleIdentifier
    PACKAGE
    CFBundleInfoDictionaryVersion
    6.0
    CFBundleName
    NAME
    CFBundlePackageType
    APPL
    CFBundleShortVersionString
    29.0.1547.31
    CFBundleVersion
    1547.31
    LSFileQuarantineEnabled
    
    LSMinimumSystemVersion
    10.6.0
    NSPrincipalClass
    NSApplication
    NSSupportsAutomaticGraphicsSwitching
    
    SCMRevision
    213023
    UTExportedTypeDeclarations
    
        
            UTTypeConformsTo
            
                com.pkware.zip-archive
            
            UTTypeDescription
            NAME
            UTTypeIconFile
            app.icns
            UTTypeIdentifier
            PACKAGE.CLASS
            UTTypeReferenceURL
            URL
            UTTypeTagSpecification
            
                com.apple.ostype
                node-webkit
                public.filename-extension
                
                    nw
                
                public.mime-type
                application/x-node-webkit-app
            
        
    


其中NAMEPACKAGECLASSURL会根据配置项自动替换。(也可以自定义)
对于Win32,前四个配置项无效。然后用工具生成安装包即可。