I have a package that requires Google Map library. And I implemented it like this in the view.
clientScript->registerScriptFile(\'
You can make the google map script a package itself by configuring the packages property of CClientScript. Then you can add the googlemap to your packages dependencies by configuring 'depends' in the package configuration. This should then add the scripts in the correct order.
To add a package you can do the following (didn't try that, but should work):
Yii::app()->clientScript->addPackage('googleMap', array(
'baseUrl'=>'http://maps.googleapis.com/maps/api',
'js'=>array('js?sensor=false&language=' . Yii::app()->language . '®ion='.Yii::app()->language)
));
Same 'googleMap'=>array(/*...*/) will work when you put it in your configuration.