@deenruv/create 1.0.0
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/LICENSE +23 -0
- package/README.md +52 -0
- package/assets/.env.hbs +14 -0
- package/assets/Dockerfile.hbs +9 -0
- package/assets/deenruv-config.hbs +109 -0
- package/assets/docker-compose.hbs +39 -0
- package/assets/environment.d.hbs +24 -0
- package/assets/gitignore.template +5 -0
- package/assets/images/abel-y-costa-716024-unsplash.jpg +0 -0
- package/assets/images/adam-birkett-239153-unsplash.jpg +0 -0
- package/assets/images/alex-rodriguez-santibanez-200278-unsplash.jpg +0 -0
- package/assets/images/alexander-andrews-260988-unsplash.jpg +0 -0
- package/assets/images/alexandru-acea-686569-unsplash.jpg +0 -0
- package/assets/images/andres-jasso-220776-unsplash.jpg +0 -0
- package/assets/images/annie-spratt-78044-unsplash.jpg +0 -0
- package/assets/images/ben-hershey-574483-unsplash.jpg +0 -0
- package/assets/images/benjamin-voros-310026-unsplash.jpg +0 -0
- package/assets/images/brandi-redd-104140-unsplash.jpg +0 -0
- package/assets/images/caleb-george-536388-unsplash.jpg +0 -0
- package/assets/images/charles-deluvio-695736-unsplash.jpg +0 -0
- package/assets/images/chuttersnap-324234-unsplash.jpg +0 -0
- package/assets/images/chuttersnap-584518-unsplash.jpg +0 -0
- package/assets/images/daniel-korpai-1302051-unsplash.jpg +0 -0
- package/assets/images/derick-david-409858-unsplash.jpg +0 -0
- package/assets/images/eniko-kis-663725-unsplash.jpg +0 -0
- package/assets/images/florian-klauer-14840-unsplash.jpg +0 -0
- package/assets/images/florian-olivo-1166419-unsplash.jpg +0 -0
- package/assets/images/imani-clovis-234736-unsplash.jpg +0 -0
- package/assets/images/jakob-owens-274337-unsplash.jpg +0 -0
- package/assets/images/jean-philippe-delberghe-1400011-unsplash.jpg +0 -0
- package/assets/images/jonathan-talbert-697262-unsplash.jpg +0 -0
- package/assets/images/juan-gomez-674574-unsplash.jpg +0 -0
- package/assets/images/kari-shea-398668-unsplash.jpg +0 -0
- package/assets/images/kelly-sikkema-685291-unsplash.jpg +0 -0
- package/assets/images/liam-briese-1128307-unsplash.jpg +0 -0
- package/assets/images/mark-tegethoff-667351-unsplash.jpg +0 -0
- package/assets/images/max-tarkhov-737999-unsplash.jpg +0 -0
- package/assets/images/michael-guite-571169-unsplash.jpg +0 -0
- package/assets/images/mikkel-bech-748940-unsplash.jpg +0 -0
- package/assets/images/mitch-lensink-256007-unsplash.jpg +0 -0
- package/assets/images/natalia-y-345738-unsplash.jpg +0 -0
- package/assets/images/nathan-fertig-249917-unsplash.jpg +0 -0
- package/assets/images/neonbrand-428982-unsplash.jpg +0 -0
- package/assets/images/neslihan-gunaydin-3493-unsplash.jpg +0 -0
- package/assets/images/nik-shuliahin-619349-unsplash.jpg +0 -0
- package/assets/images/nikolai-chernichenko-1299748-unsplash.jpg +0 -0
- package/assets/images/oscar-ivan-esquivel-arteaga-687447-unsplash.jpg +0 -0
- package/assets/images/patrick-brinksma-663044-unsplash.jpg +0 -0
- package/assets/images/paul-weaver-1120584-unsplash.jpg +0 -0
- package/assets/images/pierre-chatel-innocenti-483198-unsplash.jpg +0 -0
- package/assets/images/robert-shunev-528016-unsplash.jpg +0 -0
- package/assets/images/ruslan-bardash-351288-unsplash.jpg +0 -0
- package/assets/images/silvia-agrasar-227575-unsplash.jpg +0 -0
- package/assets/images/stoica-ionela-530966-unsplash.jpg +0 -0
- package/assets/images/thomas-q-1229169-unsplash.jpg +0 -0
- package/assets/images/thomas-serer-420833-unsplash.jpg +0 -0
- package/assets/images/tommy-bebo-600358-unsplash.jpg +0 -0
- package/assets/images/vincent-botta-736919-unsplash.jpg +0 -0
- package/assets/images/vincent-liu-525429-unsplash.jpg +0 -0
- package/assets/images/xavier-teo-469050-unsplash.jpg +0 -0
- package/assets/images/zoltan-kovacs-642412-unsplash.jpg +0 -0
- package/assets/images/zoltan-tasi-423051-unsplash.jpg +0 -0
- package/assets/index-worker.hbs +8 -0
- package/assets/index.hbs +8 -0
- package/assets/initial-data.json +1508 -0
- package/assets/products.csv +89 -0
- package/assets/readme.hbs +133 -0
- package/assets/tsconfig.template.json +20 -0
- package/index.js +2 -0
- package/lib/constants.d.ts +7 -0
- package/lib/constants.js +11 -0
- package/lib/constants.js.map +1 -0
- package/lib/create-deenruv-app.d.ts +2 -0
- package/lib/create-deenruv-app.js +269 -0
- package/lib/create-deenruv-app.js.map +1 -0
- package/lib/gather-user-responses.d.ts +10 -0
- package/lib/gather-user-responses.js +186 -0
- package/lib/gather-user-responses.js.map +1 -0
- package/lib/helpers.d.ts +29 -0
- package/lib/helpers.js +422 -0
- package/lib/helpers.js.map +1 -0
- package/lib/types.d.ts +19 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/package.json +51 -0
package/lib/helpers.js
ADDED
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.isServerPortInUse = exports.checkDbConnection = exports.getDependencies = exports.installPackages = exports.checkThatNpmCanReadCwd = exports.bunIsAvailable = exports.yarnIsAvailable = exports.checkNodeVersion = exports.scaffoldAlreadyExists = exports.isSafeToCreateProjectIn = void 0;
|
|
30
|
+
const child_process_1 = require("child_process");
|
|
31
|
+
const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
|
32
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
33
|
+
const path_1 = __importDefault(require("path"));
|
|
34
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
35
|
+
const semver_1 = __importDefault(require("semver"));
|
|
36
|
+
const constants_1 = require("./constants");
|
|
37
|
+
/**
|
|
38
|
+
* If project only contains files generated by GH, it’s safe.
|
|
39
|
+
* Also, if project contains remnant error logs from a previous
|
|
40
|
+
* installation, lets remove them now.
|
|
41
|
+
* We also special case IJ-based products .idea because it integrates with CRA:
|
|
42
|
+
* https://github.com/facebook/create-react-app/pull/368#issuecomment-243446094
|
|
43
|
+
*/
|
|
44
|
+
function isSafeToCreateProjectIn(root, name) {
|
|
45
|
+
// These files should be allowed to remain on a failed install,
|
|
46
|
+
// but then silently removed during the next create.
|
|
47
|
+
const errorLogFilePatterns = [
|
|
48
|
+
"npm-debug.log",
|
|
49
|
+
"yarn-error.log",
|
|
50
|
+
"yarn-debug.log",
|
|
51
|
+
];
|
|
52
|
+
const validFiles = [
|
|
53
|
+
".DS_Store",
|
|
54
|
+
"Thumbs.db",
|
|
55
|
+
".git",
|
|
56
|
+
".gitignore",
|
|
57
|
+
".idea",
|
|
58
|
+
"README.md",
|
|
59
|
+
"LICENSE",
|
|
60
|
+
".hg",
|
|
61
|
+
".hgignore",
|
|
62
|
+
".hgcheck",
|
|
63
|
+
".npmignore",
|
|
64
|
+
"mkdocs.yml",
|
|
65
|
+
"docs",
|
|
66
|
+
".travis.yml",
|
|
67
|
+
".gitlab-ci.yml",
|
|
68
|
+
".gitattributes",
|
|
69
|
+
"migration.ts",
|
|
70
|
+
"node_modules",
|
|
71
|
+
"package.json",
|
|
72
|
+
"package-lock.json",
|
|
73
|
+
"src",
|
|
74
|
+
"static",
|
|
75
|
+
"tsconfig.json",
|
|
76
|
+
"yarn.lock",
|
|
77
|
+
];
|
|
78
|
+
console.log();
|
|
79
|
+
const conflicts = fs_extra_1.default
|
|
80
|
+
.readdirSync(root)
|
|
81
|
+
.filter((file) => !validFiles.includes(file))
|
|
82
|
+
// IntelliJ IDEA creates module files before CRA is launched
|
|
83
|
+
.filter((file) => !/\.iml$/.test(file))
|
|
84
|
+
// Don't treat log files from previous installation as conflicts
|
|
85
|
+
.filter((file) => !errorLogFilePatterns.some((pattern) => file.indexOf(pattern) === 0));
|
|
86
|
+
if (conflicts.length > 0) {
|
|
87
|
+
console.log(`The directory ${picocolors_1.default.green(name)} contains files that could conflict:`);
|
|
88
|
+
console.log();
|
|
89
|
+
for (const file of conflicts) {
|
|
90
|
+
console.log(` ${file}`);
|
|
91
|
+
}
|
|
92
|
+
console.log();
|
|
93
|
+
console.log("Either try using a new directory name, or remove the files listed above.");
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
// Remove any remnant files from a previous installation
|
|
97
|
+
const currentFiles = fs_extra_1.default.readdirSync(path_1.default.join(root));
|
|
98
|
+
currentFiles.forEach((file) => {
|
|
99
|
+
errorLogFilePatterns.forEach((errorLogFilePattern) => {
|
|
100
|
+
// This will catch `(npm-debug|yarn-error|yarn-debug).log*` files
|
|
101
|
+
if (file.indexOf(errorLogFilePattern) === 0) {
|
|
102
|
+
fs_extra_1.default.removeSync(path_1.default.join(root, file));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
exports.isSafeToCreateProjectIn = isSafeToCreateProjectIn;
|
|
109
|
+
function scaffoldAlreadyExists(root, name) {
|
|
110
|
+
const scaffoldFiles = [
|
|
111
|
+
"migration.ts",
|
|
112
|
+
"package.json",
|
|
113
|
+
"tsconfig.json",
|
|
114
|
+
"README.md",
|
|
115
|
+
];
|
|
116
|
+
const files = fs_extra_1.default.readdirSync(root);
|
|
117
|
+
return scaffoldFiles.every((scaffoldFile) => files.includes(scaffoldFile));
|
|
118
|
+
}
|
|
119
|
+
exports.scaffoldAlreadyExists = scaffoldAlreadyExists;
|
|
120
|
+
function checkNodeVersion(requiredVersion) {
|
|
121
|
+
if (!semver_1.default.satisfies(process.version, requiredVersion)) {
|
|
122
|
+
console.error(picocolors_1.default.red("You are running Node %s.\n" +
|
|
123
|
+
"Deenruv requires Node %s or higher. \n" +
|
|
124
|
+
"Please update your version of Node."), process.version, requiredVersion);
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.checkNodeVersion = checkNodeVersion;
|
|
129
|
+
function yarnIsAvailable() {
|
|
130
|
+
try {
|
|
131
|
+
const yarnVersion = (0, child_process_1.execSync)("yarnpkg --version");
|
|
132
|
+
if (semver_1.default.major(yarnVersion.toString()) > 1) {
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (e) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
exports.yarnIsAvailable = yarnIsAvailable;
|
|
144
|
+
// Bun support should not be exposed yet, see
|
|
145
|
+
// https://github.com/oven-sh/bun/issues/4947
|
|
146
|
+
// https://github.com/lovell/sharp/issues/3511
|
|
147
|
+
function bunIsAvailable() {
|
|
148
|
+
try {
|
|
149
|
+
(0, child_process_1.execSync)("bun --version", { stdio: "ignore" });
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
catch (e) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.bunIsAvailable = bunIsAvailable;
|
|
157
|
+
function checkThatNpmCanReadCwd() {
|
|
158
|
+
const cwd = process.cwd();
|
|
159
|
+
let childOutput = null;
|
|
160
|
+
try {
|
|
161
|
+
// Note: intentionally using spawn over exec since
|
|
162
|
+
// the problem doesn't reproduce otherwise.
|
|
163
|
+
// `npm config list` is the only reliable way I could find
|
|
164
|
+
// to reproduce the wrong path. Just printing process.cwd()
|
|
165
|
+
// in a Node process was not enough.
|
|
166
|
+
childOutput = cross_spawn_1.default.sync("npm", ["config", "list"]).output.join("");
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
// Something went wrong spawning node.
|
|
170
|
+
// Not great, but it means we can't do this check.
|
|
171
|
+
// We might fail later on, but let's continue.
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
if (typeof childOutput !== "string") {
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
const lines = childOutput.split("\n");
|
|
178
|
+
// `npm config list` output includes the following line:
|
|
179
|
+
// "; cwd = C:\path\to\current\dir" (unquoted)
|
|
180
|
+
// I couldn't find an easier way to get it.
|
|
181
|
+
const prefix = "; cwd = ";
|
|
182
|
+
const line = lines.find((l) => l.indexOf(prefix) === 0);
|
|
183
|
+
if (typeof line !== "string") {
|
|
184
|
+
// Fail gracefully. They could remove it.
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
const npmCWD = line.substring(prefix.length);
|
|
188
|
+
if (npmCWD === cwd) {
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
console.error(picocolors_1.default.red("Could not start an npm process in the right directory.\n\n" +
|
|
192
|
+
`The current directory is: ${picocolors_1.default.bold(cwd)}\n` +
|
|
193
|
+
`However, a newly started npm process runs in: ${picocolors_1.default.bold(npmCWD)}\n\n` +
|
|
194
|
+
"This is probably caused by a misconfigured system terminal shell."));
|
|
195
|
+
if (process.platform === "win32") {
|
|
196
|
+
console.error(picocolors_1.default.red("On Windows, this can usually be fixed by running:\n\n") +
|
|
197
|
+
` ${picocolors_1.default.cyan("reg")} delete "HKCU\\Software\\Microsoft\\Command Processor" /v AutoRun /f\n` +
|
|
198
|
+
` ${picocolors_1.default.cyan("reg")} delete "HKLM\\Software\\Microsoft\\Command Processor" /v AutoRun /f\n\n` +
|
|
199
|
+
picocolors_1.default.red("Try to run the above two lines in the terminal.\n") +
|
|
200
|
+
picocolors_1.default.red("To learn more about this problem, read: https://blogs.msdn.microsoft.com/oldnewthing/20071121-00/?p=24433/"));
|
|
201
|
+
}
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
exports.checkThatNpmCanReadCwd = checkThatNpmCanReadCwd;
|
|
205
|
+
/**
|
|
206
|
+
* Install packages via npm or yarn.
|
|
207
|
+
* Based on the install function from https://github.com/facebook/create-react-app
|
|
208
|
+
*/
|
|
209
|
+
function installPackages(root, useYarn, dependencies, isDev, logLevel, isCi = false) {
|
|
210
|
+
return new Promise((resolve, reject) => {
|
|
211
|
+
let command;
|
|
212
|
+
let args;
|
|
213
|
+
if (useYarn) {
|
|
214
|
+
command = "yarnpkg";
|
|
215
|
+
args = ["add", "--exact", "--ignore-engines"];
|
|
216
|
+
if (isDev) {
|
|
217
|
+
args.push("--dev");
|
|
218
|
+
}
|
|
219
|
+
if (isCi) {
|
|
220
|
+
// In CI, publish to Verdaccio
|
|
221
|
+
// See https://github.com/yarnpkg/yarn/issues/6029
|
|
222
|
+
args.push("--registry http://localhost:4873/");
|
|
223
|
+
// Increase network timeout
|
|
224
|
+
// See https://github.com/yarnpkg/yarn/issues/4890#issuecomment-358179301
|
|
225
|
+
args.push("--network-timeout 300000");
|
|
226
|
+
}
|
|
227
|
+
args = args.concat(dependencies);
|
|
228
|
+
// Explicitly set cwd() to work around issues like
|
|
229
|
+
// https://github.com/facebook/create-react-app/issues/3326.
|
|
230
|
+
// Unfortunately we can only do this for Yarn because npm support for
|
|
231
|
+
// equivalent --prefix flag doesn't help with this issue.
|
|
232
|
+
// This is why for npm, we run checkThatNpmCanReadCwd() early instead.
|
|
233
|
+
args.push("--cwd");
|
|
234
|
+
args.push(root);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
command = "npm";
|
|
238
|
+
args = [
|
|
239
|
+
"install",
|
|
240
|
+
"--save",
|
|
241
|
+
"--save-exact",
|
|
242
|
+
"--loglevel",
|
|
243
|
+
"error",
|
|
244
|
+
].concat(dependencies);
|
|
245
|
+
if (isDev) {
|
|
246
|
+
args.push("--save-dev");
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (logLevel === "verbose") {
|
|
250
|
+
args.push("--verbose");
|
|
251
|
+
}
|
|
252
|
+
const child = (0, cross_spawn_1.default)(command, args, {
|
|
253
|
+
stdio: logLevel === "silent" ? "ignore" : "inherit",
|
|
254
|
+
});
|
|
255
|
+
child.on("close", (code) => {
|
|
256
|
+
if (code !== 0) {
|
|
257
|
+
let message = "An error occurred when installing dependencies.";
|
|
258
|
+
if (logLevel === "silent") {
|
|
259
|
+
message +=
|
|
260
|
+
" Try running with `--log-level info` or `--log-level verbose` to diagnose.";
|
|
261
|
+
}
|
|
262
|
+
reject({
|
|
263
|
+
message,
|
|
264
|
+
command: `${command} ${args.join(" ")}`,
|
|
265
|
+
});
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
resolve();
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
exports.installPackages = installPackages;
|
|
273
|
+
function getDependencies(dbType, deenruvPkgVersion = "") {
|
|
274
|
+
const dependencies = [
|
|
275
|
+
`@deenruv/core${deenruvPkgVersion}`,
|
|
276
|
+
`@deenruv/email-plugin${deenruvPkgVersion}`,
|
|
277
|
+
`@deenruv/asset-server-plugin${deenruvPkgVersion}`,
|
|
278
|
+
`@deenruv/admin-ui-plugin${deenruvPkgVersion}`,
|
|
279
|
+
"dotenv",
|
|
280
|
+
dbDriverPackage(dbType),
|
|
281
|
+
];
|
|
282
|
+
const devDependencies = [
|
|
283
|
+
`@deenruv/cli${deenruvPkgVersion}`,
|
|
284
|
+
"concurrently",
|
|
285
|
+
`typescript@${constants_1.TYPESCRIPT_VERSION}`,
|
|
286
|
+
];
|
|
287
|
+
return { dependencies, devDependencies };
|
|
288
|
+
}
|
|
289
|
+
exports.getDependencies = getDependencies;
|
|
290
|
+
/**
|
|
291
|
+
* Returns the name of the npm driver package for the
|
|
292
|
+
* selected database.
|
|
293
|
+
*/
|
|
294
|
+
function dbDriverPackage(dbType) {
|
|
295
|
+
switch (dbType) {
|
|
296
|
+
case "mysql":
|
|
297
|
+
case "mariadb":
|
|
298
|
+
return "mysql";
|
|
299
|
+
case "postgres":
|
|
300
|
+
return "pg";
|
|
301
|
+
case "sqlite":
|
|
302
|
+
return "better-sqlite3";
|
|
303
|
+
case "sqljs":
|
|
304
|
+
return "sql.js";
|
|
305
|
+
case "mssql":
|
|
306
|
+
return "mssql";
|
|
307
|
+
case "oracle":
|
|
308
|
+
return "oracledb";
|
|
309
|
+
default:
|
|
310
|
+
const n = dbType;
|
|
311
|
+
console.error(picocolors_1.default.red(`No driver package configured for type "${dbType}"`));
|
|
312
|
+
return "";
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Checks that the specified DB connection options are working (i.e. a connection can be
|
|
317
|
+
* established) and that the named database exists.
|
|
318
|
+
*/
|
|
319
|
+
function checkDbConnection(options, root) {
|
|
320
|
+
switch (options.type) {
|
|
321
|
+
case "mysql":
|
|
322
|
+
return checkMysqlDbExists(options, root);
|
|
323
|
+
case "postgres":
|
|
324
|
+
return checkPostgresDbExists(options, root);
|
|
325
|
+
default:
|
|
326
|
+
return Promise.resolve(true);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
exports.checkDbConnection = checkDbConnection;
|
|
330
|
+
async function checkMysqlDbExists(options, root) {
|
|
331
|
+
const mysql = await Promise.resolve(`${path_1.default.join(root, "node_modules/mysql")}`).then(s => __importStar(require(s)));
|
|
332
|
+
const connectionOptions = {
|
|
333
|
+
host: options.host,
|
|
334
|
+
user: options.username,
|
|
335
|
+
password: options.password,
|
|
336
|
+
port: options.port,
|
|
337
|
+
database: options.database,
|
|
338
|
+
};
|
|
339
|
+
const connection = mysql.createConnection(connectionOptions);
|
|
340
|
+
return new Promise((resolve, reject) => {
|
|
341
|
+
connection.connect((err) => {
|
|
342
|
+
if (err) {
|
|
343
|
+
if (err.code === "ER_BAD_DB_ERROR") {
|
|
344
|
+
throwDatabaseDoesNotExist(options.database);
|
|
345
|
+
}
|
|
346
|
+
throwConnectionError(err);
|
|
347
|
+
}
|
|
348
|
+
resolve(true);
|
|
349
|
+
});
|
|
350
|
+
}).then(() => {
|
|
351
|
+
return new Promise((resolve, reject) => {
|
|
352
|
+
connection.end((err) => {
|
|
353
|
+
resolve(true);
|
|
354
|
+
});
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
async function checkPostgresDbExists(options, root) {
|
|
359
|
+
const { Client } = await Promise.resolve(`${path_1.default.join(root, "node_modules/pg")}`).then(s => __importStar(require(s)));
|
|
360
|
+
const connectionOptions = {
|
|
361
|
+
host: options.host,
|
|
362
|
+
user: options.username,
|
|
363
|
+
password: options.password,
|
|
364
|
+
port: options.port,
|
|
365
|
+
database: options.database,
|
|
366
|
+
schema: options.schema,
|
|
367
|
+
ssl: options.ssl,
|
|
368
|
+
};
|
|
369
|
+
const client = new Client(connectionOptions);
|
|
370
|
+
try {
|
|
371
|
+
await client.connect();
|
|
372
|
+
const schema = await client.query(`SELECT schema_name FROM information_schema.schemata WHERE schema_name = '${options.schema}'`);
|
|
373
|
+
if (schema.rows.length === 0) {
|
|
374
|
+
throw new Error("NO_SCHEMA");
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
catch (e) {
|
|
378
|
+
if (e.code === "3D000") {
|
|
379
|
+
throwDatabaseDoesNotExist(options.database);
|
|
380
|
+
}
|
|
381
|
+
else if (e.message === "NO_SCHEMA") {
|
|
382
|
+
throwDatabaseSchemaDoesNotExist(options.database, options.schema);
|
|
383
|
+
}
|
|
384
|
+
else if (e.code === "28000") {
|
|
385
|
+
throwSSLConnectionError(e, options.ssl);
|
|
386
|
+
}
|
|
387
|
+
throwConnectionError(e);
|
|
388
|
+
await client.end();
|
|
389
|
+
throw e;
|
|
390
|
+
}
|
|
391
|
+
await client.end();
|
|
392
|
+
return true;
|
|
393
|
+
}
|
|
394
|
+
function throwConnectionError(err) {
|
|
395
|
+
throw new Error("Could not connect to the database. " +
|
|
396
|
+
`Please check the connection settings in your Deenruv config.\n[${(err.message || err.toString())}]`);
|
|
397
|
+
}
|
|
398
|
+
function throwSSLConnectionError(err, sslEnabled) {
|
|
399
|
+
throw new Error("Could not connect to the database. " +
|
|
400
|
+
(sslEnabled === undefined
|
|
401
|
+
? "Is your server requiring an SSL connection?"
|
|
402
|
+
: "Are you sure your server supports SSL?") +
|
|
403
|
+
`Please check the connection settings in your Deenruv config.\n[${(err.message || err.toString())}]`);
|
|
404
|
+
}
|
|
405
|
+
function throwDatabaseDoesNotExist(name) {
|
|
406
|
+
throw new Error(`Database "${name}" does not exist. Please create the database and then try again.`);
|
|
407
|
+
}
|
|
408
|
+
function throwDatabaseSchemaDoesNotExist(dbName, schemaName) {
|
|
409
|
+
throw new Error(`Schema "${dbName}.${schemaName}" does not exist. Please create the schema "${schemaName}" and then try again.`);
|
|
410
|
+
}
|
|
411
|
+
function isServerPortInUse() {
|
|
412
|
+
const tcpPortUsed = require("tcp-port-used");
|
|
413
|
+
try {
|
|
414
|
+
return tcpPortUsed.check(constants_1.SERVER_PORT);
|
|
415
|
+
}
|
|
416
|
+
catch (e) {
|
|
417
|
+
console.log(picocolors_1.default.yellow(`Warning: could not determine whether port ${constants_1.SERVER_PORT} is available`));
|
|
418
|
+
return Promise.resolve(false);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
exports.isServerPortInUse = isServerPortInUse;
|
|
422
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAyC;AACzC,8DAAgC;AAChC,wDAA0B;AAC1B,gDAAwB;AACxB,4DAA4B;AAC5B,oDAA4B;AAE5B,2CAA8D;AAG9D;;;;;;GAMG;AACH,SAAgB,uBAAuB,CAAC,IAAY,EAAE,IAAY;IAChE,+DAA+D;IAC/D,oDAAoD;IACpD,MAAM,oBAAoB,GAAG;QAC3B,eAAe;QACf,gBAAgB;QAChB,gBAAgB;KACjB,CAAC;IACF,MAAM,UAAU,GAAG;QACjB,WAAW;QACX,WAAW;QACX,MAAM;QACN,YAAY;QACZ,OAAO;QACP,WAAW;QACX,SAAS;QACT,KAAK;QACL,WAAW;QACX,UAAU;QACV,YAAY;QACZ,YAAY;QACZ,MAAM;QACN,aAAa;QACb,gBAAgB;QAChB,gBAAgB;QAChB,cAAc;QACd,cAAc;QACd,cAAc;QACd,mBAAmB;QACnB,KAAK;QACL,QAAQ;QACR,eAAe;QACf,WAAW;KACZ,CAAC;IACF,OAAO,CAAC,GAAG,EAAE,CAAC;IAEd,MAAM,SAAS,GAAG,kBAAE;SACjB,WAAW,CAAC,IAAI,CAAC;SACjB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC7C,4DAA4D;SAC3D,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAA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1
|
+
export type DbType = "mysql" | "mariadb" | "postgres" | "sqlite" | "sqljs" | "mssql" | "oracle";
|
|
2
|
+
export interface FileSources {
|
|
3
|
+
indexSource: string;
|
|
4
|
+
indexWorkerSource: string;
|
|
5
|
+
configSource: string;
|
|
6
|
+
envSource: string;
|
|
7
|
+
envDtsSource: string;
|
|
8
|
+
readmeSource: string;
|
|
9
|
+
dockerfileSource: string;
|
|
10
|
+
dockerComposeSource: string;
|
|
11
|
+
}
|
|
12
|
+
export interface UserResponses extends FileSources {
|
|
13
|
+
dbType: DbType;
|
|
14
|
+
populateProducts: boolean;
|
|
15
|
+
superadminIdentifier: string;
|
|
16
|
+
superadminPassword: string;
|
|
17
|
+
}
|
|
18
|
+
export type PackageManager = "npm" | "yarn";
|
|
19
|
+
export type CliLogLevel = "silent" | "info" | "verbose";
|
package/lib/types.js
ADDED
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deenruv/create",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"bin": {
|
|
6
|
+
"create": "./index.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"index.js",
|
|
10
|
+
"lib/**/*",
|
|
11
|
+
"assets/**/*"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://deenruv.com/",
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/cross-spawn": "^6.0.6",
|
|
19
|
+
"@types/detect-port": "^1.3.5",
|
|
20
|
+
"@types/fs-extra": "^11.0.4",
|
|
21
|
+
"@types/handlebars": "^4.1.0",
|
|
22
|
+
"@types/semver": "^7.5.8",
|
|
23
|
+
"rimraf": "^5.0.5",
|
|
24
|
+
"ts-node": "^10.9.2",
|
|
25
|
+
"typescript": "5.3.3",
|
|
26
|
+
"@deenruv/core": "^1.0.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@clack/prompts": "^0.7.0",
|
|
30
|
+
"commander": "^11.0.0",
|
|
31
|
+
"cross-spawn": "^7.0.3",
|
|
32
|
+
"detect-port": "^1.5.1",
|
|
33
|
+
"fs-extra": "^11.2.0",
|
|
34
|
+
"handlebars": "^4.7.8",
|
|
35
|
+
"picocolors": "^1.0.0",
|
|
36
|
+
"semver": "^7.5.4",
|
|
37
|
+
"tcp-port-used": "^1.0.2",
|
|
38
|
+
"@deenruv/common": "^1.0.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@deenruv/core": "^0.1.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"dev": "ts-node src/create-deenruv-app.ts",
|
|
45
|
+
"copy-assets": "rimraf assets && ts-node ./build.ts",
|
|
46
|
+
"build": "npm run copy-assets && rimraf lib && tsc -p ./tsconfig.build.json",
|
|
47
|
+
"watch": "npm run copy-assets && rimraf lib && tsc -p ./tsconfig.build.json -w",
|
|
48
|
+
"lint": "eslint .",
|
|
49
|
+
"lint:fix": "eslint --fix ."
|
|
50
|
+
}
|
|
51
|
+
}
|