create-seamless 0.0.1-beta.1 โ 0.0.1-beta.2
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/index.js +31 -15
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { execSync } from "child_process";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import selfsigned from "selfsigned";
|
|
3
6
|
|
|
4
7
|
const project = process.argv[2] || "demo-app";
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
function cleanUp() {
|
|
10
|
+
if (fs.existsSync(process.cwd(), project)) {
|
|
11
|
+
console.log(`\n๐งน Cleaning up ${project} directory due to error...`);
|
|
12
|
+
fs.rmSync(projectPath, { recursive: true, force: true });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
7
15
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
stdio: "inherit",
|
|
11
|
-
});
|
|
16
|
+
try {
|
|
17
|
+
console.log(`๐ Creating project: ${project}...\n`);
|
|
12
18
|
|
|
13
|
-
// Step
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
fs.mkdirSync(certDir);
|
|
18
|
-
}
|
|
19
|
-
const pems = selfsigned.generate(null, { days: 365 });
|
|
20
|
-
fs.writeFileSync(path.join(certDir, "cert.pem"), pems.cert);
|
|
21
|
-
fs.writeFileSync(path.join(certDir, "key.pem"), pems.private);
|
|
19
|
+
// Step 1: Clone the starter template
|
|
20
|
+
execSync(`npx degit fells-code/seamless-auth-starter-react#main ${project}`, {
|
|
21
|
+
stdio: "inherit",
|
|
22
|
+
});
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
// Step 2: Generate HTTPS certs for Vite
|
|
25
|
+
console.log(`\n๐ Generating HTTPS certificates...\n`);
|
|
26
|
+
const certDir = path.join(process.cwd(), project, ".cert");
|
|
27
|
+
if (!fs.existsSync(certDir)) {
|
|
28
|
+
fs.mkdirSync(certDir);
|
|
29
|
+
}
|
|
30
|
+
const pems = selfsigned.generate(null, { days: 365 });
|
|
31
|
+
fs.writeFileSync(path.join(certDir, "cert.pem"), pems.cert);
|
|
32
|
+
fs.writeFileSync(path.join(certDir, "key.pem"), pems.private);
|
|
33
|
+
|
|
34
|
+
console.log(`
|
|
24
35
|
โ
Done!
|
|
25
36
|
โ cd ${project}
|
|
26
37
|
โ npm install
|
|
@@ -28,3 +39,8 @@ console.log(`
|
|
|
28
39
|
|
|
29
40
|
๐ก Note: The browser may ask you to trust the certificate the first time.
|
|
30
41
|
`);
|
|
42
|
+
} catch (err) {
|
|
43
|
+
console.error(`\nโ Error: ${err.message}`);
|
|
44
|
+
cleanUp();
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-seamless",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.2",
|
|
4
4
|
"description": "The starter script for Seamless Auth + AI",
|
|
5
5
|
"homepage": "https://github.com/fells-code/create-seamless#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"create-seamlessauth": "index.js"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"degit": "^2.8.4"
|
|
24
|
+
"degit": "^2.8.4",
|
|
25
|
+
"selfsigned": "^3.0.1"
|
|
25
26
|
}
|
|
26
27
|
}
|