├── doc ├── info.txt ├── help.txt ├── serve.txt ├── prepare.txt ├── emulate.txt ├── clean.txt ├── requirements.txt ├── create.txt ├── compile.txt ├── config.txt ├── build.txt ├── run.txt ├── cordova.txt ├── bash.md ├── platform.txt ├── plugin.txt └── readme.md ├── spec ├── support │ └── jasmine.json ├── help.spec.js └── cli.spec.js ├── NOTICE ├── .github ├── ISSUE_TEMPLATE │ ├── FEATURE_REQUEST.md │ ├── SUPPORT_QUESTION.md │ └── BUG_REPORT.md ├── PULL_REQUEST_TEMPLATE.md ├── ISSUE_TEMPLATE.md └── workflows │ ├── release-audit.yml │ └── ci.yml ├── .npmrc ├── bin ├── cordova.cmd └── cordova ├── .ratignore ├── .npmignore ├── licence_checker.yml ├── .asf.yaml ├── .gitignore ├── package.json ├── cordova.js ├── CONTRIBUTING.md ├── eslint.config.js ├── src ├── help.js ├── info.js └── cli.js ├── .gitattributes ├── README.md ├── scripts └── cordova.completion ├── LICENSE └── RELEASENOTES.md /doc/info.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli info 4 | 5 | Print out useful information helpful for submitting bug 6 | reports and getting help. 7 | -------------------------------------------------------------------------------- /doc/help.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli help [command] 4 | cordova-cli [command] -h 5 | cordova-cli -h [command] 6 | 7 | Show syntax summary, or the help for a specific command. 8 | -------------------------------------------------------------------------------- /doc/serve.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli serve [PORT] 4 | 5 | Run a local web server for www/ assets. Port defaults to 8000. 6 | 7 | Access projects at: http://HOST_IP:PORT/PLATFORM/www 8 | -------------------------------------------------------------------------------- /spec/support/jasmine.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_dir": "spec", 3 | "spec_files": [ 4 | "**/*[sS]pec.js" 5 | ], 6 | "stopSpecOnExpectationFailure": false, 7 | "random": false 8 | } 9 | -------------------------------------------------------------------------------- /doc/prepare.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli prepare [PLATFORM..] 4 | 5 | Copies files for specified platforms, or all platforms, 6 | so that the project is ready to build with each SDK. 7 | 8 | Example 9 | cordova-cli prepare 10 | -------------------------------------------------------------------------------- /doc/emulate.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli emulate [PLATFORM...] [-- [platformopts]] 4 | 5 | Alias for `cordova-cli run --emulator`. Launches the emulator instead of device. 6 | Use 'cordova-cli help run' for details on options. 7 | 8 | To provide platform specific options, you must include them after `--`. 9 | -------------------------------------------------------------------------------- /doc/clean.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli clean [PLATFORM..] 4 | 5 | Cleans the build artifacts for the specified platform, or all platforms 6 | by running platform-provided clean script. 7 | 8 | To provide platform specific options, you must include them after `--`. 9 | 10 | Example 11 | cordova-cli clean android -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli requirements [PLATFORM ...] 4 | 5 | Checks and print out all the requirements for platforms specified (or all platforms added 6 | to project if none specified). If all requirements for each platform are met, exits with code 0 7 | otherwise exits with non-zero code. 8 | 9 | Example 10 | cordova-cli requirements android -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Apache Cordova 2 | Copyright 2012 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | ----- 8 | 9 | - spdx-exceptions 10 | 11 | https://github.com/jslicense/spdx-exceptions.json 12 | 13 | Licensed under the Creative Commons Attribution 3.0 Unported (CC-BY-3.0) 14 | https://creativecommons.org/licenses/by/3.0/ 15 | -------------------------------------------------------------------------------- /doc/create.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli create [ID [NAME]] [options] 4 | 5 | Create a Cordova project 6 | 7 | PATH ......................... Where to create the project 8 | ID ........................... Reverse-domain-style package name - used in 9 | NAME ......................... Human readable name 10 | 11 | Options 12 | 13 | --template= ... use a custom template located locally, in NPM, or GitHub. 14 | 15 | Example 16 | cordova-cli create myapp com.mycompany.myteam.myapp MyApp 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🚀 Feature Request 3 | about: A suggestion for a new functionality 4 | 5 | --- 6 | 7 | # Feature Request 8 | 9 | ## Motivation Behind Feature 10 | 11 | 12 | 13 | 14 | ## Feature Description 15 | 20 | 21 | 22 | 23 | ## Alternatives or Workarounds 24 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /doc/compile.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli compile [PROD] [TARGET] [PLATS] [-- POPTS] 4 | 5 | PROD: --debug|--release 6 | TARGET: --device|--emulator|--target=FOO 7 | PLATS: PLATFORM [...] 8 | POPTS: platformopts 9 | 10 | Builds the app for specified platforms, or all platforms 11 | 12 | Options 13 | 14 | --debug ............................ Deploy a debug build 15 | --release .......................... Deploy a release build 16 | 17 | --device ........................... Deploy to a device 18 | --emulator ......................... Deploy to an emulator 19 | --target ........................... Deploy to a specific target 20 | 21 | To provide platform specific options, you must include them after `--`. 22 | 23 | Examples 24 | 25 | cordova-cli compile android windows --debug --device 26 | cordova-cli compile android --release -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | registry=https://registry.npmjs.org 19 | -------------------------------------------------------------------------------- /bin/cordova.cmd: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @node "%~dpn0" %* 19 | -------------------------------------------------------------------------------- /.ratignore: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | .git/ 19 | doc/*.txt 20 | coverage/ 21 | node_modules/ 22 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | .* 19 | coverage 20 | spec 21 | temp 22 | eslint.config.js 23 | -------------------------------------------------------------------------------- /licence_checker.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | ignored-packages: 19 | - spdx-exceptions@2.5.0 20 | - underscore@1.2.1 21 | -------------------------------------------------------------------------------- /.asf.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | notifications: 19 | commits: commits@cordova.apache.org 20 | issues: issues@cordova.apache.org 21 | pullrequests_status: issues@cordova.apache.org 22 | pullrequests_comment: issues@cordova.apache.org 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 💬 Support Question 3 | about: If you have a question, please check out our Slack or StackOverflow! 4 | 5 | --- 6 | 7 | 8 | 9 | Apache Cordova uses GitHub Issues as a feature request and bug tracker _only_. 10 | For usage and support questions, please check out the resources below. Thanks! 11 | 12 | --- 13 | 14 | You can get answers to your usage and support questions about **Apache Cordova** on: 15 | 16 | * Slack Community Chat: https://cordova.slack.com (you can sign-up at http://slack.cordova.io/) 17 | * StackOverflow: https://stackoverflow.com/questions/tagged/cordova using the tag `cordova` 18 | 19 | --- 20 | 21 | If you are using a tool that uses Cordova internally, like e.g. Ionic, check their support channels: 22 | 23 | * **Ionic Framework** 24 | * [Ionic Community Forum](https://forum.ionicframework.com/) 25 | * [Ionic Worldwide Slack](https://ionicworldwide.herokuapp.com/) 26 | * **PhoneGap** 27 | * [PhoneGap Developer Community](https://forums.adobe.com/community/phonegap) 28 | -------------------------------------------------------------------------------- /doc/config.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli config [options] 4 | 5 | The config command can be used to set, get, delete, edit, and list global cordova options. 6 | 7 | Options 8 | --set ... Sets the config key to the value. If value is omitted, then it sets it to "true". 9 | --get ........... Echo the config value to stdout. 10 | --delete ........ Deletes the key from all configuration files. 11 | --edit ................ Opens the config file in an editor. 12 | --ls .................. Lists contents of config file. 13 | 14 | 15 | Syntax 16 | cordova-cli config set ....... cordova config set save-exact true 17 | cordova-cli config get ............... cordova config get save-exact 18 | cordova-cli config delete ............ cordova config delete save-exact 19 | cordova-cli config edit .................... cordova config edit 20 | cordova-cli config ls ...................... cordova config ls 21 | 22 | Options 23 | save-exact ...................... default setting = false 24 | 25 | Examples 26 | cordova config set save-exact true 27 | -------------------------------------------------------------------------------- /doc/build.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli build [PROD] [TARGET] [PLATS] [BUILDCONFIG] [-- POPTS] 4 | 5 | PROD: --debug|--release 6 | TARGET: --device|--emulator 7 | PLATS: PLATFORM [...] 8 | BUILDCONFIG: --buildConfig=CONFIGFILE 9 | POPTS: platformopts 10 | 11 | Shortcut for `cordova prepare` + `cordova compile` for 12 | all/the specified platforms. 13 | 14 | --debug ............................ debug build 15 | --release .......................... release build 16 | 17 | --device ........................... Build it for a device 18 | --emulator ......................... Build it for an emulator 19 | 20 | --buildConfig....................... Use the specified build configuration 21 | instead of default build.json 22 | 23 | To provide platform specific options, you must include them after `--`. 24 | 25 | Example 26 | cordova-cli build android windows --debug --device 27 | cordova-cli build android --release --buildConfig=..\myBuildConfig.json 28 | cordova-cli build android --release -- --keystore="..\android.keystore" --storePassword=android --alias=mykey 29 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/BUG_REPORT.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🐛 Bug Report 3 | about: If something isn't working as expected. 4 | 5 | --- 6 | 7 | # Bug Report 8 | 9 | ## Problem 10 | 11 | ### What is expected to happen? 12 | 13 | 14 | 15 | ### What does actually happen? 16 | 17 | 18 | 19 | ## Information 20 | 21 | 22 | 23 | 24 | ### Command or Code 25 | 26 | 27 | 28 | 29 | ### Environment, Platform, Device 30 | 31 | 32 | 33 | 34 | ### Version information 35 | 42 | 43 | 44 | 45 | ## Checklist 46 | 47 | 48 | - [ ] I searched for existing GitHub issues 49 | - [ ] I updated all Cordova tooling to most recent version 50 | - [ ] I included all the necessary information above 51 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | ### Platforms affected 10 | 11 | 12 | 13 | ### Motivation and Context 14 | 15 | 16 | 17 | 18 | 19 | ### Description 20 | 21 | 22 | 23 | 24 | ### Testing 25 | 26 | 27 | 28 | 29 | ### Checklist 30 | 31 | - [ ] I've run the tests to see all new and existing tests pass 32 | - [ ] I added automated test coverage as appropriate for this change 33 | - [ ] Commit is prefixed with `(platform)` if this change only applies to one platform (e.g. `(android)`) 34 | - [ ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/)) 35 | - [ ] I've updated the documentation if necessary 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | coverage 19 | .nyc_output 20 | node_modules 21 | npm-debug.log 22 | temp 23 | .DS_Store 24 | spec/fixtures/projects/native 25 | spec/fixtures/projects/cordova 26 | lib/cordova-android/framework/bin 27 | lib/cordova-android/framework/gen 28 | lib/cordova-android/framework/local.properties 29 | lib/cordova-wp7/example 30 | lib/cordova-wp8/example 31 | .idea/* 32 | spec/fixtures/* 33 | .gitcore 34 | *.jar 35 | spec_tmp 36 | # avoid npm pack issues 37 | .gitignore 38 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova", 3 | "version": "13.0.1-dev.0", 4 | "description": "Cordova command line interface tool", 5 | "main": "cordova", 6 | "engines": { 7 | "node": ">=20.17.0 || >=22.9.0" 8 | }, 9 | "bin": { 10 | "cordova": "./bin/cordova" 11 | }, 12 | "scripts": { 13 | "test": "npm run lint && npm run cover", 14 | "lint": "eslint .", 15 | "cover": "c8 jasmine" 16 | }, 17 | "repository": "github:apache/cordova-cli", 18 | "bugs": "https://github.com/apache/cordova-cli/issues", 19 | "keywords": [ 20 | "cordova", 21 | "client", 22 | "cli" 23 | ], 24 | "dependencies": { 25 | "configstore": "^5.0.1", 26 | "cordova-common": "^6.0.0", 27 | "cordova-create": "^6.0.0", 28 | "cordova-lib": "^13.0.0", 29 | "editor": "^1.0.0", 30 | "execa": "^5.1.1", 31 | "nopt": "^9.0.0", 32 | "semver": "^7.7.3", 33 | "systeminformation": "^5.27.11" 34 | }, 35 | "devDependencies": { 36 | "@cordova/eslint-config": "^6.0.0", 37 | "c8": "^10.1.3", 38 | "jasmine": "^5.12.0", 39 | "rewire": "^9.0.1" 40 | }, 41 | "author": "Apache Software Foundation", 42 | "license": "Apache-2.0", 43 | "c8": { 44 | "include": [ 45 | "bin/**", 46 | "src/**" 47 | ], 48 | "reporter": [ 49 | "lcov", 50 | "text" 51 | ] 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | ### Issue Type 7 | 8 | 9 | - [ ] Bug Report 10 | - [ ] Feature Request 11 | - [ ] Support Question 12 | 13 | ## Description 14 | 15 | ## Information 16 | 17 | 18 | ### Command or Code 19 | 20 | 21 | ### Environment, Platform, Device 22 | 23 | 24 | 25 | 26 | ### Version information 27 | 34 | 35 | 36 | 37 | ## Checklist 38 | 39 | 40 | - [ ] I searched for already existing GitHub issues about this 41 | - [ ] I updated all Cordova tooling to their most recent version 42 | - [ ] I included all the necessary information above 43 | -------------------------------------------------------------------------------- /cordova.js: -------------------------------------------------------------------------------- 1 | /** 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // All cordova js API moved to cordova-lib. If you don't need the cordova CLI, 21 | // use cordova-lib directly. 22 | 23 | const cordova_lib = require('cordova-lib'); 24 | module.exports = cordova_lib.cordova; 25 | 26 | // Also export the cordova-lib so that downstream consumers of cordova lib and 27 | // CLI will be able to use CLI's cordova-lib and avoid the risk of having two 28 | // different versions of cordova-lib which would result in two instances of 29 | // "events" and can cause bad event handling. 30 | module.exports.cordova_lib = cordova_lib; 31 | module.exports.cli = require('./src/cli'); 32 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 21 | 22 | # Contributing to Apache Cordova 23 | 24 | Anyone can contribute to Cordova. And we need your contributions. 25 | 26 | There are multiple ways to contribute: report bugs, improve the docs, and 27 | contribute code. 28 | 29 | For instructions on this, start with the 30 | [contribution overview](http://cordova.apache.org/contribute/). 31 | 32 | The details are explained there, but the important items are: 33 | 34 | - Check for Github issues that corresponds to your contribution and link or create them if necessary. 35 | - Run the tests so your patch doesn't break existing functionality. 36 | 37 | We look forward to your contributions! 38 | -------------------------------------------------------------------------------- /eslint.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | const { defineConfig, globalIgnores } = require('eslint/config'); 21 | const nodeConfig = require('@cordova/eslint-config/node'); 22 | const nodeTestConfig = require('@cordova/eslint-config/node-tests'); 23 | 24 | module.exports = defineConfig([ 25 | globalIgnores([ 26 | '**/coverage/' 27 | ]), 28 | { 29 | // Include these JavaScript files that do not have file extensions. 30 | files: [ 31 | 'bin/cordova' 32 | ] 33 | }, 34 | ...nodeConfig, 35 | ...nodeTestConfig.map(config => ({ 36 | files: ['spec/**/*.js'], 37 | ...config 38 | })) 39 | ]); 40 | -------------------------------------------------------------------------------- /src/help.js: -------------------------------------------------------------------------------- 1 | /** 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | const fs = require('node:fs'); 21 | const path = require('node:path'); 22 | const cordova_lib = require('cordova-lib'); 23 | 24 | module.exports = function help (args) { 25 | args = args || []; 26 | 27 | const command = ((args)[0] || 'cordova'); 28 | const docdir = path.join(__dirname, '..', 'doc'); 29 | const file = [ 30 | `${command}.md`, 31 | `${command}.txt`, 32 | 'cordova.md', 33 | 'cordova.txt' 34 | ] 35 | .map(f => path.join(docdir, f)) 36 | .filter(f => !!fs.existsSync(f)); 37 | 38 | const raw = fs.readFileSync(file[0]).toString('utf8').replace(/cordova-cli/g, cordova_lib.binname); 39 | // cordova.emit('results', raw); 40 | 41 | return raw; 42 | }; 43 | -------------------------------------------------------------------------------- /bin/cordova: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | const util = require('util'); 23 | const { events, CordovaError } = require('cordova-common'); 24 | const cli = require('../src/cli'); 25 | 26 | cli(process.argv).catch(err => { 27 | if (!(err instanceof Error)) { 28 | const errorOutput = typeof err === 'string' ? err : util.inspect(err); 29 | throw new CordovaError('Promise rejected with non-error: ' + errorOutput); 30 | } 31 | if (typeof err.code !== 'number') { 32 | process.exitCode = 1; 33 | } else { 34 | process.exitCode = err.code; 35 | } 36 | 37 | // We cannot emit an error event here, as that would cause another error 38 | console.error(err.message); 39 | events.emit('verbose', err.stack); 40 | }); 41 | -------------------------------------------------------------------------------- /doc/run.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli run [MODE] [BUILDOPTS] [TARGET] [PLATS] [BUILDCONFIG] [-- POPTS] 4 | 5 | MODE: --list|--debug|--release 6 | BUILDOPTS: --noprepare --nobuild 7 | TARGET: DEVICECLASS|--target=FOO 8 | PLATS: PLATFORM [...] 9 | BUILDCONFIG: --buildConfig=CONFIGFILE 10 | POPTS: platformopts 11 | DEVICECLASS: --device|--emulator 12 | 13 | Deploys app on specified platform devices / emulators 14 | 15 | --list ............................. Lists available targets 16 | Will display both device and emulator 17 | unless DEVICECLASS option is provided 18 | 19 | --debug ............................ Deploy a debug build 20 | --release .......................... Deploy a release build 21 | 22 | --noprepare ........................ Don't prepare 23 | --nobuild .......................... Don't build 24 | 25 | --device ........................... Deploy to a device 26 | --emulator ......................... Deploy to an emulator 27 | --target ........................... Deploy to a specific target 28 | 29 | --buildConfig....................... Use the specified build configuration 30 | instead of default build.json 31 | 32 | To provide platform specific options, you must include them after `--`. 33 | 34 | Technical details 35 | calls cordova prepare (unless --noprepare) 36 | calls PLATFORM run 37 | PLATFORM run calls PLATFORM build (unless --nobuild) 38 | 39 | Examples 40 | cordova-cli run android --release --buildConfig=..\myBuildConfig.json --target=myEmulator 41 | cordova-cli run android --nobuild 42 | cordova-cli run ios --device 43 | cordova-cli run ios --list 44 | -------------------------------------------------------------------------------- /.github/workflows/release-audit.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: Release Auditing 19 | 20 | on: 21 | push: 22 | branches-ignore: 23 | - 'dependabot/**' 24 | pull_request: 25 | branches: 26 | - '*' 27 | 28 | permissions: 29 | contents: read 30 | 31 | jobs: 32 | test: 33 | name: Audit Licenses 34 | runs-on: ubuntu-latest 35 | steps: 36 | # Checkout project 37 | - uses: actions/checkout@v6 38 | 39 | # Check license headers (v2.0.0) 40 | - uses: erisu/apache-rat-action@46fb01ce7d8f76bdcd7ab10e7af46e1ea95ca01c 41 | 42 | # Setup environment with node 43 | - uses: actions/setup-node@v6 44 | with: 45 | node-version: 24 46 | 47 | # Install node packages 48 | - name: npm install packages 49 | run: npm ci 50 | 51 | # Check node package licenses (v2.0.1) 52 | - uses: erisu/license-checker-action@99cffa11264fe545fd0baa6c13bca5a00ae608f2 53 | with: 54 | license-config: 'licence_checker.yml' 55 | include-asf-category-a: true 56 | -------------------------------------------------------------------------------- /doc/cordova.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli command [options] 4 | 5 | Global Commands 6 | create ............................. Create a project 7 | help ............................... Get help for a command 8 | config ............................. Set, get, delete, edit, and list global cordova options 9 | 10 | Project Commands 11 | info ............................... Generate project information 12 | requirements ....................... Checks and print out all the requirements 13 | for platforms specified 14 | 15 | platform ........................... Manage project platforms 16 | plugin ............................. Manage project plugins 17 | 18 | prepare ............................ Copy files into platform(s) for building 19 | compile ............................ Build platform(s) 20 | clean .............................. Cleanup project from build artifacts 21 | 22 | run ................................ Run project 23 | (including prepare && compile) 24 | serve .............................. Run project with a local webserver 25 | (including prepare) 26 | 27 | Learn more about command options using 'cordova-cli help ' 28 | 29 | Aliases 30 | build -> cordova-cli prepare && cordova-cli compile 31 | emulate -> cordova-cli run --emulator 32 | 33 | Options 34 | -v, --version ...................... prints out this utility's version 35 | -d, --verbose ...................... debug mode produces verbose log output for all activity, 36 | --nohooks .......................... suppress executing hooks 37 | (taking RegExp hook patterns as parameters) 38 | 39 | Examples 40 | cordova-cli create myApp org.apache.cordova.myApp myApp 41 | cordova-cli plugin add cordova-plugin-camera 42 | cordova-cli platform add android 43 | cordova-cli plugin add cordova-plugin-camera --nosave 44 | cordova-cli platform add android --nosave 45 | cordova-cli requirements android 46 | cordova-cli build android --verbose 47 | cordova-cli run android 48 | cordova-cli build android --release -- --keystore="..\android.keystore" --storePassword=android --alias=mykey 49 | cordova-cli config ls 50 | -------------------------------------------------------------------------------- /doc/bash.md: -------------------------------------------------------------------------------- 1 | 21 | Bash shell support 22 | ================== 23 | 24 | Cordova CLI comes bundled with a script which provides command-line tab-completion for Bash. If you're running a sufficiently 25 | Unix-y operating system (Linux, BSD, OS X) you can install this to make typing cordova command lines easier. 26 | 27 | Installation 28 | ------------ 29 | 30 | ### Linux 31 | 32 | To install on a Linux or BSD system, copy the `scripts/cordova.completion` file to your `/etc/bash_completion.d` directory. This will be read the next time you start a new shell. 33 | 34 | ### OS X 35 | 36 | On OS X, put the `scripts/cordova.completion` file anywhere readable, and add the following line to the end of your `~/.bashrc` file: 37 | 38 | source /cordova.completion 39 | 40 | This will be read the next time you start a new shell. 41 | 42 | Usage 43 | ------ 44 | 45 | It's easy! As long as your command line begins with an executable called 'cordova', just hit `` at any point to see a list of valid completions. 46 | 47 | Examples: 48 | 49 | $ cordova 50 | build compile create emulate platform plugin prepare serve 51 | 52 | $ cordova pla 53 | 54 | $ cordova platform 55 | add ls remove rm 56 | 57 | $ cordova platform a 58 | 59 | $ cordova platform add 60 | android blackberry ios wp8 www 61 | 62 | $ cordova plugin rm 63 | 64 | $ cordova plugin rm org.apache.cordova. 65 | org.apache.cordova.file org.apache.cordova.inappbrowser 66 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: Node CI 19 | 20 | on: 21 | push: 22 | branches-ignore: 23 | - 'dependabot/**' 24 | pull_request: 25 | branches: 26 | - '*' 27 | 28 | permissions: 29 | contents: read 30 | security-events: write 31 | 32 | jobs: 33 | test: 34 | name: NodeJS ${{ matrix.node-version }} on ${{ matrix.os }} 35 | runs-on: ${{ matrix.os }} 36 | strategy: 37 | matrix: 38 | node-version: [20.x, 22.x, 24.x] 39 | os: [ubuntu-latest, windows-latest, macos-15] 40 | 41 | steps: 42 | - uses: actions/checkout@v4 43 | 44 | - name: Use Node.js ${{ matrix.node-version }} 45 | uses: actions/setup-node@v4 46 | with: 47 | node-version: ${{ matrix.node-version }} 48 | 49 | - name: Environment Information 50 | run: | 51 | node --version 52 | npm --version 53 | 54 | - uses: github/codeql-action/init@v3 55 | with: 56 | languages: javascript 57 | queries: security-and-quality 58 | config: | 59 | paths-ignore: 60 | - coverage 61 | - node_modules 62 | 63 | - name: npm install and test 64 | run: npm cit 65 | env: 66 | CI: true 67 | 68 | - uses: github/codeql-action/analyze@v3 69 | 70 | # v4.6.0 71 | - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 72 | if: success() 73 | with: 74 | name: ${{ runner.os }} node.js ${{ matrix.node-version }} 75 | token: ${{ secrets.CORDOVA_CODECOV_TOKEN }} 76 | fail_ci_if_error: false 77 | -------------------------------------------------------------------------------- /spec/help.spec.js: -------------------------------------------------------------------------------- 1 | /** 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | const { cordova } = require('cordova-lib'); 21 | const help = require('../src/help'); 22 | const allcommands = [ 23 | '', 'prepare', 'build', 'config', 'emulate', 'plugin', 'plugins', 24 | 'serve', 'platform', 'platforms', 'compile', 'run', 'info', 'targets', 25 | 'requirements', 'projectMetadata', 'clean' 26 | ]; 27 | 28 | describe('help', () => { 29 | describe('commands should', () => { 30 | afterEach(() => { 31 | cordova.removeAllListeners('results'); 32 | }); 33 | describe('return results, and no long lines', () => { 34 | allcommands.forEach(k => { 35 | it(k, () => { 36 | const result = help([k]); 37 | expect(result).toMatch(/^Synopsis/); 38 | expect(result.split('\n').filter(l => l.length > 130).length).toBe(0); 39 | }); 40 | }); 41 | }); 42 | describe('use cordova-cli instead of cordova:', () => { 43 | const binname = cordova.binname; 44 | const testname = 'testgap'; 45 | beforeEach(() => { 46 | cordova.binname = testname; 47 | }); 48 | afterEach(() => { 49 | cordova.binname = binname; 50 | }); 51 | allcommands.forEach(k => { 52 | it(k || '(default)', () => { 53 | const result = help([k]); 54 | expect(result.split('\n')[2]).toMatch(RegExp(testname + ' (?:' + k + '|command)\\b')); 55 | }); 56 | }); 57 | }); 58 | }); 59 | }); 60 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | * text eol=lf 19 | 20 | # source code 21 | *.php text 22 | *.css text 23 | *.sass text 24 | *.scss text 25 | *.less text 26 | *.styl text 27 | *.js text 28 | *.coffee text 29 | *.json text 30 | *.htm text 31 | *.html text 32 | *.xml text 33 | *.svg text 34 | *.txt text 35 | *.ini text 36 | *.inc text 37 | *.pl text 38 | *.rb text 39 | *.py text 40 | *.scm text 41 | *.sql text 42 | *.sh text 43 | *.bat text 44 | 45 | # templates 46 | *.ejs text 47 | *.hbt text 48 | *.jade text 49 | *.haml text 50 | *.hbs text 51 | *.dot text 52 | *.tmpl text 53 | *.phtml text 54 | 55 | # server config 56 | .htaccess text 57 | 58 | # git config 59 | .gitattributes text 60 | .gitignore text 61 | .gitconfig text 62 | 63 | # code analysis config 64 | .jshintrc text 65 | .jscsrc text 66 | .jshintignore text 67 | .csslintrc text 68 | 69 | # misc config 70 | *.yaml text 71 | *.yml text 72 | .editorconfig text 73 | 74 | # build config 75 | *.npmignore text 76 | *.bowerrc text 77 | 78 | # Heroku 79 | Procfile text 80 | .slugignore text 81 | 82 | # Documentation 83 | *.md text 84 | LICENSE text 85 | AUTHORS text 86 | 87 | 88 | # 89 | ## These files are binary and should be left untouched 90 | # 91 | 92 | # (binary is a macro for -text -diff) 93 | *.png binary 94 | *.jpg binary 95 | *.jpeg binary 96 | *.gif binary 97 | *.ico binary 98 | *.mov binary 99 | *.mp4 binary 100 | *.mp3 binary 101 | *.flv binary 102 | *.fla binary 103 | *.swf binary 104 | *.gz binary 105 | *.zip binary 106 | *.7z binary 107 | *.ttf binary 108 | *.eot binary 109 | *.woff binary 110 | *.pyc binary 111 | *.pdf binary 112 | -------------------------------------------------------------------------------- /doc/platform.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli platform [options] 4 | 5 | Manage project platforms 6 | 7 | add [...].............. Add specified platforms and save platforms 8 | into config.xml & package.json after installing them 9 | 10 | --nosave ...................... Prevent saving platforms into 11 | config.xml & package.json after installing them 12 | 13 | --link ........................ When is a local path, links the platform 14 | library directly instead of making a copy of it (support 15 | varies by platform; useful for platform development) 16 | 17 | remove [...] ........... Remove specified platforms 18 | 19 | --nosave ...................... Prevent deleting specified platforms from 20 | config.xml & package.json after removing them 21 | 22 | update ................ Update the version of Cordova used for a specific platform; 23 | update to the latest if no is specified 24 | 25 | list .............................. List all installed and available platforms 26 | nosave ............................ Prevents saving version of all platforms added to 27 | config.xml & package.json 28 | Syntax 29 | : [@]||[#] 30 | 31 | ........................ Platform name e.g. android, ios, windows etc. 32 | ......................... Major.minor.patch version specifier using semver 33 | ............................ Path to a directory containing a platform 34 | ............................. Url to a git repository containing a platform 35 | ...................... Commit/tag/bramch reference. If none is specified, 'master' is used 36 | 37 | Aliases 38 | platforms -> platform 39 | rm -> remove 40 | ls -> list 41 | 42 | Examples 43 | cordova-cli platform add android ios 44 | cordova-cli platform add android@^5.0.0 45 | cordova-cli platform add https://github.com/myfork/cordova-android.git#4.0.0 46 | cordova-cli platform add ../android 47 | cordova-cli platform add ../cordova-android.tgz 48 | cordova-cli platform rm android --nosave 49 | cordova-cli platform ls 50 | -------------------------------------------------------------------------------- /doc/plugin.txt: -------------------------------------------------------------------------------- 1 | Synopsis 2 | 3 | cordova-cli plugin [options] 4 | 5 | Manage project plugins 6 | 7 | add [...] ............ Add specified plugins and save them to 8 | config.xml & package.json. 9 | --searchpath ....... When looking up plugins by ID, look in this directory and 10 | each of its subdirectories before hitting the registry. 11 | Multiple search paths can be specified. 12 | 13 | --noregistry ................... Don't search the registry for plugins 14 | 15 | --link ......................... When installing from a local path, creates a symbolic link 16 | instead of copying files. The extent to which files are linked 17 | varies by platform. Useful for plugin development. 18 | --nosave ....................... Prevent saving the information for specified plugin 19 | into config.xml & package.json. 20 | --shrinkwrap ................... Used together with --save, saves the 21 | installed version numbers to config.xml 22 | 23 | --force ........................ Forces copying source files from the plugin even if the 24 | same file already exists in the target directory. 25 | 26 | 27 | remove | [...] ..... Remove plugins with the given IDs/name and 28 | removes the information for specified plugin from config.xml & package.json. 29 | --nosave ....................... Prevents removing the information for 30 | specified plugin from config.xml & package.json. 31 | 32 | 33 | list .............................. List currently installed plugins 34 | 35 | Syntax 36 | : [@]||[#][:subdir] 37 | 38 | .......................... Plugin id (id of plugin in npm registry or --searchPath) 39 | ......................... Major.minor.patch version specifier using semver 40 | ....................... Directory containing plugin.xml 41 | ............................. Url to a git repository containing a plugin.xml 42 | ...................... Commit/tag/branch reference. If none is specified, 'master' is used 43 | .......................... Sub-directory to find plugin.xml for the specified plugin. 44 | 45 | Aliases 46 | plugins -> plugin 47 | rm -> remove 48 | ls -> list 49 | 50 | Examples 51 | cordova-cli plugin add cordova-plugin-camera cordova-plugin-file --nosave --searchpath ~/plugins 52 | cordova-cli plugin add cordova-plugin-camera@^2.0.0 --nosave 53 | cordova-cli plugin add https://github.com/myfork/cordova-plugin-camera.git#2.1.0 --nosave 54 | cordova-cli plugin add ../cordova-plugin-camera --nosave 55 | cordova-cli plugin add ../cordova-plugin-camera.tgz --nosave 56 | cordova-cli plugin rm camera --nosave 57 | cordova-cli plugin ls 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 21 | 22 | # Cordova CLI 23 | 24 | [![NPM](https://nodei.co/npm/cordova.png)](https://nodei.co/npm/cordova/) 25 | 26 | [![Node CI](https://github.com/apache/cordova-cli/workflows/Node%20CI/badge.svg?branch=master)](https://github.com/apache/cordova-cli/actions?query=branch%3Amaster) 27 | [![codecov.io](https://codecov.io/github/apache/cordova-cli/coverage.svg?branch=master)](https://codecov.io/github/apache/cordova-cli?branch=master) 28 | 29 | > The command line tool to build, deploy and manage [Cordova](https://cordova.apache.org)-based applications. 30 | 31 | [Apache Cordova](https://cordova.apache.org) allows for building native mobile applications using HTML, CSS and JavaScript. 32 | This tool helps with management of multi-platform Cordova applications as well as Cordova plugin integration. 33 | 34 | ## Installation 35 | 36 | In your command-line on Windows: 37 | 38 | ```bash 39 | c:\> npm install -g cordova 40 | ``` 41 | 42 | In your terminal on Mac OS X/Linux: 43 | 44 | ```bash 45 | $sudo npm install -g cordova 46 | ``` 47 | 48 | ## Creating a new Cordova project 49 | 50 | This simple example demonstrates how Cordova CLI can be used to create a `myApp` project with the `camera` plugin and run it for `android` platform: 51 | 52 | ```bash 53 | cordova create myApp com.myCompany.myApp myApp 54 | cd myApp 55 | cordova plugin add cordova-plugin-camera --save 56 | cordova platform add android --save 57 | cordova requirements android 58 | cordova build android --verbose 59 | cordova run android 60 | ``` 61 | 62 | ## Docs 63 | 64 | - [Overview of Cordova] 65 | - [Create your first Cordova app] guide 66 | - [Full reference docs for Cordova CLI][Reference docs] has details of commands to add platforms, add plugins, build, package, and sign your HTML, JS apps. 67 | - Cordova allows you to build apps for a number of platforms. Learn more about our [Supported platforms]. 68 | - [Project directory structure] documents the details of the directory structure created by Cordova CLI. 69 | 70 | ## Contributing 71 | 72 | Cordova is an open source Apache project and contributors are needed to keep this project moving forward. Learn more on 73 | [how to contribute on our website][contribute]. 74 | 75 | ## Reporting Issues 76 | 77 | If you find issues with the Cordova CLI, please follow our guidelines for [reporting issues]. Please bear in mind that most of `cordova-cli`'s functionality is implemented in [cordova-lib], so that could be the place to report your issue. 78 | Platform-specific issues should be reported in the relevant repositories, such as [cordova-android] and [cordova-ios]. 79 | 80 | [Overview of Cordova]: http://cordova.apache.org/docs/en/latest/guide/overview/ 81 | [Create your first Cordova app]: http://cordova.apache.org/docs/en/latest/guide/cli/index.html 82 | [Reference docs]: http://cordova.apache.org/docs/en/latest/cordova-cli/index.html 83 | [Supported platforms]: http://cordova.apache.org/docs/en/latest/guide/support/index.html 84 | [Project directory structure]: http://cordova.apache.org/docs/en/latest/cordova-cli/index.html#directory-structure 85 | [Contribute]: http://cordova.apache.org/contribute/ 86 | [Reporting issues]: http://cordova.apache.org/contribute/issues.html 87 | [cordova-lib]: https://github.com/apache/cordova-lib 88 | [cordova-android]: https://github.com/apache/cordova-android 89 | [cordova-ios]: https://github.com/apache/cordova-ios 90 | -------------------------------------------------------------------------------- /scripts/cordova.completion: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | platforms() { 19 | get_cordova && COMPREPLY=( $(compgen -W "$(${CORDOVA_BIN} platform ls | tr -d "[]',")" -- $1) ) 20 | } 21 | 22 | plugins() { 23 | get_cordova && COMPREPLY=( $(compgen -W "$(${CORDOVA_BIN} plugin ls | tr -d "[]',")" -- $1) ) 24 | } 25 | 26 | get_cordova() { 27 | local cordova 28 | if [[ -n "${CORDOVA_BIN}" ]]; then return 0; fi 29 | cordova=$(eval echo ${COMP_WORDS[0]}) 30 | if [[ -x $cordova ]]; then CORDOVA_BIN=$cordova; return 0; fi 31 | cordova=$(which cordova) 32 | if [[ $? -eq 0 ]]; then CORDOVA_BIN=$cordova; return 0; fi 33 | return 1 34 | } 35 | 36 | get_top_level_dir() { 37 | local path 38 | path=$(pwd) 39 | while [ $path != '/' ]; do 40 | if [ -d $path/.cordova ]; then 41 | echo $path 42 | return 0 43 | fi 44 | path=$(dirname $path) 45 | done 46 | return 1 47 | } 48 | 49 | _cordova() 50 | { 51 | local cur prev opts 52 | COMPREPLY=() 53 | cur="${COMP_WORDS[COMP_CWORD]}" 54 | 55 | # Skip over any initial command line switches 56 | local i=1 57 | while [[ $i -lt ${#COMP_WORDS[*]} ]] && [[ "${COMP_WORDS[${i}]}" == -* ]]; do 58 | i=$((i+1)); 59 | done 60 | 61 | # For the first word, supply all of the valid top-level commands 62 | if [[ ${COMP_CWORD} -eq $i ]]; then 63 | opts="create platform plugin prepare compile build emulate serve" 64 | COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) 65 | return 0 66 | fi 67 | 68 | case "${COMP_WORDS[$i]}" in 69 | create) 70 | if [[ ${COMP_CWORD} -eq $((i+1)) ]]; then 71 | COMPREPLY=( $(compgen -d -- ${cur}) ) 72 | return 0 73 | fi 74 | ;; 75 | platform) 76 | if [[ ${COMP_CWORD} -eq $((i+1)) ]]; then 77 | opts="add rm remove ls" 78 | COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) 79 | return 0 80 | fi 81 | case "${COMP_WORDS[$((i+1))]}" in 82 | add) 83 | opts="ios android wp7 wp8 blackberry www" 84 | COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) 85 | return 0; 86 | ;; 87 | rm|remove) 88 | platforms ${cur} 89 | return 0 90 | ;; 91 | esac 92 | ;; 93 | plugin) 94 | if [[ ${COMP_CWORD} -eq $((i+1)) ]]; then 95 | opts="add rm remove ls" 96 | COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) 97 | return 0 98 | fi 99 | case "${COMP_WORDS[$((i+1))]}" in 100 | add) 101 | COMPREPLY=( $(compgen nospace -d -- ${cur}) ) 102 | return 0; 103 | ;; 104 | rm|remove) 105 | plugins ${cur} 106 | return 0 107 | ;; 108 | esac 109 | ;; 110 | prepare|compile|build|emulate) 111 | platforms ${cur} 112 | return 0 113 | ;; 114 | serve) 115 | if [[ ${COMP_CWORD} -eq $((i+1)) ]]; then 116 | platforms ${cur} 117 | return 0 118 | fi 119 | ;; 120 | esac 121 | } 122 | complete -F _cordova cordova 123 | -------------------------------------------------------------------------------- /src/info.js: -------------------------------------------------------------------------------- 1 | /** 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | const fs = require('node:fs'); 21 | const path = require('node:path'); 22 | const execa = require('execa'); 23 | const { osInfo } = require('systeminformation'); 24 | const { cordova, cordova_platforms: { getPlatformApi } } = require('cordova-lib'); 25 | 26 | const cdvLibUtil = require('cordova-lib/src/cordova/util'); 27 | const cdvPluginUtil = require('cordova-lib/src/cordova/plugin/util'); 28 | 29 | // Cache 30 | let _installedPlatformsList = null; 31 | 32 | /* 33 | * Sections 34 | */ 35 | 36 | async function getCordovaDependenciesInfo () { 37 | // get self "Cordova CLI" 38 | const cliPkg = require('../package'); 39 | const cliDependencies = await _getLibDependenciesInfo(cliPkg.dependencies); 40 | 41 | const libPkg = require('cordova-lib/package'); 42 | const cliLibDep = cliDependencies.find(({ key }) => key === 'lib'); 43 | cliLibDep.children = await _getLibDependenciesInfo(libPkg.dependencies); 44 | 45 | return { 46 | key: 'Cordova Packages', 47 | children: [{ 48 | key: 'cli', 49 | value: cliPkg.version, 50 | children: cliDependencies 51 | }] 52 | }; 53 | } 54 | 55 | async function getInstalledPlatforms (projectRoot) { 56 | return _getInstalledPlatforms(projectRoot).then(platforms => { 57 | const key = 'Project Installed Platforms'; 58 | const children = Object.entries(platforms) 59 | .map(([key, value]) => ({ key, value })); 60 | 61 | return { key, children }; 62 | }); 63 | } 64 | 65 | async function getInstalledPlugins (projectRoot) { 66 | const key = 'Project Installed Plugins'; 67 | const children = cdvPluginUtil.getInstalledPlugins(projectRoot) 68 | .map(plugin => ({ key: plugin.id, value: plugin.version })); 69 | 70 | return { key, children }; 71 | } 72 | 73 | async function getEnvironmentInfo () { 74 | const [npmVersion, osInfoResult] = await Promise.all([_getNpmVersion(), osInfo()]); 75 | const { platform, distro, release, codename, kernel, arch, build } = osInfoResult; 76 | 77 | const optionalBuildSuffix = build ? ` (${build})` : ''; 78 | 79 | const osFormat = [ 80 | platform === 'darwin' ? codename : distro, 81 | release + optionalBuildSuffix, 82 | `(${platform} ${kernel})`, 83 | `${arch}` 84 | ]; 85 | 86 | return { 87 | key: 'Environment', 88 | children: [ 89 | { key: 'OS', value: osFormat.join(' ') }, 90 | { key: 'Node', value: process.version }, 91 | { key: 'npm', value: npmVersion } 92 | ] 93 | }; 94 | } 95 | 96 | async function getPlatformEnvironmentData (projectRoot) { 97 | const installedPlatforms = await _getInstalledPlatforms(projectRoot); 98 | 99 | return Object.keys(installedPlatforms) 100 | .map(platform => { 101 | const platformApi = getPlatformApi(platform); 102 | 103 | const getPlatformInfo = platformApi && platformApi.getEnvironmentInfo 104 | ? () => platformApi.getEnvironmentInfo() 105 | : _legacyPlatformInfo[platform]; 106 | 107 | return { platform, getPlatformInfo }; 108 | }) 109 | .filter(o => o.getPlatformInfo) 110 | .map(async ({ platform, getPlatformInfo }) => ({ 111 | key: `${platform} Environment`, 112 | children: await getPlatformInfo() 113 | })); 114 | } 115 | 116 | async function getProjectSettingsFiles (projectRoot) { 117 | const cfgXml = _fetchFileContents(cdvLibUtil.projectConfig(projectRoot)); 118 | 119 | // Create package.json snippet 120 | const pkgJson = require(path.join(projectRoot, 'package')); 121 | const pkgSnippet = [ 122 | '--- Start of Cordova JSON Snippet ---', 123 | JSON.stringify(pkgJson.cordova, null, 2), 124 | '--- End of Cordova JSON Snippet ---' 125 | ].join('\n'); 126 | 127 | return { 128 | key: 'Project Setting Files', 129 | children: [ 130 | { key: 'config.xml', value: `${cfgXml}` }, 131 | { key: 'package.json', value: pkgSnippet } 132 | ] 133 | }; 134 | } 135 | 136 | /* 137 | * Section Data Helpers 138 | */ 139 | 140 | async function _getLibDependenciesInfo (dependencies) { 141 | const cordovaPrefix = 'cordova-'; 142 | const versionFor = name => require(`${name}/package`).version; 143 | 144 | return Object.keys(dependencies) 145 | .filter(name => name.startsWith(cordovaPrefix)) 146 | .map(name => ({ key: name.slice(cordovaPrefix.length), value: versionFor(name) })); 147 | } 148 | 149 | async function _getInstalledPlatforms (projectRoot) { 150 | if (!_installedPlatformsList) { 151 | _installedPlatformsList = await cdvLibUtil.getInstalledPlatformsWithVersions(projectRoot); 152 | } 153 | return _installedPlatformsList; 154 | } 155 | 156 | async function _getNpmVersion () { 157 | return (await execa('npm', ['-v'])).stdout; 158 | } 159 | 160 | function _fetchFileContents (filePath) { 161 | if (!fs.existsSync(filePath)) return 'File Not Found'; 162 | 163 | return fs.readFileSync(filePath, 'utf-8'); 164 | } 165 | 166 | /** 167 | * @deprecated will be removed when platforms implement the calls. 168 | */ 169 | const _legacyPlatformInfo = { 170 | ios: async () => [{ 171 | key: 'xcodebuild', 172 | value: await _failSafeSpawn('xcodebuild', ['-version']) 173 | }], 174 | android: async () => [{ 175 | key: 'android', 176 | value: await _failSafeSpawn('avdmanager', ['list', 'target']) 177 | }] 178 | }; 179 | 180 | const _failSafeSpawn = (command, args) => execa(command, args).then( 181 | ({ stdout }) => stdout, 182 | err => `ERROR: ${err.message}` 183 | ); 184 | 185 | function _formatNodeList (list, level = 0) { 186 | const content = []; 187 | 188 | for (const item of list) { 189 | const indent = String.prototype.padStart((4 * level), ' '); 190 | let itemString = `${indent}${item.key}:`; 191 | 192 | if ('value' in item) { 193 | // Pad multi-line values with a new line on either end 194 | itemString += (/[\r\n]/.test(item.value)) 195 | ? `\n${item.value.trim()}\n` 196 | : ` ${item.value}`; 197 | } else { 198 | // Start of section 199 | itemString = `\n${itemString}\n`; 200 | } 201 | 202 | content.push(itemString); 203 | 204 | if (item.children) { 205 | content.push(..._formatNodeList(item.children, level + 1)); 206 | } 207 | } 208 | 209 | return content; 210 | } 211 | 212 | module.exports = async function () { 213 | const projectRoot = cdvLibUtil.cdProjectRoot(); 214 | 215 | const results = await Promise.all([ 216 | getCordovaDependenciesInfo(), 217 | getInstalledPlatforms(projectRoot), 218 | getInstalledPlugins(projectRoot), 219 | getEnvironmentInfo(), 220 | ...(await getPlatformEnvironmentData(projectRoot)), 221 | getProjectSettingsFiles(projectRoot) 222 | ]); 223 | 224 | const content = _formatNodeList(results); 225 | cordova.emit('results', content.join('\n')); 226 | }; 227 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /src/cli.js: -------------------------------------------------------------------------------- 1 | /** 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | const nopt = require('nopt'); 21 | const pkg = require('../package.json'); 22 | const help = require('./help'); 23 | const info = require('./info'); 24 | const cordova_lib = require('cordova-lib'); 25 | const CordovaError = cordova_lib.CordovaError; 26 | const cordova = cordova_lib.cordova; 27 | const events = cordova_lib.events; 28 | const logger = require('cordova-common').CordovaLogger.get(); 29 | const cordovaCreate = require('cordova-create'); 30 | const Configstore = require('configstore'); 31 | const conf = new Configstore(pkg.name + '-config'); 32 | const editor = require('editor'); 33 | const semver = require('semver'); 34 | 35 | // process.version is not declared writable or has no setter so storing in const for Jasmine. 36 | const NODE_VERSION = process.version; 37 | 38 | // When there is no node version in the deprecation stage, set to null or false. 39 | const NODE_VERSION_REQUIREMENT = false; 40 | const NODE_VERSION_DEPRECATING_RANGE = '<10'; 41 | 42 | const knownOpts = { 43 | verbose: Boolean, 44 | version: Boolean, 45 | help: Boolean, 46 | silent: Boolean, 47 | experimental: Boolean, 48 | noregistry: Boolean, 49 | nohooks: Array, 50 | shrinkwrap: Boolean, 51 | searchpath: String, 52 | variable: Array, 53 | link: Boolean, 54 | force: Boolean, 55 | 'save-exact': Boolean, 56 | // Flags to be passed to `cordova build/run/emulate` 57 | debug: Boolean, 58 | release: Boolean, 59 | archs: String, 60 | device: Boolean, 61 | emulator: Boolean, 62 | target: String, 63 | noprepare: Boolean, 64 | nobuild: Boolean, 65 | list: Boolean, 66 | buildConfig: String, 67 | template: String, 68 | production: Boolean, 69 | noprod: Boolean 70 | }; 71 | 72 | const shortHands = { 73 | d: '--verbose', 74 | v: '--version', 75 | h: '--help', 76 | t: '--template' 77 | }; 78 | 79 | module.exports = function (inputArgs) { 80 | // If no inputArgs given, use process.argv. 81 | inputArgs = inputArgs || process.argv; 82 | let cmd = inputArgs[2]; // e.g: inputArgs= 'node cordova run ios' 83 | const isConfigCmd = (cmd === 'config'); 84 | 85 | // ToDO: Move nopt-based parsing of args up here 86 | if (cmd === '--version' || cmd === '-v') { 87 | cmd = 'version'; 88 | } else if (!cmd || cmd === '--help' || cmd === 'h') { 89 | cmd = 'help'; 90 | } 91 | 92 | // If "get" is called 93 | if (isConfigCmd && inputArgs[3] === 'get') { 94 | if (inputArgs[4]) { 95 | logger.subscribe(events); 96 | conf.get(inputArgs[4]); 97 | if (conf.get(inputArgs[4]) !== undefined) { 98 | events.emit('log', conf.get(inputArgs[4]).toString()); 99 | } else { 100 | events.emit('log', 'undefined'); 101 | } 102 | } 103 | } 104 | 105 | // If "set" is called 106 | if (isConfigCmd && inputArgs[3] === 'set') { 107 | if (inputArgs[5] === undefined) { 108 | conf.set(inputArgs[4], true); 109 | } 110 | 111 | if (inputArgs[5]) { 112 | conf.set(inputArgs[4], inputArgs[5]); 113 | } 114 | } 115 | 116 | // If "delete" is called 117 | if (isConfigCmd && inputArgs[3] === 'delete') { 118 | if (inputArgs[4]) { 119 | conf.delete(inputArgs[4]); 120 | } 121 | } 122 | 123 | // If "edit" is called 124 | if (isConfigCmd && inputArgs[3] === 'edit') { 125 | editor(conf.path, function (code, sig) { 126 | logger.warn('Finished editing with code ' + code); 127 | }); 128 | } 129 | 130 | // If "ls" is called 131 | if (isConfigCmd && (inputArgs[3] === 'ls' || inputArgs[3] === 'list')) { 132 | logger.results(JSON.stringify(conf.all, null, 4)); 133 | } 134 | 135 | return Promise.resolve().then(function () { 136 | return cli(inputArgs); 137 | }); 138 | }; 139 | 140 | function printHelp (command) { 141 | const result = help([command]); 142 | cordova.emit('results', result); 143 | } 144 | 145 | function cli (inputArgs) { 146 | const args = nopt(knownOpts, shortHands, inputArgs); 147 | 148 | process.on('uncaughtException', function (err) { 149 | if (err.message) { 150 | logger.error(err.message); 151 | } else { 152 | logger.error(err); 153 | } 154 | process.exit(1); 155 | }); 156 | 157 | logger.subscribe(events); 158 | 159 | if (args.silent) { 160 | logger.setLevel('error'); 161 | } else if (args.verbose) { // can't be both silent AND verbose, silent wins 162 | logger.setLevel('verbose'); 163 | } 164 | 165 | const cliVersion = pkg.version; 166 | const usingPrerelease = !!semver.prerelease(cliVersion); 167 | if (args.version || usingPrerelease) { 168 | const libVersion = require('cordova-lib/package').version; 169 | let toPrint = cliVersion; 170 | if (cliVersion !== libVersion || usingPrerelease) { 171 | toPrint += ' (cordova-lib@' + libVersion + ')'; 172 | } 173 | 174 | if (args.version) { 175 | logger.results(toPrint); 176 | return Promise.resolve(); // Important! this will return and cease execution 177 | } else { // must be usingPrerelease 178 | // Show a warning and continue 179 | logger.warn('Warning: using prerelease version ' + toPrint); 180 | } 181 | } 182 | 183 | let warningPartial = null; 184 | 185 | // If the Node.js versions does not meet our requirements or in a deprecation stage, display a warning. 186 | if ( 187 | NODE_VERSION_REQUIREMENT && 188 | !semver.satisfies(NODE_VERSION, NODE_VERSION_REQUIREMENT) 189 | ) { 190 | warningPartial = 'is no longer supported'; 191 | } else if ( 192 | NODE_VERSION_DEPRECATING_RANGE && 193 | semver.satisfies(NODE_VERSION, NODE_VERSION_DEPRECATING_RANGE) 194 | ) { 195 | warningPartial = 'has been deprecated'; 196 | } 197 | 198 | if (warningPartial) { 199 | const upgradeMsg = 'Please upgrade to the latest Node.js version available (LTS version recommended).'; 200 | logger.warn(`Warning: Node.js ${NODE_VERSION} ${warningPartial}. ${upgradeMsg}`); 201 | } 202 | 203 | // If there were arguments protected from nopt with a double dash, keep 204 | // them in unparsedArgs. For example: 205 | // cordova build ios -- --verbose --whatever 206 | // In this case "--verbose" is not parsed by nopt and args.vergbose will be 207 | // false, the unparsed args after -- are kept in unparsedArgs and can be 208 | // passed downstream to some scripts invoked by Cordova. 209 | let unparsedArgs = []; 210 | const parseStopperIdx = args.argv.original.indexOf('--'); 211 | if (parseStopperIdx !== -1) { 212 | unparsedArgs = args.argv.original.slice(parseStopperIdx + 1); 213 | } 214 | 215 | // args.argv.remain contains both the undashed args (like platform names) 216 | // and whatever unparsed args that were protected by " -- ". 217 | // "undashed" stores only the undashed args without those after " -- " . 218 | const remain = args.argv.remain; 219 | const undashed = remain.slice(0, remain.length - unparsedArgs.length); 220 | const cmd = undashed[0]; 221 | let subcommand; 222 | 223 | if (!cmd || cmd === 'help' || args.help) { 224 | if (!args.help && remain[0] === 'help') { 225 | remain.shift(); 226 | } 227 | return printHelp(remain); 228 | } 229 | 230 | if (cmd === 'info') return info(); 231 | 232 | // Don't need to do anything with cordova-lib since config was handled above 233 | if (cmd === 'config') return true; 234 | 235 | if (cmd === 'create') { 236 | const [, dest, id, name] = undashed; 237 | return cordovaCreate(dest, { id, name, events, template: args.template }); 238 | } 239 | 240 | if (!Object.prototype.hasOwnProperty.call(cordova, cmd)) { 241 | const msg2 = 'Cordova does not know ' + cmd + '; try `' + cordova_lib.binname + 242 | ' help` for a list of all the available commands.'; 243 | throw new CordovaError(msg2); 244 | } 245 | 246 | const opts = { 247 | platforms: [], 248 | options: [], 249 | verbose: args.verbose || false, 250 | silent: args.silent || false, 251 | nohooks: args.nohooks || [], 252 | searchpath: args.searchpath 253 | }; 254 | 255 | const platformCommands = ['emulate', 'build', 'prepare', 'compile', 'run', 'clean']; 256 | if (platformCommands.indexOf(cmd) !== -1) { 257 | // All options without dashes are assumed to be platform names 258 | opts.platforms = undashed.slice(1); 259 | 260 | // Pass nopt-parsed args to PlatformApi through opts.options 261 | opts.options = args; 262 | opts.options.argv = unparsedArgs; 263 | 264 | return cordova[cmd].call(null, opts); 265 | } else if (cmd === 'requirements') { 266 | // All options without dashes are assumed to be platform names 267 | opts.platforms = undashed.slice(1); 268 | 269 | return cordova[cmd].call(null, opts.platforms) 270 | .then(function (platformChecks) { 271 | const someChecksFailed = Object.keys(platformChecks).map(function (platformName) { 272 | events.emit('log', '\nRequirements check results for ' + platformName + ':'); 273 | const platformCheck = platformChecks[platformName]; 274 | if (platformCheck instanceof CordovaError) { 275 | events.emit('warn', 'Check failed for ' + platformName + ' due to ' + platformCheck); 276 | return true; 277 | } 278 | 279 | let someChecksFailed = false; 280 | 281 | // platformCheck is expected to be an array of conditions that must be met 282 | // the browser platform currently returns nothing, which was breaking here. 283 | if (platformCheck && platformCheck.forEach) { 284 | platformCheck.forEach(function (checkItem) { 285 | const checkSummary = checkItem.name + ': ' + 286 | (checkItem.installed ? 'installed ' : 'not installed ') + 287 | (checkItem.installed ? checkItem.metadata.version.version || checkItem.metadata.version : ''); 288 | events.emit('log', checkSummary); 289 | if (!checkItem.installed) { 290 | someChecksFailed = true; 291 | events.emit('warn', checkItem.metadata.reason); 292 | } 293 | }); 294 | } 295 | return someChecksFailed; 296 | }).some(function (isCheckFailedForPlatform) { 297 | return isCheckFailedForPlatform; 298 | }); 299 | 300 | if (someChecksFailed) { 301 | throw new CordovaError('Some of requirements check failed'); 302 | } 303 | }); 304 | } else if (cmd === 'serve') { 305 | const port = undashed[1]; 306 | return cordova.serve(port); 307 | } else { 308 | // platform/plugins add/rm [target(s)] 309 | subcommand = undashed[1]; // sub-command like "add", "ls", "rm" etc. 310 | const targets = undashed.slice(2); // array of targets, either platforms or plugins 311 | const cli_vars = {}; 312 | if (args.variable) { 313 | args.variable.forEach(function (strVar) { 314 | // CB-9171 315 | const keyVal = strVar.split('='); 316 | if (keyVal.length < 2) { 317 | throw new CordovaError('invalid variable format: ' + strVar); 318 | } else { 319 | const key = keyVal.shift().toUpperCase(); 320 | const val = keyVal.join('='); 321 | cli_vars[key] = val; 322 | } 323 | }); 324 | } 325 | 326 | args.save = !args.nosave; 327 | args.production = !args.noprod; 328 | 329 | if (args.searchpath === undefined) { 330 | // User explicitly did not pass in searchpath 331 | args.searchpath = conf.get('searchpath'); 332 | } 333 | if (args['save-exact'] === undefined) { 334 | // User explicitly did not pass in save-exact 335 | args['save-exact'] = conf.get('save-exact'); 336 | } 337 | 338 | const download_opts = { 339 | searchpath: args.searchpath, 340 | noregistry: args.noregistry, 341 | nohooks: args.nohooks, 342 | cli_variables: cli_vars, 343 | link: args.link || false, 344 | save: args.save, 345 | save_exact: args['save-exact'] || false, 346 | shrinkwrap: args.shrinkwrap || false, 347 | force: args.force || false, 348 | production: args.production 349 | }; 350 | return cordova[cmd](subcommand, targets, download_opts); 351 | } 352 | } 353 | -------------------------------------------------------------------------------- /spec/cli.spec.js: -------------------------------------------------------------------------------- 1 | /** 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | const path = require('node:path'); 21 | const rewire = require('rewire'); 22 | const { events, cordova } = require('cordova-lib'); 23 | 24 | describe('cordova cli', () => { 25 | let cli, logger; 26 | 27 | beforeEach(() => { 28 | cli = rewire('../src/cli'); 29 | 30 | // Event registration is currently process-global. Since all jasmine 31 | // tests in a directory run in a single process (and in parallel), 32 | // logging events registered as a result of the "--verbose" flag in 33 | // CLI testing below would cause lots of logging messages printed out by other specs. 34 | 35 | // Prevent listeners from piling up 36 | spyOn(process, 'on'); 37 | events.removeAllListeners(); 38 | 39 | // Spy and mute output 40 | logger = jasmine.createSpyObj('logger', [ 41 | 'subscribe', 'setLevel', 'results', 'warn' 42 | ]); 43 | cli.__set__({ logger }); 44 | spyOn(console, 'log'); 45 | }); 46 | 47 | describe('options', () => { 48 | describe('version', () => { 49 | const version = require('../package').version; 50 | 51 | it('Test#001 : will spit out the version with -v', () => { 52 | return cli(['node', 'cordova', '-v']).then(() => { 53 | expect(logger.results.calls.mostRecent().args[0]).toMatch(version); 54 | }); 55 | }, 60000); 56 | 57 | it('Test#002 : will spit out the version with --version', () => { 58 | return cli(['node', 'cordova', '--version']).then(() => { 59 | expect(logger.results.calls.mostRecent().args[0]).toMatch(version); 60 | }); 61 | }, 60000); 62 | 63 | it('Test#003 : will spit out the version with -v anywhere', () => { 64 | return cli(['node', 'cordova', 'one', '-v', 'three']).then(() => { 65 | expect(logger.results.calls.mostRecent().args[0]).toMatch(version); 66 | }); 67 | }, 60000); 68 | }); 69 | }); 70 | 71 | describe('build', () => { 72 | beforeEach(() => { 73 | spyOn(cordova, 'build').and.returnValue(Promise.resolve()); 74 | }); 75 | 76 | it('Test#005 : will call command with all arguments passed through', () => { 77 | return cli(['node', 'cordova', 'build', 'blackberry10', '--', '-k', 'abcd1234']).then(() => { 78 | expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { argv: ['-k', 'abcd1234'] }, verbose: false, silent: false, nohooks: [], searchpath: undefined }); 79 | }); 80 | }, 60000); 81 | 82 | it('Test#006 : will consume the first instance of -d', () => { 83 | return cli(['node', 'cordova', '-d', 'build', 'blackberry10', '--', '-k', 'abcd1234', '-d']).then(() => { 84 | expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { verbose: true, argv: ['-k', 'abcd1234', '-d'] }, verbose: true, silent: false, nohooks: [], searchpath: undefined }); 85 | }); 86 | }); 87 | 88 | it('Test#007 : will consume the first instance of --verbose', () => { 89 | return cli(['node', 'cordova', '--verbose', 'build', 'blackberry10', '--', '-k', 'abcd1234', '--verbose']).then(() => { 90 | expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { verbose: true, argv: ['-k', 'abcd1234', '--verbose'] }, verbose: true, silent: false, nohooks: [], searchpath: undefined }); 91 | }); 92 | }); 93 | 94 | it('Test#008 : will consume the first instance of either --verbose or -d', () => { 95 | return cli(['node', 'cordova', '--verbose', 'build', 'blackberry10', '--', '-k', 'abcd1234', '-d']).then(() => { 96 | expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { verbose: true, argv: ['-k', 'abcd1234', '-d'] }, verbose: true, silent: false, nohooks: [], searchpath: undefined }); 97 | }); 98 | }); 99 | 100 | it('Test#009 : will consume the first instance of either --verbose or -d', () => { 101 | return cli(['node', 'cordova', '-d', 'build', 'blackberry10', '--', '-k', 'abcd1234', '--verbose']).then(() => { 102 | expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { verbose: true, argv: ['-k', 'abcd1234', '--verbose'] }, verbose: true, silent: false, nohooks: [], searchpath: undefined }); 103 | }); 104 | }); 105 | 106 | it('Test#010 : will consume the first instance of --silent', () => { 107 | return cli(['node', 'cordova', '--silent', 'build', 'blackberry10', '--', '-k', 'abcd1234', '--silent']).then(() => { 108 | expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { silent: true, argv: ['-k', 'abcd1234', '--silent'] }, verbose: false, silent: true, nohooks: [], searchpath: undefined }); 109 | }); 110 | }); 111 | }); 112 | 113 | describe('create', () => { 114 | beforeEach(() => { 115 | cli.__set__({ 116 | cordovaCreate: jasmine.createSpy('cordovaCreate').and.resolveTo() 117 | }); 118 | }); 119 | 120 | it('Test#011 : calls cordova create', async () => { 121 | const dest = 'a'; 122 | const opts = { id: 'b', name: 'c', template: '../my-template' }; 123 | await cli(['node', 'cordova', 'create', dest, opts.id, opts.name, '--template', opts.template]); 124 | 125 | expect(cli.__get__('cordovaCreate')).toHaveBeenCalledWith( 126 | dest, jasmine.objectContaining(opts) 127 | ); 128 | }); 129 | }); 130 | 131 | describe('plugin', () => { 132 | beforeEach(() => { 133 | spyOn(cordova, 'plugin').and.returnValue(Promise.resolve()); 134 | }); 135 | 136 | it('Test#012 : will pass variables', () => { 137 | return cli(['node', 'cordova', 'plugin', 'add', 'facebook', '--variable', 'FOO=foo']).then(() => { 138 | expect(cordova.plugin).toHaveBeenCalledWith( 139 | 'add', 140 | ['facebook'], 141 | jasmine.any(Object) 142 | ); 143 | const opts = cordova.plugin.calls.argsFor(0)[2]; 144 | expect(opts.cli_variables.FOO).toBe('foo'); 145 | }); 146 | }); 147 | 148 | it('Test#013 : will support variables with =', () => { 149 | return cli(['node', 'cordova', 'plugin', 'add', 'facebook', '--variable', 'MOTO=DELTA=WAS=HERE']).then(() => { 150 | expect(cordova.plugin).toHaveBeenCalledWith( 151 | 'add', 152 | ['facebook'], 153 | jasmine.any(Object) 154 | ); 155 | const opts = cordova.plugin.calls.argsFor(0)[2]; 156 | expect(opts.cli_variables.MOTO).toBe('DELTA=WAS=HERE'); 157 | }); 158 | }); 159 | 160 | it('Test#014 : will pass hook patterns to suppress', () => { 161 | return cli(['node', 'cordova', 'plugin', 'add', 'facebook', '--nohooks', 'before_plugin_add']).then(() => { 162 | expect(cordova.plugin).toHaveBeenCalledWith( 163 | 'add', 164 | ['facebook'], 165 | jasmine.any(Object) 166 | ); 167 | const opts = cordova.plugin.calls.argsFor(0)[2]; 168 | expect(opts.nohooks[0]).toBe('before_plugin_add'); 169 | }); 170 | }); 171 | 172 | it('Test #015 : (add) will pass save:true', () => { 173 | return cli(['node', 'cordova', 'plugin', 'add', 'device']).then(() => { 174 | expect(cordova.plugin).toHaveBeenCalledWith( 175 | 'add', 176 | ['device'], 177 | jasmine.any(Object) 178 | ); 179 | const opts = cordova.plugin.calls.argsFor(0)[2]; 180 | expect(opts.save).toBe(true); 181 | }); 182 | }); 183 | 184 | it('Test #016 : (add) will pass save:false', () => { 185 | return cli(['node', 'cordova', 'plugin', 'add', 'device', '--nosave']).then(() => { 186 | expect(cordova.plugin).toHaveBeenCalledWith( 187 | 'add', 188 | ['device'], 189 | jasmine.any(Object) 190 | ); 191 | const opts = cordova.plugin.calls.argsFor(0)[2]; 192 | expect(opts.save).toBe(false); 193 | }); 194 | }); 195 | 196 | it('Test #017: (remove) will pass save:false', () => { 197 | return cli(['node', 'cordova', 'plugin', 'remove', 'device', '--nosave']).then(() => { 198 | expect(cordova.plugin).toHaveBeenCalledWith( 199 | 'remove', 200 | ['device'], 201 | jasmine.any(Object) 202 | ); 203 | const opts = cordova.plugin.calls.argsFor(0)[2]; 204 | expect(opts.save).toBe(false); 205 | }); 206 | }); 207 | 208 | it('Test #018 : (remove) autosave is default and will pass save:true', () => { 209 | return cli(['node', 'cordova', 'plugin', 'remove', 'device']).then(() => { 210 | expect(cordova.plugin).toHaveBeenCalledWith( 211 | 'remove', 212 | ['device'], 213 | jasmine.any(Object) 214 | ); 215 | const opts = cordova.plugin.calls.argsFor(0)[2]; 216 | expect(opts.save).toBe(true); 217 | }); 218 | }); 219 | 220 | it('(add) will pass save-exact:true', () => { 221 | return cli(['node', 'cordova', 'plugin', 'add', 'device', '--save-exact']).then(() => { 222 | expect(cordova.plugin).toHaveBeenCalledWith( 223 | 'add', 224 | ['device'], 225 | jasmine.any(Object) 226 | ); 227 | const opts = cordova.plugin.calls.argsFor(0)[2]; 228 | expect(opts.save_exact).toBe(true); 229 | }); 230 | }); 231 | 232 | it('(add) will pass noprod:true and production:false', () => { 233 | return cli(['node', 'cordova', 'plugin', 'add', 'device', '--noprod']).then(() => { 234 | expect(cordova.plugin).toHaveBeenCalledWith( 235 | 'add', 236 | ['device'], 237 | jasmine.any(Object) 238 | ); 239 | const opts = cordova.plugin.calls.argsFor(0)[2]; 240 | expect(opts.production).toBe(false); 241 | }); 242 | }); 243 | }); 244 | 245 | describe('platform', () => { 246 | beforeEach(() => { 247 | spyOn(cordova, 'platform').and.returnValue(Promise.resolve()); 248 | }); 249 | 250 | it('Test #034 : (add) autosave is the default setting for platform add', () => { 251 | return cli(['node', 'cordova', 'platform', 'add', 'ios']).then(() => { 252 | expect(cordova.platform).toHaveBeenCalledWith( 253 | 'add', 254 | ['ios'], 255 | jasmine.any(Object) 256 | ); 257 | const opts = cordova.platform.calls.argsFor(0)[2]; 258 | expect(opts.save).toBe(true); 259 | }); 260 | }); 261 | 262 | it('Test #035 : (add) platform is not saved when --nosave is passed in', () => { 263 | return cli(['node', 'cordova', 'platform', 'add', 'ios', '--nosave']).then(() => { 264 | expect(cordova.platform).toHaveBeenCalledWith( 265 | 'add', 266 | ['ios'], 267 | jasmine.any(Object) 268 | ); 269 | const opts = cordova.platform.calls.argsFor(0)[2]; 270 | expect(opts.save).toBe(false); 271 | }); 272 | }); 273 | 274 | it('Test #036 : (remove) autosave is the default setting for platform remove', () => { 275 | return cli(['node', 'cordova', 'platform', 'remove', 'ios']).then(() => { 276 | expect(cordova.platform).toHaveBeenCalledWith( 277 | 'remove', 278 | ['ios'], 279 | jasmine.any(Object) 280 | ); 281 | const opts = cordova.platform.calls.argsFor(0)[2]; 282 | expect(opts.save).toBe(true); 283 | }); 284 | }); 285 | 286 | it('Test #037 : (remove) platform is not removed when --nosave is passed in', () => { 287 | return cli(['node', 'cordova', 'platform', 'remove', 'ios', '--nosave']).then(() => { 288 | expect(cordova.platform).toHaveBeenCalledWith( 289 | 'remove', 290 | ['ios'], 291 | jasmine.any(Object) 292 | ); 293 | const opts = cordova.platform.calls.argsFor(0)[2]; 294 | expect(opts.save).toBe(false); 295 | }); 296 | }); 297 | }); 298 | 299 | describe('config', () => { 300 | let clirevert, confrevert, editorArgs, confHolder; 301 | const cordovaConfig = {}; 302 | 303 | const confMock = { 304 | all: cordovaConfig, 305 | set (key, value) { 306 | cordovaConfig[key] = value; 307 | }, 308 | delete (key) { 309 | delete cordovaConfig[key]; 310 | }, 311 | path () { 312 | confHolder = 'Pathcalled'; 313 | return 'some/path/cordova-config.json'; 314 | }, 315 | get (key) { 316 | confHolder = cordovaConfig[key]; 317 | return cordovaConfig[key]; 318 | } 319 | }; 320 | 321 | beforeEach(() => { 322 | clirevert = cli.__set__('editor', (path1, cb) => { 323 | editorArgs = path1(); 324 | cb(); 325 | }); 326 | 327 | confrevert = cli.__set__('conf', confMock); 328 | }); 329 | 330 | afterEach(() => { 331 | clirevert(); 332 | confrevert(); 333 | confHolder = undefined; 334 | }); 335 | 336 | it('Test#042 : config set is called with true', () => { 337 | return cli(['node', 'cordova', 'config', 'set', 'foo', 'true', '--silent']).then(() => { 338 | expect(cordovaConfig.foo).toBe('true'); 339 | }); 340 | }); 341 | 342 | it('Test#043 : config delete is called', () => { 343 | return cli(['node', 'cordova', 'config', 'delete', 'foo']).then(() => { 344 | expect(cordovaConfig.foo).toBeUndefined(); 345 | }); 346 | }); 347 | 348 | it('Test#044 : config set is called even without value, defaults to true', () => { 349 | return cli(['node', 'cordova', 'config', 'set', 'foo']).then(() => { 350 | expect(cordovaConfig.foo).toBe(true); 351 | }); 352 | }); 353 | 354 | it('Test #045 : config get is called', () => { 355 | return cli(['node', 'cordova', 'config', 'get', 'foo']).then(() => { 356 | expect(confHolder).toBe(true); 357 | }); 358 | }); 359 | 360 | it('Test #046 : config edit is called', () => { 361 | return cli(['node', 'cordova', 'config', 'edit']).then(() => { 362 | expect(path.basename(editorArgs)).toEqual('cordova-config.json'); 363 | expect(confHolder).toEqual('Pathcalled'); 364 | }); 365 | }); 366 | 367 | it('Test #047 : config ls is called', () => { 368 | const expectedOutput = JSON.stringify(cordovaConfig, null, 4); 369 | 370 | return cli(['node', 'cordova', 'config', 'ls']).then(() => { 371 | expect(logger.results).toHaveBeenCalledWith(expectedOutput); 372 | }); 373 | }); 374 | }); 375 | 376 | describe('requirements', () => { 377 | beforeEach(() => { 378 | spyOn(cordova, 'requirements').and.returnValue(Promise.resolve({ browser: [] })); 379 | }); 380 | 381 | it('should succeed on browser as the platform argument to the requirement check method.', () => { 382 | return cli(['node', 'cordova', 'requirements', 'browser']).then(() => { 383 | expect(cordova.requirements).toHaveBeenCalledWith(['browser']); 384 | }); 385 | }); 386 | }); 387 | 388 | describe('node requirement', () => { 389 | it('should warn users about unsupported node version', () => { 390 | cli.__set__('NODE_VERSION', 'v6.1.0'); 391 | cli.__set__('NODE_VERSION_DEPRECATING_RANGE', null); 392 | cli.__set__('NODE_VERSION_REQUIREMENT', '>=8'); 393 | 394 | return cli(['node', 'cordova']).then(() => { 395 | const errorMsg = logger.warn.calls.allArgs().toString(); 396 | expect(errorMsg).toMatch(/Node.js v6.1.0 is no longer supported./); 397 | }); 398 | }); 399 | 400 | it('should not warn users about unsupported node version', () => { 401 | cli.__set__('NODE_VERSION', 'v8.0.0'); 402 | cli.__set__('NODE_VERSION_DEPRECATING_RANGE', null); 403 | cli.__set__('NODE_VERSION_REQUIREMENT', '>=8'); 404 | 405 | return cli(['node', 'cordova']).then(() => { 406 | const errorMsg = logger.warn.calls.allArgs().toString(); 407 | expect(errorMsg).not.toMatch(/Node.js v6.1.0 is no longer supported./); 408 | }); 409 | }); 410 | 411 | it('should warn users about deprecated node version', () => { 412 | cli.__set__('NODE_VERSION', 'v8.0.0'); 413 | cli.__set__('NODE_VERSION_DEPRECATING_RANGE', '<10'); 414 | cli.__set__('NODE_VERSION_REQUIREMENT', '>=8'); 415 | 416 | return cli(['node', 'cordova']).then(() => { 417 | const errorMsg = logger.warn.calls.allArgs().toString(); 418 | expect(errorMsg).toMatch(/Node.js v8.0.0 has been deprecated./); 419 | }); 420 | }); 421 | 422 | it('should warn users about deprecated node version', () => { 423 | cli.__set__('NODE_VERSION', 'v10.0.0'); 424 | cli.__set__('NODE_VERSION_DEPRECATING_RANGE', '<10'); 425 | cli.__set__('NODE_VERSION_REQUIREMENT', '>=8'); 426 | 427 | return cli(['node', 'cordova']).then(() => { 428 | const errorMsg = logger.warn.calls.allArgs().toString(); 429 | expect(errorMsg).not.toMatch(/Node.js v8.0.0 has been deprecated./); 430 | }); 431 | }); 432 | }); 433 | }); 434 | -------------------------------------------------------------------------------- /doc/readme.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CLI Commands 3 | description: Learn how to use Cordova CLI commands and their options. 4 | --- 5 | 6 | 26 | 27 | # Cordova Command-line-interface (CLI) Commands 28 | 29 | ## CLI Syntax 30 | 31 | ```bash 32 | cordova [options] -- [platformOpts] 33 | ``` 34 | 35 | ## Global Command List 36 | 37 | These commands are available at all times. 38 | 39 | | Command | Description 40 | |----------|-------------- 41 | | `create` | Create a project 42 | | `help ` | Get help for a command 43 | | `config` | Set, get, delete, edit, and list global cordova options 44 | 45 | ## Project Command List 46 | 47 | These commands are supported when the current working directory is a valid Cordova project. 48 | 49 | | Command | Description 50 | |--------------|-------------- 51 | | `info` | Generate project information 52 | | `requirements` | Checks and print out all the installation requirements for platforms specified 53 | | `platform` | Manage project platforms 54 | | `plugin` | Manage project plugins 55 | | `prepare` | Copy files into platform(s) for building 56 | | `compile` | Compile project for platform(s) 57 | | `build` | Build project for platform(s) (`prepare` + `compile`) 58 | | `clean` | Cleanup project from build artifacts 59 | | `run` | Run project (including prepare && compile) 60 | | `serve` | Run project with a local webserver (including prepare) 61 | 62 | ## Common options 63 | 64 | These options apply to all cordova-cli commands. 65 | 66 | | Option | Description 67 | |----------------------|------------------------ 68 | | -d or --verbose | Pipe out more verbose output to your shell. You can also subscribe to `log` and `warn` events if you are consuming `cordova-cli` as a node module by calling `cordova.on('log', function() {})` or `cordova.on('warn', function() {})`. 69 | | -v or --version | Print out the version of your `cordova-cli` install. 70 | |--nohooks | Suppress executing hooks (taking RegExp hook patterns as parameters) 71 | 72 | ## Platform-specific options 73 | 74 | Certain commands have options (`platformOpts`) that are specific to a particular platform. They can be provided to the cordova-cli with a '--' separator that stops the command parsing within the cordova-lib module and passes through rest of the options for platforms to parse. 75 | 76 | ## CLI Usage Example 77 | 78 | The following example illustrates how to utilize Cordova CLI to perform various tasks such as: 79 | 80 | - Creating a project 81 | - Adding the `camera` plugin 82 | - Adding, building, and running the project on the `android` platform 83 | 84 | Additionally, it includes an example showcasing the usage of specific options provided by the Cordova-Android platform, such as `--keystore`, which is utilized for release signing. 85 | 86 | 1. Create a cordova project 87 | 88 | ```bash 89 | cordova create myApp com.myCompany.myApp myApp 90 | cd myApp 91 | ``` 92 | 93 | 2. Add Camera Plugin to the Project 94 | 95 | ```bash 96 | cordova plugin add cordova-plugin-camera 97 | ``` 98 | 99 | 3. Add Android Platform to the Project 100 | 101 | ```bash 102 | cordova platform add android 103 | ``` 104 | 105 | 4. Confirm System is Configured with Android Platform Requirements 106 | 107 | ```bash 108 | cordova requirements android 109 | ``` 110 | 111 | 5. Build Project for Android with Verbose Logging Enabled 112 | 113 | ```bash 114 | cordova build android --verbose 115 | ``` 116 | 117 | 6. Run Project on Android Platform 118 | 119 | ```bash 120 | cordova run android 121 | ``` 122 | 123 | 7. Build Project for Android in Release Mode with Signing Parameters 124 | 125 | ```bash 126 | cordova build android --release -- --keystore="..\android.keystore" --storePassword=android --alias=mykey 127 | ``` 128 | 129 | ## `cordova create` command 130 | 131 | Creates the directory structure for the Cordova project in the specified path. 132 | 133 | **Command Syntax:** 134 | 135 | ```bash 136 | cordova create path [id [name]] [options] 137 | ``` 138 | 139 | **Arguments:** 140 | 141 | | Value | Description | 142 | |-------|---------------| 143 | | path | Directory which should not already exist. Cordova will create this directory. For more details on the directory structure, see below. | 144 | | id | _Default_: `org.apache.cordova.hellocordova`
Reverse domain-style identifier that maps to `id` attribute of `widget` element in `config.xml`. This can be changed but there may be code generated using this value, such as Java package names. It is recommended that you select an appropriate value. | 145 | | name | _Default_: `Hello Cordova`
Application's display title that maps `name` element in `config.xml` file. This can be changed but there may be code generated using this value, such as Java class names. The default value is `Hello Cordova`, but it is recommended that you select an appropriate value. | 146 | 147 | **Options:** 148 | 149 | | Option | Description | 150 | |--------|-------------| 151 | | --template | Use a custom template located locally, in NPM, or GitHub. | 152 | 153 | ### Examples 154 | 155 | - Create a Cordova project in `myapp` directory using the specified ID and display name: 156 | 157 | ```bash 158 | cordova create myapp com.mycompany.myteam.myapp MyApp 159 | ``` 160 | 161 | ## `cordova platform` command 162 | 163 | Manage cordova platforms - allowing you to add, remove, update and list platforms. Running commands to add or remove platforms affects the contents of the project's platforms directory. 164 | 165 | **Command Syntax:** 166 | 167 | ```bash 168 | cordova {platform | platforms} [ 169 | add [...] {--save | link= } | 170 | {remove | rm} platform [...] {--save}| 171 | {list | ls} | 172 | update ] 173 | ``` 174 | 175 | | Sub-command | Option | Description | 176 | ------------------------|-------------|------| 177 | | add `` [...] | | Add specified platforms | 178 | | | --nosave | Do not save `` into `config.xml` & `package.json` after installing them using `` tag | 179 | | | --link=`` | When `` is a local path, links the platform library directly instead of making a copy of it (support varies by platform; useful for platform development) 180 | | remove `` [...] | | Remove specified platforms | 181 | | | --nosave | Do not delete specified platforms from `config.xml` & `package.json` after removing them | 182 | | update `` [...] | | Update specified platforms | 183 | | | --save | Updates the version specified in `config.xml` | 184 | | list | | List all installed and available platforms | 185 | 186 | ### Platform-spec 187 | 188 | There are a number of ways to specify a platform: 189 | 190 | ```text 191 | : platform[@version] | path | url[#commit-ish] 192 | ``` 193 | 194 | | Value | Description | 195 | |-----------|-------------| 196 | | platform | Platform name e.g. android, ios, electron etc. to be added to the project. Every release of cordova CLI pins a version for each platform. When no version is specified this version is used to add the platform. | 197 | | version | Major.minor.patch version specifier using semver | 198 | | path | Path to a directory or tarball containing a platform | 199 | | url | URL to a git repository or tarball containing a platform | 200 | | commit-ish | Commit/tag/branch reference. If none is specified, 'master' is used | 201 | 202 | ### Supported Platforms 203 | 204 | - `android` 205 | - `browser` 206 | - `electron` 207 | - `ios` 208 | 209 | ### Examples 210 | 211 | - Add pinned version of the `android` and `ios` platform and save the downloaded version to `config.xml` & `package.json`: 212 | 213 | ```bash 214 | cordova platform add android ios 215 | ``` 216 | 217 | - Add `android` platform with [semver](http://semver.org/) version ^5.0.0 and save it to `config.xml` & `package.json`: 218 | 219 | ```bash 220 | cordova platform add android@^5.0.0 221 | ``` 222 | 223 | - Add platform by cloning the specified git repo and checkout to the `4.0.0` tag: 224 | 225 | ```bash 226 | cordova platform add https://github.com/myfork/cordova-android.git#4.0.0 227 | ``` 228 | 229 | - Add platform using a local directory named `android`: 230 | 231 | ```bash 232 | cordova platform add ../android 233 | ``` 234 | 235 | - Add platform using the specified tarball: 236 | 237 | ```bash 238 | cordova platform add ../cordova-android.tgz 239 | ``` 240 | 241 | - Remove `android` platform from the project and remove from `config.xml` & `package.json`: 242 | 243 | ```bash 244 | cordova platform rm android 245 | ``` 246 | 247 | - Remove `android` platform from the project and do NOT remove from `config.xml` & `package.json`: 248 | 249 | ```bash 250 | cordova platform rm android --nosave 251 | ``` 252 | 253 | - List available and installed platforms with version numbers. This is useful to find version numbers when reporting issues: 254 | 255 | ```bash 256 | cordova platform ls 257 | ``` 258 | 259 | ## `cordova plugin` command 260 | 261 | Manage project plugins 262 | 263 | **Command Syntax:** 264 | 265 | ```bash 266 | cordova {plugin | plugins} [ 267 | add [..] {--searchpath= | --noregistry | --link | --save | --force} | 268 | {remove | rm} { | } --save | 269 | {list | ls} 270 | ] 271 | ``` 272 | 273 | | Sub-command | Option | Description 274 | |------------------------|-------------|------ 275 | | add `` [...] | | Add specified plugins 276 | | |--searchpath `` | When looking up plugins by ID, look in this directory and each of its subdirectories before hitting the registry. Multiple search paths can be specified. Use ':' as a separator in `*nix` based systems and ';' for Windows. 277 | | |--noregistry | Don't search the registry for plugins. 278 | | |--link | When installing from a local path, creates a symbolic link instead of copying files. The extent to which files are linked varies by platform. Useful for plugin development. 279 | | |--nosave | Do NOT save the `` as part of the `plugin` element into `config.xml` or `package.json`. 280 | | |--force | _Introduced in version 6.1._ Forces copying source files from the plugin even if the same file already exists in the target directory. 281 | | remove `\|` [...] | | Remove plugins with the given IDs/name. 282 | | |--nosave | Do NOT remove the specified plugin from config.xml or package.json 283 | |list | | List currently installed plugins 284 | 285 | ### Plugin-spec 286 | 287 | There are a number of ways to specify a plugin: 288 | 289 | : [@scope/]pluginID[@version]|directory|url[#commit-ish][:subdir] 290 | 291 | | Value | Description 292 | |-------------|-------------------- 293 | | scope | Scope of plugin published as a [scoped npm package] 294 | | plugin | Plugin id (id of plugin in npm registry or in --searchPath) 295 | | version | Major.minor.patch version specifier using semver 296 | | directory | Directory containing plugin.xml 297 | | url | Url to a git repository containing a plugin.xml 298 | | commit-ish | Commit/tag/branch reference. If none is specified, 'master' is used 299 | 300 | ### Algorithm for resolving plugins 301 | 302 | When adding a plugin to a project, the CLI will resolve the plugin 303 | based on the following criteria (listed in order of precedence): 304 | 305 | 1. The `plugin-spec` given in the command (e.g. `cordova plugin add pluginID@version`) 306 | 2. The `plugin-spec` saved in `config.xml` & `package.json` (i.e. if the plugin was previously added without `--nosave`) 307 | 3. As of Cordova version 6.1, the latest plugin version published to npm that the current project can support (only applies to plugins that list their [Cordova dependencies] in their `package.json`) 308 | 4. The latest plugin version published to npm 309 | 310 | ### Examples 311 | 312 | - Add `cordova-plugin-camera` and `cordova-plugin-file` to the project and save it to `config.xml` & `package.json`. Use `../plugins` directory to search for the plugins. 313 | 314 | ```bash 315 | cordova plugin add cordova-plugin-camera cordova-plugin-file --searchpath ../plugins 316 | ``` 317 | 318 | - Add `cordova-plugin-camera` with [semver](http://semver.org/) version ^2.0.0 and save it to `config.xml` & `package.json`: 319 | 320 | ```bash 321 | cordova plugin add cordova-plugin-camera@^2.0.0 322 | ``` 323 | 324 | - Add the plugin from the specified local directory: 325 | 326 | ```bash 327 | cordova plugin add ../cordova-plugin-camera 328 | ``` 329 | 330 | - Add the plugin from the specified tarball file: 331 | 332 | ```bash 333 | cordova plugin add ../cordova-plugin-camera.tgz 334 | ``` 335 | 336 | - Remove the plugin from the project and the `config.xml` & `package.json`: 337 | 338 | ```bash 339 | cordova plugin rm camera 340 | ``` 341 | 342 | - Remove the plugin from the project, but not the `config.xml` or `package.json`: 343 | 344 | ```bash 345 | cordova plugin rm camera --nosave 346 | ``` 347 | 348 | - List all plugins installed in the project: 349 | 350 | ```bash 351 | cordova plugin ls 352 | ``` 353 | 354 | ### Conflicting plugins 355 | Conflicting plugins may occur when adding plugins that use `edit-config` tags in their plugin.xml file. `edit-config` allows plugins to add or replace attributes of XML elements. 356 | 357 | This feature can cause issues with the application if more than one plugin tries to modify the same XML element. Conflict detection has been implemented to prevent plugins from being added so one plugin doesn't try to overwrite another plugin's `edit-config` changes. An error will be thrown when a conflict in `edit-config` has been found and the plugin won't be added. The error message will mention that all conflicts must be resolved before the plugin can be added. One option to resolving the `edit-config` conflict is to make changes to the affected plugins' plugin.xml so that they do not modify the same XML element. The other option is to use the `--force` flag to force add the plugin. This option should be used with caution as it ignores the conflict detection and will overwrite all conflicts it has with other plugins, thus may leave the other plugins in a bad state. 358 | 359 | Refer to the [plugin.xml guide](https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#edit-config) for managing `edit-config`, resolving conflicts, and examples. 360 | 361 | ## `cordova prepare` command 362 | 363 | Transforms config.xml metadata to platform-specific manifest files, copies icons & splashscreens, 364 | copies plugin files for specified platforms so that the project is ready to build with each native SDK. 365 | 366 | **Command Syntax:** 367 | 368 | ```bash 369 | cordova prepare [ [..]] 370 | ``` 371 | 372 | ### Options 373 | 374 | | Option | Description 375 | |------------|------------------ 376 | | ` [..]` | Platform name(s) to prepare. If not specified, all platforms are prepared. 377 | 378 | ## `cordova compile` command 379 | 380 | `cordova compile` is a subset of the [cordova build command](#cordova-build-command). 381 | It only performs the compilation step without doing prepare. It's common to invoke `cordova build` instead of this command - however, this stage is useful to allow extending using [hooks][Hooks guide]. 382 | 383 | **Command Syntax:** 384 | 385 | ```bash 386 | cordova compile [ [...]] 387 | [--debug | --release] 388 | [--device | --emulator | --target=] 389 | [--buildConfig=] 390 | [-- ] 391 | ``` 392 | For detailed documentation see [cordova build command](#cordova-build-command) docs below. 393 | 394 | ## `cordova build` command 395 | 396 | Shortcut for `cordova prepare` + `cordova compile` for all/the specified platforms. Allows you to build the app for the specified platform. 397 | 398 | **Command Syntax:** 399 | 400 | ```bash 401 | cordova build [ [...]] 402 | [--debug | --release] 403 | [--device | --emulator] 404 | [--buildConfig=] 405 | [-- ] 406 | ``` 407 | 408 | | Option | Description 409 | |------------|------------------ 410 | | ` [..]` | Platform name(s) to build. If not specified, all platforms are built. 411 | | --debug | Perform a debug build. This typically translates to debug mode for the underlying platform being built. 412 | | --release | Perform a release build. This typically translates to release mode for the underlying platform being built. 413 | | --device | Build it for a device 414 | | --emulator | Build it for an emulator. In particular, the platform architecture might be different for a device vs. emulator. 415 | | --buildConfig=`` | Default: build.json in cordova root directory.
Use the specified build configuration file. `build.json` file is used to specify paramaters to customize the app build process especially related to signing the package. 416 | | `` | To provide platform specific options, you must include them after `--` separator. Review platform guide docs for more details. 417 | 418 | ### Examples 419 | 420 | - Build for `android` and `ios` platform in `debug` mode for deployment to device: 421 | 422 | ```bash 423 | cordova build android ios --debug --device 424 | ``` 425 | 426 | - Build for `android` platform in `release` mode and use the specified build configuration: 427 | 428 | ```bash 429 | cordova build android --release --buildConfig=..\myBuildConfig.json 430 | ``` 431 | 432 | - Build for `android` platform in release mode and pass custom platform options to android build process: 433 | 434 | ```bash 435 | cordova build android --release -- --keystore="..\android.keystore" --storePassword=android --alias=mykey 436 | ``` 437 | 438 | ## `cordova run` command 439 | 440 | Prepares, builds, and deploys app on specified platform devices/emulators. If a device is connected it will be used, unless an eligible emulator is already running. 441 | 442 | **Command Syntax:** 443 | 444 | ```bash 445 | cordova run [ [...]] 446 | [--list | --debug | --release] 447 | [--noprepare] 448 | [--nobuild] 449 | [--device | --emulator | --target=] 450 | [--buildConfig=] 451 | [-- ] 452 | ``` 453 | 454 | | Option | Description 455 | |-------------|------------------ 456 | | ` [..]` | Platform name(s) to run. If not specified, all platforms are run. 457 | | --list | Lists available targets. Displays both device and emulator deployment targets unless specified 458 | | --debug | Deploy a debug build. This is the default behavior unless `--release` is specified. 459 | | --release | Deploy a release build 460 | | --noprepare | Skip preparing (available in Cordova v6.2 or later) 461 | | --nobuild | Skip building 462 | | --device | Deploy to a device 463 | | --emulator | Deploy to an emulator 464 | | --target | Deploy to a specific target emulator/device. Use `--list` to display target options 465 | | --buildConfig=`` | Default: build.json in cordova root directory.
Use the specified build configuration file. `build.json` file is used to specify paramaters to customize the app build process especially related to signing the package. 466 | | `` | To provide platform specific options, you must include them after `--` separator. Review platform guide docs for more details. 467 | 468 | ### Examples 469 | 470 | - Run a release build of current cordova project on `android` platform emulator named `Nexus_5_API_23_x86`. Use the spcified build configuration when running: 471 | 472 | ```bash 473 | cordova run android --release --buildConfig=..\myBuildConfig.json --target=Nexus_5_API_23_x86 474 | ``` 475 | 476 | - Run a debug build of current cordova project on `android` platform using a device or emulator (if no device is connected). Skip doing the build: 477 | 478 | ```bash 479 | cordova run android --nobuild 480 | ``` 481 | 482 | - Run a debug build of current cordova project on an `ios` device: 483 | 484 | ```bash 485 | cordova run ios --device 486 | ``` 487 | 488 | - Enumerate names of all the connected devices and available emulators that can be used to run this app: 489 | 490 | ```bash 491 | cordova run ios --list 492 | ``` 493 | 494 | ## `cordova emulate` command 495 | 496 | Alias for `cordova run --emulator`. Launches the emulator instead of device. See [cordova run command docs](#cordova-run-command) for more details. 497 | 498 | ## `cordova clean` command 499 | 500 | Cleans the build artifacts for all the platforms, or the specified platform by running platform-specific build cleanup. 501 | 502 | **Command Syntax:** 503 | 504 | ```bash 505 | cordova clean [ [...]] 506 | ``` 507 | 508 | **Example Usage:** 509 | 510 | - Clean `android` platform build artifacts: 511 | 512 | ```bash 513 | cordova clean android 514 | ``` 515 | 516 | ## `cordova requirements` command 517 | 518 | Checks and print out all the requirements for platforms specified (or all platforms added 519 | to project if none specified). If all requirements for each platform are met, exits with code 0 520 | otherwise exits with non-zero code. 521 | 522 | This can be useful when setting up a machine for building a particular platform. 523 | 524 | **Command Syntax:** 525 | 526 | ```bash 527 | cordova requirements [platform?] 528 | ``` 529 | 530 | ## `cordova info` command 531 | 532 | Print out useful information helpful for submitting bug 533 | reports and getting help. 534 | 535 | **Command Syntax:** 536 | 537 | ```bash 538 | cordova info 539 | ``` 540 | 541 | ## `cordova serve` command 542 | 543 | Run a local web server for www/ assets using specified `port` or default of 8000. Access projects at: `http://HOST_IP:PORT/PLATFORM/www` 544 | 545 | **Command Syntax:** 546 | 547 | ```bash 548 | cordova serve [port] 549 | ``` 550 | 551 | ## `cordova help` command 552 | 553 | Show syntax summary, or the help for a specific command. 554 | 555 | **Command Syntax:** 556 | 557 | ```bash 558 | cordova help [command] 559 | cordova [command] -h 560 | cordova -h [command] 561 | ``` 562 | 563 | ## `cordova config` command 564 | 565 | Set, get, delete, edit, and list global cordova options. 566 | 567 | **Command Syntax:** 568 | 569 | ```bash 570 | cordova config [ls|edit|set|get|delete] 571 | ``` 572 | 573 | **Usage Examples:** 574 | 575 | ```bash 576 | cordova config ls 577 | cordova config edit 578 | cordova config set save-exact true 579 | cordova config get save-exact 580 | cordova config delete save-exact 581 | ``` 582 | 583 | [Hooks guide]: http://cordova.apache.org/docs/en/latest/guide_appdev_hooks_index.md.html 584 | [config.xml ref]: http://cordova.apache.org/docs/en/latest/config_ref/index.html 585 | [Cordova dependencies]: http://cordova.apache.org/docs/en/latest/guide/hybrid/plugins/index.html#specifying-project-requirements 586 | [scoped npm package]: https://docs.npmjs.com/misc/scope 587 | -------------------------------------------------------------------------------- /RELEASENOTES.md: -------------------------------------------------------------------------------- 1 | 21 | # Cordova-cli Release Notes 22 | 23 | ### 13.0.0 (Nov 23, 2025) 24 | 25 | **Breaking Changes:** 26 | 27 | * [GH-678](https://github.com/apache/cordova-cli/pull/678) feat!: bump dependencies & node engine requirement 28 | * [GH-633](https://github.com/apache/cordova-cli/pull/633) feat!: remove telemetry feature 29 | * [GH-672](https://github.com/apache/cordova-cli/pull/672) chore(npm)!: bump various npm packages 30 | * [GH-666](https://github.com/apache/cordova-cli/pull/666) chore!: bump node requirement & npm dependencies 31 | * [GH-642](https://github.com/apache/cordova-cli/pull/642) chore!: Prepare for next major 32 | 33 | **Fixes:** 34 | 35 | * [GH-662](https://github.com/apache/cordova-cli/pull/662) fix: bump @babel/helpers 36 | * [GH-640](https://github.com/apache/cordova-cli/pull/640) fix: remove potential error when setting exit code 37 | 38 | **Others:** 39 | 40 | * [GH-679](https://github.com/apache/cordova-cli/pull/679) chore: update release audit workflow & license headers 41 | * [GH-677](https://github.com/apache/cordova-cli/pull/677) chore(deps-dev): bump js-yaml from 4.1.0 to 4.1.1 42 | * [GH-676](https://github.com/apache/cordova-cli/pull/676) chore(deps): bump glob from 10.4.5 to 10.5.0 43 | * [GH-673](https://github.com/apache/cordova-cli/pull/673) chore: license headers 44 | * [GH-671](https://github.com/apache/cordova-cli/pull/671) chore(deps): bump tmp from 0.2.3 to 0.2.4 45 | * [GH-668](https://github.com/apache/cordova-cli/pull/668) chore(coverage): Move from nyc to c8 for code coverage 46 | * [GH-667](https://github.com/apache/cordova-cli/pull/667) chore(deps): bump on-headers and compression 47 | * [GH-665](https://github.com/apache/cordova-cli/pull/665) chore(deps-dev): bump brace-expansion from 1.1.11 to 1.1.12 48 | * [GH-658](https://github.com/apache/cordova-cli/pull/658) chore(deps): bump systeminformation from 5.22.11 to 5.23.8 49 | * [GH-657](https://github.com/apache/cordova-cli/pull/657) chore(deps): bump path-to-regexp and express 50 | * [GH-654](https://github.com/apache/cordova-cli/pull/654) chore(deps): bump cross-spawn from 7.0.3 to 7.0.6 51 | * [GH-655](https://github.com/apache/cordova-cli/pull/655) chore(ci): Add code scanning & fix dependabot failures 52 | * [GH-646](https://github.com/apache/cordova-cli/pull/646) chore(deps): bump micromatch from 4.0.7 to 4.0.8 53 | * [GH-652](https://github.com/apache/cordova-cli/pull/652) chore(deps): bump cookie and express 54 | * [GH-643](https://github.com/apache/cordova-cli/pull/643) chore: Update dependencies 55 | * [GH-637](https://github.com/apache/cordova-cli/pull/637) chore(deps): bump express from 4.18.2 to 4.19.2 56 | * [GH-639](https://github.com/apache/cordova-cli/pull/639) chore(deps): bump tar from 6.2.0 to 6.2.1 57 | * [GH-641](https://github.com/apache/cordova-cli/pull/641) chore(deps): bump braces from 3.0.2 to 3.0.3 58 | * [GH-635](https://github.com/apache/cordova-cli/pull/635) chore(deps): bump ip from 2.0.0 to 2.0.1 59 | * [GH-631](https://github.com/apache/cordova-cli/pull/631) chore: Rolled dependencies to the latest non-breaking versions 60 | * [GH-670](https://github.com/apache/cordova-cli/pull/670) ci: various workflow improvements 61 | * [GH-669](https://github.com/apache/cordova-cli/pull/669) ci(workflow): update release-audit & license config 62 | * [GH-656](https://github.com/apache/cordova-cli/pull/656) ci: use apache-rat-action@v1 (tag) 63 | * [GH-638](https://github.com/apache/cordova-cli/pull/638) ci: update codecov@v4 w/ token 64 | * [GH-636](https://github.com/apache/cordova-cli/pull/636) ci: update release audit workflow 65 | * [GH-630](https://github.com/apache/cordova-cli/pull/630) ci(gh-action): add Apache RAT & package license checker workflow 66 | * [GH-554](https://github.com/apache/cordova-cli/pull/554) doc(create): update default values 67 | * [GH-428](https://github.com/apache/cordova-cli/pull/428) doc: update `README`.md 68 | * [GH-616](https://github.com/apache/cordova-cli/pull/616) doc: update & refactor cli reference 69 | 70 | ### 12.0.0 (May 20, 2023) 71 | 72 | **Breaking:** 73 | 74 | * [GH-611](https://github.com/apache/cordova-cli/pull/611) feat!(run): call platform api to list targets 75 | * [GH-595](https://github.com/apache/cordova-cli/pull/595) feat!: remove `update-notifier` support 76 | * [GH-615](https://github.com/apache/cordova-cli/pull/615) dep!: bump `cordova-create@5.0.0` & `cordova-lib@12.0.0` 77 | * [GH-613](https://github.com/apache/cordova-cli/pull/613) dep!: bump possible dependencies & set bump node requirement `>=16.13.0` 78 | * `@cordova/eslint-config@^5.0.0` 79 | * `jasmine@^4.6.0` 80 | * `rewire@^6.0.0` 81 | * `cordova-common@5.0.0` 82 | * `fs-extra@11.1.1` 83 | * `nopt@7.1.0` 84 | * `semver@7.5.0` 85 | * `systeminformation@5.17.12` 86 | 87 | ### 11.1.0 (Jan 11, 2023) 88 | 89 | * [GH-603](https://github.com/apache/cordova-cli/pull/603) dep: bump to latest minor+patch w/ `package-lock` rebuild 90 | * `cordova-common@^4.1.0` 91 | * `cordova-create@^4.1.0` 92 | * `cordova-lib@^11.1.0` 93 | * `systeminformation@^5.17.3` 94 | * [GH-599](https://github.com/apache/cordova-cli/pull/599) chore: remove unnecessary gendered text 95 | * [GH-600](https://github.com/apache/cordova-cli/pull/600) ci: update codecov & run on node 14-18 96 | * [GH-587](https://github.com/apache/cordova-cli/pull/587) dep(npm): bump packages to latest minor/patch revisions w/ `package-lock` 97 | 98 | ### 11.0.0 (Dec 17, 2021) 99 | 100 | * [GH-575](https://github.com/apache/cordova-cli/pull/575) chore: rebuilt `package-lock.json` 101 | * [GH-574](https://github.com/apache/cordova-cli/pull/574) dep: bump `@cordova/eslint-config@^4.0.0` 102 | * [GH-573](https://github.com/apache/cordova-cli/pull/573) dep: update `insight` w/ updated code usage 103 | * [GH-572](https://github.com/apache/cordova-cli/pull/572) dep: bump all dependencies 104 | * [GH-570](https://github.com/apache/cordova-cli/pull/570) feat: rebuilt `package-lock.json` w/ v2 105 | * [GH-571](https://github.com/apache/cordova-cli/pull/571) feat!: update node support 106 | * [GH-564](https://github.com/apache/cordova-cli/pull/564) chore: `npmrc` 107 | * [GH-559](https://github.com/apache/cordova-cli/pull/559) docs: remove plugin save command from CLI help 108 | * [GH-550](https://github.com/apache/cordova-cli/pull/550) dep: `systeminformation@^5.5.0` 109 | * [GH-535](https://github.com/apache/cordova-cli/pull/535) chore(pkg): remove deprecated `no-op` field `preferGlobal` 110 | * [GH-534](https://github.com/apache/cordova-cli/pull/534) chore: clean up `package.json` 111 | * [GH-533](https://github.com/apache/cordova-cli/pull/533) (android) Replace deprecated `android` command with `avdmanager` 112 | 113 | ### 10.0.0 (Jul 31, 2020) 114 | 115 | * [GH-521](https://github.com/apache/cordova-cli/pull/521) test: fix node.js version check 116 | * [GH-520](https://github.com/apache/cordova-cli/pull/520) chore: rebuilt `package-lock` 117 | * [GH-519](https://github.com/apache/cordova-cli/pull/519) breaking: bump `cordova-lib@^10.0.0` 118 | * [GH-402](https://github.com/apache/cordova-cli/pull/402) Tiny CLI docs improvements 119 | * [GH-518](https://github.com/apache/cordova-cli/pull/518) feat(ci): migrate to `github-actions` 120 | * [GH-516](https://github.com/apache/cordova-cli/pull/516) chore: drop `node-8` deprecation transition step 121 | * [GH-517](https://github.com/apache/cordova-cli/pull/517) chore: add `package-lock.json` 122 | * [GH-515](https://github.com/apache/cordova-cli/pull/515) chore: improve npm ignore 123 | * [GH-513](https://github.com/apache/cordova-cli/pull/513) breaking: bump dev dependencies 124 | * `mock-stdin@^1.0.0` 125 | * `nyc@^15.1.0` 126 | * `rewire@^5.0.0` 127 | * [GH-514](https://github.com/apache/cordova-cli/pull/514) chore: cleanup `package.json` 128 | * [GH-512](https://github.com/apache/cordova-cli/pull/512) breaking: bump dependencies 129 | * `configstored@^5.0.1` 130 | * `cordova-commond@^4.0.2` 131 | * `cordova-created@^3.0.0` 132 | * `cordova-libd@^9.0.1` 133 | * `execad@^4.0.3` 134 | * `insightd@^0.10.3` 135 | * `loud-rejectiond@^2.2.0` 136 | * `noptd@^4.0.3` 137 | * `semverd@^7.3.2` 138 | * `systeminformationd@^4.26.10` 139 | * `update-notifierd@^4.1.0` 140 | * [GH-511](https://github.com/apache/cordova-cli/pull/511) chore(`eslint`): bump to 3.0.0 w/ fix 141 | * [GH-510](https://github.com/apache/cordova-cli/pull/510) feat: migrate "`cordova info`" lib logic to cli 142 | * chore(asf): update git notification settings 143 | * Update CONTRIBUTING.md 144 | * [GH-495](https://github.com/apache/cordova-cli/pull/495) fix: cannot call `config` or `create` commands 145 | * [GH-494](https://github.com/apache/cordova-cli/pull/494) refactor(`create`): use `cordova-create` 3.0.0-nightly 146 | * [GH-493](https://github.com/apache/cordova-cli/pull/493) refactor: `eslint` setup 147 | * [GH-490](https://github.com/apache/cordova-cli/pull/490) refactor(`create`): do not expand `~` to `$HOME` anymore 148 | * [GH-489](https://github.com/apache/cordova-cli/pull/489) refactor(`create`): depend directly on `cordova-create` 149 | * [GH-485](https://github.com/apache/cordova-cli/pull/485) docs(`config`): remove "`autosave`" setting 150 | * [GH-484](https://github.com/apache/cordova-cli/pull/484) test(`config`): use generic config key name 151 | * [GH-483](https://github.com/apache/cordova-cli/pull/483) refactor: remove dead code & simplify 152 | * [GH-486](https://github.com/apache/cordova-cli/pull/486) docs: undocument "`plugin save`" command 153 | * [GH-488](https://github.com/apache/cordova-cli/pull/488) docs: remove mentions of "`cordova create`" argument "config" 154 | * [GH-487](https://github.com/apache/cordova-cli/pull/487) docs(`info`): remove outdated remark about `info.txt` 155 | * [GH-482](https://github.com/apache/cordova-cli/pull/482) docs: undocument "`platform save`", again 156 | * [GH-475](https://github.com/apache/cordova-cli/pull/475) refactor: Remove support for `/.cordova/config.json` 157 | * [GH-468](https://github.com/apache/cordova-cli/pull/468) docs: undocument "`hooks/`" directory 158 | * [GH-467](https://github.com/apache/cordova-cli/pull/467) docs: undocument "`platform check`" command 159 | * [GH-481](https://github.com/apache/cordova-cli/pull/481) chore: update `jasmine` dependencies 160 | * [GH-480](https://github.com/apache/cordova-cli/pull/480) chore: drop node 6 and 8 support 161 | * [GH-479](https://github.com/apache/cordova-cli/pull/479) chore: bump version to 10.0.0-dev 162 | * [GH-477](https://github.com/apache/cordova-cli/pull/477) Avoid registering too many event listeners in tests 163 | * [GH-476](https://github.com/apache/cordova-cli/pull/476) Undocument removed `platform save` command 164 | * [GH-473](https://github.com/apache/cordova-cli/pull/473) Fix blocked `telemetry` calls 165 | * [GH-472](https://github.com/apache/cordova-cli/pull/472) fix: argument filtering in `telemetry.track` 166 | * [GH-474](https://github.com/apache/cordova-cli/pull/474) Remove unsupported option `--copy-from` 167 | * [GH-458](https://github.com/apache/cordova-cli/pull/458) chore: node deprecation warning for <10 168 | * [GH-471](https://github.com/apache/cordova-cli/pull/471) Add unit tests for the telemetry module 169 | * [GH-469](https://github.com/apache/cordova-cli/pull/469) Use `semver` to check if using a prerelease version 170 | * [GH-470](https://github.com/apache/cordova-cli/pull/470) chore: add codecov to display coverage in GH 171 | * [GH-459](https://github.com/apache/cordova-cli/pull/459) chore: replace `istanbul` with `nyc` 172 | * [GH-427](https://github.com/apache/cordova-cli/pull/427) Minor fixes in `README` 173 | * [GH-454](https://github.com/apache/cordova-cli/pull/454) chore: node warning on version < 8 174 | * [GH-430](https://github.com/apache/cordova-cli/pull/430) chore: add Node.js 12 to CI services 175 | * [GH-440](https://github.com/apache/cordova-cli/pull/440) docs(readme): remove duplicated instructions 176 | * [GH-433](https://github.com/apache/cordova-cli/pull/433) Updated the Supported Platforms 177 | * [GH-426](https://github.com/apache/cordova-cli/pull/426) Handle output error strings 178 | * [GH-423](https://github.com/apache/cordova-cli/pull/423) Cleaner solution to spy on latest CordovaLogger 179 | * [GH-421](https://github.com/apache/cordova-cli/pull/421) Fix `cordova config list` command 180 | * [GH-419](https://github.com/apache/cordova-cli/pull/419) Fix `cordova config list` command recognition 181 | * [GH-365](https://github.com/apache/cordova-cli/pull/365) Start requirements unit testing 182 | 183 | ### 9.0.0 (Mar 20, 2019) 184 | 185 | * [GH-414](https://github.com/apache/cordova-cli/pull/414) Cordova CLI Release Preparation (Cordova 9) 186 | * **Bumped Dependencies** 187 | * `cordova-lib@^9.0.0` 188 | * `cordova-common@^3.1.0` 189 | * `editor@^1.0.0` (Prepended `^` only) 190 | * `loud-rejection@^2.0.0` 191 | * **Bumped Dev Dependencies** 192 | * `jasmine@^3.3.1` 193 | * `eslint-plugin-promise@^4.0.1` 194 | * `eslint-plugin-node@^8.0.1` 195 | * `eslint-plugin-import@^2.16.0` 196 | * `eslint-config-standard@^12.0.0` 197 | * `eslint-config-semistandard@^13.0.0` 198 | * `eslint@^5.15.2` 199 | * Fix `logger[level]` spy in Jasmine 200 | * [GH-397](https://github.com/apache/cordova-cli/pull/397) Update Node.js Deprecation Notice Message 201 | * Add or update GitHub pull request and issue template 202 | * [GH-395](https://github.com/apache/cordova-cli/pull/395) Fix typo: "esecially" to especially 203 | * [GH-364](https://github.com/apache/cordova-cli/pull/364) Fix spec label for build tests 204 | * [GH-344](https://github.com/apache/cordova-cli/pull/344) Check that `bin/cordova` works on Travis CI 205 | * [CB-13740](https://issues.apache.org/jira/browse/CB-13740) gracefully handle platforms that don't pass back requirements to check 206 | * [GH-327](https://github.com/apache/cordova-cli/pull/327) Stub telemetry calls during all tests 207 | * [GH-322](https://github.com/apache/cordova-cli/pull/322) Remove support for `fetch` option 208 | * [GH-321](https://github.com/apache/cordova-cli/pull/321) Remove support for `browserify` 209 | * [GH-317](https://github.com/apache/cordova-cli/pull/317) cli.spec: Telemetry-Related Improvements 210 | * [GH-316](https://github.com/apache/cordova-cli/pull/316) Remove `callback` parameter of main CLI function 211 | * [GH-298](https://github.com/apache/cordova-cli/pull/298) Remove support for deprecated `--copy-from` 212 | * [GH-298](https://github.com/apache/cordova-cli/pull/298) Cleanup code calling `cordova-create` 213 | 214 | ### 8.1.1 (Sep 27, 2018) 215 | * [GH-339](https://github.com/apache/cordova-cli/issues/339) Fix bin/cordova on Node.js 4 216 | * [GH-337](https://github.com/apache/cordova-cli/issues/337) Revert messing with transitive dependencies in `npm-shrinkwrap.json` (re-introduces a _low-severity_ `npm audit` warning) 217 | 218 | ### 8.1.0 (Sep 24, 2018) 219 | * README.md fixes 220 | * [GH-295](https://github.com/apache/cordova-cli/pull/GH-295) Proper error code and message when failing 221 | * [GH-296](https://github.com/apache/cordova-cli/pull/GH-296) Remove leftover makeshift benchmarking code 222 | * [GH-296](https://github.com/apache/cordova-cli/pull/GH-296) Use multi-line comment for license headers 223 | * [CB-13772](https://issues.apache.org/jira/browse/CB-13772) print version numbers correctly in cordova requirements [GH-291](https://github.com/apache/cordova-cli/pull/291) 224 | * [GH-307](https://github.com/apache/cordova-cli/pull/GH-307) Remove outdated docs translations 225 | * [GH-306](https://github.com/apache/cordova-cli/pull/GH-306) Remove mentions of 'cordova plugin search' from docs 226 | * [GH-312](https://github.com/apache/cordova-cli/pull/GH-312) Update ESLint and fix linting errors 227 | * [GH-312](https://github.com/apache/cordova-cli/pull/GH-312) Update dependencies 228 | * [GH-300](https://github.com/apache/cordova-cli/issues/300) Update `insight` to resolve `npm audit` warning 229 | 230 | ### 8.0.0 (Dec 14, 2017) 231 | * [CB-13055](https://issues.apache.org/jira/browse/CB-13055): removed `--nofetch` flag 232 | * Use native Promises instead of `Q` 233 | * [CB-12853](https://issues.apache.org/jira/browse/CB-12853): re-check version before notifying. 234 | * [CB-13501](https://issues.apache.org/jira/browse/CB-13501): updated to include node 8 to tests 235 | 236 | ### 7.1.0 (Oct 04, 2017) 237 | * [CB-13303](https://issues.apache.org/jira/browse/CB-13303) added `--noprod` and `--production` flags as options, `--noprod` turns off our auto adding of `--production` flag 238 | * [CB-13353](https://issues.apache.org/jira/browse/CB-13353) added `--save-exact` flag to cli and unit test 239 | * [CB-12895](https://issues.apache.org/jira/browse/CB-12895) Added `eslint` and removed `jshint` 240 | * [CB-12862](https://issues.apache.org/jira/browse/CB-12862) Added `searchpath` as a config option 241 | * [CB-12762](https://issues.apache.org/jira/browse/CB-12762) point `package.json` repo items to github mirrors instead of apache repos site 242 | * [CB-12693](https://issues.apache.org/jira/browse/CB-12693) Included examples for `Browserify`, `fetch`, and `autosave` and include options with a more detailed description. 243 | * [CB-12901](https://issues.apache.org/jira/browse/CB-12901) removed `.raw` from `cordova-lib` calls 244 | 245 | ### 7.0.1 (May 08, 2017) 246 | * [CB-12769](https://issues.apache.org/jira/browse/CB-12769): Updated `cordova-lib` dependency to 7.0.1. 247 | 248 | ### 7.0.0 (May 02, 2017) 249 | * [CB-12570](https://issues.apache.org/jira/browse/CB-12570): `cordova-fetch` is true by default. Use `--nofetch` flag to fetch platforms and plugins using old fetching logic. 250 | * [CB-12665](https://issues.apache.org/jira/browse/CB-12665): removed `engineStrict` as it is no longer supported 251 | * [CB-11982](https://issues.apache.org/jira/browse/CB-11982): added `edit` and `ls` to `cordova config` 252 | * [CB-11982](https://issues.apache.org/jira/browse/CB-11982): added new `cordova config` command that `sets`, `gets`, and `deletes` global enviroment variables. 253 | * [CB-12008](https://issues.apache.org/jira/browse/CB-12008): updated docs to reflect new autosave changes and removed variables missed due to rebase 254 | * [CB-12008](https://issues.apache.org/jira/browse/CB-12008): made autosave the default for platform and plugin add/remove 255 | * [CB-11977](https://issues.apache.org/jira/browse/CB-11977): removed support for `node 0.x` 256 | 257 | ### 6.5.0 (Jan 17, 2017) 258 | * [CB-12018](https://issues.apache.org/jira/browse/CB-12018) : updated tests to function with `jasmine` instead of `jasmine-node` 259 | 260 | ### 6.4.0 (Oct 21, 2016) 261 | * [CB-12039](https://issues.apache.org/jira/browse/CB-12039) updated `cordova-lib` to `6.4.0` 262 | * [CB-11976](https://issues.apache.org/jira/browse/CB-11976) Updated `package.json` engine key 263 | * [CB-11976](https://issues.apache.org/jira/browse/CB-11976) Add deprecated node version warning for 0.x 264 | * Add github pull request template 265 | * [CB-11607](https://issues.apache.org/jira/browse/CB-11607) breakout `cordova-create` from `cordova-lib` 266 | * [CB-11623](https://issues.apache.org/jira/browse/CB-11623) added back linking 267 | * Document cli - cordova plugin save 268 | * [CB-11023](https://issues.apache.org/jira/browse/CB-11023) Add doc for conflicting plugins 269 | 270 | ### 6.3.1 (Aug 09, 2016) 271 | * [CB-11685](https://issues.apache.org/jira/browse/CB-11685) Updated cordova-lib dependency to 6.3.1 272 | 273 | ### 6.3.0 (Jul 12, 2016) 274 | * [CB-11412](https://issues.apache.org/jira/browse/CB-11412) removed link-to, aliased copy-from to template 275 | * [CB-11349](https://issues.apache.org/jira/browse/CB-11349) passing --fetch to create 276 | * [CB-11284](https://issues.apache.org/jira/browse/CB-11284) Telemetry: Track platforms/plugins subcommands(add/rm/etc...) 277 | * [CB-11262](https://issues.apache.org/jira/browse/CB-11262) Add a warning about prerelease lib/cli usage 278 | * [CB-11263](https://issues.apache.org/jira/browse/CB-11263) 'cordova telemetry help' should display help text 279 | 280 | ### 6.2.0 (May 12, 2016) 281 | * [Telemetry](https://github.com/apache/cordova-cli/pull/247) Added telemetry to cordova-cli to collect data for data driven development 282 | * [CB-11250](https://issues.apache.org/jira/browse/CB-11250) Fix CLI tests verifying the version 283 | * [CB-9858](https://issues.apache.org/jira/browse/CB-9858) added `--fetch` option 284 | * [CB-10986](https://issues.apache.org/jira/browse/CB-10986) Adding note about scoped npm packages for plugins 285 | * [CB-11042](https://issues.apache.org/jira/browse/CB-11042) Add cordova run option to skip prepare 286 | * [CB-10062](https://issues.apache.org/jira/browse/CB-10062) Error: `EACCES: permission denied - update-notifier-cordova.json` 287 | * [CB-10679](https://issues.apache.org/jira/browse/CB-10679) Documenting how the CLI chooses plugin versions 288 | 289 | ### 6.1.1 (Mar 29, 2016) 290 | * [CB-10980](https://issues.apache.org/jira/browse/CB-10980) Updated cordova-lib dependency to 6.1.1 291 | 292 | ### 6.1.0 (Mar 17, 2016) 293 | * [CB-10902](https://issues.apache.org/jira/browse/CB-10902) Updated cordova-lib dependency to 6.1.0 294 | * Simplify cordova CLI readme 295 | * [CB-10860](https://issues.apache.org/jira/browse/CB-10860) avoid node complaining of too many event listener added when running tests 296 | * Fix readme.md - directory structure 297 | * [CB-10673](https://issues.apache.org/jira/browse/CB-10673) add `plugin add --force` option. 298 | * Add Travis CI badge 299 | * Specify valid `SPDX` license in `package.json` 300 | * [CB-10748](https://issues.apache.org/jira/browse/CB-10748) Use `cordova-common.CordovaLogger` in CLI 301 | * Adding and fixing some whitespace in CLI docs. 302 | * [CB-10348](https://issues.apache.org/jira/browse/CB-10348) Update formatting of CLI reference readme 303 | * [CB-10348](https://issues.apache.org/jira/browse/CB-10348) CLI reference readme 304 | * [CB-10482](https://issues.apache.org/jira/browse/CB-10482) Remove references to **windows8** from cordova-lib/cli 305 | * [CB-10348](https://issues.apache.org/jira/browse/CB-10348) CLI doc output tweaks 306 | * Update help docs - add examples and make them consistent 307 | 308 | ### 6.0.0 (Jan 25, 2016) 309 | * [CB-10424](https://issues.apache.org/jira/browse/CB-10424) Updated cordova-lib dependency to 6.0.0 310 | * Remove browserify from experimental flags list 311 | * [CB-8455](https://issues.apache.org/jira/browse/CB-8455) Added `--nohooks` option. 312 | * [CB-9964](https://issues.apache.org/jira/browse/CB-9964) Added `--template` support to `cordova create` 313 | * Removing the `--usegit` flag from `cordova platform`. Recommended method is to use `cordova platform add git_url#branch` 314 | * [CB-9836](https://issues.apache.org/jira/browse/CB-9836) Add `.gitattributes` to prevent `CRLF` line endings in repos 315 | * Message about deprecating **amazon-fireos** for **Fire OS 5.0+** devices. 2015 onwards **FireOS** devices should use **android** platform only. 316 | * add **JIRA** issue tracker link. 317 | 318 | ### 5.4.1 (Nov 19, 2015) 319 | * [CB-10049](https://issues.apache.org/jira/browse/CB-10049) updated cordova-lib dependency to 5.4.1 320 | 321 | ### 5.4.0 (Oct 30, 2015) 322 | * [CB-9903](https://issues.apache.org/jira/browse/CB-9903) update cordova-lib dependency to 5.4.0 323 | * [CB-9861](https://issues.apache.org/jira/browse/CB-9861) fixed failing tests 324 | * [CB-9800](https://issues.apache.org/jira/browse/CB-9800) Fixing contribute link. 325 | * [CB-9792](https://issues.apache.org/jira/browse/CB-9792) Make CLI logging system interrupt process on an error event 326 | * [CB-9788](https://issues.apache.org/jira/browse/CB-9788) Add support of stderr/stdout split to CLI logger 327 | * [CB-9784](https://issues.apache.org/jira/browse/CB-9784) Remove CLI logger levels prefixes 328 | * [CB-8198](https://issues.apache.org/jira/browse/CB-8198) Unified console output logic for core platforms 329 | * [CB-9523](https://issues.apache.org/jira/browse/CB-9523) Show out of date message for older cordova CLI 330 | * [CB-9597](https://issues.apache.org/jira/browse/CB-9597) Updates cli to pass structured args to platform methods 331 | 332 | ### 5.3.1 (Aug 28, 2015) 333 | * Updated cordova-lib dependency to 5.3.1 334 | 335 | ### 5.2.0 (Aug 06, 2015) 336 | * docs: unify expression of Amazon Fire OS 337 | * docs: delete duplicated Windows Phone SDK description 338 | * [CB-9114](https://issues.apache.org/jira/browse/CB-9114): Deprecation Warning for --usegit flag. This closes #214 339 | * Adding .ratignore file. 340 | * [CB-9171](https://issues.apache.org/jira/browse/CB-9171) Support Plugin Variables with = 341 | * [CB-9128](https://issues.apache.org/jira/browse/CB-9128) cordova-cli documentation translation: cordova-cli 342 | * [CB-5578](https://issues.apache.org/jira/browse/CB-5578) Adds `clean` command to cordova-cli. 343 | * [CB-8993](https://issues.apache.org/jira/browse/CB-8993) Plugin restore ignores search path. This closes #213 344 | * [CB-9121](https://issues.apache.org/jira/browse/CB-9121) Add support for build configuration to be specified using the CLI 345 | * [CB-8898](https://issues.apache.org/jira/browse/CB-8898) Adds missing section about `requirements` to general cordova help 346 | 347 | ### 5.1.1 (June 4, 2015) 348 | * [CB-8898](https://issues.apache.org/jira/browse/CB-8898) Adds missing section about `requirements` to general cordova help 349 | * [CB-8898](https://issues.apache.org/jira/browse/CB-8898) Introduces `cordova requirements` command 350 | * Updated cordova-lib dependency to 5.1.1 351 | 352 | ### 5.0.0 (Apr 16, 2015) 353 | * Add information on Firefox OS to the README 354 | * Update link to hooks README 355 | * [CB-8634](https://issues.apache.org/jira/browse/CB-8634) Adds docs about support for custom branches for `cordova platform add` 356 | 357 | ### 4.3.0 (Feb 27, 2015) 358 | * docs update for plugin --save 359 | * Grunt "retire" task added (close #204) 360 | * [CB-8439](https://issues.apache.org/jira/browse/CB-8439) Fix 'cordova platform update' documentation to include `` (close #208) 361 | * [CB-8379](https://issues.apache.org/jira/browse/CB-8379) Have --version print out cordova-lib version if it's not the same as CLI's version 362 | * [CB-8211](https://issues.apache.org/jira/browse/CB-8211), [CB-8358](https://issues.apache.org/jira/browse/CB-8358) Update `--link` help text 363 | * [CB-8168](https://issues.apache.org/jira/browse/CB-8168) --list support for CLI (close #205) 364 | * [CB-8314](https://issues.apache.org/jira/browse/CB-8314) Speed up Travis CI (close #207) 365 | * [CB-8301](https://issues.apache.org/jira/browse/CB-8301) Added CI configuration files (close #206) 366 | * [CB-8227](https://issues.apache.org/jira/browse/CB-8227) [CB-8237](https://issues.apache.org/jira/browse/CB-8237) [CB-8238](https://issues.apache.org/jira/browse/CB-8238) Add --save option to 'cordova platform add', 'cordova platform remove' and 'cordova platform update' 367 | * Add coverage/ to .npmignore 368 | * [CB-5316](https://issues.apache.org/jira/browse/CB-5316) Spell Cordova as a brand unless it's a command or script 369 | * [CB-7950](https://issues.apache.org/jira/browse/CB-7950) CLI make CordovaCliCreate.prototype.run vaguely correct 370 | * [CB-7739](https://issues.apache.org/jira/browse/CB-7739) document installing specific version of platforms 371 | * [CB-7950](https://issues.apache.org/jira/browse/CB-7950) CLI create.js misspells parseConfig 372 | 373 | ### 4.2.0 (Jan 06, 2015) 374 | * [CB-6756](https://issues.apache.org/jira/browse/CB-6756) use cordova_lib.binname instead of cordova 375 | * Fixed jshint issues with cli.js (close #199) 376 | * [CB-8211](https://issues.apache.org/jira/browse/CB-8211) Add --link option to `cordova plugin add` (close #191) 377 | * [CB-8129](https://issues.apache.org/jira/browse/CB-8129) Adds 'npm run cover' command to generate tests coverage report 378 | * searchpath option is added to restore 379 | 380 | ### 4.1.2 (Nov 13, 2014) 381 | * Expose cordova-lib and the cli from cordova-cli 382 | * [CB-7636](https://issues.apache.org/jira/browse/CB-7636) Allow using --nobuild flag without screaning 383 | 384 | ### 4.0.0 (Oct 10, 2014) 385 | * Made version semver complient and bumped to 4.0.0 386 | * Pinned dependencies 387 | * added missing AL header 388 | 389 | ### 3.6.1-0.2.13 390 | * update shrinkwrap 391 | 392 | ### 3.6.1-0.2.12 393 | * [CB-7383](https://issues.apache.org/jira/browse/CB-7383) depend on a newer version of cordova-lib 394 | 395 | ### 3.6.1-0.2.11 396 | * bump version to 3.6.3-0.2.11 397 | 398 | ### 3.6.1-0.2.10 (Sep 05, 2014) 399 | * updated Release notes 400 | * updated version to include dev prefix 401 | 402 | ### 3.6.0-0.2.8 (Aug 29, 2014) 403 | * adds missing 'fs' reference required for Windows (ln191) 404 | * [CB-7355](https://issues.apache.org/jira/browse/CB-7355) re added single test to test call through to cordova-lib cordova raw create 405 | * [CB-7364](https://issues.apache.org/jira/browse/CB-7364) remove duplicate logging initialization for cordova/plugman 406 | * [CB-7363](https://issues.apache.org/jira/browse/CB-7363) Do not insist on precise version of cordova-lib 407 | * [CB-7355](https://issues.apache.org/jira/browse/CB-7355) removed create tests which test behaviour of downstream dependencies 408 | * [CB-7358](https://issues.apache.org/jira/browse/CB-7358) cli spec mocks console log to avoid polluting test output while testing 409 | * [CB-7347](https://issues.apache.org/jira/browse/CB-7347) document cordova platform add /path/to support 410 | * [CB-7345](https://issues.apache.org/jira/browse/CB-7345) add tests to validate documentation 411 | * [CB-7345](https://issues.apache.org/jira/browse/CB-7345) improve cli documentation 412 | * [] refactored test to make use of jasmine's 'toThrow' expectation 413 | * correct object referenced in tests 414 | * proper order of initializers, which indicates a bigger problem 415 | * removed merge conflict 416 | * moved custom www handling code to a separate function 417 | * basic tests and structure added to create spec 418 | * renamed cli create spec more sensibly 419 | * parse config json moved to a function 420 | * functional refactor of create with expected input from caller implemented 421 | * updated tests and cli to pass all tests 422 | * tracking cli create spec 423 | * inital commit of cli create command logic in its own file 424 | * added verbose mode initialization to set up event handlers 425 | * created init function to handle initalization of underscore and nopt 426 | * Fixed the tests 427 | * Added browserify option "download_opts" 428 | * [CB-7260](https://issues.apache.org/jira/browse/CB-7260) use newer cordova-lib to get cordova-android 3.5.1, bump version num 429 | * [CB-7249](https://issues.apache.org/jira/browse/CB-7249) cordova-cli documentation translation: cordova-cli 430 | * [CB-7001](https://issues.apache.org/jira/browse/CB-7001) moved browserify help docs to proper locations 431 | * [CB-7001](https://issues.apache.org/jira/browse/CB-7001) added browserify to cordova.txt help doc 432 | * [CB-6024](https://issues.apache.org/jira/browse/CB-6024) Document -- for platform options 433 | * Added browserify flag to cli options 434 | * checking for browserify flag 435 | * [CB-7220](https://issues.apache.org/jira/browse/CB-7220) Support cordova_lib.binname 436 | * [CB-7220](https://issues.apache.org/jira/browse/CB-7220) Split cordova help into per feature help files 437 | * [CB-6756](https://issues.apache.org/jira/browse/CB-6756) Adds the platforms subcommand for save and restore 438 | * [CB-7100](https://issues.apache.org/jira/browse/CB-7100): Use npm based lazy-load by default 439 | * [CB-6127](https://issues.apache.org/jira/browse/CB-6127)lisa7cordova-plugin-consolecordova-cli documentation translation: cordova-cli 440 | * Call process.removeAllListeners() in cli spec 441 | * Add --captureExceptions flag to jasmine 442 | * Pin jasmine to older version temporarily 443 | * Fix [CB-7069](https://issues.apache.org/jira/browse/CB-7069) copy-from & link-to custom uri -> url 444 | * [CB-7002](https://issues.apache.org/jira/browse/CB-7002) Incremented package version to -dev 445 | 446 | ### 3.5.0-0.2.6 () 447 | * [CB-6976](https://issues.apache.org/jira/browse/CB-6976) Add support for Windows Universal apps (Windows 8.1 and WP 8.1) 448 | * [CB-6728](https://issues.apache.org/jira/browse/CB-6728): Support chip architecture flag --archs 449 | * [CB-6954](https://issues.apache.org/jira/browse/CB-6954): Use the unified cordova_lib.events 450 | * [CB-6740](https://issues.apache.org/jira/browse/CB-6740): [amazon-fireos]Clean up error reporting when AmazonWebView SDK not found 451 | * [CB-6943](https://issues.apache.org/jira/browse/CB-6943) Path can include the : if it is absolute, only test for http. Added tests 452 | * Show full stack for CordovaError in verbose mode 453 | * [CB-6024](https://issues.apache.org/jira/browse/CB-6024): Use nopt instead of optimist in cli 454 | * [CB-6859](https://issues.apache.org/jira/browse/CB-6859) remove wp7 as platform 455 | * Add --usenpm flag to activate npm based lazy_load 456 | * [CB-6767](https://issues.apache.org/jira/browse/CB-6767) Allow `cordova` to be replacable in error messages 457 | * CLI implementation & docs for the save and restore plugins 458 | * Add --noregstry flag for disabling plugin lookup in the registry 459 | 460 | ### 3.5.0-0.2.4 (May 14, 2014) 461 | * [CB-5941](https://issues.apache.org/jira/browse/CB-5941) Update link to hooks-README.md file from README.md 462 | * Fix cordova help 463 | * Fixing failing CLI tests by removing 'experimental' key 464 | 465 | ### 3.5.0-0.2.0 (May 09, 2014) 466 | * [CB-6649](https://issues.apache.org/jira/browse/CB-6649) Removing experimental flag from positional arguments 467 | * [CB-6648](https://issues.apache.org/jira/browse/CB-6648) Adding a flag for experimental features 468 | * Fix require paths to use cordova-lib 469 | * Update package.json to use cordova-lib 470 | * Split out cordova-lib: move cordova-cli files 471 | * [Windows8] re-added BOM : [CB-5421](https://issues.apache.org/jira/browse/CB-5421) Add BOM to all html, js, css files to ensure app can pass Windows Store Certification 472 | * [CB-6491](https://issues.apache.org/jira/browse/CB-6491) add CONTRIBUTING.md 473 | * Adding support for privileged 474 | * Merge pull request #4 from rodms10/autoPermission 475 | * android-parser: Add AndroidLaunchMode preference 476 | * Fix CLI tests to work with node v0.11 477 | * Update version of jasmine-node. Fixes test warnings util.print with node 0.11 478 | * [CB-2606](https://issues.apache.org/jira/browse/CB-2606) Andriod icon - do not attempt copy to undefined path 479 | * [CB-2606](https://issues.apache.org/jira/browse/CB-2606) Icons support for iOS, Android, BB10, WP8, Win8, FxOS 480 | * [CB-6329](https://issues.apache.org/jira/browse/CB-6329) Delete unused info-utils.js 481 | * [CB-6329](https://issues.apache.org/jira/browse/CB-6329) Clean-up of cordova info changes previously merged. 482 | * [CB-6329](https://issues.apache.org/jira/browse/CB-6329) improve 'cordova info' command 483 | * [CB-5847](https://issues.apache.org/jira/browse/CB-5847) strictSSL is no longer ignored 484 | * [CB-6432](https://issues.apache.org/jira/browse/CB-6432) pre_package hook does not populate %CORDOVA_PLATFORMS% 485 | * Revert "CB-6267 Windows8. Apply BackgroundColor from config.xml" 486 | * Recreate "platforms" dir if it was deleted. 487 | * [CB-5093](https://issues.apache.org/jira/browse/CB-5093): Add versionCode and CFBundleVersion during prepare 488 | * [CB-6312](https://issues.apache.org/jira/browse/CB-6312) Use "landscape" instead of "userLandscape" in AndroidManifest.xml 489 | * [CB-6421](https://issues.apache.org/jira/browse/CB-6421): Move tests from e2e to spec - cli test 490 | * [CB-6377](https://issues.apache.org/jira/browse/CB-6377) superspawn: always wrap non .exe with spaces to cmd with /s /c 491 | 492 | ### 3.4.1-0.1.0 (Apr 03, 2014) 493 | * updated to use iOS 3.4.1 494 | * [CB-6377](https://issues.apache.org/jira/browse/CB-6377) Fix up superspawn's cmd fallback when there is a space in the args 495 | * [CB-6377](https://issues.apache.org/jira/browse/CB-6377) Remove windowsVerbatimArguments from superspawn 496 | * [CB-6344](https://issues.apache.org/jira/browse/CB-6344) Fix spy to return a default platform JSON instead of an empty object 497 | * [CB-6382](https://issues.apache.org/jira/browse/CB-6382) platform list: sort output 498 | * [CB-6377](https://issues.apache.org/jira/browse/CB-6377) Handle spaces in paths for cmd related scripts 499 | * [CB-6292](https://issues.apache.org/jira/browse/CB-6292) Add a callback-based API for cordova info (in addition to promise API) 500 | * [CB-6292](https://issues.apache.org/jira/browse/CB-6292) Revert commits that add explicit callbacks to APIs 501 | * [CB-6322](https://issues.apache.org/jira/browse/CB-6322) Simplify platforms/platform code for platform specifics 502 | * README.md: Getting Started guides link was broke. Fix. 503 | * Make "cmd" executed more readable. 504 | * [CB-6141](https://issues.apache.org/jira/browse/CB-6141) Fix Windows 8 tests 505 | * Use smarter BOM-skipping logic when parsing XML. 506 | * [CB-6357](https://issues.apache.org/jira/browse/CB-6357) platform check - install each platform to determine working + version number 507 | * [CB-6357](https://issues.apache.org/jira/browse/CB-6357) platform: provide exports for functions 508 | * [CB-6357](https://issues.apache.org/jira/browse/CB-6357) platform: Refactor into distinct functions 509 | * [CB-6338](https://issues.apache.org/jira/browse/CB-6338) Improve error for missing template 510 | * [CB-6337](https://issues.apache.org/jira/browse/CB-6337) Print nice error when cordova-cli hits various expected things 511 | * This closes #147 512 | * [CB-6267](https://issues.apache.org/jira/browse/CB-6267) Windows8. Apply BackgroundColor from config.xml 513 | * [CB-6338](https://issues.apache.org/jira/browse/CB-6338) Improve error for missing template 514 | * [CB-6030](https://issues.apache.org/jira/browse/CB-6030) - Automatically increment port for serve when default is in use 515 | * [CB-6337](https://issues.apache.org/jira/browse/CB-6337) Print nice error when cordova-cli hits various expected things 516 | * [CB-6323](https://issues.apache.org/jira/browse/CB-6323) Fix harmless typo in superspawn (cmd -> c) 517 | * [CB-6323](https://issues.apache.org/jira/browse/CB-6323) Fix superspawn's resolve function on windows (was very broken) 518 | * [CB-6306](https://issues.apache.org/jira/browse/CB-6306) Error creating project when path to project includes spaces 519 | * Tweak error message when hooks fail (wasn't showing correct command) 520 | * [CB-6296](https://issues.apache.org/jira/browse/CB-6296) callback/promise interface implemented 521 | * [CB-6293](https://issues.apache.org/jira/browse/CB-6293) additional tests for run command 522 | * [CB-6292](https://issues.apache.org/jira/browse/CB-6292) tests for build function's dual return method 523 | * updated jasmine dependency for timing 524 | * [CB-6211](https://issues.apache.org/jira/browse/CB-6211) 'cordova info' command fixed for Windows platform 525 | * Fix prepare command from hiding failures. 526 | * Fix ConfigParser.getPreference error + tests 527 | * [CB-6209](https://issues.apache.org/jira/browse/CB-6209) Uplevel changes from android_parser to amazon_fireos_parser Added orientation related config changes from android_parser. 528 | * [CB-6147](https://issues.apache.org/jira/browse/CB-6147) Enable CLI and Plugman with npm shrinkwrap 529 | * When searchpath is specified in config and CLI, merge them. 530 | * Add --searchpath to help.txt 531 | * Fix node-style-callbacks form of the CLI api not passing through results. 532 | 533 | ### 3.4.0-0.1.3 (Mar 3, 2014) 534 | * Update to plugman v0.20.2 535 | 536 | ### 3.4.0-0.1.2 (Feb 28, 2014) 537 | * Update to plugman v0.20.1 538 | 539 | ### 3.4.0-0.1.1 (Feb 26, 2014) 540 | * Update to plugman v0.20.0 541 | * [CB-5647](https://issues.apache.org/jira/browse/CB-5647) Remove concept of .staging dir. Install directly to www/ 542 | * [CB-5299](https://issues.apache.org/jira/browse/CB-5299) Speed up prepare by using plugman's new reapply_global_munge() 543 | * Refactored config_parser.js to simply both it and its tests. 544 | * [CB-6076](https://issues.apache.org/jira/browse/CB-6076) Make "Generating config.xml from defaults" a verbose log 545 | * [CB-5181](https://issues.apache.org/jira/browse/CB-5181) Use spawn helper for all sub-shelling. 546 | * [CB-6049](https://issues.apache.org/jira/browse/CB-6049), [CB-5181](https://issues.apache.org/jira/browse/CB-5181) Enable stdio for build sub-commands and hooks 547 | 548 | ## 3.4.0-0.1.0 (Feb 14, 2014) 549 | * [CB-5638](https://issues.apache.org/jira/browse/CB-5638) Clean-up: remove unreachable info case from function 550 | * [CB-5937](https://issues.apache.org/jira/browse/CB-5937) Add "platform check" command: Shows platforms that are out of date 551 | * [CB-5634](https://issues.apache.org/jira/browse/CB-5634) Minor refactoring + tests for Android's orientation preference. 552 | * [CB-5634](https://issues.apache.org/jira/browse/CB-5634) Set Android orientation from config.xml 553 | * Upleveled amazon_fireos_parser. Making it at par with android_parser.js 554 | * [CB-5947](https://issues.apache.org/jira/browse/CB-5947) Throw when trying to create project inside custom www. 555 | * [CB-4153](https://issues.apache.org/jira/browse/CB-4153) Update help.txt about --source -> --copy-from 556 | 557 | ## 3.3.1-0.3.1 (Jan 31, 2014) 558 | * [CB-4153](https://issues.apache.org/jira/browse/CB-4153) Rename --source and --link flags to --copy-from and --link-to 559 | 560 | ## 3.3.1-0.3.0 (Jan 30, 2014) 561 | * Updated plugman dependency to 0.19.0 562 | * [CB-5913](https://issues.apache.org/jira/browse/CB-5913) Fail more gracefully on Windows when symlinks fail. 563 | * Fix isWindows check in util.js to support win64 564 | * [CB-5907](https://issues.apache.org/jira/browse/CB-5907) Make `cordova update` get version from platform's version script 565 | * [CB-3612](https://issues.apache.org/jira/browse/CB-3612) Don't pass --device to "run" command by default. 566 | * [CB-5493](https://issues.apache.org/jira/browse/CB-5493) lazy_load now downloads to a temp dir and then moves. 567 | * [CB-5782](https://issues.apache.org/jira/browse/CB-5782) Hide stack trace for explicitly handled error conditions 568 | * [CB-5590](https://issues.apache.org/jira/browse/CB-5590) Have config.xml version map to CFBundleShortVersionString instead of CFBundleVersion 569 | * [CB-5299](https://issues.apache.org/jira/browse/CB-5299) Cache pbxproj to avoid re-parsing it for each plugin. 570 | * [CB-5813](https://issues.apache.org/jira/browse/CB-5813) Fix missing quotes on update and ls commands 571 | * [CB-5808](https://issues.apache.org/jira/browse/CB-5808) Fix lazy_load stripping off windows drive letters 572 | * Expose util.isCordova as cordova.findProjectRoot() 573 | * Allow lazy_load libs to work without an id and version for local paths. 574 | * Add an option to config.js to not write config.json during create. 575 | * Update node-xcode dependency to 0.6.6 576 | 577 | ## 3.3.1-0.2.0 (Jan 15, 2014) 578 | * [CB-5006](https://issues.apache.org/jira/browse/CB-5006) Add --searchpath to "plugin add" so that installing by ID will search local paths before hitting the registry. 579 | * [CB-4153](https://issues.apache.org/jira/browse/CB-4153) Add --src & --link to cordova create. 580 | * [CB-5687](https://issues.apache.org/jira/browse/CB-5687) Make cordova commands work when CWD is inside of a symlink'ed www/ 581 | * [CB-4910](https://issues.apache.org/jira/browse/CB-4910) Default config.xml to the root instead of within www/ 582 | * [CB-5764](https://issues.apache.org/jira/browse/CB-5764) Move hooks/ to top-level instead of under .cordova 583 | * [CB-5763](https://issues.apache.org/jira/browse/CB-5763) Don't create .cordova/ by default 584 | * [CB-4871](https://issues.apache.org/jira/browse/CB-4871) Reduced package size significantly. 585 | * [CB-4976](https://issues.apache.org/jira/browse/CB-4976) Don't use ~/.cordova/lib for local directory 586 | * [CB-5777](https://issues.apache.org/jira/browse/CB-5777) Fix "platform update" not updating cordova.js 587 | * [CB-5728](https://issues.apache.org/jira/browse/CB-5728) Files in merges must remain intact when removing platform 588 | 589 | ## 3.3.0-0.1.0 590 | * [CB-5347](https://issues.apache.org/jira/browse/CB-5347) Handle dangling platform symlink in cordova platform add 591 | * Added deprecation notice about wp7 592 | * updated plugman version to 0.17.0 593 | * [CB-5573](https://issues.apache.org/jira/browse/CB-5573) relies on stderr content and error codes to detect a problem with xcode installation. 594 | * [CB-4382](https://issues.apache.org/jira/browse/CB-4382) Pass cli arguments to project-level hooks 595 | * [CB-5362](https://issues.apache.org/jira/browse/CB-5362) blackberry parser: support local cordova-blackberry 596 | * [CB-5345](https://issues.apache.org/jira/browse/CB-5345) Add pre_package event for windows8 parser. 597 | 598 | ## 3.2.0-0.4.0 599 | 600 | * Make sure errors during prepare are reported 601 | * [CB-5031](https://issues.apache.org/jira/browse/CB-5031) Add CLI help text for platform update and plugin search 602 | * [CB-5298](https://issues.apache.org/jira/browse/CB-5298) Remove redundant requirements check for iOS and Android. The bin/create scripts check. 603 | * windows8. fixes version number parsing logic 604 | * [CB-4472](https://issues.apache.org/jira/browse/CB-4472) Remove preference from template config.xml 605 | 606 | ## 3.2.0-0.3.0 607 | 608 | * [CB-5501](https://issues.apache.org/jira/browse/CB-5501) fix blackberry10 platform 609 | * [android] fixing failing android parser spec tests 610 | * [android] call out to platform check_req script 611 | 612 | ## 3.2.0-0.2.0 613 | 614 | * [CB-5485](https://issues.apache.org/jira/browse/CB-5485) fixed issue with use of cordova cli api 615 | 616 | ## 3.2.0-0.1.0 617 | 618 | * add the output of the plugman results to the console 619 | * [CB-5363](https://issues.apache.org/jira/browse/CB-5363) Improve config_json error reporting 620 | * [CB-5364](https://issues.apache.org/jira/browse/CB-5364) config_parser - check for null element text 621 | * Fix issue not finding platform script when in subdir - check platforms which have subdir 622 | * [CB-5377](https://issues.apache.org/jira/browse/CB-5377) serve: should only indicate listening when it is 623 | * [CB-5368](https://issues.apache.org/jira/browse/CB-5368) Cordova serve deflate content breaks IE 624 | * Change cordova serve's project.json to include etags. 625 | * [CB-5280](https://issues.apache.org/jira/browse/CB-5280) Update serve's help text to remove platform arguments 626 | * [CB-5364](https://issues.apache.org/jira/browse/CB-5364) config_parser - handle duplicates with children and text when merging 627 | * [CB-5320](https://issues.apache.org/jira/browse/CB-5320) Document avoiding sudo 628 | * [CB-4400](https://issues.apache.org/jira/browse/CB-4400): cd to project root in most cordova commands. 629 | * [CB-5063](https://issues.apache.org/jira/browse/CB-5063): Revert to copying cordova.js before user www dir 630 | * fix 3 failing tests for windows8 and wp8 and add assertions for wp7 too. 631 | * Adding instructions for installing on master. 632 | * [CB-5063](https://issues.apache.org/jira/browse/CB-5063): Keep cordova.js in platform_www to avoid copying it from lib. 633 | * [CB-5307](https://issues.apache.org/jira/browse/CB-5307): Remove references to Callback and Incubator 634 | * tests were failing attempting to match lib/dir and lib\\dir on windows 635 | * [CB-5183](https://issues.apache.org/jira/browse/CB-5183) WP7/8 lib path is not correctly resolved by CLI (additional changes) 636 | * [CB-5283](https://issues.apache.org/jira/browse/CB-5283) Improved cordova serve message to be more descriptive 637 | * [CB-4866](https://issues.apache.org/jira/browse/CB-4866) Execute hooks in ascending order of any leading numbers 638 | * [CB-5143](https://issues.apache.org/jira/browse/CB-5143) Locate the actual Android app .java file much more carefully. 639 | * Cleaning up wp7+8 parsers' use of promises. Fix tests. 640 | * serve: Fix doRoot() not being called & remove duplicated table. 641 | * serve: provide basic entry point 642 | * Code style (indentation) 643 | * Wait for the pre_package event to finish, or the update_csproj function might give unexpected results 644 | * Add pre_package event to wp8 project 645 | * readability + code quality in wp7+8 parsers 646 | * [CB-5183](https://issues.apache.org/jira/browse/CB-5183) WP7/8 custom_path is not correctly resolved by CLI 647 | * [CB-4994](https://issues.apache.org/jira/browse/CB-4994) Update xcode dependency to handle Xcode 5 capabilities. 648 | * [CB-5220](https://issues.apache.org/jira/browse/CB-5220) "An error occurred" is missing an "A" ... 649 | 650 | 651 | ## 3.1.0-0.2.0 652 | 653 | * increased version of plugman to 0.14.0 in package.json 654 | * [CB-5187](https://issues.apache.org/jira/browse/CB-5187): remove unused var os_platform 655 | * CB:5187 on node windows broken compile, emulate, run 656 | * [CB-4976](https://issues.apache.org/jira/browse/CB-4976) Don't symlink into ~/.cordova/lib for local libs 657 | * [CB-5142](https://issues.apache.org/jira/browse/CB-5142) improve grammar of emulate description 658 | * [CB-5147](https://issues.apache.org/jira/browse/CB-5147) emulate needs a space before error message 659 | * [CB-5125](https://issues.apache.org/jira/browse/CB-5125) add tests for chil process spawn 660 | * [CB-5125](https://issues.apache.org/jira/browse/CB-5125): replace child process exec with spawn 661 | * [CB-4748](https://issues.apache.org/jira/browse/CB-4748): Fail quickly if dir passed to cordova create is not empty. 662 | * [CB-5106](https://issues.apache.org/jira/browse/CB-5106): removed flood of cp error messages when running tests 663 | * [CB-5106](https://issues.apache.org/jira/browse/CB-5106):[wp7] fixed broken wp7 tests 664 | * [CB-5106](https://issues.apache.org/jira/browse/CB-5106):[win8] fixed tests for windows 8 665 | * Using .find to grab visualelements instead 666 | * [CB-5066](https://issues.apache.org/jira/browse/CB-5066): fixed issue with visual elements not being referenced correctly 667 | * windows8: remove debug console.log 668 | * windows8: fixed project parser issue, and updated tests 669 | * Update tests for commit d1c8024: update_project() should not call update_www() directly 670 | * begin firefoxos tests 671 | * [CB-5066](https://issues.apache.org/jira/browse/CB-5066): dealing with windows8 issues 672 | * config.xml helper function is used, removed error merge of wp folder. 673 | * [CB-5066](https://issues.apache.org/jira/browse/CB-5066): continuing merge of windows 8 stuff 674 | * [CB-5066](https://issues.apache.org/jira/browse/CB-5066): merged in windows 8 support into master from cordova-3.1.x 675 | * config.xml helper function is used, removed error merge of wp folder. 676 | * [CB-5066](https://issues.apache.org/jira/browse/CB-5066): continuing merge of windows 8 stuff 677 | * [CB-5066](https://issues.apache.org/jira/browse/CB-5066): merged in windows 8 support into master from cordova-3.1.x 678 | * [CB-2234](https://issues.apache.org/jira/browse/CB-2234) Add 'cordova info' command 679 | * [CB-4774](https://issues.apache.org/jira/browse/CB-4774): Copy www assets before running plugin prepare 680 | * cordova help should return a Q. fixes [CB-5070](https://issues.apache.org/jira/browse/CB-5070) 681 | * updated to a version greater than our latest version on npm 682 | * added not about platform+os restrictions 683 | * added myself as a contributor, [CB-5042](https://issues.apache.org/jira/browse/CB-5042) added info on windows8 684 | * [CB-5067](https://issues.apache.org/jira/browse/CB-5067): added exception incase no platform level config.xml or defaults.xml exisit 685 | * added temp config path for ffos, fixed wp8 config_xml function 686 | * [CB-4774](https://issues.apache.org/jira/browse/CB-4774) Updated prepare flow to make platform config.xml a build output - Adds a new method to 687 | * [CB-5032](https://issues.apache.org/jira/browse/CB-5032): clarify the help text 688 | * [CB-4621](https://issues.apache.org/jira/browse/CB-4621) Updating run and emulate commands to always provide default options 689 | * Log requests in cordova serve 690 | * Make cordova serve ignore dot files. 691 | * [CB-4957](https://issues.apache.org/jira/browse/CB-4957): added fix for FFOS 692 | * Update "cordova serve" to work with promises refactoring 693 | * [CB-4774](https://issues.apache.org/jira/browse/CB-4774) Display proper error if cordova prepare run not in project dir. 694 | * Fixes a bug where cordova prepare bombs on a config missing a content element - Changes an undefi 695 | * Bumping elementtree version to 0.1.5 to match plugman and support namespaced xml elements 696 | * Fix cli.js tests broken by --silent change. 697 | * [CB-4877]: Add basic logging, --silent flag. 698 | * Fix busted test. 699 | * First pass 700 | * [CB-4883]: Graceful handling of lazy loading errors. 701 | * reapplied change to add event mid build to allow mods to www folder pre_package aka 775e969f9cc27a 702 | * Remove two debugger; lines that snuck in. 703 | * [CB-4604](https://issues.apache.org/jira/browse/CB-4604) Execute hooks directly (not .bat files) cross-platform 704 | * Refactor to use Q.js promises in place of callbacks everywhere. 705 | * [CB-4837]: Version 3.0.10. Depends on Plugman 0.12.x. 706 | * Add missing license headers 707 | * Update repo versions to 3.1.0-rc1 708 | * Add `cordova update foo` command, with tests. [CB-4777](https://issues.apache.org/jira/browse/CB-4777) 709 | * Add version numbers to `platform ls` output. 710 | * [CB-4545](https://issues.apache.org/jira/browse/CB-4545) support for merges directory on both wp7 & wp8 711 | * Rename CHANGELOG.md -> RELEASENOTES.md 712 | * Fix expectation for platform ls test, for firefoxos 713 | * Fix platforms.js: firefoxos.parser 714 | * CB:4657 added ffos support to cli 715 | * [CB-4657](https://issues.apache.org/jira/browse/CB-4657): added staging_dir function to ff parser 716 | * add default manifest properties for firefox os platform 717 | * make the firefoxos parser actually build the project 718 | * change firefoxos link to tarball 719 | * add firefox platform 720 | * [CB-4797](https://issues.apache.org/jira/browse/CB-4797) Fix a crash on undefined platform in path. 721 | * [CB-4797](https://issues.apache.org/jira/browse/CB-4797) Add missing return statement in cordova serve 722 | * Fix broken tests due to lazy requiring change. 723 | * [CB-4797](https://issues.apache.org/jira/browse/CB-4797) Change `serve` command to serve platforms keyed off of path component. 724 | * [CB-4793](https://issues.apache.org/jira/browse/CB-4793) Lazily require modules in some places. 725 | * [CB-4325](https://issues.apache.org/jira/browse/CB-4325) Run platform installs in serial instead of in parallel 726 | * Version updated to 3.0.10-dev 727 | 728 | ## 3.0.10 729 | 730 | Important note: This version targets Cordova version 3.1.0-rc1. 731 | 732 | ### Notable 733 | 734 | - You can now `cordova platform update `, which calls the platform's update script. Android, iOS, WP7 and WP8 have update scripts. Please give this a try and report any problems! 735 | 736 | ### Features 737 | 738 | - `platform ls` now shows the version of each installed platform. 739 | - `merges` are now supported on WP7+8. 740 | - `serve` now serves from `http://myhost.com/ios/www`, `/android/www`, etc., serving all platforms at once. 741 | - Speed significantly improved by importing modules only on demand. `prepare` is much faster, `platform ls` more than 10x faster. 742 | - Now with Firefox OS! 743 | 744 | ### Bugfixes 745 | 746 | - Corner cases in `serve`. 747 | 748 | 749 | ## 3.0.9 750 | 751 | ### Features 752 | 753 | - `platform ls` now shows both installed and available-to-install platforms. [CB-3904](https://issues.apache.org/jira/browse/CB-3904) 754 | 755 | ### Bugfixes 756 | 757 | - Plugins are now installed serially across all installed platforms, rather than in parallel. This avoids race conditions in dependency installation. [CB-4184](https://issues.apache.org/jira/browse/CB-4184) 758 | - (WP8) All files from project www dir are now copied into the binary, not the top-level www. This means merges and plugin assets are correctly handled. 759 | --------------------------------------------------------------------------------