@vendure/create 3.1.0-next.2 → 3.1.0-next.4
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/README.md +2 -32
- package/assets/Dockerfile.hbs +3 -3
- package/assets/docker-compose.hbs +114 -38
- package/assets/readme.hbs +22 -8
- package/lib/create-vendure-app.js +201 -57
- package/lib/create-vendure-app.js.map +1 -1
- package/lib/gather-user-responses.d.ts +3 -3
- package/lib/gather-user-responses.js +70 -31
- package/lib/gather-user-responses.js.map +1 -1
- package/lib/helpers.d.ts +24 -3
- package/lib/helpers.js +189 -73
- package/lib/helpers.js.map +1 -1
- package/lib/logger.d.ts +6 -0
- package/lib/logger.js +22 -0
- package/lib/logger.js.map +1 -0
- package/lib/types.d.ts +2 -2
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -4,47 +4,17 @@ A CLI tool for rapidly scaffolding a new Vendure server application. Heavily ins
|
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
-
Vendure Create requires [Node.js](https://nodejs.org/en/)
|
|
8
|
-
|
|
9
|
-
To create a new project, you may choose one of the following methods:
|
|
10
|
-
|
|
11
|
-
### npx
|
|
7
|
+
Vendure Create requires [Node.js](https://nodejs.org/en/) v18+ to be installed.
|
|
12
8
|
|
|
13
9
|
```sh
|
|
14
10
|
npx @vendure/create my-app
|
|
15
11
|
```
|
|
16
12
|
|
|
17
|
-
*[npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) comes with npm 5.2+ and higher.*
|
|
18
|
-
|
|
19
|
-
### npm
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
npm init @vendure my-app
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
*`npm init <initializer>` is available in npm 6+*
|
|
26
|
-
|
|
27
|
-
### Yarn
|
|
28
|
-
|
|
29
|
-
```sh
|
|
30
|
-
yarn create @vendure my-app
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
*`yarn create` is available in Yarn 0.25+*
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
It will create a directory called `my-app` inside the current folder.
|
|
37
|
-
|
|
38
13
|
## Options
|
|
39
14
|
|
|
40
|
-
### `--use-npm`
|
|
41
|
-
|
|
42
|
-
By default, Vendure Create will detect whether a compatible version of Yarn is installed, and if so will display a prompt to select the preferred package manager.
|
|
43
|
-
You can override this and force it to use npm with the `--use-npm` flag.
|
|
44
|
-
|
|
45
15
|
### `--log-level`
|
|
46
16
|
|
|
47
|
-
You can control how much output is generated during the installation and setup with this flag. Valid options are `silent`, `info` and `verbose`. The default is `
|
|
17
|
+
You can control how much output is generated during the installation and setup with this flag. Valid options are `silent`, `info` and `verbose`. The default is `info`
|
|
48
18
|
|
|
49
19
|
Example:
|
|
50
20
|
|
package/assets/Dockerfile.hbs
CHANGED
|
@@ -3,7 +3,7 @@ FROM node:20
|
|
|
3
3
|
WORKDIR /usr/src/app
|
|
4
4
|
|
|
5
5
|
COPY package.json ./
|
|
6
|
-
COPY
|
|
7
|
-
RUN
|
|
6
|
+
COPY package-lock.json ./
|
|
7
|
+
RUN npm install --production
|
|
8
8
|
COPY . .
|
|
9
|
-
RUN
|
|
9
|
+
RUN npm run build
|
|
@@ -1,39 +1,115 @@
|
|
|
1
|
-
|
|
1
|
+
# INFORMATION
|
|
2
|
+
# We are not exposing the default ports for the services in this file.
|
|
3
|
+
# This is to avoid conflicts with existing services on your machine.
|
|
4
|
+
# In case you don't have any services running on the default ports, you can expose them by changing the
|
|
5
|
+
# ports section in the services block. Please don't forget to update the ports in the .env file as well.
|
|
6
|
+
|
|
2
7
|
services:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
8
|
+
postgres_db:
|
|
9
|
+
image: postgres:16-alpine
|
|
10
|
+
volumes:
|
|
11
|
+
- postgres_db_data:/var/lib/postgresql/data
|
|
12
|
+
ports:
|
|
13
|
+
- "6543:5432"
|
|
14
|
+
environment:
|
|
15
|
+
POSTGRES_DB: {{{ escapeSingle dbName }}}
|
|
16
|
+
POSTGRES_USER: {{{ escapeSingle dbUserName }}}
|
|
17
|
+
POSTGRES_PASSWORD: {{{ escapeSingle dbPassword }}}
|
|
18
|
+
labels:
|
|
19
|
+
- "io.vendure.create.name={{{ escapeSingle name }}}"
|
|
20
|
+
|
|
21
|
+
mysql_db:
|
|
22
|
+
image: mysql:8
|
|
23
|
+
volumes:
|
|
24
|
+
- mysql_db_data:/var/lib/mysql
|
|
25
|
+
environment:
|
|
26
|
+
MYSQL_ROOT_PASSWORD: 'ROOT'
|
|
27
|
+
MYSQL_DATABASE: {{{ escapeSingle dbName }}}
|
|
28
|
+
MYSQL_USER: {{{ escapeSingle dbUserName }}}
|
|
29
|
+
MYSQL_PASSWORD: {{{ escapeSingle dbPassword }}}
|
|
30
|
+
ports:
|
|
31
|
+
- "4306:3306"
|
|
32
|
+
labels:
|
|
33
|
+
- "io.vendure.create.name={{{ escapeSingle name }}}"
|
|
34
|
+
|
|
35
|
+
mariadb_db:
|
|
36
|
+
image: mariadb:10
|
|
37
|
+
volumes:
|
|
38
|
+
- mariadb_db_data:/var/lib/mysql
|
|
39
|
+
environment:
|
|
40
|
+
MARIADB_ROOT_PASSWORD: 'ROOT'
|
|
41
|
+
MARIADB_DATABASE: {{{ escapeSingle dbName }}}
|
|
42
|
+
MARIADB_USER: {{{ escapeSingle dbUserName }}}
|
|
43
|
+
MARIADB_PASSWORD: {{{ escapeSingle dbPassword }}}
|
|
44
|
+
ports:
|
|
45
|
+
- "3306:3306"
|
|
46
|
+
labels:
|
|
47
|
+
- "io.vendure.create.name={{{ escapeSingle name }}}"
|
|
48
|
+
|
|
49
|
+
# RECOMMENDED (especially for production)
|
|
50
|
+
# Want to use our BullMQ with Redis instead of our default database job queue?
|
|
51
|
+
# Checkout our BullMQ plugin: https://docs.vendure.io/reference/core-plugins/job-queue-plugin/bull-mqjob-queue-plugin/
|
|
52
|
+
redis:
|
|
53
|
+
image: redis:7-alpine
|
|
54
|
+
ports:
|
|
55
|
+
- "6479:6379"
|
|
56
|
+
volumes:
|
|
57
|
+
- redis_data:/data
|
|
58
|
+
labels:
|
|
59
|
+
- "io.vendure.create.name={{{ escapeSingle name }}}"
|
|
60
|
+
|
|
61
|
+
# RECOMMENDED
|
|
62
|
+
# Want to use Typesense instead of our default search engine?
|
|
63
|
+
# Checkout our advanced search plugin: https://vendure.io/hub/vendure-plus-advanced-search-plugin
|
|
64
|
+
# To run the typesense container run "docker compose up -d typesense"
|
|
65
|
+
typesense:
|
|
66
|
+
image: typesense/typesense:27
|
|
67
|
+
command: [ '--data-dir', '/data', '--api-key', 'SuperSecret' ]
|
|
68
|
+
ports:
|
|
69
|
+
- "8208:8108"
|
|
70
|
+
volumes:
|
|
71
|
+
- typesense_data:/data
|
|
72
|
+
labels:
|
|
73
|
+
- "io.vendure.create.name={{{ escapeSingle name }}}"
|
|
74
|
+
|
|
75
|
+
# Want to use Elasticsearch instead of our default database engine?
|
|
76
|
+
# Checkout our Elasticsearch plugin: https://docs.vendure.io/reference/core-plugins/elasticsearch-plugin/
|
|
77
|
+
# To run the elasticsearch container run "docker compose up -d elasticsearch"
|
|
78
|
+
elasticsearch:
|
|
79
|
+
image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
|
|
80
|
+
environment:
|
|
81
|
+
discovery.type: single-node
|
|
82
|
+
bootstrap.memory_lock: true
|
|
83
|
+
ES_JAVA_OPTS: -Xms512m -Xmx512m
|
|
84
|
+
volumes:
|
|
85
|
+
- elasticsearch_data:/usr/share/elasticsearch/data
|
|
86
|
+
ports:
|
|
87
|
+
- "9300:9200"
|
|
88
|
+
labels:
|
|
89
|
+
- "io.vendure.create.name={{{ escapeSingle name }}}"
|
|
90
|
+
|
|
91
|
+
volumes:
|
|
92
|
+
postgres_db_data:
|
|
93
|
+
driver: local
|
|
94
|
+
labels:
|
|
95
|
+
- "io.vendure.create.name={{{ escapeSingle name }}}"
|
|
96
|
+
mysql_db_data:
|
|
97
|
+
driver: local
|
|
98
|
+
labels:
|
|
99
|
+
- "io.vendure.create.name={{{ escapeSingle name }}}"
|
|
100
|
+
mariadb_db_data:
|
|
101
|
+
driver: local
|
|
102
|
+
labels:
|
|
103
|
+
- "io.vendure.create.name={{{ escapeSingle name }}}"
|
|
104
|
+
typesense_data:
|
|
105
|
+
driver: local
|
|
106
|
+
labels:
|
|
107
|
+
- "io.vendure.create.name={{{ escapeSingle name }}}"
|
|
108
|
+
elasticsearch_data:
|
|
109
|
+
driver: local
|
|
110
|
+
labels:
|
|
111
|
+
- "io.vendure.create.name={{{ escapeSingle name }}}"
|
|
112
|
+
redis_data:
|
|
113
|
+
driver: local
|
|
114
|
+
labels:
|
|
115
|
+
- "io.vendure.create.name={{{ escapeSingle name }}}"
|
package/assets/readme.hbs
CHANGED
|
@@ -17,7 +17,7 @@ Useful links:
|
|
|
17
17
|
## Development
|
|
18
18
|
|
|
19
19
|
```
|
|
20
|
-
|
|
20
|
+
npm run dev
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
will start the Vendure server and [worker](https://www.vendure.io/docs/developer-guide/vendure-worker/) processes from
|
|
@@ -26,7 +26,7 @@ the `src` directory.
|
|
|
26
26
|
## Build
|
|
27
27
|
|
|
28
28
|
```
|
|
29
|
-
|
|
29
|
+
npm run build
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
will compile the TypeScript sources into the `/dist` directory.
|
|
@@ -41,7 +41,7 @@ hosting environment.
|
|
|
41
41
|
You can run the built files directly with the `start` script:
|
|
42
42
|
|
|
43
43
|
```
|
|
44
|
-
|
|
44
|
+
npm run start
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
You could also consider using a process manager like [pm2](https://pm2.keymetrics.io/) to run and manage
|
|
@@ -79,10 +79,24 @@ used in development.
|
|
|
79
79
|
- `vendure` - we are referencing the tag we set up during the build.
|
|
80
80
|
- `npm run start:server` - this last part is the actual command that should be run inside the container.
|
|
81
81
|
|
|
82
|
-
### Docker
|
|
82
|
+
### Docker Compose
|
|
83
83
|
|
|
84
|
-
We've included a
|
|
85
|
-
|
|
84
|
+
We've included a [docker-compose.yml](./docker-compose.yml) file which includes configuration for commonly-used
|
|
85
|
+
services such as PostgreSQL, MySQL, MariaDB, Elasticsearch and Redis.
|
|
86
|
+
|
|
87
|
+
To use Docker Compose, you will need to have Docker installed on your machine. Here are installation
|
|
88
|
+
instructions for [Mac](https://docs.docker.com/desktop/install/mac-install/), [Windows](https://docs.docker.com/desktop/install/windows-install/),
|
|
89
|
+
and [Linux](https://docs.docker.com/desktop/install/linux/).
|
|
90
|
+
|
|
91
|
+
You can start the services with:
|
|
92
|
+
|
|
93
|
+
```shell
|
|
94
|
+
docker-compose up <service>
|
|
95
|
+
|
|
96
|
+
# examples:
|
|
97
|
+
docker-compose up postgres_db
|
|
98
|
+
docker-compose up redis
|
|
99
|
+
```
|
|
86
100
|
|
|
87
101
|
## Plugins
|
|
88
102
|
|
|
@@ -92,7 +106,7 @@ These should be located in the `./src/plugins` directory.
|
|
|
92
106
|
To create a new plugin run:
|
|
93
107
|
|
|
94
108
|
```
|
|
95
|
-
|
|
109
|
+
npx vendure add
|
|
96
110
|
```
|
|
97
111
|
|
|
98
112
|
and select `[Plugin] Create a new Vendure plugin`.
|
|
@@ -105,7 +119,7 @@ will be required whenever you make changes to the `customFields` config or defin
|
|
|
105
119
|
To generate a new migration, run:
|
|
106
120
|
|
|
107
121
|
```
|
|
108
|
-
|
|
122
|
+
npx vendure migrate
|
|
109
123
|
```
|
|
110
124
|
|
|
111
125
|
The generated migration file will be found in the `./src/migrations/` directory, and should be committed to source control.
|