Skip to content

Commit e3f4ce2

Browse files
committed
- support optional in module format.
- bump version
1 parent b1c8b92 commit e3f4ce2

6 files changed

Lines changed: 11 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Logs
22

3+
## v1.3.0
4+
5+
- support `optional` in module format.
6+
7+
38
## v1.2.0
49

510
- support transpilation on demand.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ If object is used, it contains following fields:
6060
- always false if `browserify` is set to true.
6161
- `transpile`: add this object if you need to transpile module file, which contains following fields:
6262
- `files`: a list of file to transpile.
63+
- `optional`: default false. if true, ignore this entry if it can't be found, even if it's not in `optionalDependencies`.
6364

6465

6566
## Publish

cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ cmds['default'] = {
9393
root = path.relative('.', root);
9494
}
9595
if (!fs.existsSync(path.join(root, 'package.json'))) {
96-
if (!(pkg.optionalDependencies || {})[obj.name]) {
96+
if (!(pkg.optionalDependencies || {})[obj.name] && !obj.optional) {
9797
quit(" -- [ERROR] Module `".red, obj.name.brightYellow, "` is not found. Failed.".red);
9898
}
9999
skips.push({

lib/main.ls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ cmds.default =
5454
root = path.relative('.', root)
5555

5656
if !fs.exists-sync(path.join root, \package.json) =>
57-
if !(pkg.optionalDependencies or {})[obj.name] =>
57+
if !(pkg.optionalDependencies or {})[obj.name] and !obj.optional =>
5858
quit " -- [ERROR] Module `".red, obj.name.brightYellow, "` is not found. Failed.".red
5959
skips.push(name: obj.name, reason: "it is an optional dependency and is not installed")
6060
return console.warn [

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"cli.js"
77
],
88
"description": "Frontend dependency installer",
9-
"version": "1.2.0",
9+
"version": "1.3.0",
1010
"homepage": "https://github.com/plotdb/fedep",
1111
"repository": {
1212
"type": "git",

0 commit comments

Comments
 (0)