bunchee 6.9.0 → 6.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/bin/cli.js +14 -3
  2. package/package.json +1 -1
package/dist/bin/cli.js CHANGED
@@ -856,7 +856,7 @@ async function lint$1(cwd) {
856
856
  }
857
857
  }
858
858
 
859
- var version = "6.9.0";
859
+ var version = "6.9.2";
860
860
 
861
861
  async function writeDefaultTsconfig(tsConfigPath) {
862
862
  await fs.promises.writeFile(tsConfigPath, JSON.stringify(DEFAULT_TS_CONFIG, null, 2), 'utf-8');
@@ -1123,9 +1123,13 @@ function addBuildScripts(pkgJson, cwd) {
1123
1123
  }
1124
1124
  async function prepare(cwd, options) {
1125
1125
  const sourceFolder = path__default.default.resolve(cwd, SRC);
1126
+ // Create src/index.ts if src folder doesn't exist
1126
1127
  if (!fs__default.default.existsSync(sourceFolder)) {
1127
- logger.error(`Source folder ${sourceFolder} does not exist. Cannot proceed to configure \`exports\` field.`);
1128
- process.exit(1);
1128
+ await fsp__default.default.mkdir(sourceFolder, {
1129
+ recursive: true
1130
+ });
1131
+ const indexPath = path__default.default.join(sourceFolder, 'index.ts');
1132
+ await fsp__default.default.writeFile(indexPath, "export function index() {\n return 'index'\n}\n", 'utf-8');
1129
1133
  }
1130
1134
  let hasPackageJson = false;
1131
1135
  const pkgJsonPath = path__default.default.join(cwd, 'package.json');
@@ -1251,6 +1255,13 @@ async function prepare(cwd, options) {
1251
1255
  if (options == null ? void 0 : options.esm) {
1252
1256
  addBuildScripts(pkgJson, cwd);
1253
1257
  }
1258
+ // Add bunchee to devDependencies if not already present
1259
+ if (!pkgJson.devDependencies) {
1260
+ pkgJson.devDependencies = {};
1261
+ }
1262
+ if (!pkgJson.devDependencies.bunchee) {
1263
+ pkgJson.devDependencies.bunchee = 'latest';
1264
+ }
1254
1265
  await fsp__default.default.writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2) + '\n');
1255
1266
  logger.info('Configured `exports` in package.json');
1256
1267
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunchee",
3
- "version": "6.9.0",
3
+ "version": "6.9.2",
4
4
  "description": "zero config bundler for js/ts/jsx libraries",
5
5
  "bin": "./dist/bin/cli.js",
6
6
  "main": "./dist/index.js",