create-zuplo-api 1.7.0 → 2.0.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/create-zuplo-api.js +3 -1
- package/dist/index.js +31 -0
- package/dist/package.json +3 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/common/analytics/lib.d.ts +18 -0
- package/dist/src/common/analytics/lib.d.ts.map +1 -0
- package/dist/src/common/constants.d.ts +5 -0
- package/dist/src/common/constants.d.ts.map +1 -0
- package/dist/src/common/machine-id/lib.d.ts +2 -0
- package/dist/src/common/machine-id/lib.d.ts.map +1 -0
- package/dist/src/common/output.d.ts +9 -0
- package/dist/src/common/output.d.ts.map +1 -0
- package/dist/src/create/create.d.ts +6 -0
- package/dist/src/create/create.d.ts.map +1 -0
- package/dist/src/create/handler.d.ts +2 -0
- package/dist/src/create/handler.d.ts.map +1 -0
- package/dist/src/create/package-json.d.ts +16 -0
- package/dist/src/create/package-json.d.ts.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/utils.d.ts +2 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/templates/default/_README.md +1 -0
- package/dist/templates/default/config/dev-portal.json +5 -0
- package/dist/templates/default/config/policies.json +3 -0
- package/dist/templates/default/config/routes.oas.json +8 -0
- package/dist/templates/default/docs/markdown.md +43 -0
- package/dist/templates/default/docs/sidebar.json +13 -0
- package/dist/templates/default/docs/theme.css +29 -0
- package/dist/templates/default/env.example +2 -0
- package/dist/templates/default/eslintrc.js +11 -0
- package/dist/templates/default/gitignore +10 -0
- package/dist/templates/default/modules/hello-world.ts +21 -0
- package/dist/templates/default/tsconfig.json +19 -0
- package/dist/templates/default/vscode/launch.json +37 -0
- package/dist/templates/default/vscode/settings.json +24 -0
- package/dist/templates/default/zuplo.jsonc +4 -0
- package/package.json +17 -14
- package/dist/cli.js +0 -53
- package/dist/common/analytics/lib.js +0 -57
- package/dist/common/constants.js +0 -8
- package/dist/common/logger.js +0 -17
- package/dist/common/machine-id/lib.js +0 -68
- package/dist/common/output.js +0 -54
- package/dist/create/handler.js +0 -39
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9e0055eb-6035-5efb-8ac1-391c4bff8a89")}catch(e){}}();
|
|
3
|
-
import { execSync } from "node:child_process";
|
|
4
|
-
import { createHash } from "node:crypto";
|
|
5
|
-
const win32RegBinPath = {
|
|
6
|
-
skipped: "",
|
|
7
|
-
native: "%windir%\\System32",
|
|
8
|
-
mixed: "%windir%\\sysnative\\cmd.exe /c %windir%\\System32",
|
|
9
|
-
};
|
|
10
|
-
const guid = {
|
|
11
|
-
darwin: "ioreg -rd1 -c IOPlatformExpertDevice",
|
|
12
|
-
win32: `${win32RegBinPath[isWindowsProcessMixedOrNativeArchitecture()]}\\REG.exe ` +
|
|
13
|
-
"QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography " +
|
|
14
|
-
"/v MachineGuid",
|
|
15
|
-
linux: "( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",
|
|
16
|
-
};
|
|
17
|
-
function isWindowsProcessMixedOrNativeArchitecture() {
|
|
18
|
-
if (process.platform !== "win32") {
|
|
19
|
-
return "skipped";
|
|
20
|
-
}
|
|
21
|
-
if (process.arch === "ia32" && process.env["PROCESSOR_ARCHITEW6432"]) {
|
|
22
|
-
return "mixed";
|
|
23
|
-
}
|
|
24
|
-
return "native";
|
|
25
|
-
}
|
|
26
|
-
function hash(guid) {
|
|
27
|
-
return createHash("sha256").update(guid).digest("hex");
|
|
28
|
-
}
|
|
29
|
-
function expose(result) {
|
|
30
|
-
switch (process.platform) {
|
|
31
|
-
case "darwin":
|
|
32
|
-
return result
|
|
33
|
-
.split("IOPlatformUUID")[1]
|
|
34
|
-
.split("\n")[0]
|
|
35
|
-
.replace(/=|\s+]"/gi, "")
|
|
36
|
-
.toLowerCase();
|
|
37
|
-
case "win32":
|
|
38
|
-
return result
|
|
39
|
-
.toString()
|
|
40
|
-
.split("REG_SZ")[1]
|
|
41
|
-
.replace(/\r+|\n+|\s+/gi, "")
|
|
42
|
-
.toLowerCase();
|
|
43
|
-
case "linux":
|
|
44
|
-
return result
|
|
45
|
-
.toString()
|
|
46
|
-
.replace(/\r+|\n+|\s+/gi, "")
|
|
47
|
-
.toLowerCase();
|
|
48
|
-
case "freebsd":
|
|
49
|
-
return result
|
|
50
|
-
.toString()
|
|
51
|
-
.replace(/\r+|\n+|\s+/gi, "")
|
|
52
|
-
.toLowerCase();
|
|
53
|
-
default:
|
|
54
|
-
throw new Error(`Unsupported platform: ${process.platform}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export function machineId() {
|
|
58
|
-
switch (process.platform) {
|
|
59
|
-
case "darwin":
|
|
60
|
-
case "win32":
|
|
61
|
-
case "linux":
|
|
62
|
-
return hash(expose(execSync(guid[process.platform]).toString()));
|
|
63
|
-
default:
|
|
64
|
-
return "e16fc483-5593-4d71-b485-a6533693da9b";
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=lib.js.map
|
|
68
|
-
//# debugId=9e0055eb-6035-5efb-8ac1-391c4bff8a89
|
package/dist/common/output.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c9f754b6-4a30-5079-ac77-596791509251")}catch(e){}}();
|
|
3
|
-
import * as Sentry from "@sentry/node";
|
|
4
|
-
import chalk from "chalk";
|
|
5
|
-
import { MAX_WAIT_PENDING_TIME_MS } from "./constants.js";
|
|
6
|
-
export function printDiagnosticsToConsole(message) {
|
|
7
|
-
console.error(chalk.bold.blue(message));
|
|
8
|
-
}
|
|
9
|
-
export function printCriticalFailureToConsoleAndExit(message) {
|
|
10
|
-
console.error(chalk.bold.red(message));
|
|
11
|
-
void Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
|
|
12
|
-
process.exit(1);
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
export function printResultToConsole(message) {
|
|
16
|
-
console.log(chalk.bold.green(message));
|
|
17
|
-
}
|
|
18
|
-
export function printTableToConsole(table) {
|
|
19
|
-
console.table(table);
|
|
20
|
-
}
|
|
21
|
-
export function printResultToConsoleAndExitGracefully(message) {
|
|
22
|
-
printResultToConsole(message);
|
|
23
|
-
void Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
|
|
24
|
-
process.exit(0);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
export function printTableToConsoleAndExitGracefully(table) {
|
|
28
|
-
printTableToConsole(table);
|
|
29
|
-
void Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
|
|
30
|
-
process.exit(0);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
export default function setBlocking() {
|
|
34
|
-
if (typeof process === "undefined")
|
|
35
|
-
return;
|
|
36
|
-
[process.stdout, process.stderr].forEach((_stream) => {
|
|
37
|
-
const stream = _stream;
|
|
38
|
-
if (stream._handle &&
|
|
39
|
-
stream.isTTY &&
|
|
40
|
-
typeof stream._handle.setBlocking === "function") {
|
|
41
|
-
stream._handle.setBlocking(true);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
export function textOrJson(text) {
|
|
46
|
-
try {
|
|
47
|
-
return JSON.parse(text);
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
return text;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=output.js.map
|
|
54
|
-
//# debugId=c9f754b6-4a30-5079-ac77-596791509251
|
package/dist/create/handler.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f6fbd211-5c88-5e06-9a36-7482f16ce2ac")}catch(e){}}();
|
|
3
|
-
import input from "@inquirer/input";
|
|
4
|
-
import { printCriticalFailureToConsoleAndExit, printDiagnosticsToConsole, printResultToConsole, } from "../common/output.js";
|
|
5
|
-
import { logger } from "../common/logger.js";
|
|
6
|
-
import { captureEvent } from "../common/analytics/lib.js";
|
|
7
|
-
export async function create() {
|
|
8
|
-
await captureEvent({ argv: {}, event: "create-zuplo-api" });
|
|
9
|
-
const name = await input({
|
|
10
|
-
message: "What do you want to name your project?",
|
|
11
|
-
});
|
|
12
|
-
if (name) {
|
|
13
|
-
const core = await import("@zuplo/core/create");
|
|
14
|
-
try {
|
|
15
|
-
const rootDirectory = process.cwd();
|
|
16
|
-
printDiagnosticsToConsole("");
|
|
17
|
-
printDiagnosticsToConsole(`Scaffolding project in ${rootDirectory}/${name}...`);
|
|
18
|
-
const _result = await core.default.create({
|
|
19
|
-
rootDirectory,
|
|
20
|
-
name,
|
|
21
|
-
logger,
|
|
22
|
-
});
|
|
23
|
-
printDiagnosticsToConsole("");
|
|
24
|
-
printDiagnosticsToConsole("Done. Now run:");
|
|
25
|
-
printDiagnosticsToConsole("");
|
|
26
|
-
printResultToConsole(` cd ${name}`);
|
|
27
|
-
printResultToConsole(` npm install`);
|
|
28
|
-
printResultToConsole(` npm run dev`);
|
|
29
|
-
}
|
|
30
|
-
catch (err) {
|
|
31
|
-
printDiagnosticsToConsole(err.message ?? err);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
printCriticalFailureToConsoleAndExit("Please enter a name for your project");
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=handler.js.map
|
|
39
|
-
//# debugId=f6fbd211-5c88-5e06-9a36-7482f16ce2ac
|