makepack 1.3.4 → 1.3.6

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,147 @@
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
+ **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
+
147
147
  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,6 +1,6 @@
1
1
  {
2
2
  "name": "makepack",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
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": [
@@ -24,7 +24,9 @@
24
24
  "url": "https://github.com/devnax/makepack/issues"
25
25
  },
26
26
  "homepage": "https://github.com/devnax/makepack#readme",
27
- "scripts": {},
27
+ "scripts": {
28
+ "start": "node ./src/index.js"
29
+ },
28
30
  "dependencies": {
29
31
  "chalk": "^5.4.1",
30
32
  "commander": "^12.1.0",
@@ -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,43 @@
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
+ }
38
+
39
+ return {
40
+ content: JSON.stringify(json, null, 3),
41
+ filename: "package.json"
42
+ }
43
43
  }
@@ -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
  }
@@ -1,51 +1,51 @@
1
- export default (args) => {
2
- const content = `import React, { useState } from 'react';
3
-
4
- const Count = () => {
5
- const [count, setCount] = useState(0);
6
- const increment = () => setCount(prevCount => prevCount + 1);
7
- const decrement = () => setCount(prevCount => prevCount - 1);
8
- const reset = () => setCount(0);
9
-
10
- return (
11
- <div style={styles.container}>
12
- <h1>Count App</h1>
13
- <div style={styles.counter}>{count}</div>
14
- <div style={styles.buttonContainer}>
15
- <button style={styles.button} onClick={increment}>Increment</button>
16
- <button style={styles.button} onClick={decrement}>Decrement</button>
17
- <button style={styles.button} onClick={reset}>Reset</button>
18
- </div>
19
- </div>
20
- );
21
- };
22
-
23
- const styles = {
24
- container: {
25
- textAlign: 'center',
26
- padding: '20px',
27
- fontFamily: 'Arial, sans-serif'
28
- },
29
- counter: {
30
- fontSize: '2rem',
31
- margin: '20px 0',
32
- },
33
- buttonContainer: {
34
- display: 'flex',
35
- justifyContent: 'center',
36
- gap: '10px',
37
- },
38
- button: {
39
- padding: '10px 20px',
40
- fontSize: '1rem',
41
- cursor: 'pointer',
42
- },
43
- };
44
-
45
- export default Count;
46
- `
47
- return {
48
- content,
49
- filename: `${args.rootdir}/${args.entry}`
50
- }
1
+ export default (args) => {
2
+ const content = `import React, { useState } from 'react';
3
+
4
+ const Count = () => {
5
+ const [count, setCount] = useState(0);
6
+ const increment = () => setCount(prevCount => prevCount + 1);
7
+ const decrement = () => setCount(prevCount => prevCount - 1);
8
+ const reset = () => setCount(0);
9
+
10
+ return (
11
+ <div style={styles.container}>
12
+ <h1>Count App</h1>
13
+ <div style={styles.counter}>{count}</div>
14
+ <div style={styles.buttonContainer}>
15
+ <button style={styles.button} onClick={increment}>Increment</button>
16
+ <button style={styles.button} onClick={decrement}>Decrement</button>
17
+ <button style={styles.button} onClick={reset}>Reset</button>
18
+ </div>
19
+ </div>
20
+ );
21
+ };
22
+
23
+ const styles = {
24
+ container: {
25
+ textAlign: 'center',
26
+ padding: '20px',
27
+ fontFamily: 'Arial, sans-serif'
28
+ },
29
+ counter: {
30
+ fontSize: '2rem',
31
+ margin: '20px 0',
32
+ },
33
+ buttonContainer: {
34
+ display: 'flex',
35
+ justifyContent: 'center',
36
+ gap: '10px',
37
+ },
38
+ button: {
39
+ padding: '10px 20px',
40
+ fontSize: '1rem',
41
+ cursor: 'pointer',
42
+ },
43
+ };
44
+
45
+ export default Count;
46
+ `
47
+ return {
48
+ content,
49
+ filename: `${args.rootdir}/${args.entry}`
50
+ }
51
51
  }
@@ -1,11 +1,11 @@
1
- export default args => {
2
- const content = `
3
- function add(a: number, b: number): number {
4
- return a + b;
5
- }
6
- export default add`
7
- return {
8
- content,
9
- filename: `${args.rootdir}/${args.entry}`
10
- }
1
+ export default args => {
2
+ const content = `
3
+ function add(a: number, b: number): number {
4
+ return a + b;
5
+ }
6
+ export default add`
7
+ return {
8
+ content,
9
+ filename: `${args.rootdir}/${args.entry}`
10
+ }
11
11
  }