You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2017/12/12 08:07:10 UTC

[royale-asjs] branch develop updated: first cut at npm

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 30599f8  first cut at npm
30599f8 is described below

commit 30599f82717161c6cdbf9b636cd99d32c0062785
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Dec 12 00:06:31 2017 -0800

    first cut at npm
---
 build.xml                                     |   2 +
 js/bin/asjscnpm                               |  49 ++++++++
 js/bin/asjscompcnpm                           |  49 ++++++++
 js/bin/asnodecnpm                             |  49 ++++++++
 js/bin/compcnpm                               |  49 ++++++++
 js/bin/externcnpm                             |  49 ++++++++
 js/bin/mxmlcnpm                               |  49 ++++++++
 npm/dependencies/AdobeAIR.js                  | 100 ++++++++++++++++
 npm/dependencies/Constants.js                 |  26 ++++
 npm/dependencies/DownloadUncompressAndCopy.js |  92 ++++++++++++++
 npm/dependencies/FlashPlayerGlobal.js         | 101 ++++++++++++++++
 npm/dependencies/FlatUI.js                    | 131 ++++++++++++++++++++
 npm/dependencies/download_dependencies.js     | 166 ++++++++++++++++++++++++++
 npm/package.json                              |  43 +++++++
 package.json                                  |  52 ++++++++
 15 files changed, 1007 insertions(+)

diff --git a/build.xml b/build.xml
index f15b4dc..bd2bca7 100644
--- a/build.xml
+++ b/build.xml
@@ -911,6 +911,8 @@
                 <include name="royale-config.xml"/>
             </fileset>
         </replace>
+        <!-- replace npm descriptor with js-only descriptor -->
+        <copy file="${basedir}/npm/package.json" tofile="${basedir}/temp" />
         <zip destfile="${basedir}/out/apache-royale-jsonly-${release.version}-bin.zip" basedir="${basedir}/temp"/>
         <tar-gzip name="apache-royale-jsonly-${release.version}-bin" />
     </target>
diff --git a/js/bin/asjscnpm b/js/bin/asjscnpm
new file mode 100755
index 0000000..8c9e9f8
--- /dev/null
+++ b/js/bin/asjscnpm
@@ -0,0 +1,49 @@
+#!/usr/bin/env node
+
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+var child_process = require("child_process");
+var path = require("path");
+
+var scriptName = "asjsc";
+if(process.platform === "win32")
+{
+	scriptName += ".bat";
+}
+
+var scriptPath = path.join(__dirname, scriptName);
+try
+{
+	child_process.execFileSync(scriptPath, process.argv.slice(2),
+	{
+		stdio: "inherit",
+		encoding: "utf8"
+	});
+}
+catch(error)
+{
+	if(error.status === null)
+	{
+		console.error("Error executing " + scriptName + " with code: " + error.code);
+		process.exit(1);
+	}
+	process.exit(error.status);
+}
+process.exit(0);
\ No newline at end of file
diff --git a/js/bin/asjscompcnpm b/js/bin/asjscompcnpm
new file mode 100755
index 0000000..0cc2402
--- /dev/null
+++ b/js/bin/asjscompcnpm
@@ -0,0 +1,49 @@
+#!/usr/bin/env node
+
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+var child_process = require("child_process");
+var path = require("path");
+
+var scriptName = "asjscompc";
+if(process.platform === "win32")
+{
+	scriptName += ".bat";
+}
+
+var scriptPath = path.join(__dirname, scriptName);
+try
+{
+	child_process.execFileSync(scriptPath, process.argv.slice(2),
+	{
+		stdio: "inherit",
+		encoding: "utf8"
+	});
+}
+catch(error)
+{
+	if(error.status === null)
+	{
+		console.error("Error executing " + scriptName + " with code: " + error.code);
+		process.exit(1);
+	}
+	process.exit(error.status);
+}
+process.exit(0);
\ No newline at end of file
diff --git a/js/bin/asnodecnpm b/js/bin/asnodecnpm
new file mode 100644
index 0000000..8654736
--- /dev/null
+++ b/js/bin/asnodecnpm
@@ -0,0 +1,49 @@
+#!/usr/bin/env node
+
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+var child_process = require("child_process");
+var path = require("path");
+
+var scriptName = "asnodec";
+if(process.platform === "win32")
+{
+	scriptName += ".bat";
+}
+
+var scriptPath = path.join(__dirname, scriptName);
+try
+{
+	child_process.execFileSync(scriptPath, process.argv.slice(2),
+	{
+		stdio: "inherit",
+		encoding: "utf8"
+	});
+}
+catch(error)
+{
+	if(error.status === null)
+	{
+		console.error("Error executing " + scriptName + " with code: " + error.code);
+		process.exit(1);
+	}
+	process.exit(error.status);
+}
+process.exit(0);
\ No newline at end of file
diff --git a/js/bin/compcnpm b/js/bin/compcnpm
new file mode 100755
index 0000000..e9e22af
--- /dev/null
+++ b/js/bin/compcnpm
@@ -0,0 +1,49 @@
+#!/usr/bin/env node
+
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+var child_process = require("child_process");
+var path = require("path");
+
+var scriptName = "compc";
+if(process.platform === "win32")
+{
+    scriptName += ".bat";
+}
+
+var scriptPath = path.join(__dirname, scriptName);
+try
+{
+    child_process.execFileSync(scriptPath, process.argv.slice(2),
+    {
+        stdio: "inherit",
+        encoding: "utf8"
+    });
+}
+catch(error)
+{
+    if(error.status === null)
+    {
+        console.error("Error executing " + scriptName + " with code: " + error.code);
+        process.exit(1);
+    }
+    process.exit(error.status);
+}
+process.exit(0);
\ No newline at end of file
diff --git a/js/bin/externcnpm b/js/bin/externcnpm
new file mode 100755
index 0000000..a6c5c3a
--- /dev/null
+++ b/js/bin/externcnpm
@@ -0,0 +1,49 @@
+#!/usr/bin/env node
+
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+var child_process = require("child_process");
+var path = require("path");
+
+var scriptName = "externc";
+if(process.platform === "win32")
+{
+    scriptName += ".bat";
+}
+
+var scriptPath = path.join(__dirname, scriptName);
+try
+{
+    child_process.execFileSync(scriptPath, process.argv.slice(2),
+    {
+        stdio: "inherit",
+        encoding: "utf8"
+    });
+}
+catch(error)
+{
+    if(error.status === null)
+    {
+        console.error("Error executing " + scriptName + " with code: " + error.code);
+        process.exit(1);
+    }
+    process.exit(error.status);
+}
+process.exit(0);
\ No newline at end of file
diff --git a/js/bin/mxmlcnpm b/js/bin/mxmlcnpm
new file mode 100755
index 0000000..5a6c710
--- /dev/null
+++ b/js/bin/mxmlcnpm
@@ -0,0 +1,49 @@
+#!/usr/bin/env node
+
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+var child_process = require("child_process");
+var path = require("path");
+
+var scriptName = "mxmlc";
+if(process.platform === "win32")
+{
+    scriptName += ".bat";
+}
+
+var scriptPath = path.join(__dirname, scriptName);
+try
+{
+    child_process.execFileSync(scriptPath, process.argv.slice(2),
+    {
+        stdio: "inherit",
+        encoding: "utf8"
+    });
+}
+catch(error)
+{
+    if(error.status === null)
+    {
+        console.error("Error executing " + scriptName + " with code: " + error.code);
+        process.exit(1);
+    }
+    process.exit(error.status);
+}
+process.exit(0);
\ No newline at end of file
diff --git a/npm/dependencies/AdobeAIR.js b/npm/dependencies/AdobeAIR.js
new file mode 100644
index 0000000..30c77da
--- /dev/null
+++ b/npm/dependencies/AdobeAIR.js
@@ -0,0 +1,100 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+
+var request = require('request');
+var fs = require('fs');
+var events = require('events');
+var prompt = require('prompt');
+var unzip = require('unzip');
+var pjson = require('../package');
+
+var constants = require('../dependencies/Constants');
+
+var AdobeAIR = module.exports = Object.create(events.EventEmitter.prototype);
+
+//Adobe AIR
+var AdobeAIRURL = pjson.org_apache_royale.adobe_air_url;
+var fileNameAdobeAIR = pjson.org_apache_royale.adobe_air_file_name;
+
+var adobeAirPromptText = "\
+Apache Royale SWF support uses the Adobe AIR SDK to build Adobe AIR applications.\n\
+The Adobe AIR SDK is subject to and governed by the\n\
+Adobe AIR SDK License Agreement specified here:\n\
+http://www.adobe.com/products/air/sdk-eula.html.\n\
+This license is not compatible with the Apache v2 license.\n\
+Do you want to download and install the Adobe AIR SDK?\n\
+This is a required component (y/n)";
+
+function promptForAdobeAIR()
+{
+    var schema = {
+        properties: {
+            accept: {
+                description: adobeAirPromptText.grey,
+                pattern: /^[YNyn\s]{1}$/,
+                message: 'Please respond with either y or n'.red,
+                required: true
+            }
+        }
+    };
+    prompt.start();
+    prompt.get(schema, function (err, result) {
+        if(result.accept.toLowerCase() == 'y')
+        {
+            downloadAdobeAIR();
+        }
+        else
+        {
+            console.log('Aborting installation');
+            AdobeAIR.emit('abort');
+        }
+    });
+}
+
+function downloadAdobeAIR()
+{
+    var downloadURL = AdobeAIRURL + fileNameAdobeAIR;
+    console.log('Downloading Adobe AIR from ' + downloadURL);
+    request
+        .get(downloadURL)
+        .pipe(fs.createWriteStream(constants.DOWNLOADS_FOLDER + fileNameAdobeAIR)
+            .on('close', function(){
+                console.log('Adobe AIR download complete');
+                extract();
+            })
+    );
+}
+
+function extract()
+{
+    console.log('Extracting Adobe AIR');
+    fs.createReadStream(constants.DOWNLOADS_FOLDER + fileNameAdobeAIR)
+        .pipe(unzip.Extract({ path: constants.ROYALE_FOLDER })
+            .on('close', function(){
+                console.log('Adobe AIR extraction complete');
+                AdobeAIR.emit('complete');
+            })
+    );
+}
+
+AdobeAIR.install = function()
+{
+    promptForAdobeAIR();
+};
\ No newline at end of file
diff --git a/npm/dependencies/Constants.js b/npm/dependencies/Constants.js
new file mode 100644
index 0000000..a02af0d
--- /dev/null
+++ b/npm/dependencies/Constants.js
@@ -0,0 +1,26 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+//Define all constants here
+module.exports =
+{
+    DOWNLOADS_FOLDER : './downloads/',
+    ROYALE_FOLDER: './',
+    NODE_MODULES_FOLDER: './node_modules/'
+};
\ No newline at end of file
diff --git a/npm/dependencies/DownloadUncompressAndCopy.js b/npm/dependencies/DownloadUncompressAndCopy.js
new file mode 100644
index 0000000..2236991
--- /dev/null
+++ b/npm/dependencies/DownloadUncompressAndCopy.js
@@ -0,0 +1,92 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+
+var request = require('request');
+var fs = require('fs-extra');
+var events = require('events');
+var unzip = require('unzip');
+var constants = require('../dependencies/Constants');
+
+var DownloadUncompressAndCopy = module.exports = Object.create(events.EventEmitter.prototype);
+
+DownloadUncompressAndCopy.downloadFile = function(item)
+{
+    console.log('Downloading: ' + item.url + item.remoteFileName);
+    request
+        .get(item.url + item.remoteFileName)
+        .on('response', function(response){
+            if(response.statusCode != 200)
+            {
+                console.log('Download failed with status code: ' + response.statusCode);
+                DownloadUncompressAndCopy.emit('installFail');
+            }
+            else
+            {
+                response.pipe(fs.createWriteStream(constants.DOWNLOADS_FOLDER + item.remoteFileName)
+                    .on('close', function(){
+                        console.log('Finished downloading: ' + item.url + item.remoteFileName);
+                        if(item.unzip)
+                        {//Unzip
+                            console.log('Uncompressing:  ' + constants.DOWNLOADS_FOLDER + item.remoteFileName);
+                            fs.createReadStream(constants.DOWNLOADS_FOLDER + item.remoteFileName)
+                                .pipe(unzip.Parse())
+                                .on('entry', function (entry) {
+                                    var fileName = entry.path;
+                                    var type = entry.type; // 'Directory' or 'File'
+                                    var size = entry.size;
+                                    if (fileName === item.pathOfFileToBeCopiedFrom) {
+                                        entry.pipe(fs.createWriteStream(item.pathOfFileToBeCopiedTo));
+                                    } else {
+                                        entry.autodrain();
+                                    }
+                                })
+                                .on('finish', function(){
+                                    console.log('Finished uncompressing: ' + constants.DOWNLOADS_FOLDER + item.remoteFileName + ' to: ' + item.destinationPath + item.destinationFileName);
+                                    DownloadUncompressAndCopy.emit('installComplete');
+                                })
+
+                        }
+                        else
+                        {//Just copy
+                            if((constants.DOWNLOADS_FOLDER + item.remoteFileName === item.destinationPath + item.destinationFileName))
+                            {
+                                DownloadUncompressAndCopy.emit('installComplete');
+                            }
+                            else
+                            {
+                                fs.createReadStream(constants.DOWNLOADS_FOLDER + item.remoteFileName)
+                                    .pipe(fs.createWriteStream(item.destinationPath + item.destinationFileName))
+                                    .on('close', function(){
+                                        console.log("Copied " + constants.DOWNLOADS_FOLDER + item.remoteFileName + " to " +
+                                            item.destinationPath + item.destinationFileName);
+                                        DownloadUncompressAndCopy.emit('installComplete');
+                                    });
+                            }
+                        }
+                    })
+            );
+            }
+        })
+};
+
+DownloadUncompressAndCopy.install = function(item)
+{
+    DownloadUncompressAndCopy.downloadFile(item);
+};
\ No newline at end of file
diff --git a/npm/dependencies/FlashPlayerGlobal.js b/npm/dependencies/FlashPlayerGlobal.js
new file mode 100644
index 0000000..ca2abd2
--- /dev/null
+++ b/npm/dependencies/FlashPlayerGlobal.js
@@ -0,0 +1,101 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+
+var request = require('request');
+var fs = require('fs');
+var events = require('events');
+var prompt = require('prompt');
+var pjson = require('../package');
+
+var constants = require('../dependencies/Constants');
+var duc = require('../dependencies/DownloadUncompressAndCopy');
+
+var FlashPlayerGlobal = module.exports = Object.create(events.EventEmitter.prototype);
+
+var flashPlayerGlobalURL = pjson.org_apache_royale.flash_player_global_url;
+var fileNameFlashPlayerGlobal = pjson.org_apache_royale.flash_player_global_file_name;
+var flashPlayerGlobalPromptText = "\
+Apache Royale SWF support uses the Adobe Flash Player's playerglobal.swc to build Adobe Flash applications.\n\
+The playerglobal.swc file is subject to and governed by the\n\
+Adobe Flash Player License Agreement specified here:\n\
+http://wwwimages.adobe.com/content/dam/acom/en/legal/licenses-terms/pdf/Flash_Player_21_0.pdf,\n\
+By downloading, modifying, distributing, using and/or accessing the playerglobal.swc file\n\
+you agree to the terms and conditions of the applicable end user license agreement.\n\
+\n\
+In addition to the Adobe license terms, you also agree to be bound by the third-party terms specified here:\n\
+http://www.adobe.com/products/eula/third_party/.\n\
+Adobe recommends that you review these third-party terms.\n\
+\n\
+This license is not compatible with the Apache v2 license.\n\
+Do you want to download and install the playerglobal.swc?\n\
+This is a required component (y/n)";
+
+FlashPlayerGlobal.promptForFlashPlayerGlobal = function()
+{
+    var schema = {
+        properties: {
+            accept: {
+                description: flashPlayerGlobalPromptText.cyan,
+                pattern: /^[YNyn\s]{1}$/,
+                message: 'Please respond with either y or n'.red,
+                required: true
+            }
+        }
+    };
+    prompt.start();
+    prompt.get(schema, function (err, result) {
+        if(result.accept.toLowerCase() == 'y')
+        {
+            FlashPlayerGlobal.downloadFlashPlayerGlobal();
+        }
+        else
+        {
+            console.log('Aborting installation');
+            FlashPlayerGlobal.emit('abort');
+        }
+    });
+};
+
+FlashPlayerGlobal.downloadFlashPlayerGlobal = function()
+{
+    console.log('Downloading playerglobal.swc from ' + flashPlayerGlobalURL + fileNameFlashPlayerGlobal);
+
+    var downloadDetails = {
+        url:flashPlayerGlobalURL,
+        remoteFileName:fileNameFlashPlayerGlobal,
+        destinationPath:constants.DOWNLOADS_FOLDER,
+        destinationFileName:fileNameFlashPlayerGlobal,
+        unzip:false
+    };
+
+    duc.on('installComplete', handleInstallComplete);
+    duc.install(downloadDetails);
+
+};
+
+function handleInstallComplete(event)
+{
+    FlashPlayerGlobal.emit('complete');
+}
+
+FlashPlayerGlobal.install = function()
+{
+    FlashPlayerGlobal.promptForFlashPlayerGlobal();
+};
\ No newline at end of file
diff --git a/npm/dependencies/FlatUI.js b/npm/dependencies/FlatUI.js
new file mode 100644
index 0000000..8861c2b
--- /dev/null
+++ b/npm/dependencies/FlatUI.js
@@ -0,0 +1,131 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+
+var request = require('request');
+var fs = require('fs');
+var events = require('events');
+var unzip = require('unzip');
+var mkdirp = require('mkdirp');
+var pjson = require('../package');
+var prompt = require('prompt');
+
+var constants = require('../dependencies/Constants');
+
+var FlatUI = module.exports = Object.create(events.EventEmitter.prototype);
+
+//FlatUI
+var flatUIURL = pjson.org_apache_flex.flatui_url;
+var fileNameFlatUI = pjson.org_apache_flex.flatui_file_name;
+var promptText =
+"Apache FlexJS includes an optional component set\n\
+that uses fonts from designmodo.com.  The font\n\
+files are subject to and governed by the\n\
+Creative Commons Attribution-NonCommercial-NoDerivs 3.0\n\
+Unported license: http://creativecommons.org/licenses/by-nc-nd/3.0/\n\
+This license is not compatible with the Apache v2 license.\n\
+Do you want to install the designmodo fonts?\n\
+This is an optional component (y/n)";
+
+FlatUI.prompt = function()
+{
+    var schema = {
+        properties: {
+            accept: {
+                description: promptText.yellow,
+                pattern: /^[YNyn\s]{1}$/,
+                message: 'Please respond with either y or n'.red,
+                required: true
+            }
+        }
+    };
+    prompt.start();
+    prompt.get(schema, function (err, result) {
+        if(result.accept.toLowerCase() == 'y')
+        {
+            FlatUI.downloadFlatUI();
+        }
+        else
+        {
+            console.log('Skipping FlatUI installation');
+            FlatUI.emit('complete');
+        }
+    });
+};
+
+FlatUI.downloadFlatUI = function()
+{
+    var downloadURL = flatUIURL + fileNameFlatUI;
+    console.log('Downloading FlatUI from ' + downloadURL);
+    request
+        .get(downloadURL)
+        .pipe(fs.createWriteStream(constants.DOWNLOADS_FOLDER + fileNameFlatUI)
+            .on('finish', function(){
+                console.log('FlatUI download complete');
+                extract();
+            })
+        );
+};
+
+function extract()
+{
+    var fontsDir = 'frameworks/fonts/';
+    try
+    {
+        mkdirp(constants.FLEXJS_FOLDER + fontsDir);
+    }
+    catch(e)
+    {
+        if ( e.code != 'EEXIST' ) throw e;
+    }
+    console.log('Extracting FlatUI');
+    fs.createReadStream(constants.DOWNLOADS_FOLDER + fileNameFlatUI)
+        .pipe(unzip.Parse())
+        .on('entry', function (entry) {
+            var fileName = entry.path;
+            if (fileName === 'Flat-UI-2.2.2/fonts/glyphicons/flat-ui-icons-regular.eot') {
+                entry.pipe(fs.createWriteStream(constants.FLEXJS_FOLDER + fontsDir + 'flat-ui-icons-regular.eot'));
+            }
+            else if (fileName === 'Flat-UI-2.2.2/fonts/glyphicons/flat-ui-icons-regular.ttf') {
+                entry.pipe(fs.createWriteStream(constants.FLEXJS_FOLDER + fontsDir + 'flat-ui-icons-regular.ttf'));
+            }
+            else if (fileName === 'Flat-UI-2.2.2/fonts/glyphicons/flat-ui-icons-regular.svg') {
+                entry.pipe(fs.createWriteStream(constants.FLEXJS_FOLDER + fontsDir + 'flat-ui-icons-regular.svg'));
+            }
+            else if (fileName === 'Flat-UI-2.2.2/fonts/glyphicons/flat-ui-icons-regular.woff') {
+                entry.pipe(fs.createWriteStream(constants.FLEXJS_FOLDER + fontsDir + 'flat-ui-icons-regular.woff'));
+            }
+            else if (fileName === 'Flat-UI-2.2.2/README.md') {
+                entry.pipe(fs.createWriteStream(constants.FLEXJS_FOLDER + fontsDir + 'README.md'));
+            }
+            else {
+                entry.autodrain();
+            }
+        })
+        .on('finish', function(){
+            console.log('FlatUI extraction complete');
+            FlatUI.emit('complete');
+        })
+
+}
+
+FlatUI.install = function()
+{
+    FlatUI.prompt();
+};
\ No newline at end of file
diff --git a/npm/dependencies/download_dependencies.js b/npm/dependencies/download_dependencies.js
new file mode 100644
index 0000000..711505d
--- /dev/null
+++ b/npm/dependencies/download_dependencies.js
@@ -0,0 +1,166 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+'use strict';
+
+var fs = require('fs');
+var path = require('path');
+var mkdirp = require('mkdirp');
+var eol = require('eol');
+var constants = require('./Constants');
+var adobeair = require('./AdobeAIR');
+var flashplayerglobal = require('./FlashPlayerGlobal');
+var flatUI = require('./FlatUI');
+
+var installSteps = [
+    createDownloadsDirectory,
+    installFlatUI,
+    installFlashPlayerGlobal,
+    installAdobeAIR,
+    updateScriptEOL,
+    updateScriptPermissions
+    ];
+var currentStep = 0;
+
+function start()
+{
+    installSteps[0].call();
+}
+
+function updateScriptEOL()
+{
+    try
+    {
+        var dirPath = path.join(__dirname, '..', 'js', 'bin');
+        var files = fs.readdirSync(dirPath);
+        do
+        {
+            var filePath = files.shift();
+            filePath = path.resolve(dirPath, filePath);
+            var data = fs.readFileSync(filePath, {encoding: 'utf8'});
+            if(path.extname(filePath) === '.bat')
+            {
+                //windows scripts
+                data = eol.crlf(data);
+            }
+            else
+            {
+                //mac, linux, or cygwin scripts
+                data = eol.lf(data);
+            }
+            fs.writeFileSync(filePath, data, {encoding: 'utf8', mode: 0x755});
+        }
+        while(files.length > 0)
+    }
+    catch(e)
+    {
+        handleAbort();
+        return;
+    }
+    handleInstallStepComplete();
+}
+
+function updateScriptPermissions()
+{
+    var mode = parseInt('755', 8);
+    try
+    {
+        var dirPath = path.join(__dirname, '..', 'js', 'bin');
+        var files = fs.readdirSync(dirPath);
+        do
+        {
+            var filePath = files.shift();
+            filePath = path.resolve(dirPath, filePath);
+            if(path.extname(filePath) !== '.bat')
+            {
+                //mac, linux, or cygwin scripts
+                fs.chmodSync(filePath, mode);
+            }
+        }
+        while(files.length > 0)
+    }
+    catch(e)
+    {
+        handleAbort();
+        return;
+    }
+    handleInstallStepComplete();
+}
+
+function createDownloadsDirectory()
+{
+    //Create downloads directory if it does not exist already
+    try
+    {
+        mkdirp(constants.DOWNLOADS_FOLDER);
+    }
+    catch(e)
+    {
+        if ( e.code != 'EEXIST' ) throw e;
+    }
+    handleInstallStepComplete();
+}
+
+function handleInstallStepComplete(event)
+{
+    currentStep += 1;
+    if(currentStep >= installSteps.length)
+    {
+        allDownloadsComplete();
+    }
+    else
+    {
+        if(installSteps[currentStep] != undefined)
+        {
+            installSteps[currentStep].call();
+        }
+    }
+}
+
+function installFlashPlayerGlobal()
+{
+    flashplayerglobal.once('complete', handleInstallStepComplete);
+    flashplayerglobal.once('abort', handleAbort);
+    flashplayerglobal.install();
+}
+
+function installAdobeAIR(event)
+{
+    adobeair.once('complete', handleInstallStepComplete);
+    adobeair.once('abort', handleAbort);
+    adobeair.install();
+}
+
+function installFlatUI(event)
+{
+    flatUI.once('complete', handleInstallStepComplete);
+    flatUI.install();
+}
+
+function allDownloadsComplete()
+{
+    console.log('Installation complete!');
+}
+
+function handleAbort()
+{
+    process.exit(1);
+}
+
+start();
\ No newline at end of file
diff --git a/npm/package.json b/npm/package.json
new file mode 100644
index 0000000..1538bad
--- /dev/null
+++ b/npm/package.json
@@ -0,0 +1,43 @@
+{
+  "name": "royale",
+  "version": "0.9.0",
+  "description": "Apache Royale (formerly FlexJS)",
+  "keywords": [
+    "royale",
+    "apache royale",
+    "flex",
+    "flexjs",
+    "apache flexjs",
+    "actionscript",
+    "as3",
+    "mxml",
+    "angularjs",
+    "reactjs"
+  ],
+  "homepage": "http://royale.apache.org",
+  "author": "OmPrakash Muppirala <bi...@apache.org>",
+  "license": "Apache-2.0",
+  "dependencies": {
+    "eol": "^0.2.0",
+    "fs-extra": "^0.26.3",
+    "merge-dirs": "^0.2.1",
+    "mkdirp": "^0.5.1",
+    "prompt": "^0.2.14",
+    "replace": "^0.3.0",
+    "request": "^2.67.0",
+    "unzip": "^0.1.11",
+    "wrench": "^1.5.8"
+  },
+  "scripts": {
+  },
+  "bin": {
+    "asjsc": "./royale-asjs/js/bin/asjscnpm",
+    "asjscompc": "./royale-asjs/js/bin/asjscompcnpm",
+    "asnodec": "./royale-asjs/js/bin/asnodecnpm",
+    "mxmlc": "./royale-asjs/js/bin/mxmlcnpm",
+    "compc": "./royale-asjs/js/bin/compcnpm",
+    "externc": "./royale-asjs/js/bin/externcnpm"
+  },
+  "org_apache_royale": {
+  }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..fdf49f7
--- /dev/null
+++ b/package.json
@@ -0,0 +1,52 @@
+{
+  "name": "royale-swf",
+  "version": "0.9.0",
+  "description": "Apache Royale (formerly FlexJS) with SWF support",
+  "keywords": [
+    "royale",
+    "apache royale",
+    "flex",
+    "flexjs",
+    "apache flexjs",
+    "actionscript",
+    "as3",
+    "mxml",
+    "angularjs",
+    "reactjs"
+  ],
+  "homepage": "http://royale.apache.org",
+  "author": "OmPrakash Muppirala <bi...@apache.org>",
+  "license": "Apache-2.0",
+  "dependencies": {
+    "eol": "^0.2.0",
+    "fs-extra": "^0.26.3",
+    "merge-dirs": "^0.2.1",
+    "mkdirp": "^0.5.1",
+    "prompt": "^0.2.14",
+    "replace": "^0.3.0",
+    "request": "^2.67.0",
+    "unzip": "^0.1.11",
+    "wrench": "^1.5.8"
+  },
+  "scripts": {
+    "postinstall": "node npm/dependencies/download_dependencies.js"
+  },
+  "bin": {
+    "asjsc": "./royale-asjs/js/bin/asjscnpm",
+    "asjscompc": "./royale-asjs/js/bin/asjscompcnpm",
+    "asnodec": "./royale-asjs/js/bin/asnodecnpm",
+    "mxmlc": "./royale-asjs/js/bin/mxmlcnpm",
+    "compc": "./royale-asjs/js/bin/compcnpm",
+    "externc": "./royale-asjs/js/bin/externcnpm"
+  },
+  "org_apache_royale": {
+    "flash_player_global_url": "http://download.macromedia.com/get/flashplayer/updaters/25/",
+    "flash_player_global_file_name": "playerglobal25_0.swc",
+    "adobe_air_url": "http://airdownload.adobe.com/air/win/download/25.0/",
+    "adobe_air_file_name": "AdobeAIRSDK.zip",
+    "player_version": "25.0",
+    "swf_version": "36",
+    "flatui_url": "https://github.com/designmodo/Flat-UI/archive/",
+    "flatui_file_name": "2.2.2.zip"
+  }
+}

-- 
To stop receiving notification emails like this one, please contact
['"commits@royale.apache.org" <co...@royale.apache.org>'].