Sfoglia il codice sorgente

scaffolding: Stop using compat-es2015.

Use es6-promise directly.
Compatibility / polyfilling is moving sand,
let it be done explicitly
and changeable easily.
Herby Vojčík 6 anni fa
parent
commit
bfa114abcb

+ 2 - 1
grunt-init-project/root/Gruntfile.js

@@ -17,7 +17,8 @@ module.exports = function (grunt) {
     grunt.registerTask('deploy', ['amdconfig:app', 'requirejs:deploy']);
 
     var polyfillThenPromiseApp = function () {
-        define(["require", "amber/es2015-polyfills"], function (require) {
+        define(["require", "amber/es6-promise"], function (require, promiseLib) {
+            promiseLib.polyfill();
             return new Promise(function (resolve, reject) {
                 require(["__app__"], resolve, reject);
             });

+ 5 - 0
grunt-init-project/root/es6-promise.amd.json

@@ -0,0 +1,5 @@
+{
+  "paths": {
+    "amber/es6-promise": ["./es6-promise", "./dist/es6-promise", "./promise"]
+  }
+}

+ 3 - 3
grunt-init-project/root/parts.html

@@ -26,9 +26,9 @@
           is meant as alternative to <code>Web</code>
           and is inspired by stream metaphor and mochikit.</li>
   </ul>
-  <p>Additionally, module <code>amber-compat-es2015</code>
-  is included by default. This polyfills JS Promise for non-modern
-  browsers / old node.js.</p>
+  <p>Additionally, npm module <code>es6-promise</code>
+  is included and used by default in building / development
+  with help of es6-promise.amd.json manifest file.</p>
   </body>
 
 </html>

+ 6 - 2
grunt-init-project/root/uninstall.html

@@ -48,10 +48,14 @@
           add other needed ones, like <code>domite</code> or <code>Wrappers-JQuery</code>).</li>
   </ul>
   <p>If you are sure your app will only be run in modern browser / node.js
-      with Promise present, you can <code>bower uninstall amber-compat-es2015 --save</code>.</p>
+      with Promise present, you can <code>npm uninstall es6-promise --save</code>,
+      then remove <code>es6-promise.amd.json</code> file.</p>
   <p>As the last step, make sure the dependency tree is in a correct state
       by recreating it: first delete your <code>bower_components</code> folder,
-      then run <code>bower install</code> from your CLI.</p>
+      then run <code>bower install</code> from your CLI.
+      Similarly, delete your <code>node_modules</code>
+      then run <code>npm install</code> from your CLI.
+      Finally, rerun <code>grunt devel</code>.</p>
   </body>
 
 </html>

+ 3 - 1
grunt-init-project/template.js

@@ -115,6 +115,9 @@ exports.template = function (grunt, init, done) {
 
         // A few additional properties.
         props.keywords = ['Amber', 'Smalltalk'];
+        props.dependencies = {
+            "es6-promise": "^4.2.4"
+        };
         props.devDependencies = {
             "@ambers/sdk": "^0.10.6",
             "grunt": "1.0.1",
@@ -157,7 +160,6 @@ exports.template = function (grunt, init, done) {
             "private": false,
             "dependencies": {
                 "amber": "^0.22.0",
-                "amber-compat-es2015": "^0.1.5",
                 "amber-contrib-jquery": "^0.4.1",
                 "amber-contrib-web": "^0.5.1",
                 "domite": "^0.7.1",