makepack 1.7.15 → 1.7.17

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,37 +1,37 @@
1
- export default async ({ template }) => {
2
-
3
- let ext = 'jsx'
4
- if (template === 'react with typescript') {
5
- ext = 'tsx'
6
- } else if (template === 'typescript') {
7
- ext = 'ts'
8
- }
9
- else if (template === 'javascript') {
10
- ext = 'js'
11
- }
12
-
13
- const content = `import React from 'react';
14
- import { createRoot } from 'react-dom/client';
15
- import ${ext.includes("sx") ? "Count" : "sum"} from './src/index.${ext}';
16
-
17
- const Main = () => {
18
- return (
19
- <div>
20
- <h1>Welcome to makepack CLI!</h1>
21
- <p>Edit <code>index.${ext}</code> and save to reload.</p>
22
- ${ext.includes("sx") ? "<Count />" : "<p>The sum is: {sum(5, 5)}</p>"}
23
- </div>
24
- );
25
- };
26
-
27
- const rootEle = document.getElementById('root')
28
- if (rootEle) {
29
- const root = createRoot(rootEle);
30
- root.render(<Main />);
31
- }
32
- `
33
- return {
34
- content,
35
- filename: `main.${ext.includes('ts') ? "tsx" : 'jsx'}`
36
- }
1
+ export default async ({ template }) => {
2
+
3
+ let ext = 'jsx'
4
+ if (template === 'react with typescript') {
5
+ ext = 'tsx'
6
+ } else if (template === 'typescript') {
7
+ ext = 'ts'
8
+ }
9
+ else if (template === 'javascript') {
10
+ ext = 'js'
11
+ }
12
+
13
+ const content = `import React from 'react';
14
+ import { createRoot } from 'react-dom/client';
15
+ import ${ext.includes("sx") ? "Count" : "sum"} from './src/index.${ext}';
16
+
17
+ const Main = () => {
18
+ return (
19
+ <div>
20
+ <h1>Welcome to makepack CLI!</h1>
21
+ <p>Edit <code>index.${ext}</code> and save to reload.</p>
22
+ ${ext.includes("sx") ? "<Count />" : "<p>The sum is: {sum(5, 5)}</p>"}
23
+ </div>
24
+ );
25
+ };
26
+
27
+ const rootEle = document.getElementById('root')
28
+ if (rootEle) {
29
+ const root = createRoot(rootEle);
30
+ root.render(<Main />);
31
+ }
32
+ `
33
+ return {
34
+ content,
35
+ filename: `main.${ext.includes('ts') ? "tsx" : 'jsx'}`
36
+ }
37
37
  }
@@ -1,50 +1,50 @@
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
- devDependencies["react"] = "^19.0.0"
11
- devDependencies["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.js`,
25
- module: `./index.mjs`,
26
- types: `./index.d.ts`,
27
- description: "",
28
- keywords: [],
29
- sideEffects: false,
30
- scripts: {
31
- "start": "makepack start",
32
- "build": "makepack build",
33
- "release": "makepack release"
34
- },
35
- "exports": {
36
- ".": {
37
- "import": "./index.mjs",
38
- "require": "./index.js",
39
- "types": "./index.d.ts"
40
- }
41
- },
42
- dependencies,
43
- devDependencies
44
- }
45
-
46
- return {
47
- content: JSON.stringify(json, null, 3),
48
- filename: "package.json"
49
- }
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
+ devDependencies["react"] = "^19.0.0"
11
+ devDependencies["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.js`,
25
+ module: `./index.mjs`,
26
+ types: `./index.d.ts`,
27
+ description: "",
28
+ keywords: [],
29
+ sideEffects: false,
30
+ scripts: {
31
+ "start": "makepack start",
32
+ "build": "makepack build",
33
+ "release": "makepack release"
34
+ },
35
+ "exports": {
36
+ ".": {
37
+ "import": "./index.mjs",
38
+ "require": "./index.js",
39
+ "types": "./index.d.ts"
40
+ }
41
+ },
42
+ dependencies,
43
+ devDependencies
44
+ }
45
+
46
+ return {
47
+ content: JSON.stringify(json, null, 3),
48
+ filename: "package.json"
49
+ }
50
50
  }
@@ -1,13 +1,13 @@
1
- export default async () => {
2
- const content = `
3
- function sum(a, b) {
4
- return a + b;
5
- }
6
-
7
- export default sum
8
- `
9
- return {
10
- content,
11
- filename: `src/index.js`
12
- }
1
+ export default async () => {
2
+ const content = `
3
+ function sum(a, b) {
4
+ return a + b;
5
+ }
6
+
7
+ export default sum
8
+ `
9
+ return {
10
+ content,
11
+ filename: `src/index.js`
12
+ }
13
13
  }
@@ -1,51 +1,51 @@
1
- export default async () => {
2
- const content = `import React, { useState } from 'react';
3
-
4
- const Index = () => {
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 Index;
46
- `
47
- return {
48
- content,
49
- filename: `src/index.jsx`
50
- }
1
+ export default async () => {
2
+ const content = `import React, { useState } from 'react';
3
+
4
+ const Index = () => {
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 Index;
46
+ `
47
+ return {
48
+ content,
49
+ filename: `src/index.jsx`
50
+ }
51
51
  }
@@ -1,11 +1,11 @@
1
- export default async () => {
2
- const content = `
3
- function sum(a: number, b: number): number {
4
- return a + b;
5
- }
6
- export default sum`
7
- return {
8
- content,
9
- filename: `src/index.ts`
10
- }
1
+ export default async () => {
2
+ const content = `
3
+ function sum(a: number, b: number): number {
4
+ return a + b;
5
+ }
6
+ export default sum`
7
+ return {
8
+ content,
9
+ filename: `src/index.ts`
10
+ }
11
11
  }
@@ -1,51 +1,51 @@
1
- export default async () => {
2
- const content = `import React, { useState } from 'react';
3
-
4
- const Index: 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 Index;
46
- `
47
- return {
48
- content,
49
- filename: `src/index.tsx`
50
- }
1
+ export default async () => {
2
+ const content = `import React, { useState } from 'react';
3
+
4
+ const Index: 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 Index;
46
+ `
47
+ return {
48
+ content,
49
+ filename: `src/index.tsx`
50
+ }
51
51
  }
@@ -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
- ".mpack",
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
  }