makepack 1.3.8 → 1.4.0

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/README.md CHANGED
@@ -1,147 +1,167 @@
1
- <p align="center">
2
- <a href="https://github.com/devnax/makepack" rel="noopener" target="_blank"><img src="https://raw.githubusercontent.com/devnax/makepack/main/logo.png" alt="Makepack logo"></a>
3
- </p>
4
-
5
- <h1 align="center">Makepack</h1>
6
-
7
- **MakePack** is a command-line interface (CLI) tool that helps you to quickly set up, build, and manage JavaScript, TypeScript, React, and React-TypeScript libraries for use in npm projects. With just a few simple commands, you can generate your own libraries, start a development server, or build and publish your project to the npm repository.
8
-
9
- ## Installation
10
-
11
- To install **MakePack** globally, run the following command:
12
-
13
- ```bash
14
- npm install -g makepack
15
- ```
16
-
17
- This will allow you to use the `makepack` command anywhere in your terminal.
18
-
19
- ## Configuration Files
20
-
21
- **MakePack** supports loading configuration files for Vite and esbuild. If `vite.config.js` and `esbuild.config.js` exist in the root of the project, they will be automatically loaded when running the respective commands.
22
-
23
-
24
-
25
- ## Commands
26
-
27
- ### `create`
28
-
29
- The `create` command is used to create a new library project. It initializes the project structure, configures essential files, and sets up the environment for you to start working on your library.
30
-
31
- #### Usage
32
-
33
- ```bash
34
- makepack create
35
- ```
36
-
37
- #### Description
38
-
39
- - Creates a new library project by setting up the necessary configurations and boilerplate files.
40
-
41
- This command will guide you through the initial setup for your library.
42
-
43
- ---
44
-
45
- ### `serve`
46
-
47
- The `serve` command starts a development server for your library, providing you with a live-reload environment where you can test and iterate on your library in real-time. It will load `vite.config.js` if it exists in the root of the project.
48
-
49
- #### Usage
50
-
51
- ```bash
52
- makepack serve [options]
53
- ```
54
-
55
- #### Options
56
-
57
- - `-p, --port <number>`
58
- _Port number_ (optional) (default is `5000`).
59
-
60
- - `-e, --root <file>`
61
- _Root file_ (optional) (default is `serve.jsx` or `serve.tsx`). The entry point for your application. Specify the main JavaScript/TypeScript file to start the server.
62
-
63
- #### Description
64
-
65
- - Starts a local development server for testing and debugging your library.
66
-
67
- Example:
68
-
69
- ```bash
70
- makepack serve --port 4000 --root src/index.ts
71
- ```
72
-
73
- ---
74
-
75
- ### `pack`
76
-
77
- The `pack` command is used to build your library and optionally publish it to the npm repository. This command compiles your code into a distributable format and prepares it for sharing with others. It will load `esbuild.config.js` if it exists in the root of the project.
78
-
79
- #### Usage
80
-
81
- ```bash
82
- makepack pack [options]
83
- ```
84
-
85
- #### Options
86
-
87
- - `-e, --entry <file>`
88
- _Entry file or directory_ (default is `src/**/*.{tsx,ts,js,jsx}`).
89
- Specify the entry file or use a glob pattern to select the files to include in your library.
90
-
91
- - `-p, --publish`
92
- _Publish the project to the npm repository_ (default is `false`).
93
- Add this flag if you want to publish the library to npm after building it.
94
-
95
- #### Description
96
-
97
- - Builds the project by compiling and bundling your library.
98
- - Optionally publishes the library to the npm repository.
99
-
100
- Example:
101
-
102
- ```bash
103
- makepack pack --entry src/index.ts --publish
104
- ```
105
-
106
- This will compile the project from `src/index.ts` and then publish the library to npm.
107
-
108
- ---
109
-
110
- ## Example Workflow
111
-
112
- 1. Create a new project:
113
-
114
- ```bash
115
- makepack create
116
- ```
117
-
118
- 2. Start the server for development:
119
-
120
- ```bash
121
- makepack serve --port 4000 --root index.tsx
122
- ```
123
-
124
- 3. Once you're ready to build and publish your library:
125
-
126
- ```bash
127
- makepack pack --entry src/**/*.{tsx,ts,js,jsx} --publish
128
- ```
129
-
130
- This will build your library and publish it to npm.
131
-
132
-
133
- ## 🤝 Contributing
134
-
135
- Contributions are welcome! Please check out the [contribution guidelines](https://github.com/devnax/makepack).
136
-
137
- ---
138
-
139
- ## 📄 License
140
-
141
- This project is licensed under the [MIT License](https://opensource.org/licenses/MIT).
142
-
143
- ---
144
-
145
- ## 📞 Support
146
-
1
+ <p align="center">
2
+ <a href="https://github.com/devnax/makepack" rel="noopener" target="_blank"><img src="https://raw.githubusercontent.com/devnax/makepack/main/logo.png" alt="Makepack logo"></a>
3
+ </p>
4
+
5
+ <h1 align="center">Makepack</h1>
6
+
7
+ **MakePack** is a command-line interface (CLI) tool that helps you to quickly set up, build, and manage JavaScript, TypeScript, React, and React-TypeScript libraries for use in npm projects. With just a few simple commands, you can generate your own libraries, start a development server, or build and publish your project to the npm repository.
8
+
9
+ ## Installation
10
+
11
+ To install **MakePack** globally, run the following command:
12
+
13
+ ```bash
14
+ npm install -g makepack
15
+ ```
16
+
17
+ This will allow you to use the `makepack` command anywhere in your terminal.
18
+
19
+ ## Configuration Files
20
+
21
+ Previously, the project used separate configuration files for Vite and esbuild:
22
+ - `vite.config.js`
23
+ - `esbuild.config.js`
24
+
25
+ These files have been removed and replaced with a single configuration file: `makepack.js`.
26
+
27
+ ## makepack.js
28
+
29
+ The `makepack.js` file exports a function that takes the previous configuration (`prevConfig`) and returns a new configuration (`newConfig`). This allows you to configure both esbuild and Vite in one place.
30
+
31
+ ### Example Usage
32
+
33
+ ```javascript
34
+ // filepath: /Volumes/Work Space/makepack/makepack.js
35
+ module.exports = function(prevConfig) {
36
+ const newConfig = {
37
+ // ...your new configuration here...
38
+ };
39
+ return newConfig;
40
+ };
41
+ ```
42
+
43
+ This approach simplifies the configuration process by consolidating it into a single file.
44
+
45
+ ## Commands
46
+
47
+ ### `create`
48
+
49
+ The `create` command is used to create a new library project. It initializes the project structure, configures essential files, and sets up the environment for you to start working on your library.
50
+
51
+ #### Usage
52
+
53
+ ```bash
54
+ makepack create
55
+ ```
56
+
57
+ #### Description
58
+
59
+ - Creates a new library project by setting up the necessary configurations and boilerplate files.
60
+
61
+ This command will guide you through the initial setup for your library.
62
+
63
+ ---
64
+
65
+ ### `serve`
66
+
67
+ The `serve` command starts a development server for your library, providing you with a live-reload environment where you can test and iterate on your library in real-time. It will load `vite.config.js` if it exists in the root of the project.
68
+
69
+ #### Usage
70
+
71
+ ```bash
72
+ makepack serve [options]
73
+ ```
74
+
75
+ #### Options
76
+
77
+ - `-p, --port <number>`
78
+ _Port number_ (optional) (default is `5000`).
79
+
80
+ - `-e, --root <file>`
81
+ _Root file_ (optional) (default is `serve.jsx` or `serve.tsx`). The entry point for your application. Specify the main JavaScript/TypeScript file to start the server.
82
+
83
+ #### Description
84
+
85
+ - Starts a local development server for testing and debugging your library.
86
+
87
+ Example:
88
+
89
+ ```bash
90
+ makepack serve --port 4000 --root src/index.ts
91
+ ```
92
+
93
+ ---
94
+
95
+ ### `pack`
96
+
97
+ The `pack` command is used to build your library and optionally publish it to the npm repository. This command compiles your code into a distributable format and prepares it for sharing with others. It will load `esbuild.config.js` if it exists in the root of the project.
98
+
99
+ #### Usage
100
+
101
+ ```bash
102
+ makepack pack [options]
103
+ ```
104
+
105
+ #### Options
106
+
107
+ - `-e, --entry <file>`
108
+ _Entry file or directory_ (default is `src/**/*.{tsx,ts,js,jsx}`).
109
+ Specify the entry file or use a glob pattern to select the files to include in your library.
110
+
111
+ - `-p, --publish`
112
+ _Publish the project to the npm repository_ (default is `false`).
113
+ Add this flag if you want to publish the library to npm after building it.
114
+
115
+ #### Description
116
+
117
+ - Builds the project by compiling and bundling your library.
118
+ - Optionally publishes the library to the npm repository.
119
+
120
+ Example:
121
+
122
+ ```bash
123
+ makepack pack --entry src/index.ts --publish
124
+ ```
125
+
126
+ This will compile the project from `src/index.ts` and then publish the library to npm.
127
+
128
+ ---
129
+
130
+ ## Example Workflow
131
+
132
+ 1. Create a new project:
133
+
134
+ ```bash
135
+ makepack create
136
+ ```
137
+
138
+ 2. Start the server for development:
139
+
140
+ ```bash
141
+ makepack serve --port 4000 --root index.tsx
142
+ ```
143
+
144
+ 3. Once you're ready to build and publish your library:
145
+
146
+ ```bash
147
+ makepack pack --entry src/**/*.{tsx,ts,js,jsx} --publish
148
+ ```
149
+
150
+ This will build your library and publish it to npm.
151
+
152
+
153
+ ## 🤝 Contributing
154
+
155
+ Contributions are welcome! Please check out the [contribution guidelines](https://github.com/devnax/makepack).
156
+
157
+ ---
158
+
159
+ ## 📄 License
160
+
161
+ This project is licensed under the [MIT License](https://opensource.org/licenses/MIT).
162
+
163
+ ---
164
+
165
+ ## 📞 Support
166
+
147
167
  For help or suggestions, feel free to open an issue on [GitHub](https://github.com/devnax/makepack/issues) or contact us via [devnaxrul@gmail.com](mailto:devnaxrul@gmail.com).
package/package.json CHANGED
@@ -1,57 +1,57 @@
1
- {
2
- "name": "makepack",
3
- "version": "1.3.8",
4
- "type": "module",
5
- "description": "A CLI tool to create, build, and manage JavaScript, TypeScript, React, and React-TypeScript libraries for npm projects.",
6
- "files": [
7
- "src",
8
- "package.json",
9
- "README.md"
10
- ],
11
- "categories": [
12
- "Other"
13
- ],
14
- "author": {
15
- "name": "Devnax",
16
- "email": "devnaxrul@gmail.com"
17
- },
18
- "bin": "./src/index.js",
19
- "repository": {
20
- "type": "git",
21
- "url": "https://github.com/devnax/makepack"
22
- },
23
- "bugs": {
24
- "url": "https://github.com/devnax/makepack/issues"
25
- },
26
- "homepage": "https://github.com/devnax/makepack#readme",
27
- "scripts": {
28
- "start": "node ./src/index.js"
29
- },
30
- "dependencies": {
31
- "chalk": "^5.4.1",
32
- "commander": "^12.1.0",
33
- "esbuild": "^0.24.2",
34
- "express": "^4.21.1",
35
- "figlet": "^1.8.0",
36
- "figures": "^6.1.0",
37
- "fs-extra": "^11.2.0",
38
- "glob": "^11.0.0",
39
- "inquirer": "^12.1.0",
40
- "typescript": "^5.7.2",
41
- "vite": "^6.0.2",
42
- "@vitejs/plugin-react": "^4.3.4"
43
- },
44
- "keywords": [
45
- "CLI",
46
- "npm",
47
- "library",
48
- "JavaScript",
49
- "TypeScript",
50
- "React",
51
- "npm-package"
52
- ],
53
- "devDependencies": {
54
- "react": "^19.0.0",
55
- "react-dom": "^19.0.0"
56
- }
1
+ {
2
+ "name": "makepack",
3
+ "version": "1.4.0",
4
+ "type": "module",
5
+ "description": "A CLI tool to create, build, and manage JavaScript, TypeScript, React, and React-TypeScript libraries for npm projects.",
6
+ "files": [
7
+ "src",
8
+ "package.json",
9
+ "README.md"
10
+ ],
11
+ "categories": [
12
+ "Other"
13
+ ],
14
+ "author": {
15
+ "name": "Devnax",
16
+ "email": "devnaxrul@gmail.com"
17
+ },
18
+ "bin": "./src/index.js",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/devnax/makepack"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/devnax/makepack/issues"
25
+ },
26
+ "homepage": "https://github.com/devnax/makepack#readme",
27
+ "scripts": {
28
+ "start": "node ./src/index.js"
29
+ },
30
+ "dependencies": {
31
+ "chalk": "^5.4.1",
32
+ "commander": "^12.1.0",
33
+ "esbuild": "^0.24.2",
34
+ "express": "^4.21.1",
35
+ "figlet": "^1.8.0",
36
+ "figures": "^6.1.0",
37
+ "fs-extra": "^11.2.0",
38
+ "glob": "^11.0.0",
39
+ "inquirer": "^12.1.0",
40
+ "typescript": "^5.7.2",
41
+ "vite": "^6.0.2",
42
+ "@vitejs/plugin-react": "^4.3.4"
43
+ },
44
+ "keywords": [
45
+ "CLI",
46
+ "npm",
47
+ "library",
48
+ "JavaScript",
49
+ "TypeScript",
50
+ "React",
51
+ "npm-package"
52
+ ],
53
+ "devDependencies": {
54
+ "react": "^19.0.0",
55
+ "react-dom": "^19.0.0"
56
+ }
57
57
  }
@@ -1,6 +1,6 @@
1
- export default (args) => {
2
- return {
3
- content: `node_modules\n${args.outdir}`,
4
- filename: ".gitignore"
5
- }
1
+ export default (args) => {
2
+ return {
3
+ content: `node_modules\n${args.outdir}`,
4
+ filename: ".gitignore"
5
+ }
6
6
  }
@@ -1,19 +1,19 @@
1
- export default (args) => {
2
- const makepack = {
3
- "template": `${args.template}`,
4
- "serve": {
5
- "port": 3000,
6
- "entry": `${args.rootdir}/${args.entry}`
7
- },
8
- "build": {
9
- "entry": `${args.rootdir}/**/*.{tsx,ts,js,jsx}`,
10
- "outdir": `${args.outdir}`,
11
- "esbuild": {
12
- }
13
- },
14
- }
15
- return {
16
- content: `const makepack = ${JSON.stringify(makepack, null, 2)}\nexport default makepack\n`,
17
- filename: "makepack.js"
18
- }
19
- }
1
+ export default (args) => {
2
+ const makepack = {
3
+ "template": `${args.template}`,
4
+ "serve": {
5
+ "port": 3000,
6
+ "entry": `${args.rootdir}/${args.entry}`
7
+ },
8
+ "build": {
9
+ "entry": `${args.rootdir}/**/*.{tsx,ts,js,jsx}`,
10
+ "outdir": `${args.outdir}`,
11
+ "esbuild": {
12
+ }
13
+ },
14
+ }
15
+ return {
16
+ content: `const makepack = ${JSON.stringify(makepack, null, 2)}\nexport default makepack\n`,
17
+ filename: "makepack.js"
18
+ }
19
+ }
@@ -1,43 +1,60 @@
1
- export default (args) => {
2
- let dependencies = {}
3
- let devDependencies = {
4
- "makepack": "latest"
5
- }
6
-
7
- if (args.template.includes("react")) {
8
- dependencies["react"] = "^19.0.0"
9
- dependencies["react-dom"] = "^19.0.0"
10
- } else {
11
- devDependencies["react"] = "^19.0.0"
12
- devDependencies["react-dom"] = "^19.0.0"
13
- }
14
-
15
- if (args.template.includes("typescript")) {
16
- devDependencies["typescript"] = "^4.4.2"
17
- devDependencies["@types/react"] = "^19.0.2"
18
- devDependencies["@types/react-dom"] = "^19.0.2"
19
- }
20
-
21
- let main = args.entry.split('.')
22
- main.pop()
23
-
24
- const json = {
25
- name: args.dirname,
26
- version: "1.0.0",
27
- description: "",
28
- main: `./${main.join(".")}.js`,
29
- scripts: {
30
- "start": "makepack serve",
31
- "pack": "makepack pack",
32
- "publish:pack": "makepack pack -p",
33
- },
34
- dependencies,
35
- devDependencies,
36
- keywords: [],
37
- }
38
-
39
- return {
40
- content: JSON.stringify(json, null, 3),
41
- filename: "package.json"
42
- }
1
+ export default (args) => {
2
+ let dependencies = {}
3
+ let devDependencies = {
4
+ "makepack": "latest"
5
+ }
6
+
7
+ if (args.template.includes("react")) {
8
+ dependencies["react"] = "^19.0.0"
9
+ dependencies["react-dom"] = "^19.0.0"
10
+ } else {
11
+ devDependencies["react"] = "^19.0.0"
12
+ devDependencies["react-dom"] = "^19.0.0"
13
+ }
14
+
15
+ if (args.template.includes("typescript")) {
16
+ devDependencies["typescript"] = "^4.4.2"
17
+ devDependencies["@types/react"] = "^19.0.2"
18
+ devDependencies["@types/react-dom"] = "^19.0.2"
19
+ }
20
+
21
+ let main = args.entry.split('.')
22
+ main.pop()
23
+
24
+ const json = {
25
+ name: args.dirname,
26
+ version: "1.0.0",
27
+ description: "",
28
+ main: `./${main.join(".")}.js`,
29
+ scripts: {
30
+ "start": "makepack serve",
31
+ "pack": "makepack pack",
32
+ "publish:pack": "makepack pack -p",
33
+ },
34
+ dependencies,
35
+ devDependencies,
36
+ keywords: [],
37
+ exports: {
38
+ ".": {
39
+ "types": "./types/index.d.ts",
40
+ "import": "./esm/index.js",
41
+ "require": "./cjs/index.js"
42
+ },
43
+ "./*": {
44
+ "types": "./types/*.d.ts",
45
+ "import": "./esm/*.js",
46
+ "require": "./cjs/*.js"
47
+ },
48
+ "./types/*": "./types/*.d.ts",
49
+ "./esm/*": "./esm/*.js",
50
+ "./esm/*.js": "./esm/*.js",
51
+ "./cjs/*": "./cjs/*.js",
52
+ "./cjs/*.js": "./cjs/*.js"
53
+ }
54
+ }
55
+
56
+ return {
57
+ content: JSON.stringify(json, null, 3),
58
+ filename: "package.json"
59
+ }
43
60
  }
@@ -1,13 +1,13 @@
1
- export default (args) => {
2
- const content = `
3
- function add(a, b) {
4
- return a + b;
5
- }
6
-
7
- export default add
8
- `
9
- return {
10
- content,
11
- filename: `${args.rootdir}/${args.entry}`
12
- }
1
+ export default (args) => {
2
+ const content = `
3
+ function add(a, b) {
4
+ return a + b;
5
+ }
6
+
7
+ export default add
8
+ `
9
+ return {
10
+ content,
11
+ filename: `${args.rootdir}/${args.entry}`
12
+ }
13
13
  }