makepack 1.5.24 → 1.6.1

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.
@@ -1,55 +1,56 @@
1
-
2
- export default async (info) => {
3
- let dependencies = {}
4
- let devDependencies = {
5
- "makepack": "latest",
6
- "react": "^19.0.0",
7
- "react-dom": "^19.0.0",
8
- "express": "latest"
9
- }
10
-
11
- if (info.template.includes("typescript")) {
12
- devDependencies["typescript"] = "^4.4.2"
13
- devDependencies["@types/react"] = "^19.0.2"
14
- devDependencies["@types/react-dom"] = "^19.0.2"
15
- devDependencies["@types/express"] = "latest"
16
- }
17
-
18
- let main = info.sourceEntry.split('.')
19
- main.pop()
20
-
21
- const json = {
22
- name: info.projectDirName,
23
- version: "1.0.0",
24
- main: `./cjs/index.js`,
25
- module: `./index.js`,
26
- types: `./types/index.d.ts`,
27
- description: "",
28
- keywords: [],
29
- // "exports": {
30
- // ".": {
31
- // "types": "./types/index.d.ts",
32
- // "require": "./cjs/index.js",
33
- // "import": "./index.js",
34
- // },
35
- // "./types/*": "./types/*.d.ts",
36
- // "./cjs/*": "./cjs/*.js",
37
- // "./*": {
38
- // "import": "./*.js",
39
- // "require": "./cjs/*.js"
40
- // }
41
- // },
42
- scripts: {
43
- "start": "makepack start",
44
- "build": "makepack build",
45
- "build:publish": "makepack publish"
46
- },
47
- dependencies,
48
- devDependencies
49
- }
50
-
51
- return {
52
- content: JSON.stringify(json, null, 3),
53
- filename: "package.json"
54
- }
1
+
2
+ export default async (info) => {
3
+ let dependencies = {}
4
+ let devDependencies = {
5
+ "makepack": "latest",
6
+ "express": "latest"
7
+ }
8
+
9
+ if (info.template.includes("react")) {
10
+ dependencies["react"] = "^19.0.0"
11
+ dependencies["react-dom"] = "^19.0.0"
12
+ }
13
+
14
+ if (info.template.includes("typescript")) {
15
+ devDependencies["typescript"] = "^4.4.2"
16
+ devDependencies["@types/react"] = "^19.0.2"
17
+ devDependencies["@types/react-dom"] = "^19.0.2"
18
+ devDependencies["@types/express"] = "latest"
19
+ }
20
+
21
+ const json = {
22
+ name: info.pdir,
23
+ version: "1.0.0",
24
+ main: `./index.cjs`,
25
+ module: `./index.mjs`,
26
+ types: `./index.d.ts`,
27
+ description: "",
28
+ keywords: [],
29
+ sideEffects: false,
30
+ // "exports": {
31
+ // ".": {
32
+ // "types": "./types/index.d.ts",
33
+ // "require": "./cjs/index.js",
34
+ // "import": "./index.js",
35
+ // },
36
+ // "./types/*": "./types/*.d.ts",
37
+ // "./cjs/*": "./cjs/*.js",
38
+ // "./*": {
39
+ // "import": "./*.js",
40
+ // "require": "./cjs/*.js"
41
+ // }
42
+ // },
43
+ scripts: {
44
+ "start": "makepack start",
45
+ "build": "makepack build",
46
+ "publish": "makepack publish"
47
+ },
48
+ dependencies,
49
+ devDependencies
50
+ }
51
+
52
+ return {
53
+ content: JSON.stringify(json, null, 3),
54
+ filename: "package.json"
55
+ }
55
56
  }
@@ -1,13 +1,13 @@
1
- export default async (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.sourceDir}/${args.sourceEntry}`
12
- }
1
+ export default async () => {
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: `src/index.js`
12
+ }
13
13
  }
@@ -1,51 +1,56 @@
1
- export default async (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.sourceDir}/${args.sourceEntry}`
50
- }
1
+ export default async () => {
2
+ const content = `import React, { useState } from 'react';
3
+ import { createRoot } from 'react-dom/client';
4
+
5
+ const App = () => {
6
+ const [count, setCount] = useState(0);
7
+ const increment = () => setCount(prevCount => prevCount + 1);
8
+ const decrement = () => setCount(prevCount => prevCount - 1);
9
+ const reset = () => setCount(0);
10
+
11
+ return (
12
+ <div style={styles.container}>
13
+ <h1>Count App</h1>
14
+ <div style={styles.counter}>{count}</div>
15
+ <div style={styles.buttonContainer}>
16
+ <button style={styles.button} onClick={increment}>Increment</button>
17
+ <button style={styles.button} onClick={decrement}>Decrement</button>
18
+ <button style={styles.button} onClick={reset}>Reset</button>
19
+ </div>
20
+ </div>
21
+ );
22
+ };
23
+
24
+ const styles = {
25
+ container: {
26
+ textAlign: 'center',
27
+ padding: '20px',
28
+ fontFamily: 'Arial, sans-serif'
29
+ },
30
+ counter: {
31
+ fontSize: '2rem',
32
+ margin: '20px 0',
33
+ },
34
+ buttonContainer: {
35
+ display: 'flex',
36
+ justifyContent: 'center',
37
+ gap: '10px',
38
+ },
39
+ button: {
40
+ padding: '10px 20px',
41
+ fontSize: '1rem',
42
+ cursor: 'pointer',
43
+ },
44
+ };
45
+
46
+ const rootEle = document.getElementById('root')
47
+ if (rootEle) {
48
+ const root = createRoot(rootEle);
49
+ root.render(<App />);
50
+ }
51
+ `
52
+ return {
53
+ content,
54
+ filename: `src/index.jsx`
55
+ }
51
56
  }
@@ -1,11 +1,11 @@
1
- export default async (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.sourceDir}/${args.sourceEntry}`
10
- }
1
+ export default async () => {
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: `src/index.ts`
10
+ }
11
11
  }
@@ -1,51 +1,56 @@
1
- export default async (args) => {
2
- const content = `import React, { useState } from 'react';
3
-
4
- const Count: React.FC = () => {
5
- const [count, setCount] = useState<number>(0);
6
- const increment = (): void => setCount(prevCount => prevCount + 1);
7
- const decrement = (): void => setCount(prevCount => prevCount - 1);
8
- const reset = (): void => 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: { [key: string]: React.CSSProperties } = {
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.sourceDir}/${args.sourceEntry}`
50
- }
1
+ export default async () => {
2
+ const content = `import React, { useState } from 'react';
3
+ import { createRoot } from 'react-dom/client';
4
+
5
+ const App: React.FC = () => {
6
+ const [count, setCount] = useState<number>(0);
7
+ const increment = (): void => setCount(prevCount => prevCount + 1);
8
+ const decrement = (): void => setCount(prevCount => prevCount - 1);
9
+ const reset = (): void => setCount(0);
10
+
11
+ return (
12
+ <div style={styles.container}>
13
+ <h1>Count App</h1>
14
+ <div style={styles.counter}>{count}</div>
15
+ <div style={styles.buttonContainer}>
16
+ <button style={styles.button} onClick={increment}>Increment</button>
17
+ <button style={styles.button} onClick={decrement}>Decrement</button>
18
+ <button style={styles.button} onClick={reset}>Reset</button>
19
+ </div>
20
+ </div>
21
+ );
22
+ };
23
+
24
+ const styles: { [key: string]: React.CSSProperties } = {
25
+ container: {
26
+ textAlign: 'center',
27
+ padding: '20px',
28
+ fontFamily: 'Arial, sans-serif',
29
+ },
30
+ counter: {
31
+ fontSize: '2rem',
32
+ margin: '20px 0',
33
+ },
34
+ buttonContainer: {
35
+ display: 'flex',
36
+ justifyContent: 'center',
37
+ gap: '10px',
38
+ },
39
+ button: {
40
+ padding: '10px 20px',
41
+ fontSize: '1rem',
42
+ cursor: 'pointer',
43
+ },
44
+ };
45
+
46
+ const rootEle = document.getElementById('root')
47
+ if (rootEle) {
48
+ const root = createRoot(rootEle);
49
+ root.render(<App />);
50
+ }
51
+ `
52
+ return {
53
+ content,
54
+ filename: `src/index.tsx`
55
+ }
51
56
  }
@@ -1,63 +1,63 @@
1
-
2
- export default async (info) => {
3
- let pkgname = info.projectDirName
4
- const content = `# ${pkgname}
5
-
6
- [![npm version](https://img.shields.io/npm/v/${pkgname}.svg)](https://www.npmjs.com/package/${pkgname})
7
- [![License](https://img.shields.io/npm/l/${pkgname}.svg)](https://github.com/your-username/${pkgname}/blob/main/LICENSE)
8
- [![Downloads](https://img.shields.io/npm/dt/${pkgname}.svg)](https://www.npmjs.com/package/${pkgname})
9
-
10
- A brief description of what your package does and its purpose.
11
-
12
- ## Installation
13
-
14
- \`\`\`sh
15
- npm install ${pkgname}
16
- \`\`\`
17
-
18
- or with yarn:
19
-
20
- \`\`\`sh
21
- yarn add ${pkgname}
22
- \`\`\`
23
-
24
- ## Usage
25
-
26
- \`\`\`js
27
- import { feature } from "${pkgname}";
28
-
29
- const result = feature("example");
30
- console.log(result);
31
- \`\`\`
32
-
33
- ## API
34
-
35
- ### \`feature(input: string): string\`
36
- Description of the function and its parameters.
37
-
38
- ## Configuration (if applicable)
39
- Explain any configuration options if your package requires setup.
40
-
41
- ## Examples
42
- Provide additional usage examples for clarity.
43
-
44
- ## Contributing
45
- Contributions are welcome! Please follow the guidelines in [CONTRIBUTING.md](./CONTRIBUTING.md).
46
-
47
- ## License
48
-
49
- This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
50
-
51
- ## Links
52
- - [GitHub Repository](https://github.com/your-username/${pkgname})
53
- - [NPM Package](https://www.npmjs.com/package/${pkgname})
54
-
55
- ---
56
-
57
- Feel free to modify this template based on your package's specific needs.
58
- `;
59
- return {
60
- content,
61
- filename: `readme.md`
62
- }
1
+
2
+ export default async (info) => {
3
+ let pkgname = info.projectDirName
4
+ const content = `# ${pkgname}
5
+
6
+ [![npm version](https://img.shields.io/npm/v/${pkgname}.svg)](https://www.npmjs.com/package/${pkgname})
7
+ [![License](https://img.shields.io/npm/l/${pkgname}.svg)](https://github.com/your-username/${pkgname}/blob/main/LICENSE)
8
+ [![Downloads](https://img.shields.io/npm/dt/${pkgname}.svg)](https://www.npmjs.com/package/${pkgname})
9
+
10
+ A brief description of what your package does and its purpose.
11
+
12
+ ## Installation
13
+
14
+ \`\`\`sh
15
+ npm install ${pkgname}
16
+ \`\`\`
17
+
18
+ or with yarn:
19
+
20
+ \`\`\`sh
21
+ yarn add ${pkgname}
22
+ \`\`\`
23
+
24
+ ## Usage
25
+
26
+ \`\`\`js
27
+ import { feature } from "${pkgname}";
28
+
29
+ const result = feature("example");
30
+ console.log(result);
31
+ \`\`\`
32
+
33
+ ## API
34
+
35
+ ### \`feature(input: string): string\`
36
+ Description of the function and its parameters.
37
+
38
+ ## Configuration (if applicable)
39
+ Explain any configuration options if your package requires setup.
40
+
41
+ ## Examples
42
+ Provide additional usage examples for clarity.
43
+
44
+ ## Contributing
45
+ Contributions are welcome! Please follow the guidelines in [CONTRIBUTING.md](./CONTRIBUTING.md).
46
+
47
+ ## License
48
+
49
+ This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
50
+
51
+ ## Links
52
+ - [GitHub Repository](https://github.com/your-username/${pkgname})
53
+ - [NPM Package](https://www.npmjs.com/package/${pkgname})
54
+
55
+ ---
56
+
57
+ Feel free to modify this template based on your package's specific needs.
58
+ `;
59
+ return {
60
+ content,
61
+ filename: `readme.md`
62
+ }
63
63
  }
@@ -1,34 +1,34 @@
1
- export default async () => {
2
- const content = {
3
- "compilerOptions": {
4
- "target": "es5",
5
- "lib": [
6
- "dom",
7
- "dom.iterable",
8
- "esnext"
9
- ],
10
- "allowJs": true,
11
- "skipLibCheck": true,
12
- "esModuleInterop": true,
13
- "allowSyntheticDefaultImports": true,
14
- "strict": true,
15
- "forceConsistentCasingInFileNames": true,
16
- "module": "esnext",
17
- "moduleResolution": "node",
18
- "resolveJsonModule": true,
19
- "isolatedModules": true,
20
- "noEmit": true,
21
- "jsx": "react"
22
- },
23
- "include": ["src"],
24
- "exclude": [
25
- "node_modules",
26
- "build"
27
- ]
28
- }
29
-
30
- return {
31
- content: JSON.stringify(content, null, 2),
32
- filename: "tsconfig.json"
33
- }
1
+ export default async () => {
2
+ const content = {
3
+ "compilerOptions": {
4
+ "target": "es5",
5
+ "lib": [
6
+ "dom",
7
+ "dom.iterable",
8
+ "esnext"
9
+ ],
10
+ "allowJs": true,
11
+ "skipLibCheck": true,
12
+ "esModuleInterop": true,
13
+ "allowSyntheticDefaultImports": true,
14
+ "strict": true,
15
+ "forceConsistentCasingInFileNames": true,
16
+ "module": "esnext",
17
+ "moduleResolution": "node",
18
+ "resolveJsonModule": true,
19
+ "isolatedModules": true,
20
+ "noEmit": true,
21
+ "jsx": "react"
22
+ },
23
+ "include": ["src"],
24
+ "exclude": [
25
+ "node_modules",
26
+ ".mpack",
27
+ ]
28
+ }
29
+
30
+ return {
31
+ content: JSON.stringify(content, null, 2),
32
+ filename: "tsconfig.json"
33
+ }
34
34
  }