apache / cordova-plugman Goto Github PK
View Code? Open in Web Editor NEWApache Cordova Plugman
Home Page: https://cordova.apache.org/
License: Apache License 2.0
Apache Cordova Plugman
Home Page: https://cordova.apache.org/
License: Apache License 2.0
Missing:
Author plugins
create Create a plugin
createpackagejson Add a package.json file to a plugin
platform Add and remove platforms from a plugin
Outdated:
Should only be done once we have some tests (#114), so as not to give a wrong sense of security.
Those can probably be removed:
Author plugins
create Create a plugin
createpackagejson Add a package.json file to a plugin
platform Add and remove platforms from a plugin
Some input:
plugman create
, plugman createpackagejson
and plugman platform
create.Oh look, something like this already exists:
https://github.com/phonegap/phonegap-plugin-template
https://github.com/cesilva/cordova-plugin-template
Unfortunately this is gone:
https://www.npmjs.com/package/cordova-plugin-template
Although we probably don't need to publish this to npm anyway.
plugman create --name cordova-plugin-math --plugin_id cordova-plugin-math --plugin_version 0.0.1
plugman platform add --platform_name windows
results in
<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova-plugin-math" version="0.0.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android"><name>cordova-plugin-math</name><js-module name="cordova-plugin-math" src="www/cordova-plugin-math.js"><clobbers target="cordova.plugins.cordova-plugin-math" /></js-module><platform name="windows"><js-module name="cordova-plugin-math" src="src/windows/cordova-plugin-math.js"><runs target="" /></js-module></platform></plugin>
This module is virtually untested right now.
plugman create --name cordova-plugin-math --plugin_id cordova-plugin-math --plugin_version 0.0.1
leads to
<clobbers target="cordova.plugins.cordova-plugin-math" />
which is invalid.
Fixing manually to cordova.plugins.math
or similar fixes the issue.
Plugman does not work with latest version of Cordova iOS (5.0.1), resulting in error:
Failed to install 'cordova-plugin-background-fetch': Error: Your ios platform does not have Api.js
When running:
plugman install --platform ios --project platforms/ios --plugin cordova-background-geolocation-lt
The plugin will install to this specific platform correctly
Fails with error:
Failed to install 'cordova-plugin-background-fetch': Error: Your ios platform does not have Api.js
Cordova Version 9.0.0
Cordova iOS version 5.0.1
Plugman version: Latest (unable to check using plugman --version)
Can't install plugins on NPM 16.
Failed to fetch plugin cordova-clipboard via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Could not determine package name from output:
added 1 package, removed 7 packages, and audited 2 packages in 822ms
Trying to add a new plugin only to android using plugman gives below error :
Installing "cordova-plugin-firebase-messaging" for android
cordova-android version not detected (lacks script <project path>/cordova/version ), continuing.
Plugin doesn't support this project's cordova version. cordova: 9.0.1, failed version requirement: >=10.0.0
Skipping 'cordova-plugin-firebase-messaging' for android
cordova platforms list
Installed platforms:
android 12.0.1
ios 7.0.1
cordova --version
12.0.0 ([email protected])
Mac OS
When I try to install plugman with command npm install -g plugman in macOS, it gives error - Unexpected end of JSON input while parsing near '..."3.4.1":{"name":"modu'
Kindly find the entire stacktrace in attached file.
Node: v8.0.0
npm: 5.4.1
cordova: 6.5.0
OS: macOS Sierra
Plugman command not recognised after plugman help executed.
command not found: plugman
I am planning to create plugin for Android and iOS after following steps from your documentation.
Tried with sudo same happening.
plugman help -> command not found.
MacOS Catalina 10.15
Cordova 10.0.0
Plugman 3.0.0
MacOS Catalina 10.15.
Node v15.3.0
Plugin installation should succeed.
Plugin installation fails with a registry fetch error (but the plugin is in the registry). It sometimes succeeds on the second try, as if the first time it didn't wait for the fetch to finish before making sure the plugin exists on disk. Installation of all plugins fails in the same manner, it's not just this one.
Here is the error:
Running command: npm install [email protected] --production --no-save
Command finished with error code 0: npm install,[email protected],--production,--no-save
Failed to fetch plugin [email protected] via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Could not determine package name from output:
added 1 package, removed 1 package, and audited 2 packages in 1s
found 0 vulnerabilities
CordovaError: Failed to fetch plugin [email protected] via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Could not determine package name from output:
added 1 package, removed 1 package, and audited 2 packages in 1s
found 0 vulnerabilities
at /Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/node_modules/.pnpm/[email protected]/node_modules/cordova-lib/src/plugman/fetch.js:146:43
at processTicksAndRejections (node:internal/process/task_queues:96:5)
node:child_process:915
throw err;
^
Error: Command failed: node_modules/.bin/plugman -d install --platform android --project platforms/android --plugin [email protected] --plugins_dir=plugins
at checkExecSyncError (node:child_process:841:11)
at execSync (node:child_process:912:15)
at /Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/scripts/install-plugins.js:29:5
at arrayEach (/Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/node_modules/.pnpm/[email protected]/node_modules/lodash/lodash.js:530:11)
at Function.forEach (/Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/node_modules/.pnpm/[email protected]/node_modules/lodash/lodash.js:9410:14)
at /Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/scripts/install-plugins.js:28:5
at /Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/node_modules/.pnpm/[email protected]/node_modules/lodash/lodash.js:4967:15
at baseForOwn (/Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/node_modules/.pnpm/[email protected]/node_modules/lodash/lodash.js:3032:24)
at Function.forOwn (/Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/node_modules/.pnpm/[email protected]/node_modules/lodash/lodash.js:13082:24) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 37257,
stdout: null,
stderr: null
}
ELIFECYCLE Command failed with exit code 1.
It seems like the problem occurs because something goes wrong when plugman uses npm 8.5 while being run by execSync
(in a script). If I install npm 6.X locally in the project (npm install --save-dev [email protected]
), the plugman script uses that internally and installation succeeds. However, it forces me to downgrade npm to v6 for my whole project instead of staying on npm 8 which is the default for node 16.
execSync(
`node_modules/.bin/plugman -d install --platform android --project platforms/android --plugin [email protected] --plugins_dir=plugins`,
{ stdio: "inherit" }
);
macOS 12.6 (21G115)
node 16.17.1
npm 8.15.0
plugman 3.0.1
cordova 11.0.0
cordova-android 10.1.2
cordova-ios 6.2.0
We need to replicate at least part of what we did in apache/cordova-cli#295
This will get rid of the UnhandledPromiseRejectionWarning
that can be observed in the log output of #110
Once we have CI (#115)
plugman create --name cordova-plugin-math --plugin_id cordova-plugin-math --plugin_version 0.0.1
plugman platform add --platform_name windows
leads to
<js-module name="cordova-plugin-math" src="www/cordova-plugin-math.js">
<clobbers target="cordova.plugins.math" />
</js-module>
<platform name="windows">
<js-module name="cordova-plugin-math" src="src/windows/cordova-plugin-math.js">
<runs target="" />
</js-module>
</platform>
Those files being named identical, leads to this exception:
SCRIPT5022: Unhandled exception at line 74, column 13 in ms-appx-web://io.cordova.hellocordova/www/cordova.js
0x800a139e - JavaScript runtime error: module cordova-plugin-math.cordova-plugin-math already defined
because both files begin with
cordova.define("cordova-plugin-math.cordova-plugin-math", function(require, exports, module) {
Updating js-module.name
to mathProxy
(and renaming src/windows/cordova-plugin-math.js
to src/windows/mathProxy.js
and updating the .src
to that) fixes the problem. (Might have to remove and re-add the platform to get rid o the old file though)
When the -www
option is used, plugins should be installed in the given directory instead of the default <project>/cordova/plugins
Plugins are still installed in the default directory.
% ls
www myproj
% plugman install --platform ios --proj myproj --plugin cordova-plugin-device --www ./www
% plugman install --platform ios --proj myproj --plugin cordova-plugin-device --www .
% plugman install --platform ios --proj myproj --plugin cordova-plugin-device --www www
Plugins are installed in myproj/cordova/plugins, instead of the local www directory
Using platofrm-ios directly, no cordova CLI. Happens with every plugin.
plugman 3.0.1
cordova-ios 6.2.0
npm 7.20.3
node 16.7.0
macOS 11.6
λ plugman --version
Usage: plugman [OPTION]... <command>
These are the available plugman commands:
Manage plugins in a Cordova project
install Install a plugin into a Cordova project
uninstall Uninstall a plugin from a Cordova project
Author plugins
create Create a plugin
createpackagejson Add a package.json file to a plugin
platform Add and remove platforms from a plugin
Global options:
--help, -h Show help for <command> or this if none was given
--debug, -d Enable verbose output
--version, -v Display the plugman version
real version is 3.0.1
Is there a way to fetch a specific commit? I tried:
plugman install ... --plugin cordova-plugin-keyboard#1234
plugman install ... --plugin https://github.com/cjpearson/cordova-plugin-keyboard#1234
but they all "Failed to fetch plugin from registry".
λ plugman platform add --platform_name browser
platform: browser not yet supported
I am getting this error when ever i am trying to add a platform by
plugman platform add --platform_name android
(node:17948) UnhandledPromiseRejectionWarning: Error: platform: true not yet supported
at Object.add (E:\cordova-plugman\node_modules\cordova-lib\src\plugman\platform.js:51:35)
at Object.module.exports [as platform] (E:\cordova-plugman\node_modules\cordova-lib\src\plugman\platform_operation.js:23:38)
at Object.platform (E:\cordova-plugman\node_modules\cordova-lib\src\plugman\plugman.js:153:17)
at Object.<anonymous> (E:\cordova-plugman\main.js:87:42)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
(node:17948) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:17948) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.