Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.3.0 #4

Merged
merged 49 commits into from
Jun 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
9ec2f55
bundler
btamas Jun 12, 2019
4d1e88d
merge code
btamas Jun 12, 2019
a69ee23
move more src deps
btamas Jun 12, 2019
090b0c3
integrate tao item runner
btamas Jun 12, 2019
dd98b10
first test
btamas Jun 13, 2019
377495f
more test
btamas Jun 13, 2019
6f39fc7
more test
btamas Jun 13, 2019
b9a0250
move portablelibs
btamas Jun 13, 2019
30bebd1
Initialise repo with scaffolding from tao-core-sdk & js files from ta…
oatymart Jun 11, 2019
438818d
Replaced scaffold with tao-item-runner one, fixed rollup build warnings
oatymart Jun 12, 2019
c1cb712
Modify environment config to make tests resolve & load json
oatymart Jun 12, 2019
25b9677
Add qunit-assert-close library & update test config
oatymart Jun 12, 2019
3b7da38
Update all test.html headers to new format
oatymart Jun 12, 2019
c33bcb0
Add test/samples folder so tests can find resources
oatymart Jun 12, 2019
bd8ea41
Added rollup plugin for special case of expressions import
oatymart Jun 13, 2019
f33a5b5
Fix some ESLint errors & unused vars
oatymart Jun 13, 2019
7e4c1f2
Update all copyright years to 20xx-2019
oatymart Jun 13, 2019
db4de85
Enable qunit-assert-close plugin for one test only
oatymart Jun 13, 2019
b7425f2
Merged in code from branch feature/NEX-132_vendorization-of-item-runner
oatymart Jun 13, 2019
68d38b2
more tests
btamas Jun 13, 2019
cb35e89
Fix typos in README & package.json
oatymart Jun 14, 2019
a083c2a
clean
btamas Jun 14, 2019
4e05fb2
clean project
btamas Jun 14, 2019
cd834d8
Remove empty lines & fix more ESLint errors
oatymart Jun 17, 2019
93a7613
Remove empty lines in test defines
oatymart Jun 17, 2019
14a03bd
Remove unused test/taoQtiTest path
oatymart Jun 17, 2019
0ab9360
Updated package.json with npm release of tao-item-runner; remove text…
oatymart Jun 17, 2019
7055c58
mock portableElementRegistry
btamas Jun 17, 2019
b0a665b
remove unrelated tests
btamas Jun 17, 2019
73a0281
remove usless mock
btamas Jun 17, 2019
fae38b6
add description to package.json
btamas Jun 17, 2019
e28e2d0
remove useless script
btamas Jun 18, 2019
4d85258
change branch
btamas Jun 18, 2019
09eb6c5
fix cr requests
btamas Jun 19, 2019
3c6a98b
fix maxscore outcome declaration dependency
btamas Jun 19, 2019
7b0005a
use released item-runner
btamas Jun 19, 2019
46b744a
Replace tao-item-runner ref with npm package, regenerate package-lock
oatymart Jun 19, 2019
6554cc5
replace windows separators
btamas Jun 19, 2019
3b8e402
Merge pull request #1 from oat-sa/feature/NEX-132_vendorization-of-it…
krampstudio Jun 19, 2019
91c7102
Merge branch 'develop' into feature/NEX-126/vendorize-item-scoring-3
oatymart Jun 19, 2019
733efa6
Fix configuration & generate package-lock
oatymart Jun 19, 2019
115b060
Removed 3 build files related to CSS compilation - there is none here
oatymart Jun 19, 2019
45e1f34
Fix module matching expression to work on Windows
oatymart Jun 20, 2019
8a6f512
Merge pull request #2 from oat-sa/feature/NEX-126/vendorize-item-scor…
ferenckiss89 Jun 20, 2019
3401d1f
Added build watcher
oatymart Jun 25, 2019
3623631
Set up new qunit test runner
oatymart Jun 25, 2019
aa343a6
Version bump
oatymart Jun 25, 2019
3c7d18b
Revert expected media filetype so test can pass once again
oatymart Jun 26, 2019
bc70564
Merge pull request #3 from oat-sa/feature/NEX-91/test-and-build-tools
ferenckiss89 Jun 26, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
34 changes: 34 additions & 0 deletions .Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
pipeline {
agent {
label 'master'
}
stages {
stage('Frontend Tests') {
agent {
docker {
image 'btamas/puppeteer-git'
reuseNode true
}
}
environment {
HOME = '.'
PARALLEL_TESTS = 2
}
options {
skipDefaultCheckout()
}
steps {
dir('.') {
sh(
label: 'Setup frontend toolchain',
script: 'npm install'
)
sh (
label : 'Run frontend tests',
script: 'npm run test'
)
}
}
}
}
}
71 changes: 71 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"env" : {
"browser" : true,
"es6" : true,
"qunit" : true,
"node" : true
},
"globals" : {
"ENVIRONMENT" : true
},
"plugins" : ["es", "jsdoc"],
"parserOptions" : {
"sourceType" : "module",
"ecmaVersion" : 2015
},
"extends" : "eslint:recommended",
"rules" : {
"array-bracket-newline" : ["warn", "consistent"],
"arrow-body-style" : ["error", "as-needed"],
"arrow-spacing" : ["warn", { "before" : true, "after" : true }],
"brace-style" : ["warn", "1tbs"],
"consistent-this" : ["error", "self"],
"eqeqeq" : ["error", "smart"],
"es/no-classes" : ["error"],
"es/no-generators" : ["error"],
"func-call-spacing" : ["error"],
"implicit-arrow-linebreak" : ["error"],
"indent" : ["warn", 4, { "SwitchCase" : 1, "MemberExpression" : "off" }],
"jsdoc/check-alignment" : ["warn"],
"jsdoc/check-param-names" : ["warn"],
"jsdoc/require-param" : ["warn"],
"jsdoc/require-param-name" : ["warn"],
"jsdoc/require-param-type" : ["warn"],
"jsdoc/require-returns" : ["warn"],
"jsdoc/require-returns-check" : ["warn"],
"jsdoc/require-returns-type" : ["warn"],
"linebreak-style" : ["error", "unix"],
"new-parens" : ["error"],
"no-alert" : ["error"],
"no-caller" : ["error"],
"no-confusing-arrow" : ["error", { "allowParens" : false }],
"no-console" : ["error"],
"no-debugger" : ["error"],
"no-duplicate-imports" : ["error"],
"no-eval" : ["error"],
"no-extend-native" : ["error"],
"no-extra-bind" : ["error"],
"no-implicit-globals" : ["error"],
"no-implied-eval" : ["error"],
"no-lone-blocks" : ["error"],
"no-multi-assign" : ["error"],
"no-new-func" : ["error"],
"no-script-url" : ["error"],
"no-self-compare" : ["error"],
"no-sequences" : ["error"],
"no-shadow" : ["error", { "hoist" : "functions" }],
"no-template-curly-in-string" : ["error"],
"no-throw-literal" : ["error"],
"no-trailing-spaces" : ["error"],
"no-undefined" : ["error"],
"no-use-before-define" : ["error", { "functions" : false }],
"no-useless-call" : ["error"],
"no-useless-computed-key" : ["error"],
"no-useless-rename" : ["error"],
"prefer-rest-params" : ["error"],
"prefer-spread" : ["error"],
"prefer-template" : ["error"],
"semi" : ["error", "always"],
"vars-on-top" : ["error"]
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ typings/

# next.js build output
.next

dist
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# tao-item-runner-qti-fe

QTI Item Runner frontend library of TAO.

Available scripts in the project:

- `HOST=<host> PORT=<port> npm run test <testname>`: run test suite
- `HOST` (optional environment variable, default: 127.0.0.1): Test server listen host
- `PORT` (optional environment variable, default: 8082): Test server listen port
- `testname` (optional): Specific test to run. If it is not provided, all will be ran.
- `HOST=<host> PORT=<port> npm run test:keepAlive`: start test server
- `HOST` (optional environment variable, default: 127.0.0.1): Test server listen host
- `PORT` (optional environment variable, default: 8082): Test server listen port
- `npm run build`: build for production into `dist` directory
- `npm run build:watch`: build for production into `dist` directory and watch for changes
- `npm run lint`: check syntax of code
31 changes: 31 additions & 0 deletions build/external-alias.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; under version 2
* of the License (non-upgradable).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2019 (original work) Open Assessment Technologies SA ;
*/

export default (externals = []) => ({
name: 'external-alias', // this name will show up in warnings and errors
resolveId(source, importer) {
if (importer && externals.find(external => source.startsWith(external))) {
return {
id: source,
external: true,
moduleSideEffects: true
};
}
return null; // other ids should be handled as usually
}
});
33 changes: 33 additions & 0 deletions build/path.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; under version 2
* of the License (non-upgradable).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2019 (original work) Open Assessment Technologies SA ;
*/

/**
* This file contains path definitions for build scripts.
*/
const path = require('path');
const rootPath = path.resolve(__dirname, '..');
const srcDir = path.resolve(rootPath, 'src');

module.exports = {
rootPath,
srcDir,
testDir: path.resolve(rootPath, 'test'),
outputDir: path.resolve(rootPath, 'dist'),
testOutputDir: path.resolve(rootPath, 'test'),
aliases: { taoQtiItem: srcDir, build: path.resolve(rootPath, 'build') }
};
144 changes: 144 additions & 0 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/**
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; under version 2
* of the License (non-upgradable).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2019 (original work) Open Assessment Technologies SA ;
*/

import path from 'path';
import glob from 'glob';
import alias from 'rollup-plugin-alias';
import handlebarsPlugin from 'rollup-plugin-handlebars-plus';
import externalAlias from './external-alias';
import resolve from 'rollup-plugin-node-resolve';
import json from 'rollup-plugin-json';

const { srcDir, outputDir, aliases } = require('./path');
const Handlebars = require('handlebars');

/**
* Support of handlebars 1.3.0
* TODO remove once migrated to hbs >= 3.0.0
*/
const originalVisitor = Handlebars.Visitor;
Handlebars.Visitor = function() {
return originalVisitor.call(this);
};
Handlebars.Visitor.prototype = Object.create(originalVisitor.prototype);
Handlebars.Visitor.prototype.accept = function() {
try {
originalVisitor.prototype.accept.apply(this, arguments);
} catch (e) {}
};
/* --------------------------------------------------------- */

const inputs = glob.sync(path.join(srcDir, '**', '*.js'));

/**
* Define all modules as external, so rollup won't bundle them together.
*/
const localExternals = inputs.map(
input =>
`taoQtiItem/${path
.relative(srcDir, input)
.replace(/\\/g, '/')
.replace(/\.js$/, '')}`
);

export default inputs.map(input => {
const name = path.relative(srcDir, input).replace(/\.js$/, '');
const dir = path.dirname(path.relative(srcDir, input));

return {
input,
output: {
dir: path.join(outputDir, dir),
format: 'amd',
name
},
external: [
'jquery',
'lodash',
'handlebars',
'i18n',
'module',
'context',
'async',
'require',

'raphael',
'scale.raphael',
'lib/gamp/gamp',
'class',
'mathJax',
'nouislider',
'interact',
'select2',
'ckeditor',
'iframeNotifier',

'qtiInfoControlContext',
'qtiCustomInteractionContext',

...localExternals
],
plugins: [
externalAlias([
'core',
'util',
'ui',
'lib',
'taoItems/runner',
'taoItems/assets',
'taoItems/scoring',
'taoQtiItem/portableElementRegistry'
]),
alias({
resolve: ['.js', '.json', '.tpl'],
...aliases
}),
resolve(),
handlebarsPlugin({
handlebars: {
id: 'handlebars',
options: {
sourceMap: false
},
module: Handlebars
},
helpers: ['build/tpl.js'],
templateExtension: '.tpl'
}),
json({
preferConst: false
}),
/**
* The following hack is necessary because expressions.js wants to export an object
* containing a key named 'default', and expressions/engine.js needs to import the whole thing.
* By omitting a line from Rollup's generated bundle, we can preserve the full object.
*/
{
name: 'expressions_helper',
generateBundle(options, bundle) {
if (options.name.match(/expressions[\/\\]engine/)) {
bundle['engine.js'].code = bundle['engine.js'].code.replace(
/expressionProcessors\.hasOwnProperty\('default'\)/,
false
);
}
}
}
]
};
});
Loading