@contember/cli-common 1.4.0-rc.4 → 1.4.0-rc.6
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/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/utils/ProjectManager.d.ts +0 -3
- package/dist/src/utils/ProjectManager.d.ts.map +1 -1
- package/dist/src/utils/ProjectManager.js +0 -14
- package/dist/src/utils/ProjectManager.js.map +1 -1
- package/dist/src/utils/Workspace.d.ts +0 -14
- package/dist/src/utils/Workspace.d.ts.map +1 -1
- package/dist/src/utils/Workspace.js +1 -17
- package/dist/src/utils/Workspace.js.map +1 -1
- package/package.json +2 -7
- package/src/utils/ProjectManager.ts +1 -16
- package/src/utils/Workspace.ts +0 -27
- package/dist/src/utils/npm.d.ts +0 -2
- package/dist/src/utils/npm.d.ts.map +0 -1
- package/dist/src/utils/npm.js +0 -29
- package/dist/src/utils/npm.js.map +0 -1
- package/dist/src/utils/template.d.ts +0 -2
- package/dist/src/utils/template.d.ts.map +0 -1
- package/dist/src/utils/template.js +0 -81
- package/dist/src/utils/template.js.map +0 -1
- package/resources/templates/template-project/admin/.env.development +0 -3
- package/resources/templates/template-project/admin/.env.production +0 -3
- package/resources/templates/template-project/admin/components/AppHeaderTitle.tsx +0 -8
- package/resources/templates/template-project/admin/components/Constants.tsx +0 -1
- package/resources/templates/template-project/admin/components/Directives.tsx +0 -18
- package/resources/templates/template-project/admin/components/Layout.tsx +0 -75
- package/resources/templates/template-project/admin/components/LayoutComponent.tsx +0 -93
- package/resources/templates/template-project/admin/components/Navigation.tsx +0 -8
- package/resources/templates/template-project/admin/components/PanelDivider.tsx +0 -14
- package/resources/templates/template-project/admin/components/Slots.tsx +0 -64
- package/resources/templates/template-project/admin/index.html +0 -9
- package/resources/templates/template-project/admin/index.tsx +0 -34
- package/resources/templates/template-project/admin/pages/index.tsx +0 -7
- package/resources/templates/template-project/admin/tsconfig.json +0 -13
- package/resources/templates/template-project/admin/vite-env.d.ts +0 -7
- package/resources/templates/template-project/admin/vite.config.ts +0 -5
- package/resources/templates/template-project/api/index.ts +0 -7
- package/resources/templates/template-project/api/migrations/.gitkeep +0 -0
- package/resources/templates/template-project/api/model/index.ts +0 -5
- package/resources/templates/template-project/api/tsconfig.json +0 -13
- package/resources/templates/template-project/contember.template.yaml +0 -7
- package/resources/templates/template-workspace/.gitignore.dist +0 -3
- package/resources/templates/template-workspace/contember.template.yaml +0 -10
- package/resources/templates/template-workspace/docker-compose.yaml +0 -124
- package/resources/templates/template-workspace/package.json +0 -25
- package/resources/templates/template-workspace/tsconfig.json +0 -8
- package/src/utils/npm.ts +0 -26
- package/src/utils/template.ts +0 -80
- package/types/download-tarball/index.d.ts +0 -7
- package/types/get-package-json-from-registry/index.d.ts +0 -3
- package/types/registry-info/index.d.ts +0 -7
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.installTemplate = void 0;
|
|
27
|
-
const node_path_1 = require("node:path");
|
|
28
|
-
const fs = __importStar(require("node:fs/promises"));
|
|
29
|
-
const fs_extra_1 = require("fs-extra");
|
|
30
|
-
const fs_1 = require("./fs");
|
|
31
|
-
const npm_1 = require("./npm");
|
|
32
|
-
const pathUtils_1 = require("../pathUtils");
|
|
33
|
-
const yaml_1 = require("./yaml");
|
|
34
|
-
const localTemplates = {
|
|
35
|
-
['@contember/template-workspace']: (0, node_path_1.join)(pathUtils_1.resourcesDir, 'templates/template-workspace'),
|
|
36
|
-
['@contember/template-project']: (0, node_path_1.join)(pathUtils_1.resourcesDir, 'templates/template-project'),
|
|
37
|
-
};
|
|
38
|
-
const installTemplate = async (template, targetDir, requiredTemplateType, variables = {}) => {
|
|
39
|
-
let removeTemplate = () => { };
|
|
40
|
-
if (localTemplates[template]) {
|
|
41
|
-
template = localTemplates[template];
|
|
42
|
-
}
|
|
43
|
-
if (!(0, node_path_1.isAbsolute)(template)) {
|
|
44
|
-
template = await (0, npm_1.downloadPackage)(template);
|
|
45
|
-
removeTemplate = async () => {
|
|
46
|
-
await fs.unlink(template);
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
const templateConfigFile = (0, node_path_1.join)(template, 'contember.template.yaml');
|
|
50
|
-
if (!(await (0, fs_1.pathExists)(templateConfigFile))) {
|
|
51
|
-
throw `${template} is not a Contember template`;
|
|
52
|
-
}
|
|
53
|
-
const config = (await (0, yaml_1.readYaml)(templateConfigFile));
|
|
54
|
-
const nodeModulesDir = (0, node_path_1.join)(template, 'node_modules');
|
|
55
|
-
const skippedFiles = new Set([...(config.remove || []).map(it => (0, node_path_1.join)(template, it)), templateConfigFile]);
|
|
56
|
-
await (0, fs_extra_1.copy)(template, targetDir, {
|
|
57
|
-
filter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),
|
|
58
|
-
});
|
|
59
|
-
await removeTemplate();
|
|
60
|
-
if (config.patchPackageJson) {
|
|
61
|
-
await (0, fs_1.replaceFileContent)((0, node_path_1.join)(targetDir, 'package.json'), content => {
|
|
62
|
-
const { name, version, 'scripts-template': scripts, scripts: _nullScripts, license, ...json } = JSON.parse(content);
|
|
63
|
-
return JSON.stringify({ scripts, ...json }, null, ' ');
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
for (const [source, target] of Object.entries(config.rename || {})) {
|
|
67
|
-
await fs.rename((0, node_path_1.join)(targetDir, source), (0, node_path_1.join)(targetDir, target));
|
|
68
|
-
}
|
|
69
|
-
for (const [source, target] of Object.entries(config.copy || {})) {
|
|
70
|
-
await (0, fs_extra_1.copy)((0, node_path_1.join)(targetDir, source), (0, node_path_1.join)(targetDir, target));
|
|
71
|
-
}
|
|
72
|
-
for (const file of config.replaceVariables || []) {
|
|
73
|
-
const path = (0, node_path_1.join)(targetDir, file);
|
|
74
|
-
if (!(await (0, fs_1.pathExists)(path))) {
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
await (0, fs_1.replaceFileContent)(path, content => Object.entries(variables).reduce((content, [key, value]) => content.replace(new RegExp(`\{${key}\}`, 'g'), value), content));
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
exports.installTemplate = installTemplate;
|
|
81
|
-
//# sourceMappingURL=template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/utils/template.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA4C;AAC5C,qDAAsC;AACtC,uCAA+B;AAC/B,6BAAqD;AACrD,+BAAuC;AACvC,4CAA2C;AAC3C,iCAAiC;AAEjC,MAAM,cAAc,GAA2B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K,MAAM,IAAI,IAAI,MAAM,CAAC,gBAAgB,IAAI,EAAE,EAAE;QACjD,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,IAAI,CAAC,CAAA;QAClC,IAAI,CAAC,CAAC,MAAM,IAAA,eAAU,EAAC,IAAI,CAAC,CAAC,EAAE;YAC9B,SAAQ;SACR;QACD,MAAM,IAAA,uBAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CACxC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAC/B,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,EAChF,OAAO,CACP,CACD,CAAA;KACD;AACF,CAAC,CAAA;AAnEY,QAAA,eAAe,mBAmE3B"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Slots } from '@contember/layout'
|
|
2
|
-
import { useClassName } from '@contember/react-utils'
|
|
3
|
-
import { forwardRef, memo } from 'react'
|
|
4
|
-
|
|
5
|
-
export const AppHeaderTitle = memo(forwardRef<HTMLHeadingElement, Slots.OwnTargetContainerProps>((props, forwardRef) => (
|
|
6
|
-
<h1 ref={forwardRef} {...props} className={useClassName('app-header-title', props.className)} />
|
|
7
|
-
)))
|
|
8
|
-
AppHeaderTitle.displayName = 'AppHeaderTitle'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const LAYOUT_BREAKPOINT = 768
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Directives } from '@contember/layout'
|
|
2
|
-
import { Intent } from '@contember/ui'
|
|
3
|
-
import { LAYOUT_BREAKPOINT } from './Constants'
|
|
4
|
-
|
|
5
|
-
export type DirectivesType = {
|
|
6
|
-
'content-max-width': number | false | null | undefined
|
|
7
|
-
'layout.theme-content': Intent | null | undefined
|
|
8
|
-
'layout.theme-controls': Intent | null | undefined
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const initialDirectives: DirectivesType = Object.freeze({
|
|
12
|
-
'content-max-width': LAYOUT_BREAKPOINT,
|
|
13
|
-
'layout.theme-content': 'default',
|
|
14
|
-
'layout.theme-controls': 'positive',
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
export const Directive = Directives.Directive as unknown as Directives.DirectiveComponentType<DirectivesType> // <DirectivesType>
|
|
18
|
-
export const useDirectives = Directives.useDirectives<DirectivesType>
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Button, Link, LogoutLink, PortalProvider, Scheme, Stack, VisuallyHidden } from '@contember/admin'
|
|
2
|
-
import { SafeAreaInsetsProvider } from '@contember/layout'
|
|
3
|
-
import { ColorSchemeProvider, useContainerWidth, useReferentiallyStableCallback, useSessionStorageState } from '@contember/react-utils'
|
|
4
|
-
import { colorSchemeClassName, contentThemeClassName, controlsThemeClassName } from '@contember/utilities'
|
|
5
|
-
import { CircleDashedIcon, LogOutIcon, MoonIcon, SunIcon } from 'lucide-react'
|
|
6
|
-
import { PropsWithChildren, memo } from 'react'
|
|
7
|
-
import { LAYOUT_BREAKPOINT } from './Constants'
|
|
8
|
-
import { useDirectives } from './Directives'
|
|
9
|
-
import { LayoutComponent } from './LayoutComponent'
|
|
10
|
-
import { SlotSources } from './Slots'
|
|
11
|
-
import { Navigation } from './Navigation'
|
|
12
|
-
|
|
13
|
-
export const Layout = memo(({ children }: PropsWithChildren) => {
|
|
14
|
-
const directives = useDirectives()
|
|
15
|
-
const width = useContainerWidth()
|
|
16
|
-
|
|
17
|
-
const [scheme, setScheme] = useSessionStorageState<Scheme>(
|
|
18
|
-
'contember-admin-sandbox-scheme',
|
|
19
|
-
scheme => scheme ?? 'system',
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
const colorSchemeTheme = [
|
|
23
|
-
colorSchemeClassName(scheme),
|
|
24
|
-
contentThemeClassName(directives['layout.theme-content']),
|
|
25
|
-
controlsThemeClassName(directives['layout.theme-controls']),
|
|
26
|
-
].join(' ')
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<SafeAreaInsetsProvider>
|
|
30
|
-
<ColorSchemeProvider scheme={scheme}>
|
|
31
|
-
<PortalProvider className={colorSchemeTheme}>
|
|
32
|
-
<LayoutComponent className={colorSchemeTheme}>
|
|
33
|
-
<SlotSources.Logo>
|
|
34
|
-
<Link to="index">
|
|
35
|
-
<Stack align="center" horizontal gap="small">
|
|
36
|
-
<VisuallyHidden className="whitespace-nowrap" hidden={width < LAYOUT_BREAKPOINT}>{'{projectName}'}</VisuallyHidden>
|
|
37
|
-
</Stack>
|
|
38
|
-
</Link>
|
|
39
|
-
</SlotSources.Logo>
|
|
40
|
-
<SlotSources.Navigation>
|
|
41
|
-
<Navigation />
|
|
42
|
-
</SlotSources.Navigation>
|
|
43
|
-
|
|
44
|
-
<SlotSources.Switchers>
|
|
45
|
-
<Button
|
|
46
|
-
square
|
|
47
|
-
active={!scheme.match(/system/)}
|
|
48
|
-
aria-label={scheme.match(/light/) ? 'Light mode, switch to dark mode' : scheme.match(/dark/) ? 'Dark mode, switch to light mode' : 'System mode, switch to system mode'}
|
|
49
|
-
borderRadius="full"
|
|
50
|
-
distinction="seamless"
|
|
51
|
-
onClick={useReferentiallyStableCallback(() => {
|
|
52
|
-
setScheme(scheme => (scheme.match(/light/) ? 'dark' : scheme.match(/dark/) ? 'system' : 'light'))
|
|
53
|
-
})}
|
|
54
|
-
size="small"
|
|
55
|
-
>
|
|
56
|
-
{scheme.match(/light/) ? <SunIcon /> : scheme.match(/dark/) ? <MoonIcon /> : <CircleDashedIcon />}
|
|
57
|
-
</Button>
|
|
58
|
-
</SlotSources.Switchers>
|
|
59
|
-
|
|
60
|
-
<SlotSources.Profile>
|
|
61
|
-
<LogoutLink>
|
|
62
|
-
<Stack align="center" horizontal gap="small">
|
|
63
|
-
<LogOutIcon /> Logout
|
|
64
|
-
</Stack>
|
|
65
|
-
</LogoutLink>
|
|
66
|
-
</SlotSources.Profile>
|
|
67
|
-
|
|
68
|
-
{children}
|
|
69
|
-
</LayoutComponent>
|
|
70
|
-
</PortalProvider>
|
|
71
|
-
</ColorSchemeProvider>
|
|
72
|
-
</SafeAreaInsetsProvider>
|
|
73
|
-
)
|
|
74
|
-
})
|
|
75
|
-
Layout.displayName = 'Layout'
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { LayoutKit, Slots, createLayoutBarComponent } from '@contember/layout'
|
|
2
|
-
import { Divider, Spacer, Stack } from '@contember/ui'
|
|
3
|
-
import { ComponentClassNameProps } from '@contember/utilities'
|
|
4
|
-
import { PropsWithChildren } from 'react'
|
|
5
|
-
import { AppHeaderTitle } from './AppHeaderTitle'
|
|
6
|
-
import { useDirectives } from './Directives'
|
|
7
|
-
import { PanelDivider } from './PanelDivider'
|
|
8
|
-
import { SlotTargets } from './Slots'
|
|
9
|
-
|
|
10
|
-
const SubHeader = createLayoutBarComponent({
|
|
11
|
-
defaultAs: 'div',
|
|
12
|
-
displayName: 'SubHeader',
|
|
13
|
-
name: 'sub-header',
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
export const LayoutComponent = ({ children, ...rest }: PropsWithChildren<ComponentClassNameProps>) => {
|
|
17
|
-
const directives = useDirectives()
|
|
18
|
-
const createSlotTargets = Slots.useTargetsIfActiveFactory(SlotTargets)
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<LayoutKit.Frame
|
|
22
|
-
header={
|
|
23
|
-
<>
|
|
24
|
-
<LayoutKit.Header
|
|
25
|
-
start={createSlotTargets(['Logo', 'HeaderStart']) || false}
|
|
26
|
-
center={createSlotTargets(['HeaderCenter']) || false}
|
|
27
|
-
end={state => {
|
|
28
|
-
const targets = createSlotTargets(['HeaderEnd', 'Profile'])
|
|
29
|
-
const menuButton = state.panels.get(LayoutKit.SidebarLeft.NAME)?.behavior === 'modal'
|
|
30
|
-
? < LayoutKit.ToggleMenuButton panelName={LayoutKit.SidebarLeft.NAME} />
|
|
31
|
-
: null
|
|
32
|
-
|
|
33
|
-
return (targets || menuButton)
|
|
34
|
-
? (
|
|
35
|
-
<>
|
|
36
|
-
{targets}
|
|
37
|
-
{menuButton}
|
|
38
|
-
</>
|
|
39
|
-
)
|
|
40
|
-
: false
|
|
41
|
-
}}
|
|
42
|
-
/>
|
|
43
|
-
<SubHeader
|
|
44
|
-
start={createSlotTargets(['Back']) || false}
|
|
45
|
-
center={<SlotTargets.Title as={AppHeaderTitle} />}
|
|
46
|
-
end={createSlotTargets(['Actions']) || false}
|
|
47
|
-
/>
|
|
48
|
-
</>
|
|
49
|
-
}
|
|
50
|
-
footer={(
|
|
51
|
-
<LayoutKit.Footer
|
|
52
|
-
start={createSlotTargets(['FooterStart']) || false}
|
|
53
|
-
center={createSlotTargets(['FooterCenter']) || false}
|
|
54
|
-
end={createSlotTargets(['Switchers', 'FooterEnd']) || false}
|
|
55
|
-
/>
|
|
56
|
-
)}
|
|
57
|
-
{...rest}
|
|
58
|
-
>
|
|
59
|
-
<LayoutKit.SidebarLeft
|
|
60
|
-
keepVisible
|
|
61
|
-
header={(({ behavior }) => behavior === 'modal'
|
|
62
|
-
? (
|
|
63
|
-
<>
|
|
64
|
-
<SlotTargets.SidebarLeftHeader />
|
|
65
|
-
<Spacer />
|
|
66
|
-
<LayoutKit.ToggleMenuButton panelName={LayoutKit.SidebarLeft.NAME} />
|
|
67
|
-
</>
|
|
68
|
-
)
|
|
69
|
-
: createSlotTargets(['SidebarLeftHeader'])
|
|
70
|
-
) || false}
|
|
71
|
-
body={createSlotTargets(['Navigation', 'SidebarLeftBody']) || false}
|
|
72
|
-
footer={createSlotTargets(['SidebarLeftFooter']) || false}
|
|
73
|
-
/>
|
|
74
|
-
|
|
75
|
-
<PanelDivider name={LayoutKit.SidebarLeft.NAME} />
|
|
76
|
-
|
|
77
|
-
<LayoutKit.ContentPanelMain
|
|
78
|
-
header={createSlotTargets(['ContentHeader'])}
|
|
79
|
-
body={(
|
|
80
|
-
<>
|
|
81
|
-
{children}
|
|
82
|
-
<SlotTargets.SidebarRightHeader />
|
|
83
|
-
<SlotTargets.Sidebar />
|
|
84
|
-
<SlotTargets.SidebarRightBody />
|
|
85
|
-
<SlotTargets.SidebarRightFooter />
|
|
86
|
-
</>)}
|
|
87
|
-
footer={createSlotTargets(['ContentFooter'])}
|
|
88
|
-
maxWidth={directives?.['content-max-width']}
|
|
89
|
-
/>
|
|
90
|
-
</LayoutKit.Frame>
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
LayoutComponent.displayName = 'Layout(default)'
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { LayoutPrimitives } from '@contember/layout'
|
|
2
|
-
import { Divider } from '@contember/ui'
|
|
3
|
-
import { memo } from 'react'
|
|
4
|
-
|
|
5
|
-
export const PanelDivider = memo<{ name: string }>(({ name }) => (
|
|
6
|
-
<LayoutPrimitives.GetLayoutPanelsStateContext.Consumer>{({ panels }) => {
|
|
7
|
-
const panel = panels.get(name)
|
|
8
|
-
|
|
9
|
-
return panel?.behavior === 'static' && panel?.visibility === 'visible' && (
|
|
10
|
-
<Divider />
|
|
11
|
-
)
|
|
12
|
-
}}</LayoutPrimitives.GetLayoutPanelsStateContext.Consumer>
|
|
13
|
-
))
|
|
14
|
-
PanelDivider.displayName = 'PanelDivider'
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CommonSlotSources,
|
|
3
|
-
CommonSlotTargets,
|
|
4
|
-
ContentSlotSources,
|
|
5
|
-
ContentSlotTargets,
|
|
6
|
-
FooterSlotSources,
|
|
7
|
-
FooterSlotTargets,
|
|
8
|
-
HeaderSlotSources,
|
|
9
|
-
HeaderSlotTargets,
|
|
10
|
-
SidebarLeftSlotSources,
|
|
11
|
-
SidebarLeftSlotTargets,
|
|
12
|
-
SidebarRightSlotSources,
|
|
13
|
-
SidebarRightSlotTargets,
|
|
14
|
-
commonSlots,
|
|
15
|
-
contentSlots,
|
|
16
|
-
footerSlots,
|
|
17
|
-
headerSlots,
|
|
18
|
-
sidebarLeftSlots,
|
|
19
|
-
sidebarRightSlots,
|
|
20
|
-
} from '@contember/layout'
|
|
21
|
-
import { useDocumentTitle } from '@contember/react-utils'
|
|
22
|
-
import { memo } from 'react'
|
|
23
|
-
|
|
24
|
-
const Title = memo<{ children: string | null | undefined }>(({ children }) => {
|
|
25
|
-
useDocumentTitle(children)
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<CommonSlotSources.Title>{children}</CommonSlotSources.Title>
|
|
29
|
-
)
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
export const slots = [
|
|
33
|
-
...commonSlots,
|
|
34
|
-
...contentSlots,
|
|
35
|
-
...headerSlots,
|
|
36
|
-
...footerSlots,
|
|
37
|
-
...sidebarLeftSlots,
|
|
38
|
-
...sidebarRightSlots,
|
|
39
|
-
// Your custom slot names will come here, e.g:
|
|
40
|
-
// 'MySlot',
|
|
41
|
-
]
|
|
42
|
-
|
|
43
|
-
export const SlotSources = {
|
|
44
|
-
...CommonSlotSources,
|
|
45
|
-
...ContentSlotSources,
|
|
46
|
-
...HeaderSlotSources,
|
|
47
|
-
...FooterSlotSources,
|
|
48
|
-
...SidebarLeftSlotSources,
|
|
49
|
-
...SidebarRightSlotSources,
|
|
50
|
-
Title,
|
|
51
|
-
// Your custom slots will come here, e.g:
|
|
52
|
-
// MySLot: Slots.createSlotSourceComponent(slotTargets.MySLot),
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export const SlotTargets = {
|
|
56
|
-
...CommonSlotTargets,
|
|
57
|
-
...ContentSlotTargets,
|
|
58
|
-
...HeaderSlotTargets,
|
|
59
|
-
...FooterSlotTargets,
|
|
60
|
-
...SidebarLeftSlotTargets,
|
|
61
|
-
...SidebarRightSlotTargets,
|
|
62
|
-
// Your custom slot targets will come here, e.g:
|
|
63
|
-
// MySLot: Slots.createSlotTargetComponent(slotTargets.MySLot),
|
|
64
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import { ApplicationEntrypoint, PageModule, Pages, runReactApp } from '@contember/admin'
|
|
3
|
-
import '@contember/admin/index.css'
|
|
4
|
-
import '@contember/layout/index.css'
|
|
5
|
-
|
|
6
|
-
import { Layout } from './components/Layout'
|
|
7
|
-
import { createRoot } from 'react-dom/client'
|
|
8
|
-
import { Directives, Slots } from '@contember/layout'
|
|
9
|
-
import { initialDirectives } from './components/Directives'
|
|
10
|
-
|
|
11
|
-
runReactApp(
|
|
12
|
-
<Directives.Provider value={initialDirectives}>
|
|
13
|
-
<Slots.Provider>
|
|
14
|
-
<ApplicationEntrypoint
|
|
15
|
-
basePath={import.meta.env.BASE_URL}
|
|
16
|
-
apiBaseUrl={import.meta.env.VITE_CONTEMBER_ADMIN_API_BASE_URL}
|
|
17
|
-
sessionToken={import.meta.env.VITE_CONTEMBER_ADMIN_SESSION_TOKEN}
|
|
18
|
-
project={import.meta.env.VITE_CONTEMBER_ADMIN_PROJECT_NAME}
|
|
19
|
-
stage="live"
|
|
20
|
-
children={
|
|
21
|
-
<Pages
|
|
22
|
-
layout={Layout}
|
|
23
|
-
children={import.meta.glob<PageModule>(
|
|
24
|
-
'./pages/**/*.tsx',
|
|
25
|
-
{ eager: true },
|
|
26
|
-
)}
|
|
27
|
-
/>
|
|
28
|
-
}
|
|
29
|
-
/>
|
|
30
|
-
</Slots.Provider>
|
|
31
|
-
</Directives.Provider>,
|
|
32
|
-
null,
|
|
33
|
-
(dom, react, onRecoverableError) => createRoot(dom, { onRecoverableError }).render(react),
|
|
34
|
-
)
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"isolatedModules": true,
|
|
4
|
-
"jsx": "react-jsx",
|
|
5
|
-
"lib": ["esnext", "dom", "dom.iterable"],
|
|
6
|
-
"module": "esnext",
|
|
7
|
-
"moduleResolution": "node",
|
|
8
|
-
"noEmit": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"strict": true,
|
|
11
|
-
"target": "esnext"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
File without changes
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
services:
|
|
2
|
-
contember-engine:
|
|
3
|
-
image: contember/engine:{version}
|
|
4
|
-
|
|
5
|
-
environment:
|
|
6
|
-
NODE_ENV: 'development'
|
|
7
|
-
|
|
8
|
-
CONTEMBER_PORT: '4000'
|
|
9
|
-
CONTEMBER_ROOT_EMAIL: 'contember@localhost'
|
|
10
|
-
CONTEMBER_ROOT_PASSWORD: 'contember'
|
|
11
|
-
CONTEMBER_ROOT_TOKEN: '0000000000000000000000000000000000000000' # openssl rand -hex 20
|
|
12
|
-
CONTEMBER_LOGIN_TOKEN: '1111111111111111111111111111111111111111' # openssl rand -hex 20
|
|
13
|
-
CONTEMBER_ENCRYPTION_KEY: '2222222222222222222222222222222222222222222222222222222222222222' # openssl rand -hex 32
|
|
14
|
-
|
|
15
|
-
DEFAULT_DB_HOST: 'postgres'
|
|
16
|
-
DEFAULT_DB_PORT: '5432'
|
|
17
|
-
DEFAULT_DB_NAME: 'contember'
|
|
18
|
-
DEFAULT_DB_USER: 'contember'
|
|
19
|
-
DEFAULT_DB_PASSWORD: 'contember'
|
|
20
|
-
|
|
21
|
-
DEFAULT_S3_ENDPOINT: 'http://localhost:1483'
|
|
22
|
-
DEFAULT_S3_BUCKET: 'contember'
|
|
23
|
-
DEFAULT_S3_REGION: ''
|
|
24
|
-
DEFAULT_S3_KEY: 'contember'
|
|
25
|
-
DEFAULT_S3_SECRET: 'contember'
|
|
26
|
-
DEFAULT_S3_PROVIDER: 'minio'
|
|
27
|
-
|
|
28
|
-
TENANT_MAILER_HOST: 'mailhog'
|
|
29
|
-
TENANT_MAILER_PORT: '1025'
|
|
30
|
-
TENANT_MAILER_FROM: 'contember@localhost'
|
|
31
|
-
|
|
32
|
-
ports:
|
|
33
|
-
- '1481:4000'
|
|
34
|
-
|
|
35
|
-
healthcheck:
|
|
36
|
-
test: 'curl --fail http://localhost:4000'
|
|
37
|
-
interval: 5s
|
|
38
|
-
timeout: 5s
|
|
39
|
-
retries: 10
|
|
40
|
-
|
|
41
|
-
depends_on:
|
|
42
|
-
postgres:
|
|
43
|
-
condition: service_healthy
|
|
44
|
-
|
|
45
|
-
contember-cli:
|
|
46
|
-
image: contember/cli:{version}
|
|
47
|
-
user: '1000:1000'
|
|
48
|
-
|
|
49
|
-
deploy:
|
|
50
|
-
replicas: 0
|
|
51
|
-
|
|
52
|
-
environment:
|
|
53
|
-
CONTEMBER_API_URL: 'http://contember-engine:4000/'
|
|
54
|
-
CONTEMBER_API_TOKEN: '0000000000000000000000000000000000000000'
|
|
55
|
-
CONTEMBER_PROJECT_NAME: '{projectName}'
|
|
56
|
-
|
|
57
|
-
volumes:
|
|
58
|
-
- ./:/src
|
|
59
|
-
|
|
60
|
-
depends_on:
|
|
61
|
-
contember-engine:
|
|
62
|
-
condition: service_healthy
|
|
63
|
-
|
|
64
|
-
postgres:
|
|
65
|
-
image: postgres:14-alpine
|
|
66
|
-
|
|
67
|
-
environment:
|
|
68
|
-
POSTGRES_USER: 'contember'
|
|
69
|
-
POSTGRES_PASSWORD: 'contember'
|
|
70
|
-
POSTGRES_DB: 'contember'
|
|
71
|
-
|
|
72
|
-
ports:
|
|
73
|
-
- '1482:5432'
|
|
74
|
-
|
|
75
|
-
volumes:
|
|
76
|
-
- pgsql-data:/var/lib/postgresql/data
|
|
77
|
-
|
|
78
|
-
healthcheck:
|
|
79
|
-
test: 'pg_isready --username contember'
|
|
80
|
-
interval: 5s
|
|
81
|
-
timeout: 5s
|
|
82
|
-
retries: 10
|
|
83
|
-
|
|
84
|
-
minio:
|
|
85
|
-
image: bitnami/minio
|
|
86
|
-
|
|
87
|
-
environment:
|
|
88
|
-
MINIO_ROOT_USER: 'contember'
|
|
89
|
-
MINIO_ROOT_PASSWORD: 'contember'
|
|
90
|
-
MINIO_DEFAULT_BUCKETS: 'contember:download'
|
|
91
|
-
|
|
92
|
-
ports:
|
|
93
|
-
- '1483:9000'
|
|
94
|
-
|
|
95
|
-
volumes:
|
|
96
|
-
- minio-data:/data
|
|
97
|
-
|
|
98
|
-
mailhog:
|
|
99
|
-
image: mailhog/mailhog
|
|
100
|
-
ports:
|
|
101
|
-
- '1484:8025'
|
|
102
|
-
|
|
103
|
-
adminer:
|
|
104
|
-
image: michalhosna/adminer:4.8.0-en_v1
|
|
105
|
-
|
|
106
|
-
environment:
|
|
107
|
-
ADMINER_DRIVER: 'pgsql'
|
|
108
|
-
ADMINER_SERVER: 'postgres'
|
|
109
|
-
ADMINER_DB: 'contember'
|
|
110
|
-
ADMINER_USERNAME: 'contember'
|
|
111
|
-
ADMINER_PASSWORD: 'contember'
|
|
112
|
-
ADMINER_AUTOLOGIN: '1'
|
|
113
|
-
ADMINER_NAME: 'Contember'
|
|
114
|
-
|
|
115
|
-
ports:
|
|
116
|
-
- '1485:8080'
|
|
117
|
-
|
|
118
|
-
depends_on:
|
|
119
|
-
postgres:
|
|
120
|
-
condition: service_healthy
|
|
121
|
-
|
|
122
|
-
volumes:
|
|
123
|
-
pgsql-data: ~
|
|
124
|
-
minio-data: ~
|