scripts
Scripts for umm modules.
Script list
Library list
Usage
package.json
Normal
{
"scripts": {
"umm:init": "./node_modules/.bin/umm-init",
"umm:install": "./node_modules/.bin/umm-install",
"umm:uninstall": "./node_modules/.bin/umm-uninstall",
"postinstall": "npm run --silent umm:install",
"postuninstall": "npm run --silent umm:uninstall"
},
}
- Automatic deployment by
umm:install
.
- Copy assets to
Assets/Modules/<scope>@<module>/
from Assets/
in modules excepts listed in .npmignore
.
Customized
{
"scripts": {
"umm:init": "./node_modules/.bin/umm-init",
"umm:install": "./node_modules/.bin/umm-install",
"umm:uninstall": "./node_modules/.bin/umm-uninstall",
"postinstall": "npm run --silent umm:install && node ./scripts/postinstall.js",
"postuninstall": "npm run --silent umm:uninstall"
},
}
- Append calling script into
postinstall
section if you need to customized deploy.
postinstall.js
const umm = require('@umm/scripts');
umm.libraries.synchronize("path/to/source", "path/to/destination");
Signature
libraries.synchronize(source_path, destination_path, [patterns], [overwrite_options], [callback])
- Synchronize assets flexiblly.
Detail
Argument |
Type |
Description |
source_path |
{String} |
Copy source path |
destination_path |
{String} |
Copy destination path |
patterns |
`{Array<String |
Object>}` |
overwrite_options |
{Object} |
Overwrite default options |
callback |
{Function} |
Callback function |
Details of patterns
Detail
Key |
Type |
Description |
Default |
pattern |
{String} |
Designation patterns as glob. |
- |
overwrite |
{Boolean} |
Overwrite files if already exists. |
true |
remove_source |
{Boolean} |
Remove source files when finish copy. |
false |
remove_empty_source_directory |
{Boolean} |
Remove empty directory in source path after finish processing remove_source . |
false |
remove_deleted_files |
{Boolean} |
Remove files that do not exist on the source path. |
false |
Details of overwrite_options
- Parameters are ignored if specified by patterns.
Detail
Key |
Type |
Description |
Default |
overwrite |
{Boolean} |
Overwrite files if already exists. |
true |
remove_source |
{Boolean} |
Remove source files when finish copy. |
false |
remove_empty_source_directory |
{Boolean} |
Remove empty directory in source path after finish processing remove_source . |
false |
remove_deleted_files |
{Boolean} |
Remove files that do not exist on the source path. |
false |
libraries.info
- Information of module as JavaScript
Object
.
Detail
Key |
Type |
Description |
npm_package_name |
{String} |
Name of npm package. |
has_scope |
{Boolean} |
Package name has scope? (Package name has @ character if scoped.) |
development_install |
{Boolean} |
Set true if installation process is development. |
module_name |
{String} |
Module name. |
scope |
{String} |
Scope of module. |
name |
{String} |
Name of module. |
package_path |
{String} |
Path to package install. |
base_path |
{String} |
Path of project. |
Example
{
npm_package_name: "@umm/sample_module",
has_scope: true,
development_install: false,
module_name: "umm@sample_module",
scope: "umm",
name: "sample_module",
package_path: "/Users/monry/Development/git/monry/some_project/node_modules/@umm/sample_module",
base_path: "/Users/monry/Development/git/monry/some_project",
}
License
Copyright (c) 2018 Tetsuya Mori
Released under the MIT license, see LICENSE.txt