@contember/cli-common 1.0.0-alpha.7 → 1.0.0-rc.2

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@contember/cli-common",
3
- "version": "1.0.0-alpha.7",
3
+ "version": "1.0.0-rc.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/src/index.js",
6
6
  "typings": "dist/src/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "@types/npm-package-arg": "^6.1.0"
14
14
  },
15
15
  "dependencies": {
16
- "@contember/config-loader": "^1.0.0-alpha.7",
16
+ "@contember/config-loader": "^1.0.0-rc.2",
17
17
  "chalk": "^4.1.0",
18
18
  "download-tarball": "^2.0.0",
19
19
  "fs-extra": "^10.0.0",
@@ -0,0 +1,3 @@
1
+ VITE_CONTEMBER_ADMIN_API_BASE_URL=http://localhost:1481
2
+ VITE_CONTEMBER_ADMIN_SESSION_TOKEN=0000000000000000000000000000000000000000
3
+ VITE_CONTEMBER_ADMIN_PROJECT_NAME={projectName}
@@ -1,12 +1,12 @@
1
1
  import * as React from 'react'
2
2
  import { ReactNode } from 'react'
3
3
  import { Layout as ContemberLayout } from '@contember/admin'
4
- import { SideMenu } from './SideMenu'
4
+ import { Navigation } from './Navigation'
5
5
 
6
6
  export const Layout = (props: { children?: ReactNode }) => (
7
7
  <ContemberLayout
8
- topStart="{projectName}"
9
- sideBar={<SideMenu />}
8
+ sidebarHeader="{projectName}"
9
+ navigation={<Navigation />}
10
10
  children={props.children}
11
11
  />
12
12
  )
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react'
2
2
  import { Menu } from '@contember/admin'
3
3
 
4
- export const SideMenu = () => (
4
+ export const Navigation = () => (
5
5
  <Menu>
6
6
  <Menu.Item>
7
- <Menu.Item title="Dashboard" to="dashboard" />
7
+ <Menu.Item title="Dashboard" to="index" />
8
8
  </Menu.Item>
9
9
  </Menu>
10
10
  )
@@ -1,9 +1,7 @@
1
1
  import * as React from 'react'
2
2
  import { ApplicationEntrypoint, Pages, runReactApp } from '@contember/admin'
3
- import { Layout } from './components/Layout'
4
3
  import '@contember/admin/style.css'
5
-
6
- const pages = Object.values(import.meta.globEager('./pages/*.tsx')).flatMap(Object.values)
4
+ import { Layout } from './components/Layout'
7
5
 
8
6
  runReactApp(
9
7
  <ApplicationEntrypoint
@@ -12,7 +10,11 @@ runReactApp(
12
10
  sessionToken={import.meta.env.VITE_CONTEMBER_ADMIN_SESSION_TOKEN}
13
11
  project={import.meta.env.VITE_CONTEMBER_ADMIN_PROJECT_NAME}
14
12
  stage="live"
15
- routes={{ dashboard: { path: '/' } }}
16
- children={<Pages layout={Layout} children={pages} />}
13
+ children={
14
+ <Pages
15
+ layout={Layout}
16
+ children={Object.assign({}, ...Object.values(import.meta.globEager('./pages/*.tsx')))}
17
+ />
18
+ }
17
19
  />,
18
20
  )
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react'
2
2
  import { GenericPage } from '@contember/admin'
3
3
 
4
- export const DashboardPage = (
5
- <GenericPage pageName="dashboard">
4
+ export const index = (
5
+ <GenericPage pageName="index">
6
6
  Welcome to Contember Admin!
7
7
  </GenericPage>
8
8
  )
@@ -1,4 +1,5 @@
1
1
  type: project
2
2
  replaceVariables:
3
+ - admin/.env
3
4
  - admin/index.tsx
4
- - admin/index.html
5
+ - admin/components/Layout.tsx
@@ -3,7 +3,7 @@
3
3
  "allowSyntheticDefaultImports": true,
4
4
  "experimentalDecorators": true,
5
5
  "isolatedModules": true,
6
- "jsx": "react-jsx",
6
+ "jsx": "react",
7
7
  "lib": [
8
8
  "esnext",
9
9
  "dom"
@@ -1,3 +1,3 @@
1
- /dist
1
+ /admin/dist
2
2
  /node_modules
3
3
  /docker-compose.override.yaml
@@ -3,7 +3,6 @@ remove:
3
3
  - package-lock.json
4
4
  patchPackageJson: true
5
5
  replaceVariables:
6
- - contember.yaml
7
6
  - package.json
8
7
  - docker-compose.yaml
9
8
 
@@ -3,6 +3,6 @@ set -ex
3
3
 
4
4
  mkdir -p /data/contember
5
5
  mkdir -p /data/.minio.sys/buckets/contember/
6
- cp /bucket-policy.json /data/.minio.sys/buckets/contember/policy.json
6
+ cp /minio/s3-policy.json /data/.minio.sys/buckets/contember/policy.json
7
7
 
8
8
  minio "$@"
@@ -1,35 +1,18 @@
1
1
  version: '2.4'
2
2
 
3
3
  services:
4
- admin:
5
- image: node:14-alpine
6
- command: npm run start-admin
7
- user: '1000:1000'
8
-
9
- environment:
10
- VITE_PORT: '1480'
11
- VITE_CONTEMBER_ADMIN_API_BASE_URL: 'http://localhost:1481'
12
- VITE_CONTEMBER_ADMIN_SESSION_TOKEN: '0000000000000000000000000000000000000000'
13
- VITE_CONTEMBER_ADMIN_PROJECT_NAME: '{projectName}'
14
-
15
- ports:
16
- - '1480:1480' # ports must match
17
-
18
- working_dir: /src
19
- volumes:
20
- - ./:/src:cached
21
-
22
- contember:
4
+ contember-engine:
23
5
  image: contember/engine:{version}
24
- restart: on-failure
25
6
 
26
7
  environment:
27
8
  NODE_ENV: 'development'
28
9
 
10
+ CONTEMBER_PORT: '4000'
29
11
  CONTEMBER_ROOT_EMAIL: 'contember@localhost'
30
12
  CONTEMBER_ROOT_PASSWORD: 'contember'
31
- CONTEMBER_ROOT_TOKEN: '0000000000000000000000000000000000000000'
32
- CONTEMBER_LOGIN_TOKEN: '1111111111111111111111111111111111111111'
13
+ CONTEMBER_ROOT_TOKEN: '0000000000000000000000000000000000000000' # openssl rand -hex 20
14
+ CONTEMBER_LOGIN_TOKEN: '1111111111111111111111111111111111111111' # openssl rand -hex 20
15
+
33
16
  CONTEMBER_CONFIG_YAML: |
34
17
  projectDefaults:
35
18
  s3:
@@ -55,6 +38,12 @@ services:
55
38
  ports:
56
39
  - '1481:4000'
57
40
 
41
+ healthcheck:
42
+ test: ['CMD-SHELL', 'curl --fail http://localhost:4000']
43
+ interval: 5s
44
+ timeout: 5s
45
+ retries: 10
46
+
58
47
  depends_on:
59
48
  postgres:
60
49
  condition: service_healthy
@@ -62,9 +51,10 @@ services:
62
51
  contember-cli:
63
52
  image: contember/cli:{version}
64
53
  user: '1000:1000'
54
+ scale: 0
65
55
 
66
56
  environment:
67
- CONTEMBER_API_URL: 'http://contember:4000/'
57
+ CONTEMBER_API_URL: 'http://contember-engine:4000/'
68
58
  CONTEMBER_API_TOKEN: '0000000000000000000000000000000000000000'
69
59
  CONTEMBER_PROJECT_NAME: '{projectName}'
70
60
 
@@ -73,40 +63,22 @@ services:
73
63
  - ./:/src:cached
74
64
 
75
65
  depends_on:
76
- contember:
77
- condition: service_started
78
-
79
- contember-migrations:
80
- image: contember/cli:{version}
81
- command: 'migrations:execute . --yes'
82
- user: '1000:1000'
83
-
84
- environment:
85
- CONTEMBER_API_URL: 'http://contember:4000/'
86
- CONTEMBER_API_TOKEN: '0000000000000000000000000000000000000000'
87
- CONTEMBER_PROJECT_NAME: '{projectName}'
88
-
89
- working_dir: /src
90
- volumes:
91
- - ./:/src:cached
92
-
93
- depends_on:
94
- contember:
95
- condition: service_started
66
+ contember-engine:
67
+ condition: service_healthy
96
68
 
97
69
  postgres:
98
- image: postgres:13-alpine
70
+ image: postgres:14-alpine
99
71
 
100
72
  environment:
101
- POSTGRES_PASSWORD: contember
102
- POSTGRES_USER: contember
103
- POSTGRES_DB: contember
73
+ POSTGRES_PASSWORD: 'contember'
74
+ POSTGRES_USER: 'contember'
75
+ POSTGRES_DB: 'contember'
104
76
 
105
77
  ports:
106
78
  - '1482:5432'
107
79
 
108
80
  volumes:
109
- - pgsql-data:/var/lib/postgres/data
81
+ - pgsql-data:/var/lib/postgresql/data
110
82
 
111
83
  healthcheck:
112
84
  test: ['CMD-SHELL', 'pg_isready -U contember']
@@ -116,20 +88,19 @@ services:
116
88
 
117
89
  s3:
118
90
  image: minio/minio
119
- entrypoint: /minio-entrypoint.sh
91
+ entrypoint: /minio/s3-entrypoint.sh
120
92
  command: 'server --address :1483 /data'
121
93
 
122
94
  environment:
123
- MINIO_ROOT_USER: contember
124
- MINIO_ROOT_PASSWORD: contember
95
+ MINIO_ROOT_USER: 'contember'
96
+ MINIO_ROOT_PASSWORD: 'contember'
125
97
 
126
98
  ports:
127
99
  - '1483:1483' # ports must match
128
100
 
129
101
  volumes:
130
102
  - s3-data:/data
131
- - ./scripts/minio/s3-policy.json:/bucket-policy.json
132
- - ./scripts/minio/s3-entrypoint.sh:/minio-entrypoint.sh
103
+ - ./docker/minio/:/minio
133
104
 
134
105
  mailhog:
135
106
  image: mailhog/mailhog
@@ -140,19 +111,20 @@ services:
140
111
  image: michalhosna/adminer:4.8.0-en_v1
141
112
 
142
113
  environment:
143
- ADMINER_DRIVER: pgsql
144
- ADMINER_SERVER: postgres
145
- ADMINER_DB: contember
146
- ADMINER_USERNAME: contember
147
- ADMINER_PASSWORD: contember
148
- ADMINER_AUTOLOGIN: 1
149
- ADMINER_NAME: Contember
114
+ ADMINER_DRIVER: 'pgsql'
115
+ ADMINER_SERVER: 'postgres'
116
+ ADMINER_DB: 'contember'
117
+ ADMINER_USERNAME: 'contember'
118
+ ADMINER_PASSWORD: 'contember'
119
+ ADMINER_AUTOLOGIN: '1'
120
+ ADMINER_NAME: 'Contember'
150
121
 
151
122
  ports:
152
123
  - '1485:8080'
153
124
 
154
125
  depends_on:
155
- - postgres
126
+ postgres:
127
+ condition: service_healthy
156
128
 
157
129
  volumes:
158
130
  pgsql-data: ~
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "scripts-template": {
3
3
  "contember": "docker-compose run contember-cli",
4
- "start-admin": "vite admin --port ${VITE_PORT:-4000} --host 0.0.0.0",
4
+ "start": "npm run start-engine && npm run start-admin",
5
+ "start-engine": "npm run contember migrations:execute . --yes && docker-compose up --detach",
6
+ "start-admin": "vite admin --port 1480 --host 0.0.0.0",
5
7
  "build-admin": "tsc && vite build admin"
6
8
  },
7
9
  "devDependencies": {
8
10
  "@contember/schema": "{version}",
9
11
  "@contember/schema-definition": "{version}",
10
- "@contember/admin": "0.7.0-beta.1",
11
- "@contember/admin-i18n": "0.7.0-beta.1",
12
- "@types/react": "17.0.5",
13
- "@vitejs/plugin-react-refresh": "^1.3.6",
14
- "react": "17.0.1",
15
- "react-dom": "17.0.1",
16
- "vite": "^2.5.2"
12
+ "@contember/admin": "^1.0.0-alpha.6",
13
+ "@types/react": "^17",
14
+ "react": "^17",
15
+ "react-dom": "^17",
16
+ "typescript": "^4.5",
17
+ "vite": "^2.7"
17
18
  }
18
19
  }
@@ -1,20 +0,0 @@
1
- import { defineConfig } from 'vite'
2
- import reactRefresh from '@vitejs/plugin-react-refresh'
3
-
4
- export default defineConfig({
5
- root: 'projects',
6
- esbuild: {
7
- jsxFactory: '_jsx',
8
- jsxFragment: '_jsxFragment',
9
- jsxInject: `import { createElement as _jsx, Fragment as _jsxFragment } from 'react'`,
10
- },
11
- build: {
12
- brotliSize: false,
13
- chunkSizeWarningLimit: undefined,
14
- },
15
- plugins: [reactRefresh()],
16
- server: {
17
- host: '0.0.0.0',
18
- port: 1480,
19
- },
20
- })
@@ -1,4 +0,0 @@
1
- api:
2
- version: {version}
3
- projects:
4
- {projectName}: .