makepack 1.5.2 → 1.5.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makepack",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "type": "module",
5
5
  "description": "A CLI tool to create, build, and manage JavaScript, TypeScript, React, and React-TypeScript libraries for npm projects.",
6
6
  "files": [
@@ -5,10 +5,9 @@ import chalk from 'chalk'
5
5
  import ora from 'ora'
6
6
  import { glob } from 'glob'
7
7
  import ts from 'typescript'
8
- import { execSync } from '../../helpers.js'
9
8
  import makepackConfig from '../../makepack-config.js'
10
9
 
11
- const build = async (args) => {
10
+ const build = async () => {
12
11
 
13
12
  const spinner = ora("Generating a production build for the package...").start();
14
13
 
@@ -69,19 +68,15 @@ const build = async (args) => {
69
68
  const formatPackageJson = build.formatPackageJson || ((p) => p)
70
69
  packageJson = formatPackageJson(packageJson)
71
70
 
72
- fs.writeFileSync(path.join(process.cwd(), outdir, '/package.json'), JSON.stringify(packageJson, null, 2));
73
- fs.copyFileSync(path.join(process.cwd(), '/readme.md'), path.join(process.cwd(), outdir, `/readme.md`))
71
+ fs.writeFileSync(path.join(process.cwd(), build.outdir, '/package.json'), JSON.stringify(packageJson, null, 2));
72
+ fs.copyFileSync(path.join(process.cwd(), '/readme.md'), path.join(process.cwd(), build.outdir, `/readme.md`))
74
73
  spinner.succeed('Production build generated successfully! The package is ready for deployment.')
75
74
 
76
- if (args.publish) {
77
- console.log("Publishing the production build to the npm repository...")
78
- execSync(`npm publish`, {
79
- cwd: path.join(process.cwd(), outdir)
80
- })
81
- } else {
82
- console.log(`\nTo publish your package:`);
83
- console.log(`${chalk.yellow(`1. Navigate to the ${outdir} directory:`)}\n ${chalk.green(`cd ./${outdir}`)}\n${chalk.yellow(`2. Publish the buildage to npm:`)}\n${chalk.green(`npm publish`)}\nYour buildage is ready to share with the world! 🚀`);
84
- }
75
+ console.log(`\nTo publish your package:`);
76
+ console.log(`run: ${chalk.green(`makepack publish`)} to publish the package directly from the current project.`);
77
+ console.log(chalk.yellow(`OR`));
78
+ console.log(`${chalk.yellow(`Navigate to the ${build.outdir} directory:`)} ${chalk.green(`cd ./${build.outdir}`)} and run ${chalk.green(`npm publish`)}`);
79
+
85
80
  } catch (error) {
86
81
  spinner.fail("An error occurred while generating the production build.")
87
82
  console.error(error);
@@ -40,7 +40,7 @@ export default async (info) => {
40
40
  }
41
41
  },
42
42
  scripts: {
43
- "start": "makepack serve",
43
+ "start": "makepack start",
44
44
  "build": "makepack build",
45
45
  "build:publish": "makepack publish"
46
46
  },
@@ -62,10 +62,8 @@ const create = async () => {
62
62
  logger.info("", "Creating project...", false)
63
63
  const projectDir = path.join(cwd, information.projectDirName)
64
64
 
65
- if (information.projectDirName !== cwdFolder) {
66
- if (fs.existsSync(projectDir)) {
67
- fs.mkdirSync(projectDir)
68
- }
65
+ if (!fs.existsSync(projectDir)) {
66
+ fs.mkdirSync(projectDir)
69
67
  }
70
68
 
71
69
  if (!fs.existsSync(path.join(projectDir, information.sourceDir))) {