├── .npmignore ├── .stylelintrc.json ├── .gitignore ├── generators └── app │ ├── templates │ ├── .dockerignore │ ├── github │ │ ├── .gitkeep │ │ ├── .gitattributes │ │ ├── PULL_REQUEST_TEMPLATE.md │ │ ├── feature_request.md │ │ ├── ISSUE_TEMPLATE.md │ │ ├── contributing.md │ │ ├── __gitignore__ │ │ └── readme.md │ ├── img │ │ ├── icon.png │ │ ├── favicon.ico │ │ ├── poly-icon.png │ │ ├── exist_icon_16x16.ico │ │ ├── exist-design │ │ │ ├── body.gif │ │ │ ├── noise.png │ │ │ ├── bgmenu.gif │ │ │ ├── bgmenuhi.gif │ │ │ ├── existdb.png │ │ │ ├── header.gif │ │ │ ├── body-base.gif │ │ │ └── horizontal.gif │ │ ├── icon.svg │ │ ├── existdb-web.svg │ │ └── powered-by.svg │ ├── Dockerfile │ ├── specs │ │ ├── cypress │ │ │ ├── fixtures │ │ │ │ └── example.json │ │ │ └── support │ │ │ │ ├── e2e.js │ │ │ │ └── commands.js │ │ ├── cypress.config.js │ │ ├── e2e │ │ │ ├── landing.cy.js │ │ │ ├── login-ok.cy.js │ │ │ └── login-fail.cy.js │ │ ├── xqs │ │ │ ├── test-runner.xq │ │ │ ├── test-suite.xqm │ │ │ └── xqSuite.js │ │ └── mocha │ │ │ ├── rest_spec.js │ │ │ └── app_spec.js │ ├── pages │ │ ├── error-page.html │ │ ├── mysec │ │ │ ├── admin │ │ │ │ ├── index.html │ │ │ │ └── security.html │ │ │ └── templates │ │ │ │ └── login-panel.html │ │ ├── index.html │ │ ├── plain │ │ │ └── page.html │ │ └── exist-design │ │ │ └── page.html │ ├── expath-pkg.xml │ ├── styles │ │ ├── style.css │ │ └── exist-2.2.css │ ├── collection.xconf │ ├── ci │ │ ├── dependabot.yml │ │ ├── .travis.yml │ │ └── exist.yml │ ├── xq │ │ ├── post-install.xq │ │ ├── pre-install.xq │ │ ├── view.xq │ │ ├── controller.xq │ │ ├── app.xqm │ │ ├── admin │ │ │ └── controller.xq │ │ └── config.xqm │ ├── .existdb.json │ ├── repo.xml │ └── build.xml │ └── index.js ├── .eslintrc.yml ├── .eslintignore ├── test ├── fixtures │ ├── exception.xml │ ├── mono-case.json │ ├── multi-case.json │ └── multi-suite.json ├── util │ ├── meta-test.js │ ├── gulp-ews.js │ ├── app.js │ └── consistency.js ├── mock_rest.js ├── generated-pkg │ ├── app-mysec.js │ ├── app-empty.js │ ├── app-eXide-plain.js │ ├── app-lib.js │ └── app-eXide-default.js └── mock_xqs.js ├── .github ├── dependabot.yml ├── no-response.yml ├── workflows │ └── node.js.yml └── ISSUE_TEMPLATE │ └── bug_report.md ├── LICENSE ├── server.js ├── package.json └── README.md /.npmignore: -------------------------------------------------------------------------------- 1 | .travis.yml 2 | .notes 3 | .github/ 4 | .code-workspace -------------------------------------------------------------------------------- /.stylelintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "stylelint-config-standard" 3 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | 3 | *.xar 4 | 5 | .notes 6 | 7 | *.code-workspace 8 | -------------------------------------------------------------------------------- /generators/app/templates/.dockerignore: -------------------------------------------------------------------------------- 1 | .git/ 2 | 3 | .existdb.json 4 | 5 | yo-rc.json -------------------------------------------------------------------------------- /generators/app/templates/github/.gitkeep: -------------------------------------------------------------------------------- 1 | # This is here to create an empty folder 2 | -------------------------------------------------------------------------------- /.eslintrc.yml: -------------------------------------------------------------------------------- 1 | extends: standard 2 | plugins: 3 | - mocha 4 | env: 5 | mocha: true 6 | -------------------------------------------------------------------------------- /generators/app/templates/github/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /generators/app/templates/img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eXist-db/generator-exist/HEAD/generators/app/templates/img/icon.png -------------------------------------------------------------------------------- /generators/app/templates/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM duncdrum/existdb:<%- dockertag %> 2 | 3 | COPY build/<%- title %>-<%- version %>.xar /exist/autodeploy -------------------------------------------------------------------------------- /generators/app/templates/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eXist-db/generator-exist/HEAD/generators/app/templates/img/favicon.ico -------------------------------------------------------------------------------- /generators/app/templates/img/poly-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eXist-db/generator-exist/HEAD/generators/app/templates/img/poly-icon.png -------------------------------------------------------------------------------- /generators/app/templates/img/exist_icon_16x16.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eXist-db/generator-exist/HEAD/generators/app/templates/img/exist_icon_16x16.ico -------------------------------------------------------------------------------- /generators/app/templates/img/exist-design/body.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eXist-db/generator-exist/HEAD/generators/app/templates/img/exist-design/body.gif -------------------------------------------------------------------------------- /generators/app/templates/img/exist-design/noise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eXist-db/generator-exist/HEAD/generators/app/templates/img/exist-design/noise.png -------------------------------------------------------------------------------- /generators/app/templates/img/exist-design/bgmenu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eXist-db/generator-exist/HEAD/generators/app/templates/img/exist-design/bgmenu.gif -------------------------------------------------------------------------------- /generators/app/templates/img/exist-design/bgmenuhi.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eXist-db/generator-exist/HEAD/generators/app/templates/img/exist-design/bgmenuhi.gif -------------------------------------------------------------------------------- /generators/app/templates/img/exist-design/existdb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eXist-db/generator-exist/HEAD/generators/app/templates/img/exist-design/existdb.png -------------------------------------------------------------------------------- /generators/app/templates/img/exist-design/header.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eXist-db/generator-exist/HEAD/generators/app/templates/img/exist-design/header.gif -------------------------------------------------------------------------------- /generators/app/templates/img/exist-design/body-base.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eXist-db/generator-exist/HEAD/generators/app/templates/img/exist-design/body-base.gif -------------------------------------------------------------------------------- /generators/app/templates/img/exist-design/horizontal.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eXist-db/generator-exist/HEAD/generators/app/templates/img/exist-design/horizontal.gif -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | generators/app/templates/specs/e2e/landing.cy.js 2 | generators/app/templates/specs/mocha/rest_spec.js 3 | generators/app/templates/specs/xqs/xqSuite.js 4 | 5 | node_modules/ -------------------------------------------------------------------------------- /generators/app/templates/specs/cypress/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io", 4 | "body": "Fixtures are a great way to mock data for responses to routes" 5 | } -------------------------------------------------------------------------------- /generators/app/templates/github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Thank you for your Pull Request 2 | 3 | If you're adding a new feature, please adjust / add tests covering your code changes. You can reference any related issues below. 4 | 5 | Fixes # 6 | -------------------------------------------------------------------------------- /generators/app/templates/github/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Your Ideal Solution 11 | 12 | ### Any Alternative Options 13 | 14 | ### Additional Context -------------------------------------------------------------------------------- /test/fixtures/exception.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /db/apps/tmp/test/xqs/test-runner.xq 4 | err:XQST0034 error found while loading module tests: Error while loading module test-suite.xqm: Function {http://www.obdurodon.org/apps/tmp/tests}tautology#0 is already defined. 5 | -------------------------------------------------------------------------------- /generators/app/templates/pages/error-page.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |

An error has occurred

4 |

An error has been generated by the application.

5 |
6 | 
7 | -------------------------------------------------------------------------------- /generators/app/templates/github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Expected behavior 11 | 12 | ### Actual behavior 13 | 14 | ### Reproduction steps 15 | 16 | ### Please provide the following 17 | * Java Version: 18 | * exist-db version: 19 | * <%- title %> version: 20 | * OS version: 21 | -------------------------------------------------------------------------------- /test/util/meta-test.js: -------------------------------------------------------------------------------- 1 | exports.metaTest = function () { 2 | const assert = require('yeoman-assert') 3 | 4 | it('unit-tests', function (done) { 5 | assert.file(['test/mocha/app_spec.js', 'test/xqs/xqSuite.js']) 6 | done() 7 | }) 8 | 9 | it('integration-tests', function (done) { 10 | assert.file(['cypress.config.js', 'test/cypress/e2e/landing.cy.js', 'reports/videos/.gitkeep']) 11 | done() 12 | }) 13 | } 14 | -------------------------------------------------------------------------------- /test/fixtures/mono-case.json: -------------------------------------------------------------------------------- 1 | { 2 | "testsuite": { 3 | "package": "https://dunddrum.eu/apps/mocha/mono", 4 | "timestamp": "2020-10-13T12:17:01.271Z", 5 | "tests": "1", 6 | "failures": "0", 7 | "errors": "0", 8 | "pending": "0", 9 | "time": "PT0.004S", 10 | "testcase": { 11 | "name": "dummy test", 12 | "class": "tests:templating-foo" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /generators/app/templates/expath-pkg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | <%- desc %> 5 | 6 | <%_ if (apptype !== 'empty') { %><% } -%> 7 | 8 | -------------------------------------------------------------------------------- /generators/app/templates/styles/style.css: -------------------------------------------------------------------------------- 1 | /* Application styles could go here */ 2 | 3 | <% if (apptype == 'plain'){ %> 4 | footer .poweredby { 5 | width: 120px; 6 | height: 56px; 7 | margin-bottom: 10px; 8 | display: inline-block; 9 | background-size: 100% 100%;} 10 | footer .poweredby img { width: 120px; }<% } else{ %><% } %> 11 | -------------------------------------------------------------------------------- /generators/app/templates/collection.xconf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <%_ if (apptype == 'exist-design') { %> 7 | 8 | 9 | 10 | <% } else { %> <% } -%> 11 | 12 | -------------------------------------------------------------------------------- /generators/app/templates/specs/cypress.config.js: -------------------------------------------------------------------------------- 1 | const { defineConfig } = require('cypress') 2 | 3 | module.exports = defineConfig({ 4 | screenshotsFolder: 'reports/screenshots', 5 | videosFolder: 'reports/videos', 6 | fixturesFolder: 'test/cypress/fixtures', 7 | e2e: { 8 | setupNodeEvents (on, config) { 9 | // implement node event listeners here 10 | }, 11 | baseUrl: 'http://localhost:8080', 12 | includeShadowDom: true, 13 | specPattern: 'test/cypress/e2e/**/*.cy.{js,jsx,ts,tsx}', 14 | supportFile: 'test/cypress/support/e2e.js' 15 | } 16 | }) 17 | -------------------------------------------------------------------------------- /generators/app/templates/ci/dependabot.yml: -------------------------------------------------------------------------------- 1 | 2 | # Please see the documentation for all configuration options: 3 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 4 | 5 | version: 2 6 | updates: 7 | # Maintain dependencies for npm 8 | - package-ecosystem: "npm" 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | 13 | # Maintain dependencies for GitHub Actions 14 | - package-ecosystem: "github-actions" 15 | directory: "/" 16 | schedule: 17 | interval: "weekly" -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | - package-ecosystem: npm 8 | directory: "/" 9 | schedule: 10 | interval: daily 11 | time: "03:00" 12 | open-pull-requests-limit: 10 13 | versioning-strategy: increase 14 | ignore: 15 | - dependency-name: cypress 16 | versions: 17 | - 7.0.0 18 | - 7.0.1 19 | - dependency-name: "@babel/core" 20 | versions: 21 | - 7.13.13 22 | - dependency-name: yeoman-generator 23 | versions: 24 | - 5.0.0 25 | - 5.0.1 26 | - 5.1.0 27 | -------------------------------------------------------------------------------- /generators/app/templates/xq/post-install.xq: -------------------------------------------------------------------------------- 1 | xquery version "3.1"; 2 | (:~ The post-install runs after contents are copied to db. 3 | : 4 | : @version <%- version %> 5 | :) 6 | declare namespace repo="http://exist-db.org/xquery/repo"; 7 | 8 | (: The following external variables are set by the repo:deploy function :) 9 | 10 | (: file path pointing to the exist installation directory :) 11 | declare variable $home external; 12 | (: path to the directory containing the unpacked .xar package :) 13 | declare variable $dir external; 14 | (: the target collection into which the app is deployed :) 15 | declare variable $target external; 16 | 17 | 1 + 1 18 | -------------------------------------------------------------------------------- /generators/app/templates/.existdb.json: -------------------------------------------------------------------------------- 1 | { 2 | "servers": { 3 | "localhost": { 4 | "server": "<%- instance %>", 5 | "user": "<%- admin %>", 6 | "password": "<%- adminpw %>", 7 | "root": "/db/<%- defcoll %>/<%- short %>" 8 | } 9 | }, 10 | "sync": { 11 | "server": "localhost", 12 | "active": true, 13 | "ignore": [ 14 | ".existdb.json", 15 | ".git/**", 16 | "node_modules/**", 17 | "build/**", 18 | ".vscode/**", 19 | "README.md", 20 | "yo-rc.json" 21 | ] 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /generators/app/templates/specs/e2e/landing.cy.js: -------------------------------------------------------------------------------- 1 | /* global cy */ 2 | describe('The landing page', function () { 3 | it <%_ if (apptype == 'empty') { %>.skip <% } _%> ('should load ', function () { 4 | cy.visit('/exist/<%- defcoll %>/<%- short %>/index.html') 5 | .get('.alert') 6 | .contains('app.xqm') 7 | }) 8 | 9 | <%_ if (mysec) { %> 10 | // TODO: add more mysec tests, broken upstream 11 | it.skip('navbar link should forward to admin page', function () { 12 | cy.get() 13 | }) 14 | 15 | // TODO: The navbar should have uniform background color 16 | it.skip('navbar should render properly', function () { 17 | cy.get() 18 | }) 19 | <% } _%> 20 | }) 21 | -------------------------------------------------------------------------------- /test/util/gulp-ews.js: -------------------------------------------------------------------------------- 1 | exports.prettyDataEWS = function () { 2 | const fs = require('fs-extra') 3 | const assert = require('yeoman-assert') 4 | 5 | // early warning test for abandoned gulp-pretty-data plugin 6 | 7 | it('regular xml', function (done) { 8 | const build = fs.readFileSync('build.xml', 'utf8') 9 | const res = build.toString().split('\n').length 10 | // -1 removes the eof line 11 | assert.strictEqual(res - 1, 28) 12 | done() 13 | }) 14 | 15 | it('custom extension', function (done) { 16 | const xconf = fs.readFileSync('collection.xconf', 'utf8') 17 | const res = xconf.toString().split('\n').length 18 | assert.strictEqual(res - 1, 11) 19 | done() 20 | }) 21 | } 22 | -------------------------------------------------------------------------------- /generators/app/templates/pages/mysec/admin/index.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 | 8 |
9 |

You are now logged in.

10 |
11 |
12 |
13 |

Application Info

14 |
15 |
16 |
17 |
-------------------------------------------------------------------------------- /generators/app/templates/repo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- desc %> 4 | <%- author %> 5 | <%- website %> 6 | <%- status %> 7 | <%- license %> 8 | true 9 | <%- apptype %> 10 | <%_ if (apptype !== 'library') { %><%- short %> 11 | <% } -%> 12 | <%_ if (pre) { %><%- prexq %> 13 | <% } -%> 14 | <%_ if (post) { %><%- postxq %> 15 | <% } -%> 16 | <%_ if (setperm) { %> 17 | <% } -%> 18 | 19 | -------------------------------------------------------------------------------- /.github/no-response.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-no-response - https://github.com/probot/no-response 2 | 3 | # Number of days of inactivity before an Issue is closed for lack of response 4 | daysUntilClose: 14 5 | # Label requiring a response 6 | responseRequiredLabel: more-information-needed 7 | # Comment to post when closing an Issue for lack of response. Set to `false` to disable 8 | closeComment: > 9 | This issue has been automatically closed because there has been no response 10 | to our request for more information from the original author. With only the 11 | information that is currently in the issue, we don't have enough information 12 | to take action. Please reach out if you have or find the answers we need so 13 | that we can investigate further. 14 | -------------------------------------------------------------------------------- /generators/app/templates/specs/xqs/test-runner.xq: -------------------------------------------------------------------------------- 1 | xquery version "3.1"; 2 | 3 | (:~ This library runs the XQSuite unit tests for the <%- title %> app. 4 | : 5 | : @author <%- author %> 6 | : @version <%- version %> 7 | : @see http://www.exist-db.org/exist/apps/doc/xqsuite 8 | :) 9 | import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; 10 | import module namespace tests="<%- defuri %>/<%- defcoll %>/<%- short %>/tests" at "test-suite.xqm"; 11 | 12 | declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization"; 13 | declare option output:method "json"; 14 | declare option output:media-type "application/json"; 15 | 16 | test:suite( 17 | inspect:module-functions(xs:anyURI("test-suite.xqm")) 18 | ) 19 | -------------------------------------------------------------------------------- /generators/app/templates/specs/cypress/support/e2e.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/e2e.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands' 18 | 19 | // Alternatively you can use CommonJS syntax: 20 | // require('./commands') 21 | -------------------------------------------------------------------------------- /generators/app/templates/pages/mysec/admin/security.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 | 8 |
9 |

This is a protected page. You must be logged in as a user with the appropriate 10 | privileges.

11 |
12 |
13 |
14 |

Application Info

15 |
16 |
17 |
18 |
19 | -------------------------------------------------------------------------------- /generators/app/templates/specs/e2e/login-ok.cy.js: -------------------------------------------------------------------------------- 1 | /* global cy */ 2 | describe('On a protected page', function () { 3 | it('the page should load ', function () { 4 | cy.visit('/exist/<%- defcoll %>/<%- short %>/admin/index.html') 5 | .get('.alert') 6 | .contains('This is a protected page.') 7 | }) 8 | 9 | it('login should accept admin user', function () { 10 | cy.contains('Login').click() 11 | cy.get('.modal-content') 12 | .find('input[name=user]').type('admin{enter}') 13 | cy.get('body') 14 | .contains('You are now logged in.') 15 | }) 16 | 17 | it('navigation bar shows the admin user is logged in', function () { 18 | cy.get('.navbar-right > :nth-child(1) > a') 19 | .contains('Hello admin') 20 | }) 21 | 22 | after('logout', function () { 23 | cy.get(':nth-child(2) > .btn').click() 24 | }) 25 | }) 26 | -------------------------------------------------------------------------------- /generators/app/templates/specs/e2e/login-fail.cy.js: -------------------------------------------------------------------------------- 1 | /* global cy */ 2 | describe('On a protected pages when not logged in', function () { 3 | it('the page should load ', function () { 4 | cy.visit('/exist/<%- defcoll %>/<%- short %>/admin/index.html') 5 | .get('.alert') 6 | .contains('This is a protected page.') 7 | }) 8 | 9 | it('login should fail with bad credentials', function () { 10 | cy.contains('Login').click() 11 | cy.get('.modal-content') 12 | .find('input[name=user]').type('baduser{enter}') 13 | cy.get('body') 14 | .contains('This is a protected page.') 15 | }) 16 | 17 | it('Navigation Bar should show guest user', function () { 18 | cy.get('.navbar-right > :nth-child(1) > a') 19 | .contains('Hello Guest') 20 | }) 21 | 22 | after('logout', function () { 23 | cy.get(':nth-child(2) > .btn').click() 24 | }) 25 | }) 26 | -------------------------------------------------------------------------------- /test/fixtures/multi-case.json: -------------------------------------------------------------------------------- 1 | { 2 | "testsuite": { 3 | "package": "https://dunddrum.eu/apps/mocha/multi", 4 | "timestamp": "2020-10-13T12:18:34.64Z", 5 | "tests": "3", 6 | "failures": "1", 7 | "errors": "0", 8 | "pending": "0", 9 | "time": "PT0.008S", 10 | "testcase": [ 11 | { 12 | "name": "failing test", 13 | "class": "tests:fail-foo", 14 | "failure": { 15 | "message": "assertTrue failed.", 16 | "type": "failure-error-code-1" 17 | }, 18 | "output": "false" 19 | }, 20 | { 21 | "name": "passing test", 22 | "class": "tests:pass-foo" 23 | }, 24 | { 25 | "name": "dummy test", 26 | "class": "tests:templating-foo" 27 | } 28 | ] 29 | } 30 | } -------------------------------------------------------------------------------- /generators/app/templates/specs/cypress/support/commands.js: -------------------------------------------------------------------------------- 1 | // *********************************************** 2 | // This example commands.js shows you how to 3 | // create various custom commands and overwrite 4 | // existing commands. 5 | // 6 | // For more comprehensive examples of custom 7 | // commands please read more here: 8 | // https://on.cypress.io/custom-commands 9 | // *********************************************** 10 | // 11 | // 12 | // -- This is a parent command -- 13 | // Cypress.Commands.add('login', (email, password) => { ... }) 14 | // 15 | // 16 | // -- This is a child command -- 17 | // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) 18 | // 19 | // 20 | // -- This is a dual command -- 21 | // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) 22 | // 23 | // 24 | // -- This will overwrite an existing command -- 25 | // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) 26 | -------------------------------------------------------------------------------- /generators/app/templates/ci/.travis.yml: -------------------------------------------------------------------------------- 1 | notifications: 2 | email: false 3 | 4 | language: node_js 5 | os: linux 6 | dist: bionic 7 | 8 | node_js: 9 | - "node" 10 | - "18" 11 | 12 | jdk: 13 | - openjdk8 14 | 15 | services: 16 | - docker 17 | 18 | env: 19 | - img=existdb/existdb:latest 20 | - img=existdb/existdb:release 21 | - img=existdb/existdb:5.0.0 22 | - img=existdb/existdb:4.7.1 23 | 24 | cache: 25 | npm: true 26 | directories: 27 | - ~/.cache 28 | 29 | before_install: 30 | - docker pull $img 31 | - docker create --name exist-ci -p 8080:8080 $img 32 | 33 | install: 34 | - npm ci 35 | - ant 36 | 37 | before_script: 38 | - docker cp ./build/*-dev.xar exist-ci:exist/autodeploy 39 | - docker start exist-ci 40 | # exist needs time 41 | - sleep 30 42 | - docker ps 43 | 44 | script: 45 | - npm test 46 | <%_ if (apptype != 'library') { %> - cypress run<% } -%> 47 | 48 | # - ant test 49 | 50 | after_success: 51 | - docker stop exist-ci 52 | -------------------------------------------------------------------------------- /generators/app/templates/specs/xqs/test-suite.xqm: -------------------------------------------------------------------------------- 1 | xquery version "3.1"; 2 | 3 | (:~ This library module contains XQSuite tests for the <%- title %> app. 4 | : 5 | : @author <%- author %> 6 | : @version <%- version %> 7 | : @see <%- website %> 8 | :) 9 | 10 | module namespace tests = "<%- defuri %>/<%- defcoll %>/<%- short %>/tests"; 11 | <%_ if (apptype !== 'empty') { %> 12 | import module namespace app = "<%- defuri %>/<%- defcoll %>/<%- short %>/templates" at "../../modules/app.xqm"; 13 | <% } -%> 14 | 15 | declare namespace test="http://exist-db.org/xquery/xqsuite"; 16 | 17 | <%_ if (apptype !== 'empty') { %> 18 | declare variable $tests:map := map {1: 1}; 19 | 20 | declare 21 | %test:name('dummy-templating-call') 22 | %test:arg('n', 'div') 23 | %test:assertEquals("

Dummy templating function.

") 24 | function tests:templating-foo($n as xs:string) as node(){ 25 | app:foo(element {$n} {}, $tests:map) 26 | }; 27 | <% } else { %> 28 | 29 | declare 30 | %test:name('one-is-one') 31 | %test:assertTrue 32 | function tests:tautology() { 33 | 1 = 1 34 | }; 35 | <% } -%> 36 | -------------------------------------------------------------------------------- /test/fixtures/multi-suite.json: -------------------------------------------------------------------------------- 1 | { 2 | "testsuite": [ 3 | { 4 | "package": "http://heml.mta.ca/Lace2/templates", 5 | "timestamp": "2020-10-13T12:19:13.927Z", 6 | "tests": "1", 7 | "failures": "0", 8 | "errors": "0", 9 | "pending": "0", 10 | "time": "PT0.013S", 11 | "testcase": { 12 | "name": "make img tag", 13 | "class": "app:getImageLink" 14 | } 15 | }, 16 | { 17 | "package": "http://www.functx.com", 18 | "timestamp": "2020-10-13T12:19:13.932Z", 19 | "tests": "0", 20 | "failures": "0", 21 | "errors": "0", 22 | "pending": "0", 23 | "time": "PT0S" 24 | }, 25 | { 26 | "package": "http://www.w3.org/2005/xquery-local-functions", 27 | "timestamp": "2020-10-13T12:19:13.933Z", 28 | "tests": "0", 29 | "failures": "0", 30 | "errors": "0", 31 | "pending": "0", 32 | "time": "PT0S" 33 | } 34 | ] 35 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Duncan Paterson (https://github.com/duncdrum) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /generators/app/templates/specs/mocha/rest_spec.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const supertest = require('supertest') 4 | const expect = require('chai').expect 5 | 6 | let client = supertest.agent('http://localhost:8080') 7 | 8 | describe('rest api returns', function () { 9 | it('404 from random page', function (done) { 10 | this.timeout(10000) 11 | client 12 | .get('/random') 13 | .expect(404) 14 | .end(function (err, res) { 15 | expect(res.status).to.equal(404) 16 | if (err) return done(err) 17 | done() 18 | }) 19 | }) 20 | 21 | it('200 from default rest endpoint', function (done) { 22 | client 23 | .get('/exist/rest/db/') 24 | .expect(200) 25 | .end(function (err, res) { 26 | expect(res.status).to.equal(200) 27 | if (err) return done(err) 28 | done() 29 | }) 30 | }) 31 | 32 | it<%_ if (apptype == 'empty') { %>.skip<% } _%>('file index.html exists in application root', function (done) { 33 | client 34 | .get('/exist/rest/db/<%- defcoll %>/<%- short %>/index.html') 35 | .expect(200) 36 | .end(function (err, res) { 37 | expect(res.status).to.equal(200) 38 | if (err) return done(err) 39 | done() 40 | }) 41 | }) 42 | }) -------------------------------------------------------------------------------- /generators/app/templates/xq/pre-install.xq: -------------------------------------------------------------------------------- 1 | xquery version "1.0"; 2 | (:~ The pre-install runs before the actual install and deploy. 3 | : 4 | : @version <%- version %> 5 | :) 6 | import module namespace xdb="http://exist-db.org/xquery/xmldb"; 7 | 8 | (: The following external variables are set by the repo:deploy function :) 9 | 10 | (: file path pointing to the exist installation directory :) 11 | declare variable $home external; 12 | (: path to the directory containing the unpacked .xar package :) 13 | declare variable $dir external; 14 | (: the target collection into which the app is deployed :) 15 | declare variable $target external; 16 | 17 | declare function local:mkcol-recursive($collection, $components) { 18 | if (exists($components)) then 19 | let $newColl := concat($collection, "/", $components[1]) 20 | return ( 21 | xdb:create-collection($collection, $components[1]), 22 | local:mkcol-recursive($newColl, subsequence($components, 2)) 23 | ) 24 | else 25 | () 26 | }; 27 | 28 | (: Helper function to recursively create a collection hierarchy. :) 29 | declare function local:mkcol($collection, $path) { 30 | local:mkcol-recursive($collection, tokenize($path, "/")) 31 | }; 32 | 33 | (: store the collection configuration :) 34 | local:mkcol("/db/system/config", $target), 35 | xdb:store-files-from-pattern(concat("/db/system/config", $target), $dir, "*.xconf") 36 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Node.js CI 5 | 6 | on: [push, pull_request] 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | strategy: 12 | fail-fast: false 13 | matrix: 14 | node-version: ['18', '20'] 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: Use Node.js ${{ matrix.node-version }} 18 | uses: actions/setup-node@v4 19 | with: 20 | node-version: ${{ matrix.node-version }} 21 | cache: 'npm' 22 | - run: npm ci 23 | - run: npm test 24 | continue-on-error: ${{ matrix.node-version == '18' }} 25 | release: 26 | name: Release 27 | runs-on: ubuntu-latest 28 | needs: build 29 | if: github.ref == 'refs/heads/main' 30 | steps: 31 | - name: Checkout 32 | uses: actions/checkout@v4 33 | with: 34 | fetch-depth: 0 35 | - name: Setup Node.js 36 | uses: actions/setup-node@v4 37 | with: 38 | node-version: 18 39 | cache: 'npm' 40 | - name: Install dependencies 41 | run: npm ci 42 | - name: Release 43 | env: 44 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 45 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 46 | run: npx semantic-release 47 | 48 | 49 | -------------------------------------------------------------------------------- /generators/app/templates/pages/index.html: -------------------------------------------------------------------------------- 1 |
2 | <% if(apptype == 'plain'){ %> 3 |
4 |
5 |