create-sip 0.0.7 → 0.0.8
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/genHtml.js +23 -0
- package/manager.js +7 -9
- package/package.json +7 -3
package/genHtml.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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
|
package/manager.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const fsExtra = require('fs-extra');
|
|
3
|
+
const genHtml = require('./genHtml');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
const genWebpage = (target) => {
|
|
7
|
-
|
|
7
|
+
createFile(`${target}/index.html`, genHtml);
|
|
8
|
+
createFile(`${target}/style.css`, '');
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
fs.mkdirSync(destDir, { recursive: true });
|
|
14
|
-
for (const file of fs.readdirSync(`${dir}/${srcDir}`)) {
|
|
15
|
-
fs.copyFileSync(`${dir}/${srcDir}/${file}`, `${destDir}/${file}`);
|
|
11
|
+
const createFile = (path, content) => {
|
|
12
|
+
if (!fsExtra.existsSync(path)) {
|
|
13
|
+
fsExtra.writeFileSync(path, content);
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-sip",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-sip": "create-sip.js"
|
|
@@ -8,16 +8,20 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
10
|
},
|
|
11
|
-
"keywords": [
|
|
11
|
+
"keywords": [
|
|
12
|
+
"project",
|
|
13
|
+
"generator"
|
|
14
|
+
],
|
|
12
15
|
"author": "Sallai András",
|
|
13
16
|
"license": "MIT",
|
|
14
17
|
"description": "Simple project generator",
|
|
15
18
|
"dependencies": {
|
|
16
19
|
"commander": "^12.1.0",
|
|
20
|
+
"fs-extra": "^11.2.0",
|
|
17
21
|
"minimist": "^1.2.8"
|
|
18
22
|
},
|
|
19
23
|
"repository": {
|
|
20
24
|
"type": "git",
|
|
21
25
|
"url": "https://github.com/andteki/create-sip.git"
|
|
22
|
-
}
|
|
26
|
+
}
|
|
23
27
|
}
|