bunup 0.8.9 → 0.8.11

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.
package/dist/cli.js CHANGED
@@ -437,7 +437,25 @@ import {
437
437
  } from "@clack/prompts";
438
438
  import { downloadTemplate } from "giget";
439
439
  import { replaceInFile } from "replace-in-file";
440
+ function displayBunupGradientArt() {
441
+ const art = `
442
+ \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557
443
+ \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557
444
+ \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D
445
+ \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u255D
446
+ \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551
447
+ \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D
448
+ `.trim();
449
+ const lines = art.split(`
450
+ `);
451
+ console.log();
452
+ for (const line of lines) {
453
+ console.log(import_picocolors6.default.cyan(line));
454
+ }
455
+ console.log();
456
+ }
440
457
  async function newProject() {
458
+ displayBunupGradientArt();
441
459
  intro(import_picocolors6.default.bgCyan(import_picocolors6.default.black(" Scaffold a new project with Bunup ")));
442
460
  const selectedTemplateDir = await select({
443
461
  message: "Select a template",
@@ -492,7 +510,7 @@ async function newProject() {
492
510
  const [githubUsername, githubRepoName] = githubRepoInfo.split("/");
493
511
  await tasks([
494
512
  {
495
- title: "Downloading template",
513
+ title: "Creating project",
496
514
  task: async () => {
497
515
  const templatePath = useMonorepo ? template.monorepoDir : template.dir;
498
516
  await downloadTemplate(`github:${TEMPLATE_OWNER}/${TEMPLATE_REPO}/${templatePath}`, {
@@ -563,7 +581,7 @@ var init_new = __esm(() => {
563
581
  // src/cli/index.ts
564
582
  import { exec } from "tinyexec";
565
583
  // package.json
566
- var version = "0.8.9";
584
+ var version = "0.8.11";
567
585
 
568
586
  // src/cli/index.ts
569
587
  init_errors();
package/dist/plugins.cjs CHANGED
@@ -410,6 +410,9 @@ function getUpdatedPackageJson(oldPackageJson, newPackageJson) {
410
410
  return JSON.stringify(newPackageJson, null, getJsonSpaceCount(oldPackageJson)) + (hasTrailingNewline ? `
411
411
  ` : "");
412
412
  }
413
+ function isDirectoryPath(filePath) {
414
+ return import_node_path.default.extname(filePath) === "";
415
+ }
413
416
 
414
417
  // src/plugins/built-in/productivity/exports.ts
415
418
  function exports2() {
@@ -637,31 +640,23 @@ function injectStyles(options) {
637
640
  };
638
641
  }
639
642
  // src/plugins/built-in/productivity/copy.ts
640
- var import_promises = require("fs/promises");
641
643
  var import_node_path3 = require("path");
642
- function copy(patterns, outDir) {
644
+ var import_node_path4 = require("path");
645
+ function copy(patterns, outPath) {
643
646
  return {
644
647
  type: "bunup",
645
648
  name: "copy",
646
649
  hooks: {
647
650
  onBuildDone: async ({ options, meta }) => {
648
- const targetDir = outDir || options.outDir;
649
- const baseDir = meta.rootDir;
651
+ const destinationPath = outPath || options.outDir;
650
652
  for (const pattern of patterns) {
651
- let globPattern = pattern;
652
- if (!pattern.includes("*") && !pattern.includes("?")) {
653
- try {
654
- const stats = await import_promises.stat(`${baseDir}/${pattern}`);
655
- if (stats.isDirectory()) {
656
- globPattern = `${pattern}/**/*`;
657
- }
658
- } catch {}
659
- }
660
- const glob = new Bun.Glob(globPattern);
661
- for await (const file of glob.scan(baseDir)) {
662
- const targetPath = `${targetDir}/${file}`;
663
- await import_promises.mkdir(import_node_path3.dirname(targetPath), { recursive: true });
664
- await Bun.write(targetPath, Bun.file(`${baseDir}/${file}`));
653
+ const glob = new Bun.Glob(pattern);
654
+ for await (const filePath of glob.scan({
655
+ cwd: meta.rootDir,
656
+ dot: true
657
+ })) {
658
+ const sourceFile = Bun.file(import_node_path3.join(meta.rootDir, filePath));
659
+ await Bun.write(outPath && isDirectoryPath(outPath) ? import_node_path3.join(destinationPath, import_node_path4.basename(filePath)) : destinationPath, sourceFile);
665
660
  }
666
661
  }
667
662
  }
@@ -415,7 +415,9 @@ declare function injectStyles(options?: InjectStylesPluginOptions): Plugin;
415
415
  /**
416
416
  * A plugin that copies files and directories to the output directory.
417
417
  *
418
+ * @param patterns - Array of glob patterns to match files for copying
419
+ * @param outPath - Optional output path. If not provided, uses the build output directory
418
420
  * @see https://bunup.dev/docs/plugins/productivity#copy
419
421
  */
420
- declare function copy(patterns: string[], outDir?: string): BunupPlugin;
422
+ declare function copy(patterns: string[], outPath?: string): BunupPlugin;
421
423
  export { shims, report, injectStyles, filterJsDtsFiles, exports, copy };
package/dist/plugins.d.ts CHANGED
@@ -415,7 +415,9 @@ declare function injectStyles(options?: InjectStylesPluginOptions): Plugin;
415
415
  /**
416
416
  * A plugin that copies files and directories to the output directory.
417
417
  *
418
+ * @param patterns - Array of glob patterns to match files for copying
419
+ * @param outPath - Optional output path. If not provided, uses the build output directory
418
420
  * @see https://bunup.dev/docs/plugins/productivity#copy
419
421
  */
420
- declare function copy(patterns: string[], outDir?: string): BunupPlugin;
422
+ declare function copy(patterns: string[], outPath?: string): BunupPlugin;
421
423
  export { shims, report, injectStyles, filterJsDtsFiles, exports, copy };
package/dist/plugins.js CHANGED
@@ -374,6 +374,9 @@ function getUpdatedPackageJson(oldPackageJson, newPackageJson) {
374
374
  return JSON.stringify(newPackageJson, null, getJsonSpaceCount(oldPackageJson)) + (hasTrailingNewline ? `
375
375
  ` : "");
376
376
  }
377
+ function isDirectoryPath(filePath) {
378
+ return path.extname(filePath) === "";
379
+ }
377
380
 
378
381
  // src/plugins/built-in/productivity/exports.ts
379
382
  function exports() {
@@ -601,31 +604,23 @@ function injectStyles(options) {
601
604
  };
602
605
  }
603
606
  // src/plugins/built-in/productivity/copy.ts
604
- import { mkdir, stat } from "fs/promises";
605
- import { dirname } from "path";
606
- function copy(patterns, outDir) {
607
+ import { join } from "path";
608
+ import { basename } from "path";
609
+ function copy(patterns, outPath) {
607
610
  return {
608
611
  type: "bunup",
609
612
  name: "copy",
610
613
  hooks: {
611
614
  onBuildDone: async ({ options, meta }) => {
612
- const targetDir = outDir || options.outDir;
613
- const baseDir = meta.rootDir;
615
+ const destinationPath = outPath || options.outDir;
614
616
  for (const pattern of patterns) {
615
- let globPattern = pattern;
616
- if (!pattern.includes("*") && !pattern.includes("?")) {
617
- try {
618
- const stats = await stat(`${baseDir}/${pattern}`);
619
- if (stats.isDirectory()) {
620
- globPattern = `${pattern}/**/*`;
621
- }
622
- } catch {}
623
- }
624
- const glob = new Bun.Glob(globPattern);
625
- for await (const file of glob.scan(baseDir)) {
626
- const targetPath = `${targetDir}/${file}`;
627
- await mkdir(dirname(targetPath), { recursive: true });
628
- await Bun.write(targetPath, Bun.file(`${baseDir}/${file}`));
617
+ const glob = new Bun.Glob(pattern);
618
+ for await (const filePath of glob.scan({
619
+ cwd: meta.rootDir,
620
+ dot: true
621
+ })) {
622
+ const sourceFile = Bun.file(join(meta.rootDir, filePath));
623
+ await Bun.write(outPath && isDirectoryPath(outPath) ? join(destinationPath, basename(filePath)) : destinationPath, sourceFile);
629
624
  }
630
625
  }
631
626
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bunup",
3
3
  "description": "⚡ A blazing-fast build tool for your libraries built with Bun.",
4
- "version": "0.8.9",
4
+ "version": "0.8.11",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -47,9 +47,9 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@clack/prompts": "^0.10.1",
50
- "bun-dts": "^0.1.28",
50
+ "bun-dts": "^0.1.30",
51
51
  "chokidar": "^4.0.3",
52
- "coffi": "^0.1.29",
52
+ "coffi": "^0.1.30",
53
53
  "giget": "^2.0.0",
54
54
  "replace-in-file": "^8.3.0",
55
55
  "tinyexec": "^1.0.1"