makepack 1.5.21 → 1.5.23

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,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
+ "build"
27
+ ]
28
+ }
29
+
30
+ return {
31
+ content: JSON.stringify(content, null, 2),
32
+ filename: "tsconfig.json"
33
+ }
34
34
  }
@@ -1,106 +1,106 @@
1
- import { execSync, logger } from "../../helpers.js"
2
- import makeFiles from "./makeFiles.js"
3
- import path from 'path'
4
- import inquirer from 'inquirer'
5
- import figlet from 'figlet'
6
- import fs from "fs-extra"
7
- const cwd = process.cwd()
8
- const cwdFolder = cwd.split(path.sep).pop()
9
-
10
- const create = async () => {
11
- const information = {
12
- projectDirName: cwdFolder,
13
- cwd: path.join(cwd, cwdFolder),
14
- template: "typescript",
15
- sourceDir: "src",
16
- sourceEntry: "index.ts",
17
- }
18
-
19
- let { projectDirName } = await inquirer.prompt([
20
- {
21
- type: 'input',
22
- name: 'projectDirName',
23
- message: 'Enter the project name',
24
- default: information.projectDir
25
- }
26
- ])
27
-
28
- if (projectDirName !== cwdFolder) {
29
- if (fs.existsSync(path.join(cwd, projectDirName))) {
30
- const { proceed } = await inquirer.prompt([
31
- {
32
- type: "confirm",
33
- name: 'proceed',
34
- message: "The directory already exists, do you want to overwrite it?",
35
- default: "No"
36
- }
37
- ])
38
- if (!proceed) {
39
- console.log('Project creation canceled.');
40
- return
41
- }
42
- }
43
- }
44
-
45
- information.projectDirName = projectDirName
46
- information.cwd = path.join(cwd, information.projectDirName)
47
- let isCurrentDir = projectDirName !== cwdFolder
48
-
49
- // template
50
- const { template } = await inquirer.prompt([
51
- {
52
- type: 'list',
53
- name: 'template',
54
- message: 'Select a template',
55
- choices: ['typescript', 'javascript', 'react with typescript', 'react with javascript'],
56
- default: information.template
57
- }
58
- ])
59
-
60
- information.template = template
61
-
62
- logger.info("", "Creating project...", false)
63
- const projectDir = path.join(cwd, information.projectDirName)
64
-
65
- if (!fs.existsSync(projectDir)) {
66
- fs.mkdirSync(projectDir)
67
- }
68
-
69
- if (!fs.existsSync(path.join(projectDir, information.sourceDir))) {
70
- fs.mkdirSync(path.join(projectDir, information.sourceDir))
71
- }
72
-
73
- switch (information.template) {
74
- case "react with typescript":
75
- information.sourceEntry = "index.tsx"
76
- break;
77
- case "react with javascript":
78
- information.sourceEntry = "index.jsx"
79
- break;
80
- case "javascript":
81
- information.sourceEntry = "index.js"
82
- break;
83
- }
84
-
85
- await makeFiles(information)
86
-
87
- logger.info("", "Installing Dependencies", false)
88
- execSync("npm install", {
89
- cwd: information.cwd,
90
- })
91
-
92
- logger.info("Project setup complete!", "", false)
93
- if (isCurrentDir) {
94
- console.log(`Run the development server: \n${logger.info("", "npm start", false)}\nEnjoy your new project! 😊`);
95
- } else {
96
- console.log(`To start working with your project:\nNavigate to your project directory:\n${logger.info("", "cd " + information.projectDirName, false)} and Run the development server:\n${logger.info("", "npm start", false)}\nEnjoy your new project! 😊`);
97
- }
98
-
99
- figlet("Makepack CLI", function (err, data) {
100
- if (!err) {
101
- console.log(data);
102
- }
103
- });
104
- }
105
-
1
+ import { execSync, logger } from "../../helpers.js"
2
+ import makeFiles from "./makeFiles.js"
3
+ import path from 'path'
4
+ import inquirer from 'inquirer'
5
+ import figlet from 'figlet'
6
+ import fs from "fs-extra"
7
+ const cwd = process.cwd()
8
+ const cwdFolder = cwd.split(path.sep).pop()
9
+
10
+ const create = async () => {
11
+ const information = {
12
+ projectDirName: cwdFolder,
13
+ cwd: path.join(cwd, cwdFolder),
14
+ template: "typescript",
15
+ sourceDir: "src",
16
+ sourceEntry: "index.ts",
17
+ }
18
+
19
+ let { projectDirName } = await inquirer.prompt([
20
+ {
21
+ type: 'input',
22
+ name: 'projectDirName',
23
+ message: 'Enter the project name',
24
+ default: information.projectDir
25
+ }
26
+ ])
27
+
28
+ if (projectDirName !== cwdFolder) {
29
+ if (fs.existsSync(path.join(cwd, projectDirName))) {
30
+ const { proceed } = await inquirer.prompt([
31
+ {
32
+ type: "confirm",
33
+ name: 'proceed',
34
+ message: "The directory already exists, do you want to overwrite it?",
35
+ default: "No"
36
+ }
37
+ ])
38
+ if (!proceed) {
39
+ console.log('Project creation canceled.');
40
+ return
41
+ }
42
+ }
43
+ }
44
+
45
+ information.projectDirName = projectDirName
46
+ information.cwd = path.join(cwd, information.projectDirName)
47
+ let isCurrentDir = projectDirName !== cwdFolder
48
+
49
+ // template
50
+ const { template } = await inquirer.prompt([
51
+ {
52
+ type: 'list',
53
+ name: 'template',
54
+ message: 'Select a template',
55
+ choices: ['typescript', 'javascript', 'react with typescript', 'react with javascript'],
56
+ default: information.template
57
+ }
58
+ ])
59
+
60
+ information.template = template
61
+
62
+ logger.info("", "Creating project...", false)
63
+ const projectDir = path.join(cwd, information.projectDirName)
64
+
65
+ if (!fs.existsSync(projectDir)) {
66
+ fs.mkdirSync(projectDir)
67
+ }
68
+
69
+ if (!fs.existsSync(path.join(projectDir, information.sourceDir))) {
70
+ fs.mkdirSync(path.join(projectDir, information.sourceDir))
71
+ }
72
+
73
+ switch (information.template) {
74
+ case "react with typescript":
75
+ information.sourceEntry = "index.tsx"
76
+ break;
77
+ case "react with javascript":
78
+ information.sourceEntry = "index.jsx"
79
+ break;
80
+ case "javascript":
81
+ information.sourceEntry = "index.js"
82
+ break;
83
+ }
84
+
85
+ await makeFiles(information)
86
+
87
+ logger.info("", "Installing Dependencies", false)
88
+ execSync("npm install", {
89
+ cwd: information.cwd,
90
+ })
91
+
92
+ logger.info("Project setup complete!", "", false)
93
+ if (isCurrentDir) {
94
+ console.log(`Run the development server: \n${logger.info("", "npm start", false)}\nEnjoy your new project! 😊`);
95
+ } else {
96
+ console.log(`To start working with your project:\nNavigate to your project directory:\n${logger.info("", "cd " + information.projectDirName, false)} and Run the development server:\n${logger.info("", "npm start", false)}\nEnjoy your new project! 😊`);
97
+ }
98
+
99
+ figlet("Makepack CLI", function (err, data) {
100
+ if (!err) {
101
+ console.log(data);
102
+ }
103
+ });
104
+ }
105
+
106
106
  export default create
@@ -1,64 +1,64 @@
1
- // import makepack from "./files/makepack.js";
2
- import packageJson from "./files/package-json.js";
3
- import gitignore from "./files/gitignore.js";
4
- import App from "./files/App.js";
5
- import tsconfig from "./files/tsconfig.js";
6
- import projectJs from "./files/project-js.js";
7
- import projectJsx from "./files/project-jsx.js";
8
- import projectTs from "./files/project-ts.js";
9
- import projectTsx from "./files/project-tsx.js";
10
-
11
- import inquirer from 'inquirer'
12
- import fs from "fs-extra"
13
- import path from "path"
14
- import readmeMd from "./files/readme.md.js";
15
-
16
- export default async (info) => {
17
- const files = [
18
- await packageJson(info),
19
- await gitignore(info),
20
- await App(info),
21
- await readmeMd(info)
22
- ];
23
-
24
- switch (info.template) {
25
- case "typescript":
26
- files.push(await projectTs(info))
27
- break
28
- case "react with typescript":
29
- files.push(await projectTsx(info))
30
- break;
31
- case "javascript":
32
- files.push(await projectJs(info))
33
- break
34
- case "react with javascript":
35
- files.push(await projectJsx(info))
36
- break;
37
- }
38
-
39
- // push ts config
40
- if (info.template.includes("typescript")) {
41
- files.push(await tsconfig(info))
42
- }
43
-
44
- for (let file of files) {
45
- // check if the file exists
46
- if (fs.existsSync(path.join(info.cwd, file.filename))) {
47
- const { overwrite } = await inquirer.prompt([
48
- {
49
- type: "confirm",
50
- name: 'overwrite',
51
- message: `The file ${file.filename} already exists, do you want to overwrite it?`,
52
- default: true
53
- }
54
- ])
55
- if (!overwrite) {
56
- continue
57
- } else {
58
- fs.removeSync(path.join(info.cwd, file.filename))
59
- }
60
- }
61
-
62
- fs.writeFileSync(path.join(info.cwd, file.filename), file.content)
63
- }
64
- }
1
+ // import makepack from "./files/makepack.js";
2
+ import packageJson from "./files/package-json.js";
3
+ import gitignore from "./files/gitignore.js";
4
+ import App from "./files/App.js";
5
+ import tsconfig from "./files/tsconfig.js";
6
+ import projectJs from "./files/project-js.js";
7
+ import projectJsx from "./files/project-jsx.js";
8
+ import projectTs from "./files/project-ts.js";
9
+ import projectTsx from "./files/project-tsx.js";
10
+
11
+ import inquirer from 'inquirer'
12
+ import fs from "fs-extra"
13
+ import path from "path"
14
+ import readmeMd from "./files/readme.md.js";
15
+
16
+ export default async (info) => {
17
+ const files = [
18
+ await packageJson(info),
19
+ await gitignore(info),
20
+ await App(info),
21
+ await readmeMd(info)
22
+ ];
23
+
24
+ switch (info.template) {
25
+ case "typescript":
26
+ files.push(await projectTs(info))
27
+ break
28
+ case "react with typescript":
29
+ files.push(await projectTsx(info))
30
+ break;
31
+ case "javascript":
32
+ files.push(await projectJs(info))
33
+ break
34
+ case "react with javascript":
35
+ files.push(await projectJsx(info))
36
+ break;
37
+ }
38
+
39
+ // push ts config
40
+ if (info.template.includes("typescript")) {
41
+ files.push(await tsconfig(info))
42
+ }
43
+
44
+ for (let file of files) {
45
+ // check if the file exists
46
+ if (fs.existsSync(path.join(info.cwd, file.filename))) {
47
+ const { overwrite } = await inquirer.prompt([
48
+ {
49
+ type: "confirm",
50
+ name: 'overwrite',
51
+ message: `The file ${file.filename} already exists, do you want to overwrite it?`,
52
+ default: true
53
+ }
54
+ ])
55
+ if (!overwrite) {
56
+ continue
57
+ } else {
58
+ fs.removeSync(path.join(info.cwd, file.filename))
59
+ }
60
+ }
61
+
62
+ fs.writeFileSync(path.join(info.cwd, file.filename), file.content)
63
+ }
64
+ }
@@ -1,21 +1,21 @@
1
- import path from 'path'
2
- import { execSync, logger } from '../../helpers.js'
3
- import makepackConfig from '../../makepack-config.js'
4
- import fs from 'fs-extra'
5
-
6
- const publish = async () => {
7
- const { build } = await makepackConfig()
8
- const buildDir = path.join(process.cwd(), build.outdir)
9
- const exists = fs.existsSync(buildDir)
10
- if (!exists) {
11
- logger.error(`Build directory ${buildDir} does not exist. Please build the project first`)
12
- process.exit(1)
13
- }
14
-
15
- logger.info(`Publishing the production build to the npm repository...`)
16
- execSync(`npm publish`, {
17
- cwd: buildDir
18
- })
19
- }
20
-
1
+ import path from 'path'
2
+ import { execSync, logger } from '../../helpers.js'
3
+ import makepackConfig from '../../makepack-config.js'
4
+ import fs from 'fs-extra'
5
+
6
+ const publish = async () => {
7
+ const { build } = await makepackConfig()
8
+ const buildDir = path.join(process.cwd(), build.outdir)
9
+ const exists = fs.existsSync(buildDir)
10
+ if (!exists) {
11
+ logger.error(`Build directory ${buildDir} does not exist. Please build the project first`)
12
+ process.exit(1)
13
+ }
14
+
15
+ logger.info(`Publishing the production build to the npm repository...`)
16
+ execSync(`npm publish`, {
17
+ cwd: buildDir
18
+ })
19
+ }
20
+
21
21
  export default publish
@@ -1,26 +1,26 @@
1
- import express from 'express';
2
- import { logger } from '../../helpers.js'
3
- import chalk from 'chalk';
4
- import makepackConfig from '../../makepack-config.js';
5
- import viteSetup from './vite.js';
6
- import userExpress from './user-express.js';
7
-
8
- const app = express();
9
- const server = async () => {
10
- const config = await makepackConfig()
11
- userExpress(app)
12
- await viteSetup(app)
13
- app.use((_req, res) => {
14
- res.status(500).send('Internal Server Error');
15
- });
16
-
17
- app.listen(config.start.port, () => {
18
- logger.success(`Server is running on ${chalk.blue(chalk.underline(`http://localhost:${config.start.port}`))}`);
19
- });
20
-
21
- process.on('SIGINT', async () => {
22
- process.exit(0);
23
- });
24
- }
25
-
1
+ import express from 'express';
2
+ import { logger } from '../../helpers.js'
3
+ import chalk from 'chalk';
4
+ import makepackConfig from '../../makepack-config.js';
5
+ import viteSetup from './vite.js';
6
+ import userExpress from './user-express.js';
7
+
8
+ const app = express();
9
+ const server = async () => {
10
+ const config = await makepackConfig()
11
+ userExpress(app)
12
+ await viteSetup(app)
13
+ app.use((_req, res) => {
14
+ res.status(500).send('Internal Server Error');
15
+ });
16
+
17
+ app.listen(config.start.port, () => {
18
+ logger.success(`Server is running on ${chalk.blue(chalk.underline(`http://localhost:${config.start.port}`))}`);
19
+ });
20
+
21
+ process.on('SIGINT', async () => {
22
+ process.exit(0);
23
+ });
24
+ }
25
+
26
26
  server()