UNPKG

@seanox/aspect-js

Version:

full stack JavaScript framework for SPAs incl. reactivity rendering, mvc / mvvm, models, expression language, datasource, routing, paths, unit test and some more

322 lines (295 loc) 16.2 kB
<?xml version="1.0" ?> <project name="aspect-js" default="usage" basedir="${ant.file}/../.."> <target name="usage"> <echo>Following targets are available: </echo> <echo> </echo> <echo> changes Synchronizes README.md with CHANGES </echo> <echo> </echo> <echo> release Creates the release as archive for distribution </echo> <echo> Synchronizes README.md with CHANGES </echo> <echo> </echo> <echo> publish Creates the release as archive for distribution </echo> <echo> Synchronizes README.md with CHANGES </echo> <echo> Publishes the version to the npm repository </echo> <echo> </echo> <echo> test Creates a release for testing </echo> <echo> Starts the included development server </echo> <echo> Console output of the access log </echo> <echo> </echo> <echo> start Starts the included development server </echo> <echo> Console output of the access log </echo> <echo> </echo> <echo> stop Stops the included development server </echo> </target> <property name="workspace" value="${basedir}"/> <property name="workspace.optimize" value="${workspace}/optimize"/> <property name="workspace.release" value="${workspace}/release"/> <property name="workspace.release.temp" value="${workspace.release}/temp"/> <property name="workspace.sources" value="${workspace}/sources"/> <property name="workspace.test" value="${workspace}/test"/> <macrodef name="release-locate"> <sequential> <copy file="CHANGES" tofile="CHANGES.tmp" overwrite="true"/> <replaceregexp file="CHANGES.tmp" match="(?s)^\s*([\d\.x]+) (\d{4})([\dx]+).*$" flags="g" byline="false" replace="release.version=\1&#x000D;release.year=\2&#x000D;release.date=\2\3&#x000D;"/> <replaceregexp file="CHANGES.tmp" match="x+" replace="0000" flags="g" byline="false"/> <loadproperties> <file file="CHANGES.tmp"/> </loadproperties> <delete file="CHANGES.tmp"/> <echo file="CHANGES.tmp" message="release.major=${release.version}"/> <replaceregexp file="CHANGES.tmp" match="(?&lt;=\d+)\." byline="true" replace="&#x000D;release.minor="/> <replaceregexp file="CHANGES.tmp" match="(?&lt;=\d+)\." byline="true" replace="&#x000D;release.patch="/> <loadproperties> <file file="CHANGES.tmp"/> </loadproperties> <delete file="CHANGES.tmp"/> </sequential> </macrodef> <target name="changes"> <release-locate/> <replaceregexp file="${workspace}/CHANGES" match="&#x00E4;" replace="ae" flags="g"/> <replaceregexp file="${workspace}/CHANGES" match="&#x00C4;" replace="Ae" flags="g"/> <replaceregexp file="${workspace}/CHANGES" match="&#x00F6;" replace="oe" flags="g"/> <replaceregexp file="${workspace}/CHANGES" match="&#x00D6;" replace="Oe" flags="g"/> <replaceregexp file="${workspace}/CHANGES" match="&#x00FC;" replace="ue" flags="g"/> <replaceregexp file="${workspace}/CHANGES" match="&#x00DC;" replace="Ue" flags="g"/> <copy file="${workspace}/CHANGES" tofile="${workspace}/CHANGES.tmp" overwrite="true"/> <replaceregexp file="${workspace}/CHANGES.tmp" match="^\s+" replace="" byline="false"/> <replaceregexp file="${workspace}/CHANGES.tmp" match="(?s)^(.*?)[\r\n]+\d[\d\. x]+.*$" replace="\1" byline="false"/> <replaceregexp file="${workspace}/CHANGES.tmp" match="^(.*?)\s*$" replace="\1 " flags="g" byline="true"/> <replaceregexp file="${workspace}/CHANGES.tmp" match="^(\d[\.\d x]+)[^\r\n]*" replace="## \1" byline="false"/> <replaceregexp file="${workspace}/CHANGES.tmp" match="^ {0,4}([A-Z]+:.*)\s*$" replace="\1" byline="true"/> <replaceregexp file="${workspace}/CHANGES.tmp" match="(?s)[\r\n]+ [^\r\n]+" replace="" flags="g" byline="false"/> <replaceregexp file="${workspace}/CHANGES.tmp" match="^(## \d[\.\d]+ \d+)( )" replace="\1\2" flags="g" byline="true"/> <replaceregexp file="${workspace}/CHANGES.tmp" match="^(## \d[\.\d]+ \d+x+)( )" replace="\1 (upcoming version)\2" flags="g" byline="true"/> <loadresource property="changes"> <file file="${workspace}/CHANGES.tmp"/> </loadresource> <delete file="${workspace}/CHANGES.tmp"/> <replaceregexp file="${workspace}/README.md" match="(?si)(# Changes\s+).*?(\[Read more\])" flags="g" byline="false" replace="\1${changes}${line.separator}${line.separator}\2"/> <tstamp> <format property="now.year" pattern="yyyy"/> </tstamp> <replaceregexp file="${workspace}/README.md" match="(?si)(?&lt;=\(C\)\s)\d{4}\b" flags="g" byline="true" replace="${now.year}"/> <replaceregexp file="${workspace}/README.md" match="^(\s*#+\s*version\s+)\d+(\.\d)+\s*$" flags="gi" byline="true" replace="\1${release.version}"/> <replaceregexp file="${workspace}/README.md" match="\d+(?:\.\d)+(\.zip)" flags="gi" byline="false" replace="${release.version}\1"/> <replaceregexp file="${workspace}/README.md" match="(download/)\d+(?:\.\d)+" flags="gi" byline="false" replace="\1${release.version}"/> <replaceregexp file="${workspace}/README.md" match="(aspect-js )\d+(?:\.\d)+" flags="gi" byline="false" replace="\1${release.version}"/> </target> <macrodef name="file-compose"> <attribute name="output"/> <element name="filelist" implicit="true"/> <sequential> <concat destfile="@{output}" append="false"> <filelist refid="@{filelist}"/> </concat> <replaceregexp file="@{output}" flags="g" byline="false" match="\b(compliant\(\x22([\w\.]+)\x22)\);\s*compliant\(\s*null,\s*(window\.)?\2\s*=\s*" replace="\1, "/> <replaceregexp file="@{output}" flags="g" byline="false" match="(?s)(?&lt;=\S)(/\*\*)" replace="${line.separator}${line.separator}\1"/> <replaceregexp file="@{output}" flags="g" byline="false" match="(?s)(?&lt;=.)(?:(/\*(?:\*\s+)+)LIZENZBEDINGUNGEN.*?----\s+(?:\s*\*\s+)*)" replace="\1"/> <replaceregexp file="@{output}" flags="g" byline="false" match=" +(\R)" replace="\1"/> </sequential> </macrodef> <macrodef name="file-es6"> <attribute name="input"/> <attribute name="output"/> <sequential> <exec executable="cmd.exe" dir="${workspace.optimize}"> <arg value="/c npx babel @{input} -o @{output} --presets=@babel/preset-env"/> </exec> <exec executable="cmd.exe" dir="${workspace.optimize}"> <arg value="/c npx prettier --write --tab-width 2 --use-tabs @{output}"/> </exec> </sequential> </macrodef> <macrodef name="file-es6-lint"> <attribute name="input"/> <sequential> <exec executable="cmd.exe" dir="${workspace.release}" failonerror="true"> <arg value="/c npx eslint --config ${workspace.optimize}\.eslintrc @{input}"/> </exec> </sequential> </macrodef> <macrodef name="file-minimize"> <attribute name="input"/> <attribute name="output"/> <sequential> <exec executable="cmd.exe" dir="${workspace.optimize}"> <arg value="/c npx uglifyjs @{input} -c -m --no-module -o @{output}"/> </exec> </sequential> </macrodef> <macrodef name="file-replace-tabs"> <attribute name="input"/> <sequential> <replaceregexp file="@{input}" flags="g" byline="true" match=" {24}" replace="&#09;&#09;&#09;&#09;&#09;&#09;"/> <replaceregexp file="@{input}" flags="g" byline="true" match=" {20}" replace="&#09;&#09;&#09;&#09;&#09;"/> <replaceregexp file="@{input}" flags="g" byline="true" match=" {16}" replace="&#09;&#09;&#09;&#09;"/> <replaceregexp file="@{input}" flags="g" byline="true" match="^ {12}" replace="&#09;&#09;&#09;"/> <replaceregexp file="@{input}" flags="g" byline="true" match="^ {8}" replace="&#09;&#09;"/> <replaceregexp file="@{input}" flags="g" byline="true" match="^ {4}" replace="&#09;"/> </sequential> </macrodef> <target name="release" depends="changes"> <release-locate/> <property name="release.file.source" value="${workspace.release}/${ant.project.name}-source.js"/> <property name="release.file.source.testing" value="${workspace.release}/${ant.project.name}-source-testing.js"/> <property name="release.file" value="${workspace.release}/${ant.project.name}.js"/> <property name="release.file.debug" value="${workspace.release}/${ant.project.name}-debug.js"/> <property name="release.file.debug.max" value="${workspace.release}/${ant.project.name}-debug-max.js"/> <property name="release.file.max" value="${workspace.release}/${ant.project.name}-max.js"/> <property name="release.file.testing" value="${workspace.release}/${ant.project.name}-testing.js"/> <property name="release.file.testing.max" value="${workspace.release}/${ant.project.name}-testing-max.js"/> <property name="release.file.debug.testing" value="${workspace.release}/${ant.project.name}-debug-testing.js"/> <property name="release.file.debug.testing.max" value="${workspace.release}/${ant.project.name}-debug-testing-max.js"/> <delete dir="${workspace.release}"/> <mkdir dir="${workspace.release}"/> <exec executable="cmd.exe" dir="${workspace.optimize}"> <arg value="/c npm install"/> </exec> <!-- In the debug version, for the internal variables window variants starting with ___ are created so that they can be accessed during debugging. Otherwise they cannot be accessed later from outside! For this to work, internal variables must begin with _! () => { const _x = Math.serial(); will be replaced by: const _x = window.___x = Math.serial(); } --> <file-compose output="${release.file.source}"> <filelist dir="${workspace.sources}"> <file name="extension.js"/> <file name="datasource.js"/> <file name="scripting.js"/> <file name="expression.js"/> <file name="composite.js"/> <file name="messages.js"/> <file name="reactive.js"/> <file name="routing.js"/> </filelist> </file-compose> <copy file="${release.file.source}" tofile="${release.file.debug.max}"/> <replaceregexp file="${release.file.debug.max}" flags="g" byline="false" match="(\R\s+const )(_\w+)" replace="\1\2 = window.__\2"/> <copy file="${release.file.source}" tofile="${release.file.max}"/> <copy file="${release.file.max}" tofile="${release.file}"/> <file-minimize input="${release.file.max}" output="${release.file}"/> <file-es6-lint input="${release.file.max}"/> <file-es6-lint input="${release.file}"/> <file-compose output="${release.file.source.testing}"> <filelist dir="${workspace.sources}"> <file name="${release.file.source}"/> <file name="test.js"/> </filelist> </file-compose> <copy file="${release.file.source.testing}" tofile="${release.file.testing.max}"/> <copy file="${release.file.source.testing}" tofile="${release.file.debug.testing.max}"/> <replaceregexp file="${release.file.debug.testing.max}" flags="g" byline="false" match="(\R\s+const )(_\w+)" replace="\1\2 = window.__\2"/> <file-minimize input="${release.file.debug.testing.max}" output="${release.file.debug.testing}"/> <file-es6-lint input="${release.file.debug.testing.max}"/> <file-es6-lint input="${release.file.debug.testing}"/> <copy file="${release.file.testing.max}" tofile="${release.file.testing}"/> <file-minimize input="${release.file.testing.max}" output="${release.file.testing}"/> <file-es6-lint input="${release.file.testing.max}"/> <file-es6-lint input="${release.file.testing}"/> <file-replace-tabs input="${release.file.max}"/> <file-replace-tabs input="${release.file.testing.max}"/> <delete dir="${workspace.optimize}/node_modules"/> <delete file="${workspace.optimize}/package-lock.json"/> <mkdir dir="${workspace.release.temp}"/> <copy todir="${workspace.release.temp}"> <fileset dir="${workspace.release}"> <include name="${ant.project.name}-max.js"/> <include name="${ant.project.name}.js"/> <include name="${ant.project.name}-testing-max.js"/> <include name="${ant.project.name}-testing.js"/> </fileset> </copy> <copy todir="${workspace.release.temp}"> <fileset dir="${workspace}"> <include name="manual/**/*"/> <include name="CHANGES"/> <include name="LICENSE"/> <include name="README.md"/> </fileset> </copy> <touch datetime="${release.date}" pattern="yyyyMMdd"> <fileset dir="${workspace.release}" includes="**/*"/> </touch> <zip destfile="${workspace.release}/${ant.project.name}-${release.version}.zip"> <fileset dir="${workspace.release.temp}" includes="**/*"/> </zip> <delete dir="${workspace.release.temp}"/> <touch datetime="${release.date}" pattern="yyyyMMdd"> <fileset dir="${workspace.release}" includes="${ant.project.name}-${release.version}.zip"/> </touch> <replaceregexp file="${workspace}/README.md" match="(Seanox ${ant.project.name} )\d+(\.\d+)*" flags="g" byline="false" replace="\1${release.version}"/> <replaceregexp file="${workspace}/README.md" match="(seanox/${ant.project.name}/releases/download/)\d+(?:\.\d+)*(/${ant.project.name}-)\d+(?:\.\d+)*(\.zip)" flags="g" byline="false" replace="\1${release.version}\2${release.version}\3"/> <replaceregexp file="${workspace}/README.md" match="(seanox/${ant.project.name}/archive/refs/tags/)\d+(?:\.\d+)*(\.zip)" flags="g" byline="false" replace="\1${release.version}\2"/> </target> <target name="publish" depends="release"> <replaceregexp file="${workspace}/package.json" match="(&quot;version&quot;: &quot;)\d+(?:\.\d+)+(\&quot;)" flags="g" replace="\1${release.version}\2" byline="false"/> <exec executable="cmd.exe"> <arg value="/c npm publish --access public"/> </exec> <replaceregexp file="${workspace}/package.json" match="(&quot;version&quot;: &quot;)\d+(?:\.\d+)+(\&quot;)" flags="g" replace="\10.0.0\2" byline="false"/> </target> <target name="test" depends="release"> <copy file="${release.file.debug.testing}" tofile="${workspace.test}/${ant.project.name}.js" overwrite="true"/> <antcall target="run"/> </target> <target name="test-max" depends="release"> <copy file="${release.file.debug.testing.max}" tofile="${workspace.test}/${ant.project.name}.js" overwrite="true"/> <antcall target="run"/> </target> <target name="run"> <java classpath="server/devwex.jar" classname="com.seanox.devwex.Service" dir="server" fork="true" spawn="false"> <jvmarg value="-Dfile.encoding=ISO-8859-1"/> <arg value="start"/> </java> </target> <target name="stop"> <java classpath="server/devwex.jar" classname="com.seanox.devwex.Service" dir="server" fork="true" spawn="false"> <jvmarg value="-Dfile.encoding=ISO-8859-1"/> <arg value="stop"/> <arg value="127.0.0.1:8001"/> </java> </target> </project>