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

chore(all): update template, update tests #653

Merged
merged 8 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on:
- master
- "[0-9]+_[0-9]+_X"
pull_request:

env:
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 170 # Default is 20
jobs:
build:
runs-on: macos-latest
Expand All @@ -23,7 +24,7 @@ jobs:

- name: Cache Node.js modules
id: node-cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.OS }}-node-modules-${{ hashFiles('package-lock.json') }}
Expand All @@ -44,7 +45,8 @@ jobs:
api-level: 29
target: playstore
script: npm run unit-test
disable-animations: false # defaulting to true, the commands sent to emulator to do this sometimes run too quickly after boot and cause "adb: device offline" failures
emulator-options: -no-window -noaudio -no-boot-anim
disable-animations: true # defaulting to true, the commands sent to emulator to do this sometimes run too quickly after boot and cause "adb: device offline" failures

- run: npm pack
name: Package
Expand Down
198 changes: 1 addition & 197 deletions lib/tiappxml.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,98 +256,6 @@ function toXml(dom, parent, name, value) {
}
break;

case 'mobileweb':
Object.keys(value).forEach(function (prop) {
switch (prop) {
case 'build':
dom.create('build', null, node, function (build) {
Object.keys(value.build).forEach(function (name) {
dom.create(name, null, build, function (deployment) {
Object.keys(value.build[name]).forEach(function (d) {
var val = value.build[name][d];
switch (d) {
case 'js':
case 'css':
case 'html':
dom.create(d, null, deployment, function (type) {
Object.keys(val).forEach(function (v) {
dom.create(v, { nodeValue: val[v] }, type);
});
});
break;

default:
dom.create(d, { nodeValue: val }, deployment);
}
});
});
});
});
break;

case 'analytics':
case 'filesystem':
case 'map':
case 'splash':
case 'unsupported-platforms':
dom.create(prop, null, node, function (section) {
Object.keys(value[prop]).forEach(function (key) {
dom.create(key, { nodeValue: value[prop][key] }, section);
});
});
break;

case 'precache':
dom.create('precache', null, node, function (precache) {
Object.keys(value[prop]).forEach(function (type) {
value[prop][type].forEach(function (n) {
dom.create(type, { nodeValue: n }, precache);
});
});
});
break;

default:
dom.create(prop, { nodeValue: value[prop] }, node);
}
});
break;

case 'tizen':
node.setAttribute('xmlns:tizen', 'http://ti.appcelerator.org');
// use default and generated values if appid and configXml are empty
value.appid && node.setAttribute('appid', value.appid);
// creating nodes from tizen specific entries
var tizenSection = new DOMParser(defaultDOMParserArgs).parseFromString('<?xml version="1.0" encoding="UTF-8"?>\n<tizen xmlns:tizen="http://ti.appcelerator.org" appid="' + value.appid + '"> ' + value.configXml + ' </tizen>', 'text/xml').documentElement,
child = tizenSection.firstChild,
nextSibl;
while (child) {
// store next sibling before calling nextSibling().
// Becaus after appendChild() nextSibling() will return node from other tree
nextSibl = child.nextSibling;
node.appendChild(child);
child = nextSibl;
}
break;

case 'windows':
Object.keys(value).forEach(function (prop) {
switch (prop) {
default:
dom.create(prop, { nodeValue: value[prop] }, node);
}
});
break;

case 'windows-phone':
Object.keys(value).forEach(function (prop) {
switch (prop) {
default:
dom.create(prop, { nodeValue: value[prop] }, node);
}
});
break;

case 'webpack':
if (value.type) {
dom.create('type', { nodeValue: value.type }, node);
Expand Down Expand Up @@ -544,27 +452,6 @@ function toJS(obj, doc, targetPlatform) {
});
break;

case 'blackberry':
var blackberry = obj.blackberry = {};
obj.blackberry.other = '';
xml.forEachElement(node, function (elem) {
switch (elem.tagName) {
case 'permissions':
const permissions = blackberry.permissions = {};
xml.forEachElement(elem, (e) => permissions[xml.getValue(e)] = true);
break;

case 'build-id':
case 'orientation':
blackberry[elem.tagName] = xml.getValue(elem);
break;

default:
obj.blackberry.other += elem.toString() + '\n';
}
});
break;

case 'iphone':
var iphone = obj.iphone = {},
dev;
Expand Down Expand Up @@ -702,89 +589,6 @@ function toJS(obj, doc, targetPlatform) {
});
break;

case 'mobileweb':
var mobileweb = obj.mobileweb = {};
xml.forEachElement(node, function (elem) {
switch (elem.tagName) {
case 'build':
var build = mobileweb.build = {};
xml.forEachElement(elem, function (elem) {
var profile = build[elem.tagName] = {};
xml.forEachElement(elem, function (elem) {
switch (elem.tagName) {
case 'js':
case 'css':
case 'html':
var filetype = profile[elem.tagName] = {};
xml.forEachElement(elem, function (elem) {
filetype[elem.tagName] = xml.getValue(elem);
});
break;

default:
profile[elem.tagName] = xml.getValue(elem);
}
});
});
break;

case 'analytics':
case 'filesystem':
case 'map':
case 'splash':
case 'unsupported-platforms':
mobileweb[elem.tagName] = {};
xml.forEachElement(elem, function (subelem) {
mobileweb[elem.tagName][subelem.tagName] = xml.getValue(subelem);
});
break;

case 'precache':
var precache = mobileweb.precache = {};
xml.forEachElement(elem, function (elem) {
precache[elem.tagName] || (precache[elem.tagName] = []);
precache[elem.tagName].push(xml.getValue(elem));
});
break;

default:
mobileweb[elem.tagName] = xml.getValue(elem);
}
});
break;

case 'tizen':
var tizen = obj.tizen = {
appid: undefined,
configXml: undefined
};

tizen.appid = xml.getAttr(node, 'appid');
xml.forEachElement(node, function (elem) {
tizen.configXml ? tizen.configXml = tizen.configXml + '\n' + elem.toString() : tizen.configXml = elem.toString();
});
break;

case 'windows':
var windows = obj.windows = {};
xml.forEachElement(node, function (elem) {
windows[elem.tagName] = xml.getValue(elem);
});
break;

case 'windows-phone':
var wp = obj['windows-phone'] = {};
xml.forEachElement(node, function (elem) {
switch (elem.tagName) {
case 'target-sdk':
wp[elem.tagName] = elem.firstChild && elem.firstChild.data.replace(/\n/g, '').trim() || '';
break;
default:
wp[elem.tagName] = xml.getValue(elem);
}
});
break;

case 'modules':
var modules = obj.modules = [];
xml.forEachElement(node, function (elem) {
Expand Down Expand Up @@ -884,7 +688,7 @@ function tiapp(filename, platform) {
Object.defineProperty(this, 'toString', {
value: function (fmt) {
if (fmt === 'xml') {
var dom = new DOMParser(defaultDOMParserArgs).parseFromString('<ti:app xmlns:ti="http://ti.appcelerator.org"/>', 'text/xml');
var dom = new DOMParser(defaultDOMParserArgs).parseFromString('<ti:app xmlns:ti="http://ti.tidev.io"/>', 'text/xml');

dom.create = function (tag, attrs, parent, callback) {
var node = dom.createElement(tag),
Expand Down
6 changes: 1 addition & 5 deletions lib/titanium.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports.availablePlatformsNames = (function (platforms) {
});
return platforms.sort();
}(manifest.platforms || []));
exports.allPlatformNames = [ 'android', 'ios', 'iphone', 'ipad', 'mobileweb', 'blackberry', 'windows', 'tizen' ];
exports.allPlatformNames = [ 'android', 'ios', 'iphone', 'ipad' ];

exports.commonOptions = function (logger, config) {
return {
Expand Down Expand Up @@ -489,10 +489,6 @@ exports.validateCorrectSDK = function (logger, config, cli, commandName) {
}
break;

case 'mobileweb':
cmdAdd(argv['project-dir'], argv['deploy-type']);
break;

case 'android':
if (argv['build-only']) {
cmdAdd('build', tiapp.name, argv['android-sdk'], argv['project-dir'], tiapp.id);
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 3 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,8 @@
"titanium",
"mobile"
],
"version": "5.1.9",
"author": {
"name": "Appcelerator, Inc.",
"email": "info@appcelerator.com"
},
"maintainers": [
{
"name": "Chris Barber",
"email": "cbarber@appcelerator.com"
},
{
"name": "Chris Williams",
"email": "cwilliams@appcelerator.com"
}
],
"version": "6.0.0",
"author": "TiDev, Inc. <npm@tidev.io>",
"license": "Apache-2.0",
"main": "./lib/titanium",
"directories": {
Expand Down Expand Up @@ -66,7 +53,7 @@
"url": "git://github.com/appcelerator/node-titanium-sdk.git"
},
"engines": {
"node": ">=10"
"node": ">=16"
},
"scripts": {
"lint": "eslint .",
Expand Down
4 changes: 2 additions & 2 deletions tests/avd_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('emulator', function () {

it('#start(), #isRunning() and #stop()', function (finished) {
this.slow(30000);
this.timeout(180000);
this.timeout(280000);

emulator.start(avd.id, function (err, emu) {
if (err) {
Expand All @@ -101,7 +101,7 @@ describe('emulator', function () {

emulator.stop(device.emulator.id, function (errOrCode) {
errOrCode.should.eql(0);
setTimeout(finished, 5000); // let it wait 5 seconds or else adb will still report it as connected
setTimeout(finished, 6000); // let it wait 5 seconds or else adb will still report it as connected
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/tiapp1.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
<ti:app xmlns:ti="http://ti.tidev.io">
<id>ti.testapp</id>
<name>testapp</name>
<version>1.0</version>
Expand Down
Loading
Loading