Skip to content
Browse files

Added aliases to export

  • Loading branch information...
1 parent b8ebab3 commit 127007bd2366851b7cf2660cf0b96b60294b3007 @davglass committed Sep 30, 2011
Showing with 22 additions and 5 deletions.
  1. +15 −3 scripts/convert.php
  2. +7 −2 scripts/export_modules.js
View
18 scripts/convert.php
@@ -13,11 +13,23 @@
}
-
+if (!is_file($cwd.'/../lib/meta/json_'.$version.'.txt')) {
+ echo('Please run export_modules.js first!');
+ exit;
+}
$config = json_decode(file_get_contents($cwd.'/../lib/meta/json_'.$version.'.txt'), true);
-$out = '<?php $GLOBALS[\'yui_current\'] = ' . var_export($config, true) . '; ?>';
+if (is_file($cwd.'/../lib/meta/json_aliases_'.$version.'.txt')) {
+ $aliases = json_decode(file_get_contents($cwd.'/../lib/meta/json_aliases_'.$version.'.txt'), true);
+}
+
+
+$out = '<?php $GLOBALS[\'yui_current\'] = ' . var_export($config, true) . ';'."\n\n";
+if ($aliases) {
+ $out .= '$GLOBALS[\'yui_current_aliases\'] = ' . var_export($aliases, true) . ';'."\n";
+}
+$out .= ' ?>';
file_put_contents($cwd.'/../lib/meta/config_'.$version.'.php', $out);
-echo('Finished converting JSON to PHP\n');
+echo("Finished converting JSON to PHP\n");
?>
View
9 scripts/export_modules.js
@@ -4,7 +4,7 @@ var args = process.argv.slice(2);
var fs = require('fs'),
path = require('path'),
- yui3 = path.resolve(args[0]) || path.join(__dirname, '../../yui');
+ yui3 = ((args[0])) ? path.resolve(args[0]) : path.join(__dirname, '../../yui');
if (!path.existsSync(yui3)) {
console.error('YUI 3 source tree was not found: ', yui3);
@@ -19,9 +19,14 @@ var Y = YUI();
var loader = new Y.Loader({});
var out = path.join(__dirname, '../lib/meta/json_' + Y.version + '.txt');
+var out2 = path.join(__dirname, '../lib/meta/json_aliases_' + Y.version + '.txt');
fs.writeFileSync(out, JSON.stringify(loader.moduleInfo), 'utf8');
-
console.log('JS Loader meta written: ', out);
+if (YUI.Env.aliases) {
+ fs.writeFileSync(out2, JSON.stringify(YUI.Env.aliases), 'utf8');
+ console.log('Loader aliases written: ', out2);
+}
+
console.log('Version: ', Y.version);
console.log('./convert.php', Y.version);

0 comments on commit 127007b

Please sign in to comment.
Something went wrong with that request. Please try again.