Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

assets-manager

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assets-manager - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

dist/rename.js

20

dist/Manifest.js

@@ -41,2 +41,6 @@ 'use strict';

var _rename = require('./rename');
var _rename2 = _interopRequireDefault(_rename);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -142,2 +146,3 @@

var files = [];
var renameRules = Object.assign(this.getConfigure('rename'), pkg.options.rename);

@@ -148,14 +153,19 @@ var _loop = function _loop(type) {

var dest = void 0;
var basename = _path2.default.basename(filepath);
if (renameRules) {
basename = (0, _rename2.default)(basename, renameRules);
}
/*eslint no-lonely-if: "off"*/
if (pkg.options.flattenPackages) {
if (pkg.options.flattenTypes) {
dest = _path2.default.join(_this.dest, _path2.default.basename(filepath));
dest = _path2.default.join(_this.dest, basename);
} else {
dest = _path2.default.join(dests[type], _path2.default.basename(filepath));
dest = _path2.default.join(dests[type], basename);
}
} else {
if (pkg.options.flattenTypes) {
dest = _path2.default.join(_this.dest, pkg.name, _path2.default.basename(filepath));
dest = _path2.default.join(_this.dest, pkg.name, basename);
} else {
dest = _path2.default.join(dests[type], pkg.name, _path2.default.basename(filepath));
dest = _path2.default.join(dests[type], pkg.name, basename);
}

@@ -299,2 +309,4 @@ }

this.setConfigure('types', this.data.types, _types2.default);
this.setConfigure('rename', this.data.types, {});
this.setConfigure('replace', this.data.types, {});

@@ -301,0 +313,0 @@ var cwd = this.data.cwd;

6

dist/Package.js

@@ -60,3 +60,5 @@ 'use strict';

override: _configure2.default.get('override', true),
registry: _configure2.default.get('defaultRegistry', 'npm')
registry: _configure2.default.get('defaultRegistry', 'npm'),
rename: {},
replace: {}
}, options);

@@ -141,2 +143,4 @@

types[type].push(defination[type][_file]);
this.options.rename[_path2.default.basename(defination[type][_file])] = _file;
}

@@ -143,0 +147,0 @@ } else {

{
"name": "assets-manager",
"version": "0.1.1",
"version": "0.1.2",
"description": "Copy packages files based on manifest file",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/amazingSurge/assets-manager",

@@ -7,3 +7,3 @@ # assets-manager [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url]

```sh
$ npm install --save assets-manager
$ npm install --save-dev assets-manager
```

@@ -58,5 +58,5 @@

## Registries
Assets manager can work with different package manager like npm, bower. Also It can use custom folders.
Assets manager can work with different package manager like **npm**, **bower**. It Also can use custom folders.
Just defined the registries in the manifest.json.
Just defined the registries in the manifest.json. The **npm** and **bower** are supported by default, you don't need defined them again.

@@ -70,2 +70,48 @@ ```js

## Example manifest.json
```js
{
"cwd": "./",
"registries": {
"vendor": "libs"
},
"defaultRegistry": "npm",
"verbose": true,
"override": true,
"flattenPackages": true,
"flattenTypes": false,
"dest": "assets",
"dests": {
"images": "images",
"fonts": "fonts",
"js": "js",
"coffee": "source/coffee",
"es6": "source/es6",
"css": "css",
"stylus": "source/stylus",
"less": "source/less",
"sass": "source/sass",
"scss": "source/scss"
},
"packages": {
"bower:jquery": true,
"npm:bootstrap": [{
"js": "dist/js",
"css": "dist/css",
"less": "less",
"fonts": "dist/fonts"
}, {
"replace": {
"*.css": {
"../fonts": "path-to-fonts"
}
}
}],
"vendor:modernizr": {
"modernizr.js": "dist/modernizr.min.js",
}
}
}
```
## Global options

@@ -85,3 +131,3 @@ ### cwd

### verbose
Whether to console log copy and clean files.
Whether to output copy and clean files infos to console.
Defaults to true.

@@ -139,3 +185,3 @@

1. simple mode
1.simple mode
```js

@@ -147,3 +193,3 @@ "PACKAGEKEY": true

2. use options only
2.use options only
```js

@@ -160,3 +206,3 @@ "PACKAGEKEY": [

3. use types only
3.use types only
```js

@@ -171,3 +217,3 @@ "PACKAGEKEY": [{

4. use types only alternatively
4.use types only alternatively
```js

@@ -180,3 +226,3 @@ "PACKAGEKEY": {

5. use types and options
5.use types and options
```js

@@ -198,3 +244,3 @@ "PACKAGEKEY": [

1. Simple path mapping
1.Simple path mapping
```js

@@ -207,3 +253,3 @@ {

2. Glob support
2.Glob support
```js

@@ -216,3 +262,3 @@ {

3. Array support
3.Array support
```js

@@ -225,3 +271,3 @@ {

4. You can rename the files
4.You can rename the files
```js

@@ -250,3 +296,3 @@ js: {

#### clean, flattenPackages, flattenTypes, registry
#### flattenPackages, flattenTypes, verbose, override, registry
These options will override the global options.

@@ -257,50 +303,35 @@

#### Hooks
Assets manager provides 2 separate hooks that can be used to trigger other automated tools during assets copy operate.
#### replace
```js
"replace": {
"*.css": {
"../fonts": "path-to-fonts"
}
}
```
"hook:pre": "<your command here>",
"hook:post": "<your command here>",
```
## Example manifest.json
#### rename
```js
{
"cwd": "./",
"registries": {
"vendor": "libs"
},
"defaultRegistry": "npm",
"verbose": true,
"override": true,
"flattenPackages": true,
"flattenTypes": false,
"dest": "assets",
"dests": {
"images": "images",
"fonts": "fonts",
"js": "js",
"coffee": "source/coffee",
"es6": "source/es6",
"css": "css",
"stylus": "source/stylus",
"less": "source/less",
"sass": "source/sass",
"scss": "source/scss"
},
"packages": {
"bower:jquery": true,
"npm:bootstrap": [{
"js": "dist/js",
"css": "dist/css",
"less": "less",
"fonts": "dist/fonts"
}],
"vendor:modernizr": {
"modernizr.js": "dist/modernizr.min.js",
}
}
"rename": {
"jquery.min.js": "jquery.js",
"*.min.css": [/\.min.css$/, ".css"]
}
```
#### Hooks
Assets manager provides 4 separate hooks that can be used to trigger other automated tools during assets copy or clean operate.
```
"copy:pre": "<your command here>",
"copy:post": "<your command here>",
"clean:pre": "<your command here>",
"clean:post": "<your command here>",
```
## Todos
- Hooks
- Npm package version support
- File collections
- Dependencies
## License

@@ -307,0 +338,0 @@

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