Comparing version 1.0.2 to 1.1.0
@@ -48,3 +48,3 @@ #!/usr/bin/env node | ||
var pkg_1 = __importDefault(require("./pkg")); | ||
var _1 = __importDefault(require(".")); | ||
var index_1 = __importDefault(require("./index")); | ||
commander_1.default | ||
@@ -54,4 +54,5 @@ .name("bunchee") | ||
.option("-w, --watch", "watch src files changes") | ||
.option("-o --output <file>", "specify output filename") | ||
.option("--format <format>", "specify output file format") | ||
.option("-o, --output <file>", "specify output filename") | ||
.option("-f, --format <format>", "specify output file format") | ||
.option("-b, --bin", "output with shebang as banner at top") | ||
.action(run); | ||
@@ -61,11 +62,12 @@ commander_1.default.parse(process.argv); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var format, file, outputConfig, entry; | ||
var format, file, bin, watch, outputConfig, entry; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
format = commander_1.default.format, file = commander_1.default.output; | ||
format = commander_1.default.format, file = commander_1.default.output, bin = commander_1.default.bin, watch = commander_1.default.watch; | ||
outputConfig = { | ||
file: file, | ||
format: format, | ||
watch: !!commander_1.default.watch, | ||
watch: !!watch, | ||
shebang: !!bin, | ||
}; | ||
@@ -79,3 +81,3 @@ if (typeof entryFilePath !== "string") { | ||
} | ||
return [4, _1.default(entry, outputConfig)]; | ||
return [4, index_1.default(entry, outputConfig)]; | ||
case 1: | ||
@@ -82,0 +84,0 @@ _a.sent(); |
@@ -28,3 +28,4 @@ "use strict"; | ||
.reduce(function (a, b) { return a.concat(b); }, []); | ||
var useTypescript = path_1.default.extname(entry) === ".ts" || path_1.default.extname(entry) === ".tsx"; | ||
var ext = path_1.default.extname(entry); | ||
var useTypescript = ext === ".ts" || ext === ".tsx"; | ||
var plugins = [ | ||
@@ -71,5 +72,7 @@ plugin_node_resolve_1.default({ | ||
} | ||
function createOutputOptions(file, format, npmPackage) { | ||
function createOutputOptions(cliArgs, npmPackage) { | ||
var file = cliArgs.file, format = cliArgs.format, shebang = cliArgs.shebang; | ||
return { | ||
name: npmPackage.name, | ||
banner: shebang ? '#!/usr/bin/env node' : undefined, | ||
file: file, | ||
@@ -93,6 +96,16 @@ format: format, | ||
var filename = npmPackage[config.field]; | ||
return createOutputOptions(filename, config.format, npmPackage); | ||
return createOutputOptions({ | ||
file: filename, | ||
format: config.format, | ||
shebang: options.shebang, | ||
}, npmPackage); | ||
}); | ||
if (file) { | ||
outputConfigs = [createOutputOptions(file, format, npmPackage)]; | ||
outputConfigs = [ | ||
createOutputOptions({ | ||
file: file, | ||
format: format, | ||
shebang: options.shebang | ||
}, npmPackage) | ||
]; | ||
} | ||
@@ -99,0 +112,0 @@ return { |
{ | ||
"name": "bunchee", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "simple bundler", | ||
@@ -5,0 +5,0 @@ "bin": { |
# bunchee | ||
> zero config bundler for ES6 syntax library | ||
> zero config bundler for JavaScript/TypeScript/JSX library | ||
Bunchee can help you to bundle your code in ES6 syntax into one file with no configuration. It's built on top of rollup and buble. | ||
[![CI Status](https://github.com/huozhi/bunchee/workflows/CI/badge.svg)](https://github.com/huozhi/bunchee/actions?workflow=CI) | ||
Bunchee can help you to bundle your library into one file with zero configuration. It's built on top of rollup and babel. | ||
Let you focus on writing code and can generate multiple types of module (commonjs, esmodule) at the same time. | ||
@@ -26,7 +28,8 @@ | ||
-f, --format <format> specify bundle type. esm, cjs, umd. default is esm | ||
-b, --bin output with shebang banner at top of file | ||
-h, --help output usage information | ||
Usage: | ||
$ bunchee ./src/index.js | ||
``` | ||
$ bunchee ./src/index.js # if you set main fields in package.json | ||
$ bunchee ./src/index.ts -o ./dist/bundle.js # specify the dist file path | ||
@@ -33,0 +36,0 @@ ### Use NPM Script |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28171
12
322
59