makepack 1.0.3 → 1.0.5

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.0.3",
3
+ "version": "1.0.5",
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
  "categories": [
@@ -1,6 +1,6 @@
1
1
  export default (args) => {
2
2
  return {
3
- content: `node_modules\n$${args.outdir}`,
3
+ content: `node_modules\n${args.outdir}`,
4
4
  filename: ".gitignore"
5
5
  }
6
6
  }
@@ -6,25 +6,29 @@ export default (args) => {
6
6
 
7
7
  if (args.template.includes("react")) {
8
8
  dependencies = {
9
- "react": "^17.0.2",
10
- "react-dom": "^17.0.2"
9
+ "react": "^19.0.0",
10
+ "react-dom": "^19.0.0"
11
11
  }
12
12
  }
13
13
 
14
14
  if (args.template.includes("typescript")) {
15
15
  devDependencies["typescript"] = "^4.4.2"
16
- devDependencies["@types/react"] = "^18.3.12"
17
- devDependencies["@types/react-dom"] = "^18.3.1"
16
+ devDependencies["@types/react"] = "^19.0.2"
17
+ devDependencies["@types/react-dom"] = "^19.0.2"
18
18
  }
19
19
 
20
+ let main = args.entry.split('.')
21
+ main.pop()
22
+
20
23
  const json = {
21
24
  name: args.diraname,
22
25
  version: "1.0.0",
23
26
  description: "",
24
- main: `${args.outdir}/${args.entry}`,
27
+ main: `./${main.join(".")}.js`,
25
28
  scripts: {
26
29
  "start": "makepack serve",
27
- "build": "makepack build",
30
+ "pack": "makepack pack",
31
+ "publish": "makepack pack -p",
28
32
  },
29
33
  dependencies,
30
34
  devDependencies,
@@ -1,5 +1,7 @@
1
1
  export default (args) => {
2
2
  const content = `import React from 'react';
3
+ import { createRoot } from 'react-dom/client';
4
+
3
5
  const App = () => {
4
6
  return (
5
7
  <div style={{ textAlign: 'center', marginTop: '50px' }}>
@@ -16,7 +18,11 @@ const App = () => {
16
18
  </div>
17
19
  );
18
20
  };
19
- export default App;
21
+ const rootEle = document.getElementById('root')
22
+ if (rootEle) {
23
+ const root = createRoot(rootEle);
24
+ root.render(<App />);
25
+ }
20
26
  `
21
27
  return {
22
28
  content,
@@ -1,5 +1,7 @@
1
1
  export default args => {
2
2
  const content = `import React from 'react';
3
+ import { createRoot } from 'react-dom/client';
4
+
3
5
  const App: React.FC = () => {
4
6
  return (
5
7
  <div style={{ textAlign: 'center', marginTop: '50px' }}>
@@ -16,7 +18,11 @@ const App: React.FC = () => {
16
18
  </div>
17
19
  );
18
20
  }
19
- export default App;
21
+ const rootEle = document.getElementById('root')
22
+ if (rootEle) {
23
+ const root = createRoot(rootEle);
24
+ root.render(<App />);
25
+ }
20
26
  `
21
27
  return {
22
28
  content,
@@ -18,6 +18,7 @@ export default args => {
18
18
  "resolveJsonModule": true,
19
19
  "isolatedModules": true,
20
20
  "noEmit": true,
21
+ "jsx": "react"
21
22
  },
22
23
  "include": [args.rootdir],
23
24
  "exclude": [
@@ -20,7 +20,7 @@ const pack = async (args) => {
20
20
  outdir: path.join(process.cwd(), args.outdir),
21
21
  minify: true,
22
22
  sourcemap: true,
23
- format: "esm",
23
+ format: "cjs",
24
24
  platform: 'node',
25
25
  loader: { '.ts': 'ts' },
26
26
  // tsconfig: path.join(process.cwd(), 'tsconfig.json'),
@@ -36,7 +36,6 @@ const serve = async (args) => {
36
36
  <head>
37
37
  <meta charset="UTF-8" />
38
38
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
39
- <title>Xanos</title>
40
39
  </head>
41
40
  <body>
42
41
  <div id="root"></div>
package/src/index.js CHANGED
@@ -16,7 +16,7 @@ program
16
16
 
17
17
  program
18
18
  .command("serve")
19
- .option("-p, --port <type>", "Port number", "3000")
19
+ .option("-p, --port <type>", "Port number", "5000")
20
20
  .option("-e, --entry <type>", "entry file")
21
21
  .description("Start the server")
22
22
  .action(serve);