New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cordova-import-npm

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-import-npm - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

importNpmPackages.js

2

package.json
{
"name": "cordova-import-npm",
"version": "1.0.0",
"version": "1.0.1",
"description": "Import files from npm packages into your cordova www directory automatically, upon cordova prepare or cordova build",

@@ -5,0 +5,0 @@ "scripts": {

@@ -0,4 +1,60 @@

# On development, don't use this yet...
# cordova-import-npm
Import files from npm packages into your cordova www directory automatically, upon cordova prepare or cordova build
in production...
Oftentimes we want to import files available in npm modules into our `www/` directory in cordova projects.
## Install
Just run in the root directory of your cordova project
`npm i cordova-import-npm`
It will add a hook at hooks/ and edit your `config.xml` accordingly, such that npm files that you define will be imported upon `cordova prepare` or `cordova build`
## Settings
You define the npm files you'd like to import by editing the file `npmFilesToImport.json`. The syntax is the following:
```json
{
"npmPackageName": {
"from": "path/to/file/relative/to/npmModule/directory",
"to": "path/to/file/relative/to/cordovaWWW/directory"
}
}
```
The paths may be strings or arrays, though arrays are recommended as then it works in either unix or windows file systems.
Use an array to copy more than one file for each package.
## Example
Imagine you want the latest jquery and bootsrap files on your `www/js/res/` and `www/css/res/ directories`. Just run
```
npm i cordova-import-npm
```
And then edit your `npmFilesToImport.json` with this info:
```json
{
"jquery": {
"from": ["dist", "jquery.min.js"],
"to": ["js", "res", "jquery.min.js"]
},
"bootstrap": [
{
"from": ["dist", "js", "bootstrap.min.js"],
"to": ["js", "res", "bootstrap.min.js"]
},
{
"from": ["dist", "css", "bootstrap.min.css"],
"to": ["css", "res", "bootstrap.min.css"]
},
],
}
```
Then run `cordova prepare` or `cordova build` and the npm files will be copied.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc