nuxi-docker 0.0.1 → 0.0.3

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.
Files changed (3) hide show
  1. package/README.md +16 -2
  2. package/bin/index.mjs +74 -13
  3. package/package.json +5 -1
package/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  Nuxi-Docker is a preconfigured Docker environment tailored to streamline interaction with Nuxt.js projects using the Nuxi CLI.
4
4
 
5
- ## Creating a New Project
5
+ ## Installation
6
+
7
+ ### Creating a New Project
6
8
 
7
9
  To create a new Nuxt.js project and set it up within the Nuxi-Docker environment:
8
10
 
@@ -12,6 +14,18 @@ npx nuxi-docker init <PROJECT>
12
14
 
13
15
  This command automates project creation by executing `nuxi init <PROJECT>` and copying the necessary Docker configurations for the new project.
14
16
 
17
+ ### Installing Nuxi-Docker in an Existing Nuxt Project
18
+
19
+ If you already have an existing Nuxt.js project and want to integrate it with the Nuxi-Docker environment, you can use the `install` command:
20
+
21
+ ```bash
22
+ npx nuxi-docker install
23
+ ```
24
+
25
+ This command sets up the necessary configurations and Docker environment within your current Nuxt project.
26
+
27
+ ## Usage
28
+
15
29
  ### Commands Proxied to Nuxi
16
30
 
17
31
  The following commands are proxied directly to Nuxi in the app container:
@@ -44,7 +58,7 @@ To avoid collision with Docker Compose's `build`, use `nuxi-build` to run Nuxi's
44
58
  npx nuxi-docker nuxi-build [args]
45
59
  ```
46
60
 
47
- ### Binaries Proxied to App Container
61
+ ### Commands proxied to binaries in the app container
48
62
 
49
63
  The commands `nuxi`, `nuxt`, `node`, `npm`, `npx`, `yarn`, `pnpm`, `pnpx`, `bun`, and `bunx` are proxied to the binaries in the app container. Use them by running:
50
64
 
package/bin/index.mjs CHANGED
@@ -7,37 +7,56 @@ import { fileURLToPath } from "url";
7
7
  import * as path from "path";
8
8
 
9
9
  function help() {
10
- console.log("nuxi-docker - a preconfigured docker environment to interact with nuxt projects with the nuxi cli");
10
+ console.log("");
11
+ console.log("nuxi-docker - a preconfigured docker environment to interact with Nuxt projects using the Nuxi CLI");
11
12
  console.log("");
12
13
  console.log("QUICK START");
13
- console.log("to bring the containers up:");
14
+ console.log("Start a new project:");
15
+ console.log(" npx nuxi-docker init <PROJECT>");
16
+ console.log("Or install in an existing project:");
17
+ console.log(" npx nuxi-docker install");
18
+ console.log("Bring up the containers:");
14
19
  console.log(" npx nuxi-docker up -d");
15
20
  console.log("");
16
- console.log("to start the dev site:");
21
+ console.log("Start the development site:");
17
22
  console.log(" npx nuxi-docker dev");
18
23
  console.log("");
19
- console.log("add, analyze, build-module, cleanup, dev, devtools, generate, info, init, prepare, preview, typecheck, and upgrade are proxied straight to nuxi in the app container:");
24
+ console.log("INITIALISATION");
25
+ console.log("To create a new Nuxt.js project and set it up within the Nuxi-Docker environment:");
26
+ console.log(" npx nuxi-docker init <PROJECT>");
27
+ console.log("");
28
+ console.log("INSTALLATION");
29
+ console.log("To integrate Nuxi-Docker into an existing Nuxt.js project:");
30
+ console.log(" npx nuxi-docker install");
31
+ console.log("");
32
+ console.log("COMMANDS PROXIED TO NUXI");
33
+ console.log("The following commands are proxied directly to Nuxi in the app container:");
34
+ console.log(" add, analyze, build-module, cleanup, dev, devtools, generate, info, init, prepare, preview, typecheck, and upgrade");
35
+ console.log("Usage:");
20
36
  console.log(" npx nuxi-docker <COMMAND> [args]");
21
37
  console.log("");
22
- console.log("nuxi-build (to avoid collision with docker-compose build) runs nuxi build in the app container:");
38
+ console.log("NUXI BUILD");
39
+ console.log("To run Nuxi's build command in the app container (useful to avoid collision with docker-compose build):");
23
40
  console.log(" npx nuxi-docker nuxi-build [args]");
24
41
  console.log("");
25
- console.log("nuxi, nuxt, node, npm, npx, yarn, pnpm, pnpx, bun, bunx are proxied to the binaries in the app container:");
42
+ console.log("COMMANDS PROXIED TO BINARIES IN THE APP CONTAINER");
43
+ console.log("The commands 'nuxi', 'nuxt', 'node', 'npm', 'npx', 'yarn', 'pnpm', 'pnpx', 'bun', and 'bunx' are proxied to the binaries in the app container.");
44
+ console.log("Usage:");
26
45
  console.log(" npx nuxi-docker <COMMAND> [args]");
27
46
  console.log("");
28
- console.log("shell/bash initiates a terminal in the app container:");
47
+ console.log("SHELL ACCESS");
48
+ console.log("Initiate a terminal in the app container:");
29
49
  console.log(" npx nuxi-docker shell");
30
50
  console.log("");
31
- console.log("postgres proxies commands to the postgres container:");
51
+ console.log("POSTGRES OPERATIONS");
52
+ console.log("Commands prefixed with 'postgres' are forwarded to the Postgres container:");
32
53
  console.log(" npx nuxi-docker postgres [args]");
33
- console.log("");
34
- console.log("postgres shell/bash initiates a terminal in the postgres container:");
35
54
  console.log(" npx nuxi-docker postgres shell");
36
- console.log("");
37
- console.log("psql opens a postgres cli terminal in the postgres container:");
38
55
  console.log(" npx nuxi-docker psql");
39
56
  console.log("");
40
- console.log("anything else is proxied to docker-compose");
57
+ console.log("DOCKER COMPOSE PROXY");
58
+ console.log("Any other command is proxied to Docker Compose.");
59
+ console.log("");
41
60
  process.exit(0);
42
61
  }
43
62
 
@@ -73,8 +92,50 @@ const env_variables = [
73
92
  `DOCKERFILE_DIRECTORY="${DOCKERFILE_DIRECTORY}"`,
74
93
  ];
75
94
 
95
+ // install command
96
+ if (process.argv[2] == "install") {
97
+ const PROJECT_DIRECTORY = process.cwd();
98
+ const COMPOSE_FILENAME = "docker-compose.yml";
99
+ const files_to_copy = [];
100
+ if (existsSync(path.join(PROJECT_DIRECTORY, COMPOSE_FILENAME))) {
101
+ console.log(`${COMPOSE_FILENAME} already exists in this project`);
102
+ process.exit(1);
103
+ }
104
+ files_to_copy.push(COMPOSE_FILENAME);
105
+ if (existsSync(path.join(PROJECT_DIRECTORY, ".env"))) {
106
+ console.log(".env already exists in this project, skipping");
107
+ } else {
108
+ files_to_copy.push(".env");
109
+ }
110
+
111
+ for (const filename of files_to_copy) {
112
+ copyFile(
113
+ path.join(__dirname, "docker", filename),
114
+ path.join(PROJECT_DIRECTORY, filename),
115
+ (err) => {
116
+ if (err) throw err;
117
+ }
118
+ );
119
+ }
120
+
121
+ console.log("--------------------------------------");
122
+ console.log("");
123
+ console.log("install complete!");
124
+ console.log("");
125
+ console.log("to bring the containers up:");
126
+ console.log(" npx nuxi-docker up -d");
127
+ console.log("");
128
+ console.log("to start the dev site:");
129
+ console.log(" npx nuxi-docker dev");
130
+ console.log("");
131
+ console.log("--------------------------------------");
132
+
133
+ process.exit(0);
134
+ }
135
+
76
136
  // init command
77
137
  if (process.argv[2] === "init") {
138
+ console.log("")
78
139
  console.log("welcome to nuxi-docker")
79
140
  console.log("")
80
141
  console.log("building the init container then passing you to nuxi init")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxi-docker",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "A preconfigured docker environment and cli tool for managing Nuxt.js projects",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -10,5 +10,9 @@
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "dotenv": "^16.3.1"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "github:Bibliophage305/nuxi-docker"
13
17
  }
14
18
  }