try cmjs only

This commit is contained in:
Anton Lavrenov 2022-05-04 16:04:16 -05:00
parent 0a32772fa9
commit 149c8d83fd
5 changed files with 47 additions and 10 deletions

View File

@ -37,6 +37,34 @@ gulp.task('update-version-lib', function () {
.pipe(gulp.dest('./lib')); .pipe(gulp.dest('./lib'));
}); });
gulp.task('update-version-cmj', function () {
return gulp
.src(['./cmj/Global.js'])
.pipe(replace('@@version', conf.version))
.pipe(rename('Global.js'))
.pipe(gulp.dest('./cmj'));
});
gulp.task('update-version-es-to-cmj-index', function () {
return gulp
.src(['./lib/index.js'])
.pipe(
replace(`import { Konva } from './_F`, `import { Konva } from '../cmj/_F`)
)
.pipe(rename('index.js'))
.pipe(gulp.dest('./lib'));
});
gulp.task('update-version-es-to-cmj-node', function () {
return gulp
.src(['./lib/index-node.js'])
.pipe(
replace(`import { Konva } from './_F`, `import { Konva } from '../cmj/_F`)
)
.pipe(rename('index-node.js'))
.pipe(gulp.dest('./lib'));
});
// create usual build konva.js and konva.min.js // create usual build konva.js and konva.min.js
gulp.task('pre-build', function () { gulp.task('pre-build', function () {
return build() return build()
@ -52,7 +80,16 @@ gulp.task('pre-build', function () {
.pipe(gulp.dest('./')); .pipe(gulp.dest('./'));
}); });
gulp.task('build', gulp.parallel(['update-version-lib', 'pre-build'])); gulp.task(
'build',
gulp.parallel([
'update-version-lib',
'update-version-cmj',
'update-version-es-to-cmj-index',
'update-version-es-to-cmj-node',
'pre-build',
])
);
// local server for better development // local server for better development
gulp.task('server', function () { gulp.task('server', function () {

View File

@ -8,7 +8,7 @@
* Konva JavaScript Framework v8.3.6 * Konva JavaScript Framework v8.3.6
* http://konvajs.org/ * http://konvajs.org/
* Licensed under the MIT * Licensed under the MIT
* Date: Wed Apr 27 2022 * Date: Wed May 04 2022
* *
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS) * Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva) * Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)

2
konva.min.js vendored
View File

@ -3,7 +3,7 @@
* Konva JavaScript Framework v8.3.6 * Konva JavaScript Framework v8.3.6
* http://konvajs.org/ * http://konvajs.org/
* Licensed under the MIT * Licensed under the MIT
* Date: Wed Apr 27 2022 * Date: Wed May 04 2022
* *
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS) * Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva) * Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)

View File

@ -25,20 +25,20 @@
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./cmj": { "./cmj": {
"import": "./lib/index.js", "import": "./cmj/index.js",
"require": "./cmj/index-node.js", "require": "./cmj/index-node.js",
"node": "./cmj/index-node.js", "node": "./cmj/index-node.js",
"default": "./cmj/index.js" "default": "./cmj/index.js"
}, },
"./cmj/*": { "./cmj/*": {
"import": "./lib/*.js", "import": "./cmj/*.js",
"require": "./cmj/*.js", "require": "./cmj/*.js",
"default": "./cmj/*.js" "default": "./cmj/*.js"
}, },
"./lib/*": { "./lib/*": {
"import": "./lib/*.js", "import": "./cmj/*.js",
"require": "./cmj/*.js", "require": "./cmj/*.js",
"default": "./lib/*.js" "default": "./cmj/*.js"
} }
}, },
"scripts": { "scripts": {

View File

@ -5,18 +5,18 @@ function equal(val1, val2, message) {
} }
// try to import only core // try to import only core
import Konva from '../lib/Core.js'; import Konva from 'konva';
// no external shapes // no external shapes
// equal(Konva.Rect, undefined, 'no external shapes'); // equal(Konva.Rect, undefined, 'no external shapes');
import { Rect } from '../lib/shapes/Rect.js'; import { Rect } from 'konva/lib/shapes/Rect';
equal(Rect !== undefined, true, 'Rect is defined'); equal(Rect !== undefined, true, 'Rect is defined');
equal(Konva.Rect, Rect, 'Rect is injected'); equal(Konva.Rect, Rect, 'Rect is injected');
import Konva2 from '../lib/index-node.js'; import Konva2 from 'konva';
equal(Konva2.Rect, Rect, 'Rect is injected'); equal(Konva2.Rect, Rect, 'Rect is injected');