diff --git a/README.md b/README.md index 8c07d822..304ee41f 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,222 @@ Note: If you told yeoman to use Github for your new project, your project will s Some of the answers, such as username will be stored after the initial run of the generator. So you only have to type them once. +### The Scaffold + +The generator creates sensible default structures for `expath` packages for exist-db, which includes default folders for `xquery` code, meta-data files, `html`, etc. modelled on eXide's package generation scripts. In addition there are optional features such as `dockerfile`, CI scripts, github templates, secure area, … depending on the options selected by the user. The idea is that if you select e.g. to include a secure area in your application from the start, the files will contain the necessary parts, after the intial run of the generator. Saving you from having to manualy add sections, or repeatedly providing the same information over and over agian. There are 4 basic app types. + +- exist-design +- plain +- empty +- xquery library + +Since if would be impractical to go through all possible combinations of option here are some sample scaffolds created with the generator. + +#### exist-design (with. secure area selected) + +```shell +├── Dockerfile +├── LICENSE +├── README.md +├── admin +│   ├── controller.xql +│   ├── index.html +│   └── security.html +├── build +│   ├── exide_demo-1.0.0-dev.xar +│   └── exide_demo-1.0.0.xar +├── build.xml +├── collection.xconf +├── controller.xql +├── cypress.json +├── error-page.html +├── expath-pkg.xml +├── icon.png +├── index.html +├── modules +│   ├── app.xql +│   ├── config.xqm +│   └── view.xql +├── node_modules +│   └── pruned … +├── package-lock.json +├── package.json +├── post-install.xql +├── pre-install.xql +├── repo.xml +├── reports +│   ├── screenshots +│   └── videos +├── resources +│   ├── css +│   │   └── style.css +│   └── images +│   ├── bgmenu.gif +│   ├── bgmenuhi.gif +│   ├── body-base.gif +│   ├── body.gif +│   ├── bold.gif +│   ├── code.gif +│   ├── delete-icon.png +│   ├── existdb.png +│   ├── glyphicons-halflings.png +│   ├── grey-box-bot.gif +│   ├── grey-box-rpt.gif +│   ├── grey-box-top.gif +│   ├── header.gif +│   ├── horizontal.gif +│   ├── italic.gif +│   ├── nav-dropdown.gif +│   ├── nav-dropdown.png +│   ├── nav.gif +│   └── page-edit-icon.png +├── templates +│   ├── login-panel.html +│   └── page.html +└── test + ├── cypress + │   ├── fixtures + │   │   └── example.json + │   ├── integration + │   │   ├── landing_spec.js + │   │   ├── login-fail_spec.js + │   │   └── login-ok_spec.js + │   ├── plugins + │   │   └── index.js + │   └── support + │   ├── commands.js + │   └── index.js + ├── mocha + │   ├── app_spec.js + │   └── rest_spec.js + └── xqs + ├── test-runner.xq + ├── test-suite.xql + └── xqSuite.js +``` + +#### plain (with most options) + +```shell +├── LICENSE +├── README.md +├── build +│   ├── plain_demo-1.0.0-dev.xar +│   └── plain_demo-1.0.0.xar +├── build.xml +├── collection.xconf +├── controller.xql +├── cypress.json +├── error-page.html +├── expath-pkg.xml +├── icon.png +├── index.html +├── modules +│   ├── app.xql +│   ├── config.xqm +│   └── view.xql +├── node_modules +│   └── pruned … +├── package-lock.json +├── package.json +├── post-install.xql +├── pre-install.xql +├── repo.xml +├── reports +│   ├── screenshots +│   └── videos +├── resources +│   └── css +│   └── style.css +├── templates +│   └── page.html +└── test + ├── cypress + │   ├── fixtures + │   │   └── example.json + │   ├── integration + │   │   └── landing_spec.js + │   ├── plugins + │   │   └── index.js + │   └── support + │   ├── commands.js + │   └── index.js + ├── mocha + │   ├── app_spec.js + │   └── rest_spec.js + └── xqs + ├── test-runner.xq + ├── test-suite.xql + └── xqSuite.js +``` + +#### empty (without extras) + +```shell +├── LICENSE +├── build +│   ├── empty_demo-1.0.0-dev.xar +│   └── empty_demo-1.0.0.xar +├── build.xml +├── cypress.json +├── expath-pkg.xml +├── icon.png +├── node_modules +│   └── pruned … +├── package-lock.json +├── package.json +├── repo.xml +├── reports +│   ├── screenshots +│   └── videos +└── test + ├── cypress + │   ├── fixtures + │   │   └── example.json + │   ├── integration + │   │   └── landing_spec.js + │   ├── plugins + │   │   └── index.js + │   └── support + │   ├── commands.js + │   └── index.js + ├── mocha + │   ├── app_spec.js + │   └── rest_spec.js + └── xqs + ├── test-runner.xq + ├── test-suite.xql + └── xqSuite.js +``` + +#### xquery library + +```shell +├── LICENSE +├── README.md +├── build +│   ├── lib_demo-1.0.0-dev.xar +│   └── lib_demo-1.0.0.xar +├── build.xml +├── collection.xconf +├── expath-pkg.xml +├── node_modules +│   └── pruned … +├── package-lock.json +├── package.json +├── post-install.xql +├── pre-install.xql +├── repo.xml +└── test + ├── mocha + │   ├── app_spec.js + │   └── rest_spec.js + └── xqs + ├── test-runner.xq + ├── test-suite.xql + └── xqSuite.js +``` + ## Development If you want to contribute another template or option, please take a look at the issue tracker. Pull request are always welcome. This generator uses `mocha` for unit testing. Please make sure to add tests when opening a PR. diff --git a/generators/app/index.js b/generators/app/index.js index f38ba51b..5ba9711d 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -4,7 +4,6 @@ const chalk = require('chalk') const yosay = require('yosay') const prettyData = require('gulp-pretty-data') const stripBom = require('gulp-stripbom') -const validateElementName = require('validate-element-name') const pjson = require('../../package.json') // Var isodate = (new Date()).toISOString(); @@ -69,11 +68,6 @@ module.exports = class extends Generator { name: 'plain', value: ['plain', 'application'] }, - // TODO compose with polymer-cli should work - { - name: 'polymer', - value: ['polymer', 'application'] - }, { name: 'empty', value: ['empty', 'application'] @@ -83,45 +77,6 @@ module.exports = class extends Generator { value: ['empty', 'library'] }] }, - { - when: response => { - return response.apptype[0] === 'polymer' - }, - type: 'list', - name: 'polytempl', - message: 'select the type of polymer 2.0 project', - choices: [{ - name: 'Polymer 2 element', - value: 'polymer-2-element:app' - }, { - name: 'Polymer 2 application', - value: 'polymer-2-application:app' - } - // , { - // name: 'Polymer starter kit', - // value: 'polymer-2-starter-kit:app' - // } - ] - }, - { - when: response => { - return response.apptype[0] === 'polymer' - }, - name: 'name', - type: 'input', - message: 'Element name', - default: this.appname + (this.appname.includes('-') ? '' : '-element'), - validate: (name) => { - const nameValidation = validateElementName(name) - if (!nameValidation.isValid) { - this.log(`\n${nameValidation.message}\nPlease try again.`) - } else if (nameValidation.message) { - this.log('') // 'empty' log inserts a line break - // logger.warn(nameValidation.message) - } - return nameValidation.isValid - } - }, // TODO: [yo] Make these options meaningful // { // type: 'checkbox', @@ -244,6 +199,7 @@ module.exports = class extends Generator { value: ['unlicense', 'unlicense', 'https://choosealicense.com/licenses/unlicense/'] }] }, + // See #601 { type: 'confirm', name: 'github', @@ -391,14 +347,6 @@ module.exports = class extends Generator { if (this.props.name) { this.props.elementClassName = this.props.name.replace(/(^|-)(\w)/g, (_match, _p0, p1) => p1.toUpperCase()) } - - // '../../node_modules/polymer-cli/lib/init/element/element.js' - // if (this.props.polytempl[1] === 'polymer-2-element:app') { - // this.composeWith(require.resolve('polymer-init-polymer-2-element'), { - // name: this.props.title, - // description: this.props.desc - // }) - // } }) } @@ -453,7 +401,7 @@ module.exports = class extends Generator { }, repository: '' } - // TODO html -> xhtml + // TODO #56 html -> xhtml // Applies to all (build, expath-pkg, repo, xqs) this.fs.copyTpl( this.templatePath('build.xml'), @@ -528,7 +476,7 @@ module.exports = class extends Generator { ) } // not polymer (flexible) - if (this.props.apptype[0] !== 'empty' && this.props.apptype[0] !== 'polymer') { + if (this.props.apptype[0] !== 'empty') { this.fs.copyTpl( this.templatePath('pages/error-page.html'), this.destinationPath('error-page.html'), { @@ -558,39 +506,6 @@ module.exports = class extends Generator { this.destinationPath('resources/images/') ) break - case 'polymer': - this.fs.copyTpl( - this.templatePath('exist-polymer/*'), - this.destinationPath(''), { - desc: this.props.desc, - title: this.props.title, - name: this.props.name, - polytempl: this.props.polytempl, - elementClassName: this.props.elementClassName, - defcoll: this.props.defcoll, - short: this.props.short, - admin: this.props.admin, - adminpw: this.props.adminpw, - apptype: this.props.apptype[0] - }) - this.fs.copyTpl( - this.templatePath('style.css'), - this.destinationPath('resources/css/style.css'), { - apptype: this.props.apptype[0] - }) - // Poly2 template is deprecated - Object.assign(pkgJson.devDependencies, { - 'brace-expansion': '^1.1.4', - del: '^2.2.0', - gulp: '^4.0.2', - 'gulp-exist': '^3.0.3', - 'gulp-less': '^3.1.0', - 'gulp-watch': '^4.3.6', - 'less-plugin-autoprefix': '^1.5.1', - 'less-plugin-clean-css': '^1.5.1', - bower: '^1.8.8' - }) - break default: } @@ -661,7 +576,7 @@ module.exports = class extends Generator { break default: } - if (this.props.apptype[0] !== 'polymer') { + if (this.props.apptype[1] === 'application') { this.fs.copyTpl( this.templatePath('pages/index.html'), this.destinationPath('index.html'), { @@ -675,59 +590,6 @@ module.exports = class extends Generator { } } - // polymer-app-types - if (this.props.polytempl === 'polymer-2-element:app') { - this.fs.copyTpl( - this.templatePath('tests/polymer/_element_test.html'), - this.destinationPath('test/' + this.props.name + '_test.html'), { - name: this.props.name, - polytempl: this.props.polytempl - }) - this.fs.copyTpl( - this.templatePath('tests/polymer/index.html'), - this.destinationPath('test/index.html'), { - name: this.props.name, - polytempl: this.props.polytempl - }) - this.fs.copyTpl( - this.templatePath('exist-polymer/demo/index.html'), - this.destinationPath('demo/index.html'), { - name: this.props.name, - polytempl: this.props.polytempl - }) - this.fs.copyTpl( - this.templatePath('exist-polymer/demo/_element.html'), - this.destinationPath(this.props.name + '.html'), { - name: this.props.name, - polytempl: this.props.polytempl, - elementClassName: this.props.elementClassName, - desc: this.props.desc - }) - } - if (this.props.polytempl === 'polymer-2-application:app') { - this.fs.copyTpl( - this.templatePath('tests/polymer/_element_test.html'), - this.destinationPath('test/' + this.props.name + '/' + this.props.name + '_test.html'), { - name: this.props.name, - polytempl: this.props.polytempl - }) - this.fs.copyTpl( - this.templatePath('exist-polymer/src/manifest.json'), - this.destinationPath('manifest.json'), { - name: this.props.name, - short: this.props.short, - desc: this.props.desc - }) - this.fs.copyTpl( - this.templatePath('exist-polymer/demo/_element.html'), - this.destinationPath('src/' + this.props.name + '/' + this.props.name + '.html'), { - name: this.props.name, - polytempl: this.props.polytempl, - elementClassName: this.props.elementClassName, - desc: this.props.desc - }) - } - // Pre-install if (this.props.pre) { this.fs.copyTpl( @@ -746,7 +608,6 @@ module.exports = class extends Generator { }) } // Post-install - // TODO [teipub] updated xql & post partial from gitlab if (this.props.post) { this.fs.copyTpl( this.templatePath('post-install.xql'), @@ -940,15 +801,6 @@ module.exports = class extends Generator { bower: false, yarn: false }) - - if (this.props.apptype[0] === 'polymer') { - this.bowerInstall() - } - - // this will start the default polymer cli - // if (this.props.apptype[0] === 'polymer') { - // this.spawnCommandSync('polymer', ['init', this.props.polytempl[1]]) - // } } end () { @@ -959,11 +811,6 @@ module.exports = class extends Generator { } this.spawnCommandSync('ant', '-q') - // conditional gulp watch - // if (this.props.apptype[0] === 'polymer') { - // this.spawnCommandSync('gulp', ['watch']) - // } - console.log(yosay('I believe we\'re done here.')) } } diff --git a/generators/app/templates/build.xml b/generators/app/templates/build.xml index 18c7c7a9..119954c6 100644 --- a/generators/app/templates/build.xml +++ b/generators/app/templates/build.xml @@ -10,12 +10,6 @@ - <%_ if (apptype === 'polymer') { %> - - - - - <% } -%> @@ -23,46 +17,9 @@ - <%_ if (apptype === 'polymer') { %> - - - - - - - - - - - - - - <% } -%> - - - <%_ if (apptype === 'polymer') { %> - - - - - - - - - - - <% } else { %> + - <% } %> diff --git a/generators/app/templates/controller.xql b/generators/app/templates/controller.xql index 39ca3ce5..b3b70a5a 100755 --- a/generators/app/templates/controller.xql +++ b/generators/app/templates/controller.xql @@ -5,13 +5,6 @@ xquery version "3.1"; : @see http://www.exist-db.org/exist/apps/doc/urlrewrite.xml :) - <%_ if (apptype == 'polymer') { %> - declare namespace json = "http://www.json.org"; - declare namespace control = "http://exist-db.org/apps/dashboard/controller"; - declare namespace output = "http://exquery.org/ns/rest/annotation/output"; - declare namespace rest = "http://exquery.org/ns/restxq"; - <% } -%> - <%_ if (mysec) { %> import module namespace login="http://exist-db.org/xquery/login" at "resource:org/exist/xquery/modules/persistentlogin/login.xql"; <% } -%> @@ -49,20 +42,10 @@ else if (contains($exist:path, "/$shared/")) then -<%_ if (apptype == 'polymer') { %> - else if ($exist:path eq "/demo/") then - - - -<% } %> else if (ends-with($exist:resource, ".html")) then ( (: the html page is run through view.xql to expand templates :) -<%_ if (apptype == 'polymer') { %> - - ) -<% } else { %> @@ -71,7 +54,6 @@ else if (contains($exist:path, "/$shared/")) then ) -<% } %> else (: everything else is passed through :) diff --git a/generators/app/templates/exist-polymer/bower.json b/generators/app/templates/exist-polymer/bower.json deleted file mode 100644 index 593a3bee..00000000 --- a/generators/app/templates/exist-polymer/bower.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "<%- name %>", - "description": "<%- desc %>", - <%_ if (polytempl === 'polymer-2-element:app') { %> - "main": "<%- name %>.html", - <% } else { %> - "main": "index.html", - <% } -%> - "dependencies": { - "polymer": "Polymer/polymer#^2.0.0" - }, - "devDependencies": { - <% if (polytempl === 'polymer-2-element:app') { -%> - "iron-demo-helpers": "PolymerElements/iron-demo-helpers#^2.0.0", - <% } -%> - "web-component-tester": "Polymer/web-component-tester#^6.0.0", - "webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0" - }, - "resolutions": { - "polymer": "^2.0.0" - } -} diff --git a/generators/app/templates/exist-polymer/bower.json.ignores b/generators/app/templates/exist-polymer/bower.json.ignores deleted file mode 100755 index cb81f3c9..00000000 --- a/generators/app/templates/exist-polymer/bower.json.ignores +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "<%- name %>", - "description": "", - "main": "index.html", - "repository": { - "type": "git", - "url": "git://gitlab.exist-db.org:eXistdbElements/existdb-packagemanager.git" - }, - "dependencies": { - }, - "devDependencies": { - }, - "ignore": [ - ".idea", - "build", - "bower_components", - "node_modules", - "test", - "build.xml", - "expath-pkg.xml", - "repo.xml", - "package.json", - "gulpfile.js" - ], - "private": true -} diff --git a/generators/app/templates/exist-polymer/demo/_element.html b/generators/app/templates/exist-polymer/demo/_element.html deleted file mode 100644 index e5dd545c..00000000 --- a/generators/app/templates/exist-polymer/demo/_element.html +++ /dev/null @@ -1,40 +0,0 @@ -<%_ if (polytempl === 'polymer-2-application:app') { %> - -<% } else { %> - -<% } _%> - - - - - - diff --git a/generators/app/templates/exist-polymer/demo/index.html b/generators/app/templates/exist-polymer/demo/index.html deleted file mode 100644 index ec5c7601..00000000 --- a/generators/app/templates/exist-polymer/demo/index.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - <%- name %> demo - - - - - - - - - - - - -
-

Basic <%- name %> demo

- - - -
- - diff --git a/generators/app/templates/exist-polymer/gulpfile.js b/generators/app/templates/exist-polymer/gulpfile.js deleted file mode 100755 index 6e7797f0..00000000 --- a/generators/app/templates/exist-polymer/gulpfile.js +++ /dev/null @@ -1,124 +0,0 @@ -'use strict'; - -var gulp = require('gulp'); - -var exist = require('gulp-exist'); - -var watch = require('gulp-watch'); - -var less = require('gulp-less'); - -var del = require('del'); - -var path = require('path'); - -var LessPluginCleanCSS = require('less-plugin-clean-css'); - -var LessAutoprefix = require('less-plugin-autoprefix'); - -var PRODUCTION = (Boolean(process.env.NODE_ENV) || process.env.NODE_ENV === 'production'); - -console.log('Production? %s', PRODUCTION); - -// add .xconf ? -exist.defineMimeTypes({ - 'application/xml': ['odd'] -}); - -var exClient = exist.createClient({ - host: 'localhost', - port: '8080', - path: '/exist/xmlrpc', - basic_auth: { - <%_ if (admin) { %> - user: '<%- admin %>', - pass: '<%- adminpw %>' - <% } else { %> - user: 'admin', - pass: '' - <% } _%> - } -}); - -var html5TargetConfiguration = { - target: '/db/<%- defcoll %>/<%- short %>', - html5AsBinary: true -}; - -var targetConfiguration = { - target: '/db/<%- defcoll %>/<%- short %>', - html5AsBinary: true -}; - -gulp.task('clean', function () { - return del(['build/**/*']); -}); - -// Styles // - -var lessPath = './resources/css/style.less'; -var stylesPath = 'resources/css/*'; -var cleanCSSPlugin = new LessPluginCleanCSS({advanced: true}); -var autoprefix = new LessAutoprefix({browsers: ['last 2 versions']}); - -gulp.task('styles', function () { - return gulp.src(lessPath) - .pipe(less({plugins: [cleanCSSPlugin, autoprefix]})) - .pipe(gulp.dest('./resources/css')); -}); - -gulp.task('deploy:styles', ['styles'], function () { - return gulp.src('resources/css/*.css', {base: './'}) - .pipe(exClient.newer(targetConfiguration)) - .pipe(exClient.dest(targetConfiguration)); -}); - -// Files in project root // - -var componentPaths = [ - '*.html', - 'bower_components/**/*' -]; - -gulp.task('deploy:components', function () { - return gulp.src(componentPaths, {base: './'}) - .pipe(exClient.newer(html5TargetConfiguration)) - .pipe(exClient.dest(html5TargetConfiguration)); -}); - -var otherPaths = [ - '*.html', - '*.xql', - 'templates/**/*', - 'transforms/**/*', - 'resources/**/*', - '!resources/css/*', - 'modules/**/*', - 'demo/**/*' -]; - -gulp.task('deploy:other', function () { - return gulp.src(otherPaths, {base: './'}) - .pipe(exClient.newer(targetConfiguration)) - .pipe(exClient.dest(targetConfiguration)); -}); - -var components = [ - '*-*.html' -]; - -gulp.task('deploy:comp', function () { - return gulp.src(components, {base: './'}) - .pipe(gulp.dest('bower_components/<%- name %>')); -}); - -gulp.task('deploy', ['deploy:comp', 'deploy:other', 'deploy:components', 'deploy:styles']); - -gulp.task('watch', function () { - gulp.watch('resources/css/!*', ['deploy:styles']); - gulp.watch(otherPaths, ['deploy:other']); - gulp.watch(components, ['deploy:comp']); - gulp.watch('*.html', ['deploy:components']); -}); - -gulp.task('default', ['watch']); diff --git a/generators/app/templates/exist-polymer/index.html b/generators/app/templates/exist-polymer/index.html deleted file mode 100755 index bb9f5097..00000000 --- a/generators/app/templates/exist-polymer/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - <%_ if (polytempl === 'polymer-2-element:app') { %> - - <% } _%> - <%- name %> - <%_ if (polytempl === 'polymer-2-application:app') { %> - - - - - - - - <% } _%> - - - <%_ if (polytempl === 'polymer-2-application:app') { %> - <<%= name %>>> - <% } else { %> - - <% } _%> - - diff --git a/generators/app/templates/exist-polymer/polymer.json b/generators/app/templates/exist-polymer/polymer.json deleted file mode 100755 index 008b6b7e..00000000 --- a/generators/app/templates/exist-polymer/polymer.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "shell": "index.html", - "lint": { - "rules": [ - "polymer-2" - ] - } -} diff --git a/generators/app/templates/exist-polymer/src/manifest.json b/generators/app/templates/exist-polymer/src/manifest.json deleted file mode 100644 index 8f80abc8..00000000 --- a/generators/app/templates/exist-polymer/src/manifest.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "<%= name %>", - "short_name": "<%= short %>", - "description": "<%- desc %>", - "start_url": "/", - "display": "standalone" -} diff --git a/generators/app/templates/expath-pkg.xml b/generators/app/templates/expath-pkg.xml index fecb901e..d2a88d9e 100644 --- a/generators/app/templates/expath-pkg.xml +++ b/generators/app/templates/expath-pkg.xml @@ -3,5 +3,5 @@ abbrev="<%- short %>" version="<%- version %>" spec="1.0"> <%- desc %> - <%_ if (apptype !== 'polymer' && apptype !== 'empty') { %><% } -%> + <%_ if (apptype !== 'empty') { %><% } -%> diff --git a/generators/app/templates/github/readme.md b/generators/app/templates/github/readme.md index 952b0e5a..9bcb831a 100644 --- a/generators/app/templates/github/readme.md +++ b/generators/app/templates/github/readme.md @@ -1,4 +1,5 @@ # <%- title %> + [![License][license-img]][license-url] [![GitHub release][release-img]][release-url] <%_ if (ci == 'travis') { -%> @@ -13,6 +14,7 @@ <%- desc %> ## Requirements + * [exist-db](http://exist-db.org/exist/apps/homepage/index.html) version: `5.x` or greater * [ant](http://ant.apache.org) version: `1.10.7` \(for building from source\) @@ -21,22 +23,30 @@ <% } %> ## Installation + 1. Download the `<%- title %>-<%- version %>.xar` file from GitHub [releases](https://github.com/<%- ghuser %>/<%- title %>/releases) page. + 2. Open the [dashboard](http://localhost:8080/exist/apps/dashboard/index.html) of your eXist-db instance and click on `package manager`. + 1. Click on the `add package` symbol in the upper left corner and select the `.xar` file you just downloaded. + 3. You have successfully installed <%- title %> into exist. ### Building from source + 1. Download, fork or clone this GitHub repository 2. There are two default build targets in `build.xml`: * `dev` including *all* files from the source folder including those with potentially sensitive information. + * `deploy` is the official release. It excludes files necessary for development but that have no effect upon deployment. -3. Calling `ant`in your CLI will build both files: +3. Calling `ant`in your CLI will build both files: + ```bash cd <%- title %> ant ``` + 1. to only build a specific target call either `dev` or `deploy` like this: ```bash ant dev @@ -45,10 +55,13 @@ ant If you see `BUILD SUCCESSFUL` ant has generated a `<%- title %>-<%- version %>.xar` file in the `build/` folder. To install it, follow the instructions [above](#installation). <%_ if (apptype == 'exist-design' || 'plain') { %> + ## Running Tests + To run tests locally your app needs to be installed in a running exist-db instance at the default port `8080` and with the default dba user `admin` with the default empty password. A quick way to set this up for docker users is to simply issue: + ```bash docker run -dit -p 8080:8080 existdb/existdb:release ``` @@ -56,11 +69,15 @@ docker run -dit -p 8080:8080 existdb/existdb:release After you finished installing the application, you can run the full testsuite locally. ### Unit-tests + This app uses [mochajs](https://mochajs.org) as a test-runner. To run both xquery and javascript unit-tests type: + ```bash npm test ``` + ### Integration-tests + This app uses [cypress](https://www.cypress.io) for integration tests, just type: ```bash @@ -68,42 +85,15 @@ npm run cypress ``` Alternatively, use npx: + ```bash npx cypress open ``` -<% } -%> - -<%_ if (apptype == 'polymer') { %> - First, make sure you have the [Polymer CLI](https://www.npmjs.com/package/polymer-cli) installed. Then run `polymer serve` to serve your application locally. - - ## Viewing Your Application - - ```bash - polymer serve - ``` - ## Building Your Application - - ```bash - polymer build - ``` - - This will create builds of your application in the `build/` directory, optimized to be served in production. You can then serve the built versions by giving `polymer serve` a folder to serve from: - - ```bash - polymer serve build/default - ``` - - ## Running Tests - - ```bash - polymer test - ``` - - Your application is already set up to be tested via [web-component-tester](https://github.com/Polymer/web-component-tester). Run `polymer test` to run your application's test suite locally. <% } -%> ## Contributing + You can take a look at the [Contribution guidelines for this project](.github/CONTRIBUTING.md) ## License diff --git a/generators/app/templates/partials/tei-post.ejs b/generators/app/templates/partials/tei-post.ejs deleted file mode 100644 index e9f44448..00000000 --- a/generators/app/templates/partials/tei-post.ejs +++ /dev/null @@ -1,42 +0,0 @@ -declare variable $repoxml := - let $uri := doc($target || "/expath-pkg.xml")/*/@name - let $repo := util:binary-to-string(repo:get-resource($uri, "repo.xml")) - return - parse-xml($repo) -; - -declare function local:generate-code($collection as xs:string) { - for $source in xmldb:get-child-resources($collection || "/resources/odd")[ends-with(., ".odd")] - for $module in ("web", "print", "latex", "epub") - for $file in pmu:process-odd( - odd:get-compiled($collection || "/resources/odd", $source), - $collection || "/transform", - $module, - "../transform", - doc($collection || "/resources/odd/configuration.xml")/*)?("module") - return - (), - let $permissions := $repoxml//repo:permissions[1] - return ( - for $file in xmldb:get-child-resources($collection || "/transform") - let $path := xs:anyURI($collection || "/transform/" || $file) - return ( - sm:chown($path, $permissions/@user), - sm:chgrp($path, $permissions/@group) - ) - ) -}; - -sm:chmod(xs:anyURI($target || "/modules/view.xql"), "rwsr-xr-x"), -(:sm:chmod(xs:anyURI($target || "/modules/transform.xql"), "rwsr-xr-x"),:) -sm:chmod(xs:anyURI($target || "/modules/lib/pdf.xql"), "rwsr-xr-x"), -sm:chmod(xs:anyURI($target || "/modules/lib/get-epub.xql"), "rwsr-xr-x"), -sm:chmod(xs:anyURI($target || "/modules/lib/ajax.xql"), "rwsr-xr-x"), -sm:chmod(xs:anyURI($target || "/modules/lib/regenerate.xql"), "rwsr-xr-x"), -sm:chmod(xs:anyURI($target || "/modules/lib/upload.xql"), "rwsr-xr-x"), - -(: LaTeX requires dba permissions to execute shell process :) -sm:chmod(xs:anyURI($target || "/modules/lib/latex.xql"), "rwxr-Sr-x"), -sm:chgrp(xs:anyURI($target || "/modules/lib/latex.xql"), "dba"), - -local:generate-code($target) diff --git a/generators/app/templates/post-install.xql b/generators/app/templates/post-install.xql index 16ebb23a..e6fbaec5 100644 --- a/generators/app/templates/post-install.xql +++ b/generators/app/templates/post-install.xql @@ -14,6 +14,4 @@ declare variable $dir external; (: the target collection into which the app is deployed :) declare variable $target external; -<%_ if (apptype == 'teipub'){ %><%- include('partials/tei-post'); %><% } %> - 1 + 1 diff --git a/generators/app/templates/tests/polymer/_element_test.html b/generators/app/templates/tests/polymer/_element_test.html deleted file mode 100644 index 97cb93ea..00000000 --- a/generators/app/templates/tests/polymer/_element_test.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - <%= name %> test - - - - <%_ if (polytempl === 'polymer-2-application:app') { %> - - <% } else { %> - - <% } _%> - - - - - - - - - - - - - - - diff --git a/generators/app/templates/tests/polymer/index.html b/generators/app/templates/tests/polymer/index.html deleted file mode 100644 index c9a87ebc..00000000 --- a/generators/app/templates/tests/polymer/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - diff --git a/package-lock.json b/package-lock.json index bf793a72..4d85cc68 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2290,11 +2290,6 @@ "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", "dev": true }, - "array-find-index": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", - "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=" - }, "array-ify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", @@ -2731,12 +2726,6 @@ "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", "dev": true }, - "bower": { - "version": "1.8.12", - "resolved": "https://registry.npmjs.org/bower/-/bower-1.8.12.tgz", - "integrity": "sha512-u1xy9SrwwoPlgjuHNjhV+YUPVdqyBj2ALBxuzeIUKXaPI2i2xypGgxqXkuHcITGdi5yBj5JuXgyMvgiWiS1S3Q==", - "dev": true - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -2886,20 +2875,6 @@ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, - "camelcase": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", - "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=" - }, - "camelcase-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", - "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", - "requires": { - "camelcase": "^2.0.0", - "map-obj": "^1.0.0" - } - }, "capture-exit": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz", @@ -4162,14 +4137,6 @@ "integrity": "sha512-JKG8vIHpWPzdilp2SAmvjmAiIhD+XGKGdhZBGi8QIECgJAsFr7k5CmJIW2QkSxBBsctvmojM25s+UINzQ5NLTg==", "dev": true }, - "currently-unhandled": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", - "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", - "requires": { - "array-find-index": "^1.0.1" - } - }, "cvss": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/cvss/-/cvss-1.0.5.tgz", @@ -4336,7 +4303,8 @@ "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true }, "decamelize-keys": { "version": "1.1.0", @@ -7290,14 +7258,6 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, - "indent-string": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", - "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", - "requires": { - "repeating": "^2.0.0" - } - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -7503,11 +7463,6 @@ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" }, - "is-finite": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", - "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==" - }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -7615,7 +7570,8 @@ "is-potential-custom-element-name": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.0.tgz", - "integrity": "sha1-DFLlS8yjkbssSUsh6GJtczbG45c=" + "integrity": "sha1-DFLlS8yjkbssSUsh6GJtczbG45c=", + "dev": true }, "is-promise": { "version": "2.2.2", @@ -9699,15 +9655,6 @@ } } }, - "loud-rejection": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", - "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", - "requires": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" - } - }, "lowercase-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", @@ -9755,7 +9702,8 @@ "map-obj": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=" + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true }, "map-visit": { "version": "1.0.0", @@ -9876,104 +9824,6 @@ "vinyl": "^2.0.1" } }, - "meow": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", - "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", - "requires": { - "camelcase-keys": "^2.0.0", - "decamelize": "^1.1.2", - "loud-rejection": "^1.0.0", - "map-obj": "^1.0.1", - "minimist": "^1.1.3", - "normalize-package-data": "^2.3.4", - "object-assign": "^4.0.1", - "read-pkg-up": "^1.0.1", - "redent": "^1.0.0", - "trim-newlines": "^1.0.0" - }, - "dependencies": { - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "requires": { - "error-ex": "^1.2.0" - } - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - }, - "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - } - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "requires": { - "is-utf8": "^0.2.0" - } - } - } - }, "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -14723,7 +14573,8 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true }, "object-copy": { "version": "0.1.0", @@ -15171,12 +15022,14 @@ "pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true }, "pinkie-promise": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, "requires": { "pinkie": "^2.0.0" } @@ -15504,15 +15357,6 @@ "resolve": "^1.1.6" } }, - "redent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", - "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", - "requires": { - "indent-string": "^2.1.0", - "strip-indent": "^1.0.1" - } - }, "redeyed": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/redeyed/-/redeyed-2.1.1.tgz", @@ -15582,14 +15426,6 @@ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" }, - "repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "requires": { - "is-finite": "^1.0.0" - } - }, "replace-ext": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.1.tgz", @@ -17175,14 +17011,6 @@ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" }, - "strip-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", - "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", - "requires": { - "get-stdin": "^4.0.1" - } - }, "strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -17582,11 +17410,6 @@ "integrity": "sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=", "dev": true }, - "trim-newlines": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", - "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=" - }, "trim-off-newlines": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz", @@ -17917,69 +17740,6 @@ "homedir-polyfill": "^1.0.1" } }, - "validate-element-name": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/validate-element-name/-/validate-element-name-2.1.1.tgz", - "integrity": "sha1-j/dffaafc+fFEFiDYhMFCLesZE4=", - "requires": { - "is-potential-custom-element-name": "^1.0.0", - "log-symbols": "^1.0.0", - "meow": "^3.7.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "log-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", - "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", - "requires": { - "chalk": "^1.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" - } - } - }, "validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", diff --git a/package.json b/package.json index 6a520be2..5e46901e 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ ], "devDependencies": { "@babel/core": "^7.12.10", - "bower": "^1.8.12", "chai": "^4.2.0", "chai-xml": "^0.4.0", "coveralls": "^3.1.0", @@ -60,7 +59,6 @@ "generator-license": "^5.4.0", "gulp-pretty-data": "^0.1.2", "gulp-stripbom": "^1.0.5", - "validate-element-name": "^2.1.1", "yeoman-generator": "^4.13.0", "yosay": "^2.0.2" },