Browse Source

Modernize Amber infrastructure.

Get on par w/ scaffolding 0.22.5.
Herby Vojčík 5 years ago
parent
commit
4ca37b40b2
7 changed files with 73 additions and 63 deletions
  1. 5 13
      .gitignore
  2. 18 17
      Gruntfile.js
  3. 1 1
      LICENSE-MIT
  4. 2 2
      bower.json
  5. 5 0
      es6-promise.amd.json
  6. 27 26
      index.html
  7. 15 4
      package.json

+ 5 - 13
.gitignore

@@ -1,15 +1,7 @@
-# Ignoring Mac Finder files
-.DS_Store
+/node_modules/
+/bower_components/
 
-# In case amber is also saved in a local Subversion
-.svn
+/test_runner.js
 
-# Ignoring local NPM modules
-node_modules/
-
-# Ignoring local bower modules
-bower_components/
-
-# Ignores autogenerated files
-config.js
-test_runner.js
+/config.js
+/the.js

+ 18 - 17
Gruntfile.js

@@ -1,35 +1,38 @@
 'use strict';
 
 var fs = require('fs'),
-    path = require('path');
+    path = require('path'),
+    helpers = require('@ambers/sdk').helpers;
 
 function findAmberPath(options) {
     var result;
     options.some(function (x) {
         var candidate = path.join(__dirname, x);
-        return fs.existsSync(path.join(candidate, 'support/boot.js')) && (result = candidate);
+        return (
+            fs.existsSync(path.join(candidate, 'support/boot.js')) ||
+            fs.existsSync(path.join(candidate, 'base/boot.js'))
+        ) && (result = candidate);
     });
     return result;
 }
 
 module.exports = function (grunt) {
-    var helpers = require('@ambers/sdk').helpers;
-
     // These plugins provide necessary tasks.
-    grunt.loadNpmTasks('grunt-execute');
     grunt.loadNpmTasks('grunt-contrib-clean');
     grunt.loadNpmTasks('grunt-contrib-less');
     grunt.loadNpmTasks('grunt-contrib-requirejs');
     grunt.loadNpmTasks('grunt-contrib-watch');
+    grunt.loadNpmTasks('grunt-exec');
     grunt.loadNpmTasks('@ambers/sdk');
 
     // Default task.
-    grunt.registerTask('default', ['amdconfig:helios', 'less', 'amberc:all']);
-    grunt.registerTask('test', ['amdconfig:helios', 'requirejs:test_runner', 'execute:test_runner', 'clean:test_runner']);
-    grunt.registerTask('devel', ['amdconfig:helios']);
+    grunt.registerTask('default', ['amdconfig:app', 'less', 'amberc:all']);
+    grunt.registerTask('test', ['amdconfig:app', 'requirejs:test_runner', 'exec:test_runner', 'clean:test_runner']);
+    grunt.registerTask('devel', ['amdconfig:app']);
 
     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);
             });
@@ -56,11 +59,10 @@ module.exports = function (grunt) {
 
         amberc: {
             options: {
-                amber_dir: findAmberPath(['../..', 'bower_components/amber']),
+                amber_dir: findAmberPath(['../..', '../amber/lang', 'bower_components/amber']),
                 configFile: "config.js"
             },
             all: {
-                output_dir: 'src',
                 src: [
                     // list all sources in dependency order
                     'src/Helios-Core.st', 'src/Helios-Exceptions.st', 'src/Helios-Announcements.st',
@@ -78,6 +80,9 @@ module.exports = function (grunt) {
                 jsGlobals: ['navigator']
             }
         },
+
+        amdconfig: {app: {dest: 'config.js'}},
+
         requirejs: {
             options: {
                 useStrict: true
@@ -109,12 +114,8 @@ module.exports = function (grunt) {
             }
         },
 
-        amdconfig: {helios: {dest: 'config.js'}},
-
-        execute: {
-            test_runner: {
-                src: ['test_runner.js']
-            }
+        exec: {
+            test_runner: 'node test_runner.js'
         },
 
         clean: {

+ 1 - 1
LICENSE-MIT

@@ -1,5 +1,5 @@
 Copyright (c) 2012-2013 Nicolas Petton
-Copyright (c) 2014-2017 Helios contributors
+Copyright (c) 2014-2018 Helios contributors
 
 Permission is hereby granted, free of charge, to any person
 obtaining a copy of this software and associated documentation

+ 2 - 2
bower.json

@@ -17,9 +17,9 @@
   "license": [
     "MIT"
   ],
+  "private": false,
   "dependencies": {
     "amber": ">=0.21.0",
-    "amber-compat-es2015": "^0.1.5",
     "amber-contrib-web": ">=0.5.0",
     "jquery-ui": ">=1.9.2",
     "bootstrap": "^3.3.4",
@@ -28,4 +28,4 @@
     "require-css": "^0.1.2",
     "typeahead.js": "^0.10.5"
   }
-}
+}

+ 5 - 0
es6-promise.amd.json

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

+ 27 - 26
index.html

@@ -1,39 +1,40 @@
 <!DOCTYPE html>
 <html>
-  <head>
+
+<head>
     <title>Helios IDE</title>
-    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
-    <meta name="author" content="Nicolas Petton" />
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <meta name="author" content="Nicolas Petton"/>
     <link type="image/x-icon" rel="shortcut icon" href="/favicon.ico"/>
-  </head>
-  <body id="helios">
-    <div id="helper">Loading Helios...</div>
+</head>
 
-    <div id="includes">
-      <script type='text/javascript'>
+<body id="helios">
+<div id="helper">Loading Helios...</div>
+<div id="includes">
+    <script type='text/javascript'>
         var global = typeof global === "undefined" ? window : global || window;
         var base = decodeURIComponent(window.location.hash.slice(1)).replace(/\/$/, "");
         var script = document.createElement("script");
         script.src = base + "/config.js";
         document.getElementsByTagName("head")[0].appendChild(script);
         var __interval = setInterval(function () {
-          if (typeof require !== "undefined") {
-            clearInterval(__interval);
-            require.baseUrl = base;
-            require.paths['helios/app'] = require.paths['helios/index'].replace("index", "app");
-            require.callback = function () {
-              require(["helios/app", "amber_core/Platform-Browser"], function (amber) {
-                amber.initialize({'transport.defaultAmdNamespace': "amber_core"}).then(function () {
-                  amber.globals.HLManager._setup();
-                });
-              });
-            };
-            script = document.createElement("script");
-            script.src = base + "/" + require.paths.requireJS + ".js";
-            document.getElementsByTagName("head")[0].appendChild(script);
-          }
+            if (typeof require !== "undefined") {
+                clearInterval(__interval);
+                require.baseUrl = base;
+                require.paths['helios/app'] = require.paths['helios/index'].replace("index", "app");
+                require.callback = function () {
+                    require(["helios/app", "amber_core/Platform-Browser"], function (amber) {
+                        amber.initialize({'transport.defaultAmdNamespace': "helios"}).then(function () {
+                            amber.globals.HLManager._setup();
+                        });
+                    });
+                };
+                script = document.createElement("script");
+                script.src = base + "/" + require.paths.requireJS + ".js";
+                document.getElementsByTagName("head")[0].appendChild(script);
+            }
         }, 200);
-      </script>
-    </div>
-  </body>
+    </script>
+</div>
+</body>
 </html>

+ 15 - 4
package.json

@@ -11,21 +11,32 @@
   "bugs": {
     "url": "https://lolg.it/amber/helios/issues"
   },
-  "license": "MIT",
+  "licenses": [
+    {
+      "type": "MIT",
+      "url": "https://lolg.it/amber/amber-contrib-foobar/src/master/LICENSE-MIT"
+    }
+  ],
   "engines": {
-    "node": "0.10.x || 0.12.x || >=4.0.0"
+    "node": ">=4.0.0"
   },
   "scripts": {
+    "reset": "npm run clean && npm run init",
+    "clean": "(rm -rf bower_components || rd /s/q bower_components) && (rm -rf node_modules || rd /s/q node_modules)",
+    "init": "npm install && bower install && grunt default devel",
     "test": "grunt test"
   },
+  "dependencies": {
+    "es6-promise": "^4.2.4"
+  },
   "devDependencies": {
-    "@ambers/sdk": "^0.10.5",
+    "@ambers/sdk": "^0.10.7",
     "grunt": "^1.0.3",
     "grunt-contrib-clean": "^1.1.0",
     "grunt-contrib-less": "^2.0.0",
     "grunt-contrib-requirejs": "^1.0.0",
     "grunt-contrib-watch": "^1.1.0",
-    "grunt-execute": "^0.2.2",
+    "grunt-exec": "^3.0.0",
     "requirejs": "^2.3.5"
   },
   "keywords": [