diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 5b53c71b4..000000000 --- a/Gruntfile.js +++ /dev/null @@ -1,252 +0,0 @@ -module.exports = function(grunt) { - - var appPath = 'src', - buildPath = 'dist', - stylePath = 'styles', - configPath = 'config/require-config.js', - port = grunt.option('port') || 8000; - - grunt.loadNpmTasks('grunt-contrib-requirejs'); - grunt.loadNpmTasks('grunt-contrib-connect'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-cssmin'); - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks('grunt-contrib-clean'); - grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-bowercopy'); - grunt.loadNpmTasks('grunt-mocha'); - grunt.loadNpmTasks('grunt-sass'); - - grunt.initConfig({ - appDir: appPath, - builtDir: buildPath, - styleDir: stylePath, - pkg: grunt.file.readJSON("package.json"), - - requirejs:{ - compile:{ - options: { - mainConfigFile: '<%= appDir %>/' + configPath, - appDir: '<%= appDir %>', - dir: '<%= builtDir %>', - baseUrl: './', - name: 'main', - include: ["./../node_modules/almond/almond"], - removeCombined: true, - findNestedDependencies: true, - keepBuildDir: true, - inlineText: true, - optimize: 'none', - wrap: { - start: "(function (root, factory) {"+ - "if (typeof define === 'function' && define.amd)"+ - "define([], factory);"+ - "else if(typeof exports === 'object' && typeof module === 'object')"+ - "module.exports = factory();"+ - "else "+ - "root.<%= pkg.name %> = root.GrapesJS = factory();"+ - "}(this, function () {", - end: "return require('grapesjs/main'); }));" - }, - - paths: { - "jquery": "wrappers/jquery", - } - - } - } - }, - - jshint: { - all: [ - 'Gruntfile.js', - '<%= appDir %>/**/*.js', - ] - }, - - uglify: { - options: { - banner: '/*! <%= pkg.name %> - v<%= pkg.version %> */\n' - }, - build:{ - files: { - '<%= builtDir %>/grapes.min.js': ['<%= builtDir %>/main.js'] - } - } - }, - - sass: { - dist: { - files: [{ - expand: true, - cwd: '<%= styleDir %>/scss', - src: ['**/*.scss'], - dest: '<%= styleDir %>/css', - ext: '.css' - }] - } - }, - - cssmin: { - target: { - files: [{ - expand: true, - flatten: true, - src: [ - '<%= styleDir %>/css/main.css', - 'node_modules/codemirror/lib/codemirror.css', - 'node_modules/codemirror/theme/hopscotch.css' - ], - dest: '<%= builtDir %>', - ext: '.min.css' - }] - } - }, - - concat: { - css: { - src: ['<%= builtDir %>/*.min.css'], - dest: '<%= builtDir %>/css/grapes.min.css' - } - }, - - mocha: { - test: { - src: ['test/index.html'], - options: { log: true, }, - }, - }, - - connect: { - server: { - options: { - port: port, - open: true - } - }, - }, -/* - bowercopy: { - options: { - srcPrefix: 'bower_components' - }, - scripts: { - options: { - destPrefix: 'vendor' - }, - files: { - 'almond/almond.js' : 'almond/almond.js', - 'jquery/jquery.js' : 'jquery/dist/jquery.min.js', - 'underscore/underscore.js' : 'underscore/underscore-min.js', - 'backbone/backbone.js' : 'backbone/backbone-min.js', - 'backbone-undo/backbone-undo.js' : 'Backbone.Undo/Backbone.Undo.js', - 'keymaster/keymaster.js' : 'keymaster/keymaster.js', - 'require/require.js' : 'requirejs/require.js', - 'require-text/text.js' : 'requirejs-text/text.js', - 'spectrum/spectrum.js' : 'spectrum/spectrum.js', - 'codemirror' : 'codemirror', - 'codemirror-formatting' : 'codemirror-formatting/formatting.js', - 'mocha' : 'mocha', - 'chai' : 'chai/chai.js', - 'sinon' : 'sinonjs/sinon.js', - }, - } - }, -*/ - watch: { - script: { - files: [ '<%= appDir %>/**/*.js' ], - tasks: ['jshint'] - }, - css: { - files: '**/*.scss', - tasks: ['sass'] - }, - test: { - files: ['test/specs/**/*.js'], - tasks: ['mocha'], - //options: { livereload: true }, //default port 35729 - } - }, - - clean: { - all: ["<%= builtDir %>/*", "!<%= builtDir %>/grapes.min.js", "!<%= builtDir %>/css"] - }, - - copy: { - fonts: { - cwd: '<%= styleDir %>/fonts', - src: '**/*', - dest: '<%= builtDir %>/fonts', - expand: true - } - } - - }); - - /** - * Have to copy require configs cause r.js will try to load them from the path indicated inside - * main.js file. This is the only way I have found to do it - * */ - grunt.registerTask('before-rjs', function() { - if(grunt.file.exists(buildPath)) - grunt.file.delete(buildPath); - grunt.file.mkdir(buildPath); - grunt.file.copy(appPath + '/' + configPath, buildPath + '/' + appPath + '/' + configPath); - }); - - grunt.registerTask('webfont-custom', function() { - var dir = './styles/fonts/'; - var destName = 'main-fonts'; - var donePromise = this.async(); - var svg2ttf = { - cmd: 'svg2ttf', - args: [dir + destName + '.svg', dir + destName + '.ttf'], - }; - var ttf2woff = { - cmd: 'ttf2woff', - args: [dir + destName + '.ttf', dir + destName + '.woff'], - }; - var ttf2woff2 = { - cmd: 'cat', - //args: [dir + destName + '.ttf', dir + destName + '.woff2'], - args: [dir + destName + '.ttf', '|', 'ttf2woff2', '>>', dir + destName + '.woff2'], - }; - var ttf2eot = { - cmd: 'ttf2eot', - args: [dir + destName + '.ttf', dir + destName + '.eot'], - }; - grunt.util.spawn(svg2ttf, function done(error, result, code) { - grunt.log.ok('.ttf file created'); - - grunt.util.spawn(ttf2woff, function done(error, result, code) { - grunt.log.ok('.woff file created'); - - grunt.util.spawn(ttf2eot, function done(error, result, code) { - grunt.log.ok('.eot file created'); - donePromise(); - /* - grunt.util.spawn(ttf2woff2, function done(error, result, code) { - grunt.log.ok('.woff2 file created'); - donePromise(); - }); - */ - }); - }); - }); - - }); - - grunt.registerTask('dev', ['connect', 'watch']); - - grunt.registerTask('test', ['jshint', 'mocha']); - - grunt.registerTask('build:fonts', ['webfont-custom']); - - grunt.registerTask('build', ['jshint', 'sass', 'before-rjs', 'requirejs', 'uglify', 'cssmin', 'concat', 'clean', 'copy']); - - grunt.registerTask('default', ['dev']); - -}; diff --git a/LICENSE b/LICENSE index 33625788a..d880dc50e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016, Artur Arseniev +Copyright (c) 2017, Artur Arseniev All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -22,4 +22,4 @@ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/package.json b/package.json index a33b049d8..05d841f84 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,6 @@ "lint": "eslint src", "build": "WEBPACK_ENV=prod && npm run test && npm run v:patch && webpack && npm run build:css", "build:css": "node-sass src/styles/scss/main.scss dist/css/grapes.min.css", - "build:fonts": "./node_modules/.bin/grunt build:fonts", "v:patch": "npm version --no-git-tag-version patch", "start": "WEBPACK_ENV=dev webpack-dev-server --progress --colors & npm run build:css -- -w", "test": "NODE_PATH=./src mocha --compilers js:babel-core/register --require test/helper.js --recursive test/main.js",