Skip to content

Commit ed0e790

Browse files
committed
Update README.md
2 parents 16d64a5 + 6868f4e commit ed0e790

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+11031
-10650
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ GraphicsJS supports z-index. Typically, if you ever decided to change the overla
3030

3131
GraphicsJS provides a convenient [Transformations](https://docs.anychart.com/Graphics/Transformations) API that allows to move, scale, rotate and shear both elements and groups of elements. Transformations, in good hands, when used along with [flexible Event Model](https://docs.anychart.com/Graphics/Events) and [Virtual DOM](https://docs.anychart.com/Graphics/Virtual_DOM), is a very powerfull tool.
3232

33-
GraphicsJS [supports legacy browsers including IE6+](https://docs.anychart.com/Graphics/Browser_Support).
33+
GraphicsJS [supports legacy browsers including IE6+](https://docs.anychart.com/Graphics/Browser_Support).
3434

3535
GraphicsJS API is very convenient to use. [GraphicsJS API](https://api.anychart.com/latest/anychart.graphics) is very concise and provides chaining support, which makes it possible to use a dozen lines of code where other libraries require a hundred.
3636

@@ -45,7 +45,7 @@ To get started with GraphicsJS create simple HTML document and copy paste the fo
4545
<html lang="en">
4646
<head>
4747
<meta charset="utf-8" />
48-
<script src="https://cdn.anychart.com/js/latest/graphics.min.js"></script>
48+
<script src="https://cdn.anychart.com/releases/v8/js/graphics.min.js"></script>
4949
</head>
5050
<body>
5151
<div id="stage-container" style="width: 400px; height: 375px;"></div>
@@ -74,7 +74,7 @@ Launch the page in your browser and here you are: you have created your first dr
7474

7575
# Articles
7676
- [Introducing GraphicsJS, a Powerful Lightweight Graphics Library](https://www.sitepoint.com/introducing-graphicsjs-a-powerful-lightweight-graphics-library/) by [@RomanLubushkin](https://github.com/RomanLubushkin)
77-
- [GraphicsJS Overview](https://docs.anychart.com/Graphics/Overview) by [AnyChart](http://www.anychart.com/)
77+
- [GraphicsJS Overview](https://docs.anychart.com/Graphics/Overview) by [AnyChart](https://www.anychart.com/)
7878

7979
# Building
8080

@@ -89,7 +89,7 @@ To contribute to AnyChart project please:
8989
* Make any changes you want to contribute.
9090
* Create a pull request against the `develop` branch.
9191

92-
[GitHub documentation: Forking repositories](https://help.github.com/articles/fork-a-repo/).
92+
[GitHub documentation: Forking repositories](https://help.github.com/articles/fork-a-repo/).
9393
[GitHub documentation: Collaborating using pull requests](https://help.github.com/categories/collaborating-with-issues-and-pull-requests/).
9494

9595
# Links
@@ -98,4 +98,4 @@ To contribute to AnyChart project please:
9898
- [GraphicsJS API](https://api.anychart.com/latest/anychart.graphics)
9999
- [GraphicsJS at GitHub](https://github.com/anychart/graphicsjs)
100100
- [Report a bug or an issue](https://github.com/anychart/graphicsjs/issues)
101-
101+
[![Analytics](https://ga-beacon.appspot.com/UA-228820-4/GraphicsJS?pixel&useReferer)](https://github.com/igrigorik/ga-beacon)

build renamed to build.py

Lines changed: 99 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
#coding=utf-8
2+
# coding=utf-8
33

44
import os
55
import sys
@@ -9,9 +9,12 @@
99
import platform
1010
import shlex
1111
import time
12-
#=======================================================================================================================
12+
import json
13+
import datetime
14+
15+
# =======================================================================================================================
1316
# Project paths
14-
#=======================================================================================================================
17+
# =======================================================================================================================
1518
COMPILER_VERSION = '20161024'
1619
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
1720
CONTRIB_PATH = os.path.join(PROJECT_PATH, 'contrib')
@@ -25,12 +28,11 @@
2528
DEPS_WRITER_PATH = os.path.join(CLOSURE_BIN_PATH, 'build', 'depswriter.py')
2629

2730
PYTHON = 'python'
28-
if not (platform.system() == 'Windows'):
29-
PYTHON = 'python2.7'
3031

31-
#=======================================================================================================================
32+
33+
# =======================================================================================================================
3234
# Synchronize contributions.
33-
#=======================================================================================================================
35+
# =======================================================================================================================
3436
def __has_closure_library():
3537
return os.path.exists(CLOSURE_LIBRARY_PATH)
3638

@@ -59,9 +61,9 @@ def __ensure_dir_exists(path):
5961

6062

6163
def __need_sync_contrib():
62-
return not __has_closure_library()\
63-
or not __has_closure_compiler()\
64-
or not __has_closure_linter_wrapper()\
64+
return not __has_closure_library() \
65+
or not __has_closure_compiler() \
66+
or not __has_closure_linter_wrapper() \
6567
or not __has_closure_linter()
6668

6769

@@ -72,7 +74,7 @@ def __sync_contrib():
7274
subprocess.call(['git', 'submodule', 'init'])
7375
subprocess.call(['git', 'submodule', 'update'])
7476

75-
#Download closure compiler
77+
# Download closure compiler
7678
if not os.path.exists(COMPILER_PATH):
7779
print 'Downloading Google Closure Compiler v.' + COMPILER_VERSION
7880
try:
@@ -85,7 +87,7 @@ def __sync_contrib():
8587
print 'Failed'
8688
return False
8789

88-
#Install closure linter
90+
# Install closure linter
8991
if not __has_closure_linter():
9092
if not __install_closure_linter():
9193
return False
@@ -135,12 +137,24 @@ def wrapper():
135137
if __need_sync_contrib():
136138
__sync_contrib()
137139
return func()
140+
138141
return wrapper
139142

140143

141-
#=======================================================================================================================
144+
# =======================================================================================================================
142145
# Build project
143-
#=======================================================================================================================
146+
# =======================================================================================================================
147+
def __get_version():
148+
f = open(os.path.join(PROJECT_PATH, 'package.json'));
149+
package_json = json.loads(f.read());
150+
f.close()
151+
return package_json['version']
152+
153+
154+
def __get_file_overview():
155+
return "/**\n * GraphicsJS is a lightweight JavaScript graphics library with an intuitive API, based on SVG/VML technology.\n * Version: %s (%s)\n * License: BSD 3-clause\n * Copyright: AnyChart.com %s. All rights reserved.\n */\n" % (__get_version(), datetime.datetime.now().strftime("%Y-%m-%d"), str(datetime.datetime.now().year))
156+
157+
144158
def __getNotOptimizedCompilerArgs():
145159
compilerArgs = [
146160
'--compilation_level WHITESPACE_ONLY',
@@ -151,60 +165,75 @@ def __getNotOptimizedCompilerArgs():
151165

152166
def __getOptimizedCompilerArgs():
153167
compilerArgs = [
154-
# '--variable_renaming_report out/vars.txt',
155-
# '--property_renaming_report out/props.txt',
156-
# '--output_manifest out/involved.txt',
168+
'--charset UTF-8',
157169
'--compilation_level ADVANCED_OPTIMIZATIONS',
158-
'--output_wrapper "(function(){%output%})();"',
170+
'--process_closure_primitives',
171+
'--language_in ECMASCRIPT3',
172+
'--language_out ECMASCRIPT3',
159173
'--assume_function_wrapper',
160-
# '--new_type_inf',
174+
'--use_types_for_optimization true',
175+
'--output_wrapper "' + __get_file_overview() + '(function(){%output%})();"',
161176
'--env BROWSER',
177+
'--extra_annotation_name "includeDoc"',
178+
'--extra_annotation_name "illustration"',
179+
'--extra_annotation_name "illustrationDesc"',
180+
'--extra_annotation_name "ignoreDoc"',
181+
'--extra_annotation_name "propertyDoc"',
182+
'--extra_annotation_name "shortDescription"',
162183
'--warning_level VERBOSE',
184+
'--hide_warnings_for "libs/closure-library"',
163185
'--jscomp_warning accessControls',
164186
'--jscomp_warning ambiguousFunctionDecl',
187+
'--jscomp_warning checkDebuggerStatement',
165188
'--jscomp_warning checkEventfulObjectDisposal',
166189
'--jscomp_warning checkRegExp',
167190
'--jscomp_warning checkTypes',
168191
'--jscomp_warning checkVars',
192+
'--jscomp_warning closureDepMethodUsageChecks',
169193
'--jscomp_warning commonJsModuleLoad',
170194
'--jscomp_warning conformanceViolations',
171195
'--jscomp_warning const',
172196
'--jscomp_warning constantProperty',
173197
'--jscomp_warning deprecated',
174198
'--jscomp_warning deprecatedAnnotations',
199+
'--jscomp_warning duplicate',
175200
'--jscomp_warning duplicateMessage',
176201
'--jscomp_warning es3',
177202
'--jscomp_warning es5Strict',
178-
#'--jscomp_warning externsValidation',
203+
'--jscomp_warning externsValidation',
204+
'--jscomp_off extraRequire',
179205
'--jscomp_warning fileoverviewTags',
180206
'--jscomp_warning functionParams',
181207
'--jscomp_warning globalThis',
208+
'--jscomp_warning inferredConstCheck',
182209
'--jscomp_warning internetExplorerChecks',
183210
'--jscomp_warning invalidCasts',
184211
'--jscomp_warning misplacedTypeAnnotation',
185212
'--jscomp_warning missingGetCssName',
186-
# '--jscomp_warning missingOverride',
213+
'--jscomp_off missingOverride',
187214
'--jscomp_warning missingPolyfill',
188215
'--jscomp_warning missingProperties',
189216
'--jscomp_warning missingProvide',
190217
'--jscomp_warning missingRequire',
191218
'--jscomp_warning missingReturn',
192219
'--jscomp_warning msgDescriptions',
193-
'--jscomp_warning newCheckTypes',
194-
'--jscomp_warning nonStandardJsDocs',
195-
# '--jscomp_warning reportUnknownTypes',
220+
'--jscomp_off newCheckTypes',
221+
'--jscomp_off newCheckTypesExtraChecks',
222+
'--jscomp_off nonStandardJsDocs',
223+
'--jscomp_off reportUnknownTypes',
196224
'--jscomp_warning suspiciousCode',
197225
'--jscomp_warning strictModuleDepCheck',
198226
'--jscomp_warning typeInvalidation',
199227
'--jscomp_warning undefinedNames',
200228
'--jscomp_warning undefinedVars',
201229
'--jscomp_warning unknownDefines',
202-
'--jscomp_warning unusedLocalVariables',
203-
# '--jscomp_warning unusedPrivateMembers',
230+
'--jscomp_off unusedLocalVariables',
231+
'--jscomp_off unusedPrivateMembers',
204232
'--jscomp_warning uselessCode',
205-
# '--jscomp_warning useOfGoogBase',
233+
'--jscomp_off useOfGoogBase',
206234
'--jscomp_warning underscore',
207235
'--jscomp_warning visibility',
236+
'--jscomp_warning lintChecks',
208237
]
209238
return compilerArgs
210239

@@ -217,10 +246,8 @@ def __getDefaultCompilerArgs(outputFile):
217246
'--js="%s"' % os.path.join(CLOSURE_LIBRARY_PATH, '**.js'),
218247
'--define "goog.DEBUG=false"',
219248
'--js_output_file ' + outputFile,
220-
'--language_in ECMASCRIPT3',
221-
'--charset UTF-8',
222249
'--dependency_mode=STRICT',
223-
'--entry_point acgraph',
250+
'--entry_point acgraphentry',
224251
'--hide_warnings_for="goog"'
225252
]
226253
return result
@@ -233,7 +260,7 @@ def __compileBinary():
233260
t = time.time()
234261
outputFileName = os.path.join(OUT_PATH, 'graphics.min.js')
235262
print 'Building optimized Graphics library js to ' + outputFileName
236-
commands = __getDefaultCompilerArgs(outputFileName) +\
263+
commands = __getDefaultCompilerArgs(outputFileName) + \
237264
__getOptimizedCompilerArgs()
238265
success = (__call_compiler(commands) == 0)
239266
res = 'Success' if success else 'Failed'
@@ -249,7 +276,7 @@ def __compilePlain():
249276
t = time.time()
250277
outputFileName = os.path.join(OUT_PATH, 'graphics.js')
251278
print 'Building plain Graphics library js to ' + outputFileName
252-
commands = __getDefaultCompilerArgs(outputFileName) +\
279+
commands = __getDefaultCompilerArgs(outputFileName) + \
253280
__getNotOptimizedCompilerArgs()
254281
success = (__call_compiler(commands) == 0)
255282
res = 'Success' if success else 'Failed'
@@ -261,18 +288,18 @@ def __compilePlain():
261288
def __call_compiler(commands):
262289
commands = " ".join(commands).replace('\\', '\\\\')
263290
commands = shlex.split(commands)
264-
#print commands
291+
# print commands
265292
p = subprocess.Popen(commands, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
266293
(output, err) = p.communicate()
267294
retcode = p.poll()
268295
if len(output) > 0:
269-
print output
296+
print output
270297
return retcode
271298

272299

273-
#=======================================================================================================================
300+
# =======================================================================================================================
274301
# Build deps
275-
#=======================================================================================================================
302+
# =======================================================================================================================
276303
@sync_required
277304
def __buildDepsFromCommandLine():
278305
t = time.time()
@@ -282,6 +309,7 @@ def __buildDepsFromCommandLine():
282309
print res + ". Time spent: {:.3f}s\n".format(time.time() - t)
283310
return success
284311

312+
285313
def __callDepsWriter(root, output_file, bundle_name):
286314
print 'Writing deps file to ' + output_file
287315
return subprocess.call([
@@ -292,9 +320,9 @@ def __callDepsWriter(root, output_file, bundle_name):
292320
])
293321

294322

295-
#=======================================================================================================================
323+
# =======================================================================================================================
296324
# Linter.
297-
#=======================================================================================================================
325+
# =======================================================================================================================
298326
@sync_required
299327
def __lintFromCommandLine():
300328
t = time.time()
@@ -303,6 +331,7 @@ def __lintFromCommandLine():
303331
print res + ". Time spent: {:.3f}s\n".format(time.time() - t)
304332
return success
305333

334+
306335
def __callLinter(root):
307336
print 'Linting ' + root + ' directory'
308337
return subprocess.call([
@@ -313,9 +342,11 @@ def __callLinter(root):
313342
'-r',
314343
root
315344
])
316-
#=======================================================================================================================
345+
346+
347+
# =======================================================================================================================
317348
# JSDoc auto fix.
318-
#=======================================================================================================================
349+
# =======================================================================================================================
319350
@sync_required
320351
def __autofixFromCommandLine():
321352
t = time.time()
@@ -335,38 +366,41 @@ def __callAutoFix(root):
335366
'-r',
336367
root
337368
])
338-
#=======================================================================================================================
369+
370+
371+
# =======================================================================================================================
339372
# Help
340-
#=======================================================================================================================
373+
# =======================================================================================================================
341374
def __printHelp():
342-
print "Build script commands:\n"\
343-
"\n"\
344-
"without params Prepares the environment, than lints and builds everything.\n"\
345-
"\n"\
346-
"contrib Prepares buildin environment.\n"\
347-
"\n"\
348-
"deps Build ./src/deps.js file, needed to run the library in uncompiled mode.\n"\
349-
"\n"\
350-
"compile Builds the library minified js to ./out/ directory.\n"\
351-
"\n"\
352-
"plain Builds the library as one file pretty-printed js to ./out/ directory.\n"\
353-
"\n"\
354-
"lint Lints library sources.\n"\
355-
"\n"\
356-
"autofix Tries to fix lint errors in library sources.\n"\
357-
358-
#=======================================================================================================================
375+
print "Build script commands:\n" \
376+
"\n" \
377+
"without params Prepares the environment, than lints and builds everything.\n" \
378+
"\n" \
379+
"contrib Prepares buildin environment.\n" \
380+
"\n" \
381+
"deps Build ./src/deps.js file, needed to run the library in uncompiled mode.\n" \
382+
"\n" \
383+
"compile Builds the library minified js to ./out/ directory.\n" \
384+
"\n" \
385+
"plain Builds the library as one file pretty-printed js to ./out/ directory.\n" \
386+
"\n" \
387+
"lint Lints library sources.\n" \
388+
"\n" \
389+
"autofix Tries to fix lint errors in library sources.\n"
390+
391+
392+
# =======================================================================================================================
359393
# Main
360-
#=======================================================================================================================
394+
# =======================================================================================================================
361395
def __execMainScript():
362396
print ''
363397
args = sys.argv
364398
if len(args) == 1:
365399
success = __sync_contrib() and \
366-
__lintFromCommandLine() and \
367-
__buildDepsFromCommandLine() and \
368-
__compilePlain() and \
369-
__compileBinary()
400+
__lintFromCommandLine() and \
401+
__buildDepsFromCommandLine() and \
402+
__compilePlain() and \
403+
__compileBinary()
370404
elif args[1] == 'contrib':
371405
success = __sync_contrib()
372406
elif args[1] == 'compile':
@@ -384,6 +418,7 @@ def __execMainScript():
384418
success = True
385419
return success
386420

421+
387422
if __name__ == '__main__':
388423
try:
389424
success = __execMainScript()

0 commit comments

Comments
 (0)