create-directus-docker 1.3.5 → 1.4.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 CHANGED
@@ -1,7 +1,7 @@
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.3.5",
4
+ "version": "1.4.0",
5
5
  "type": "module",
6
6
  "author": {
7
7
  "name": "Dave Kobrenski",
@@ -37,6 +37,10 @@ As an alternative, you can install this package by following these steps. Once y
37
37
 
38
38
  *Note that you'll only have to do these two steps the first time you run this.*
39
39
 
40
+ ### Seeding MySQL data
41
+
42
+ If you want to seed your database with data on first launch, place your .sql file(s) in the "init" directory at the root of this package. MySQL will run any files in this directory the first time it launches.
43
+
40
44
  ### Starting/stopping with Docker Compose
41
45
 
42
46
  To **stop** your running containers, simply run `docker compose down` in your terminal from within the project directory. All containers will be stopped.
@@ -18,6 +18,7 @@ services:
18
18
  - 3306:3306
19
19
  volumes:
20
20
  - ./mysql:/var/lib/mysql
21
+ - ./init:/docker-entrypoint-initdb.d
21
22
  command: --default-authentication-plugin=mysql_native_password
22
23
  environment:
23
24
  MYSQL_USER: ${MYSQL_USER}
@@ -56,6 +56,12 @@ try {
56
56
  });
57
57
  }
58
58
 
59
+ if (fs.existsSync(path.join(rootPath, 'init')) === false) {
60
+ fs.mkdir(path.join(rootPath, 'init'), () => {
61
+ //console.log(`'init' directory created. If you want to seed your database on first lanch, place your .sql file(s) in this directory BEFORE running services.`);
62
+ });
63
+ }
64
+
59
65
  inquirer.prompt([
60
66
  {
61
67
  name: 'ADMIN_EMAIL',
@@ -169,7 +175,9 @@ try {
169
175
 
170
176
  writeStream.end();
171
177
 
172
- console.log("\nYou can always edit the variables that we've just set in the .env file manually.\n");
178
+ console.log("\nYou can always edit the variables that we've just set in the .env file manually.\n\n");
179
+ console.log(chalk.redBright("If you want to seed your database on first launch, place your .sql file(s) in the \"init\" directory BEFORE running services."));
180
+ console.log("");
173
181
 
174
182
  inquirer.prompt([
175
183
  {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "directus-mysql-docker",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "A helper app to configure Directus on Docker with MySQL, Adminer, and GraphQL",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",