This commit is contained in:
tiago.kayaya
2021-08-18 18:58:02 +01:00
parent 4439604772
commit 24e2a8f518
5000 changed files with 655398 additions and 26 deletions
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env node
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var path = require('path');
var check_reqs = require('./check_reqs');
/**
* run
* Creates a zip file int platform/build folder
*/
module.exports.run = function () {
return check_reqs.run();
};
module.exports.help = function () {
console.log('Usage: cordova build browser');
var wwwPath = path.resolve(path.join(__dirname, '../../www'));
console.log("Build will create the packaged app in '" + wwwPath + "'.");
};
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
// add methods as we determine what are the requirements
module.exports.run = function () {
// caller expects a promise resolved with an array of conditions
return Promise.resolve([]);
};
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env node
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var fs = require('fs');
var shell = require('shelljs');
var path = require('path');
var check_reqs = require('./check_reqs');
var platformBuildDir = path.join('platforms', 'browser', 'www');
var run = function () {
// TODO: everything calls check_reqs ... why?
// Check that requirements are (still) met
if (!check_reqs.run()) {
console.error('Please make sure you meet the software requirements in order to clean an browser cordova project');
process.exit(2);
}
try {
if (fs.existsSync(platformBuildDir)) {
shell.rm('-r', platformBuildDir);
}
} catch (err) {
console.log('could not remove ' + platformBuildDir + ' : ' + err.message);
}
};
module.exports.run = run;
// just on the off chance something is still calling cleanProject, we will leave this here for a while
module.exports.cleanProject = function () {
console.log('lib/clean will soon only export a `run` command, please update to not call `cleanProject`.');
return run();
};
+68
View File
@@ -0,0 +1,68 @@
#!/usr/bin/env node
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var fs = require('fs');
var path = require('path');
var url = require('url');
var cordovaServe = require('cordova-serve');
module.exports.run = function (args) {
// defaults
args.port = args.port || 8000;
args.target = args.target || 'default'; // make default the system browser
args.noLogOutput = args.silent || false;
var wwwPath = path.join(__dirname, '../../www');
var manifestFilePath = path.resolve(path.join(wwwPath, 'manifest.json'));
var startPage;
// get start page from manifest
if (fs.existsSync(manifestFilePath)) {
try {
var manifest = require(manifestFilePath);
startPage = manifest.start_url;
} catch (err) {
console.log('failed to require manifest ... ' + err);
}
}
var server = cordovaServe();
server.servePlatform('browser', { port: args.port, noServerInfo: true, noLogOutput: args.noLogOutput })
.then(function () {
if (!startPage) {
// failing all else, set the default
startPage = 'index.html';
}
var projectUrl = (new url.URL(`http://localhost:${server.port}/${startPage}`)).href;
console.log('startPage = ' + startPage);
console.log('Static file server running @ ' + projectUrl + '\nCTRL + C to shut down');
return server.launchBrowser({ 'target': args.target, 'url': projectUrl });
})
.catch(function (error) {
console.log(error.message || error.toString());
if (server.server) {
server.server.close();
}
});
};