create-sip 0.0.11 → 0.0.13

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 ADDED
@@ -0,0 +1,7 @@
1
+ # create-sip
2
+
3
+ ## Használat
4
+
5
+ ```bash
6
+ npm create sip@latest webpage valami
7
+ ```
package/create-sip.js CHANGED
@@ -1,18 +1,47 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { program } = require('commander');
4
3
  const { genWebpage } = require('./manager');
4
+ const prompts = require('prompts');
5
5
 
6
- program
7
- .name('create-sin')
8
- .description('create a new sip project')
6
+ const questions = [
7
+ {
8
+ type: 'text',
9
+ name: 'name',
10
+ message: 'Project name: ',
11
+ initial: 'app01'
12
+ },
13
+ {
14
+ type: 'select',
15
+ name: 'type',
16
+ message: 'Project type (webpage): ',
17
+ choices: [
18
+ {
19
+ title: 'webpage',
20
+ description: 'simple webpage: index.html, style.css',
21
+ value: 'webpage'
22
+ },
23
+ {
24
+ title: 'javascript',
25
+ description: 'simple javascript: index.html, style.css,app.js',
26
+ value: 'javascript'
27
+ }
28
+ ],
29
+ initial: 0
30
+ }
31
+ ];
9
32
 
10
- program
11
- .command('webpage [target]')
12
- .description('simple webpage')
13
- .action((target) => {
33
+ (async () => {
34
+ const res = await prompts(questions);
35
+ console.log(res);
36
+ if(res.type === 'webpage') {
14
37
  console.log('create a new webpage...');
15
- genWebpage(target);
16
- });
17
-
18
- program.parse()
38
+ genWebpage(res.name);
39
+ return;
40
+ }
41
+ if(res.type === 'javascript') {
42
+ console.log('create a new javascript...');
43
+ console.log('Nincs implementálva.')
44
+ return;
45
+ }
46
+
47
+ })();
package/manager.js CHANGED
@@ -8,7 +8,6 @@ const genWebpage = (target) => {
8
8
  }
9
9
 
10
10
  const copyDir = (srcDir, destDir) => {
11
- console.log('Könyvtár: ', dir)
12
11
  fs.mkdirSync(destDir, { recursive: true });
13
12
  for (const file of fs.readdirSync(`${dir}/${srcDir}`)) {
14
13
  fs.copyFileSync(`${dir}/${srcDir}/${file}`, `${destDir}/${file}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-sip",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "main": "index.js",
5
5
  "bin": {
6
6
  "create-sip": "create-sip.js"
@@ -18,7 +18,8 @@
18
18
  "dependencies": {
19
19
  "commander": "^12.1.0",
20
20
  "fs-extra": "^11.2.0",
21
- "minimist": "^1.2.8"
21
+ "minimist": "^1.2.8",
22
+ "prompts": "^2.4.2"
22
23
  },
23
24
  "repository": {
24
25
  "type": "git",
package/genHtml.js DELETED
@@ -1,23 +0,0 @@
1
-
2
- const htmlContent = `
3
- <!DOCTYPE html>
4
- <html lang="hu">
5
- <head>
6
- <meta charset="UTF-8">
7
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
- <title>Sinto Project</title>
9
- <link rel="stylesheet" href="bootstrap.css">
10
- <link rel="stylesheet" href="style.css">
11
- </head>
12
- <body>
13
- <div class="container">
14
- <h1>Sinto Project</h1>
15
- <p>This is a default index.html file, which was created by the sin command.</p>
16
- </div>
17
- <script type="module" src="app.js"></script>
18
- </body>
19
- </html>
20
-
21
- `
22
-
23
- module.exports = htmlContent