UNPKG

@seanox/aspect-js

Version:

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

278 lines (254 loc) 14.8 kB
<?xml version="1.0" ?> <project name="aspect-js" default="usage" basedir=".."> <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> </echo> <echo> debug Creates a release for testing in debug mode </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.sources" value="${workspace}/sources"/> <property name="workspace.test" value="${workspace}/test"/> <property name="workspace.release" value="${workspace}/release"/> <property name="workspace.release.temp" value="${workspace.release}/temp"/> <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-minimize"> <attribute name="file"/> <attribute name="file-min"/> <sequential> <replaceregexp file="@{file}" flags="g" byline="false" match="(?s)(?&lt;=\S)(/\*\*)" replace="${line.separator}${line.separator}\1"/> <replaceregexp file="@{file}" flags="g" byline="false" match="(?s)(?&lt;=.)(?:(/\*(?:\*\s+)+)LIZENZBEDINGUNGEN.*?----\s+(?:\s*\*\s+)*)" replace="\1"/> <replaceregexp file="@{file}" flags="g" byline="false" match=" +(\R)" replace="\1"/> <replaceregexp file="@{file}" flags="g" byline="true" match="^(\t*)( ){24}" replace="\1&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;"/> <replaceregexp file="@{file}" flags="g" byline="true" match="^(\t*)( ){20}" replace="\1&#x09;&#x09;&#x09;&#x09;&#x09;"/> <replaceregexp file="@{file}" flags="g" byline="true" match="^(\t*)( ){16}" replace="\1&#x09;&#x09;&#x09;&#x09;"/> <replaceregexp file="@{file}" flags="g" byline="true" match="^(\t*)( ){12}" replace="\1&#x09;&#x09;&#x09;"/> <replaceregexp file="@{file}" flags="g" byline="true" match="^(\t*)( ){8}" replace="\1&#x09;&#x09;"/> <replaceregexp file="@{file}" flags="g" byline="true" match="^(\t*)( ){4}" replace="\1&#x09;"/> <replaceregexp file="@{file}" flags="g" byline="true" match="\s+$" replace=""/> <replaceregexp file="@{file}" flags="g" byline="false" match="\r\n" replace="&#x0A;"/> <exec executable="cmd.exe" dir="${workspace}/compress"> <arg value="/c npm link ."/> </exec> <exec executable="cmd.exe" dir="${workspace}/compress"> <arg value="/c uglifyjs @{file} -c -m -o @{file-min}"/> </exec> <exec executable="cmd.exe" dir="${workspace}/compress"> <arg value="/c npm uninstall -g uglify-js"/> </exec> </sequential> </macrodef> <target name="release" depends="changes"> <release-locate/> <property name="release.file.max" value="${workspace.release}/${ant.project.name}-max.js"/> <property name="release.file" value="${workspace.release}/${ant.project.name}.js"/> <property name="release.file.core.max" value="${workspace.release}/${ant.project.name}-core-max.js"/> <property name="release.file.core" value="${workspace.release}/${ant.project.name}-core.js"/> <property name="release.file.micro.max" value="${workspace.release}/${ant.project.name}-micro-max.js"/> <property name="release.file.micro" value="${workspace.release}/${ant.project.name}-micro.js"/> <property name="release.file.micro.core.max" value="${workspace.release}/${ant.project.name}-micro-core-max.js"/> <property name="release.file.micro.core" value="${workspace.release}/${ant.project.name}-micro-core.js"/> <delete dir="${workspace.release}"/> <mkdir dir="${workspace.release}"/> <concat destfile="${release.file.micro.core.max}" append="false"> <filelist dir="${workspace.sources}"> <file name="extension.js"/> <file name="datasource.js"/> <file name="messages.js"/> <file name="scripting.js"/> <file name="expression.js"/> <file name="composite.js"/> <file name="reactive.js"/> </filelist> </concat> <replaceregexp file="${release.file.micro.core.max}" flags="g" byline="false" match="\b(compliant\(\x22([\w\.]+)\x22)\);\s*compliant\(\s*null,\s*(window\.)?\2\s*=\s*" replace="\1, "/> <concat destfile="${release.file.micro.max}" append="false"> <filelist dir="${workspace.sources}"> <file name="${release.file.micro.core.max}"/> <file name="test.js"/> </filelist> </concat> <replaceregexp file="${release.file.micro.max}" flags="g" byline="false" match="\b(compliant\(\x22([\w\.]+)\x22)\);\s*compliant\(\s*null,\s*(window\.)?\2\s*=\s*" replace="\1, "/> <concat destfile="${release.file.core.max}" append="false"> <filelist dir="${workspace.sources}"> <file name="${release.file.micro.core.max}"/> <file name="sitemap.js"/> </filelist> </concat> <replaceregexp file="${release.file.core.max}" flags="g" byline="false" match="\b(compliant\(\x22([\w\.]+)\x22)\);\s*compliant\(\s*null,\s*(window\.)?\2\s*=\s*" replace="\1, "/> <concat destfile="${release.file.max}" append="false"> <filelist dir="${workspace.sources}"> <file name="${release.file.core.max}"/> <file name="test.js"/> </filelist> </concat> <replaceregexp file="${release.file.max}" flags="g" byline="false" match="\b(compliant\(\x22([\w\.]+)\x22)\);\s*compliant\(\s*null,\s*(window\.)?\2\s*=\s*" replace="\1, "/> <file-minimize file="${release.file.max}" file-min="${release.file}"/> <file-minimize file="${release.file.core.max}" file-min="${release.file.core}"/> <file-minimize file="${release.file.micro.max}" file-min="${release.file.micro}"/> <file-minimize file="${release.file.micro.core.max}" file-min="${release.file.micro.core}"/> <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}-core-max.js"/> <include name="${ant.project.name}-core.js"/> <include name="${ant.project.name}-micro-max.js"/> <include name="${ant.project.name}-micro.js"/> <include name="${ant.project.name}-micro-core-max.js"/> <include name="${ant.project.name}-micro-core.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="debug"> <file-minimize file="${workspace.test}/${ant.project.name}.js" file-min="${workspace.test}/${ant.project.name}.js"/> </target> <target name="debug" depends="release"> <copy file="${release.file.max}" tofile="${workspace.test}/${ant.project.name}.js" overwrite="true"/> <replaceregexp file="${workspace.test}/${ant.project.name}.js" flags="g" byline="false" match="(const\s+(_secret)\s+=\s+)Math\.serial\(\)(;)" replace="\1&quot;__\2&quot;\3"/> <replaceregexp file="${workspace.test}/${ant.project.name}.js" flags="g" byline="false" match="(\R\s+const )(_\w+)" replace="\1\2 = window.__\2"/> </target> <target name="start"> <java classpath="server/devwex.jar" classname="com.seanox.devwex.Service" dir="server" fork="true" spawn="false"> <arg value="start"/> </java> </target> <target name="stop"> <java classpath="server/devwex.jar" classname="com.seanox.devwex.Service" dir="server" fork="true" spawn="false"> <arg value="stop"/> <arg value="127.0.0.1:8001"/> </java> </target> </project>