create-directus-docker 1.4.4 → 1.5.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/package.json +8 -4
- package/src/cli.js +40 -32
- package/templates/default/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-directus-docker",
|
|
3
3
|
"description": "An installer for Dockerized Directus + MySQL + Adminer + GraphiQL with a helper Node app",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Dave Kobrenski",
|
|
8
8
|
"email": "dave@rlmg.com"
|
|
9
9
|
},
|
|
10
|
-
"bin":
|
|
10
|
+
"bin": {
|
|
11
|
+
"create-directus-docker": "src/cli.js",
|
|
12
|
+
"cdd": "src/cli.js"
|
|
13
|
+
},
|
|
11
14
|
"keywords": [
|
|
12
15
|
"directus",
|
|
13
16
|
"docker",
|
|
@@ -32,10 +35,11 @@
|
|
|
32
35
|
],
|
|
33
36
|
"dependencies": {
|
|
34
37
|
"chalk": "^5.2.0",
|
|
35
|
-
"create-create-app": "7.1.0",
|
|
36
38
|
"execa": "^6.1.0",
|
|
39
|
+
"fs-extra": "^11.1.0",
|
|
37
40
|
"log-update": "^5.0.1",
|
|
38
|
-
"upath": "^2.0.1"
|
|
41
|
+
"upath": "^2.0.1",
|
|
42
|
+
"yargs": "^17.6.2"
|
|
39
43
|
},
|
|
40
44
|
"license": "MIT",
|
|
41
45
|
"devDependencies": {
|
package/src/cli.js
CHANGED
|
@@ -3,40 +3,26 @@
|
|
|
3
3
|
import upath from 'upath';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import path from 'path';
|
|
6
|
-
import {fileURLToPath} from 'url';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
import logUpdate from 'log-update';
|
|
8
|
+
import fs from 'fs-extra';
|
|
9
|
+
import yargs from 'yargs';
|
|
10
|
+
import { hideBin } from 'yargs/helpers';
|
|
11
11
|
|
|
12
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
13
13
|
const __dirname = path.dirname(__filename);
|
|
14
|
+
const templateDir = upath.resolve(__dirname, '../templates/default');
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// const install = spawn('npm', ['install']);
|
|
26
|
-
|
|
27
|
-
// install.stdout.on('data', (data) => {
|
|
28
|
-
// logUpdate(`${data}`);
|
|
29
|
-
// });
|
|
30
|
-
|
|
31
|
-
// install.on('close', (code) => {
|
|
32
|
-
// logUpdate.done();
|
|
33
|
-
// execa('npm', ['start']).stdout.pipe(process.stdout);
|
|
34
|
-
// });
|
|
35
|
-
// });
|
|
36
|
-
// },
|
|
37
|
-
|
|
38
|
-
caveat: ({ packageDir }) => {
|
|
39
|
-
return `
|
|
16
|
+
const rootPath = path.resolve();
|
|
17
|
+
|
|
18
|
+
const argv = yargs(hideBin(process.argv)).argv;
|
|
19
|
+
const args = argv._;
|
|
20
|
+
|
|
21
|
+
//check enough args
|
|
22
|
+
if (args.length > 0) {
|
|
23
|
+
const packageDir = args[0];
|
|
24
|
+
|
|
25
|
+
const successMsg = `
|
|
40
26
|
${chalk.bold.yellowBright("Directus with MySQL, Adminer, and GraphiQL:")}
|
|
41
27
|
|
|
42
28
|
To configure and run your Directus services, first ${chalk.bold("make sure you have Docker installed and running")}, then run:
|
|
@@ -49,6 +35,28 @@ For more information, see:
|
|
|
49
35
|
https://github.com/davekobrenski/create-directus-docker
|
|
50
36
|
|
|
51
37
|
Enjoy!
|
|
52
|
-
|
|
38
|
+
`;
|
|
39
|
+
console.log("");
|
|
40
|
+
logUpdate(`Creating directory: ${packageDir}...`);
|
|
41
|
+
const dirFullPath = path.join(rootPath, packageDir);
|
|
42
|
+
|
|
43
|
+
//make the dir for the project
|
|
44
|
+
if (fs.existsSync(dirFullPath) === false) {
|
|
45
|
+
fs.mkdir(path.join(rootPath, packageDir)).then(() => {
|
|
46
|
+
//success
|
|
47
|
+
logUpdate(chalk.greenBright(`Directory '${packageDir}' created successfully.`));
|
|
48
|
+
logUpdate.done();
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
fs.copySync(templateDir, dirFullPath);
|
|
52
|
+
logUpdate(successMsg);
|
|
53
|
+
} catch (err) {
|
|
54
|
+
console.error(err);
|
|
55
|
+
}
|
|
56
|
+
}).catch(err => console.error(err));
|
|
57
|
+
} else {
|
|
58
|
+
console.error(chalk.redBright(`Error: Specified directory '${packageDir}' already exists.`));
|
|
53
59
|
}
|
|
54
|
-
}
|
|
60
|
+
} else {
|
|
61
|
+
console.error(chalk.redBright(`Error: please specify a project directory.`));
|
|
62
|
+
}
|