diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a60d01..a1f7077 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Logs +## v1.3.0 + + - support `optional` in module format. + + ## v1.2.0 - support transpilation on demand. diff --git a/README.md b/README.md index 7b6bfa8..4f84da5 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ If object is used, it contains following fields: - always false if `browserify` is set to true. - `transpile`: add this object if you need to transpile module file, which contains following fields: - `files`: a list of file to transpile. + - `optional`: default false. if true, ignore this entry if it can't be found, even if it's not in `optionalDependencies`. ## Publish diff --git a/cli.js b/cli.js index 9d65a9c..32c7094 100755 --- a/cli.js +++ b/cli.js @@ -93,7 +93,7 @@ cmds['default'] = { root = path.relative('.', root); } if (!fs.existsSync(path.join(root, 'package.json'))) { - if (!(pkg.optionalDependencies || {})[obj.name]) { + if (!(pkg.optionalDependencies || {})[obj.name] && !obj.optional) { quit(" -- [ERROR] Module `".red, obj.name.brightYellow, "` is not found. Failed.".red); } skips.push({ diff --git a/lib/main.ls b/lib/main.ls index 3b029a6..26ee8eb 100644 --- a/lib/main.ls +++ b/lib/main.ls @@ -54,7 +54,7 @@ cmds.default = root = path.relative('.', root) if !fs.exists-sync(path.join root, \package.json) => - if !(pkg.optionalDependencies or {})[obj.name] => + if !(pkg.optionalDependencies or {})[obj.name] and !obj.optional => quit " -- [ERROR] Module `".red, obj.name.brightYellow, "` is not found. Failed.".red skips.push(name: obj.name, reason: "it is an optional dependency and is not installed") return console.warn [ diff --git a/package-lock.json b/package-lock.json index 7cc118f..a252636 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fedep", - "version": "1.2.0", + "version": "1.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "fedep", - "version": "1.2.0", + "version": "1.3.0", "license": "MIT", "dependencies": { "@babel/core": "^7.23.9", diff --git a/package.json b/package.json index 76c725d..cc214b6 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "cli.js" ], "description": "Frontend dependency installer", - "version": "1.2.0", + "version": "1.3.0", "homepage": "https://github.com/plotdb/fedep", "repository": { "type": "git",