@contember/cli-common 1.4.0-rc.3 → 1.4.0-rc.5

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 (51) hide show
  1. package/dist/src/tsconfig.tsbuildinfo +1 -1
  2. package/dist/src/utils/ProjectManager.d.ts +0 -3
  3. package/dist/src/utils/ProjectManager.d.ts.map +1 -1
  4. package/dist/src/utils/ProjectManager.js +0 -14
  5. package/dist/src/utils/ProjectManager.js.map +1 -1
  6. package/dist/src/utils/Workspace.d.ts +0 -14
  7. package/dist/src/utils/Workspace.d.ts.map +1 -1
  8. package/dist/src/utils/Workspace.js +1 -17
  9. package/dist/src/utils/Workspace.js.map +1 -1
  10. package/package.json +2 -7
  11. package/src/utils/ProjectManager.ts +1 -16
  12. package/src/utils/Workspace.ts +0 -27
  13. package/dist/src/utils/npm.d.ts +0 -2
  14. package/dist/src/utils/npm.d.ts.map +0 -1
  15. package/dist/src/utils/npm.js +0 -29
  16. package/dist/src/utils/npm.js.map +0 -1
  17. package/dist/src/utils/template.d.ts +0 -2
  18. package/dist/src/utils/template.d.ts.map +0 -1
  19. package/dist/src/utils/template.js +0 -81
  20. package/dist/src/utils/template.js.map +0 -1
  21. package/resources/templates/template-project/admin/.env.development +0 -3
  22. package/resources/templates/template-project/admin/.env.production +0 -3
  23. package/resources/templates/template-project/admin/components/AppHeaderTitle.tsx +0 -8
  24. package/resources/templates/template-project/admin/components/Constants.tsx +0 -1
  25. package/resources/templates/template-project/admin/components/Directives.tsx +0 -18
  26. package/resources/templates/template-project/admin/components/Layout.tsx +0 -75
  27. package/resources/templates/template-project/admin/components/LayoutComponent.tsx +0 -93
  28. package/resources/templates/template-project/admin/components/Navigation.tsx +0 -8
  29. package/resources/templates/template-project/admin/components/PanelDivider.tsx +0 -14
  30. package/resources/templates/template-project/admin/components/Slots.tsx +0 -64
  31. package/resources/templates/template-project/admin/index.html +0 -9
  32. package/resources/templates/template-project/admin/index.tsx +0 -34
  33. package/resources/templates/template-project/admin/pages/index.tsx +0 -7
  34. package/resources/templates/template-project/admin/tsconfig.json +0 -13
  35. package/resources/templates/template-project/admin/vite-env.d.ts +0 -7
  36. package/resources/templates/template-project/admin/vite.config.ts +0 -5
  37. package/resources/templates/template-project/api/index.ts +0 -7
  38. package/resources/templates/template-project/api/migrations/.gitkeep +0 -0
  39. package/resources/templates/template-project/api/model/index.ts +0 -5
  40. package/resources/templates/template-project/api/tsconfig.json +0 -13
  41. package/resources/templates/template-project/contember.template.yaml +0 -7
  42. package/resources/templates/template-workspace/.gitignore.dist +0 -3
  43. package/resources/templates/template-workspace/contember.template.yaml +0 -10
  44. package/resources/templates/template-workspace/docker-compose.yaml +0 -124
  45. package/resources/templates/template-workspace/package.json +0 -25
  46. package/resources/templates/template-workspace/tsconfig.json +0 -8
  47. package/src/utils/npm.ts +0 -26
  48. package/src/utils/template.ts +0 -80
  49. package/types/download-tarball/index.d.ts +0 -7
  50. package/types/get-package-json-from-registry/index.d.ts +0 -3
  51. package/types/registry-info/index.d.ts +0 -7
@@ -1,25 +0,0 @@
1
- {
2
- "scripts-template": {
3
- "contember": "docker-compose run --rm contember-cli",
4
- "start": "npm run start-engine && npm run start-admin",
5
- "start-engine": "docker-compose up --detach && npm run contember migrations:execute --yes",
6
- "start-admin": "vite admin --port 1480 --host 0.0.0.0",
7
- "build": "npm run build-admin && npm run build-api",
8
- "build-admin": "tsc --project admin && vite build admin",
9
- "build-api": "tsc --project api",
10
- "deploy": "npm run build && docker-compose run contember-cli deploy"
11
- },
12
- "devDependencies": {
13
- "@contember/schema": "{version}",
14
- "@contember/schema-definition": "{version}",
15
- "@contember/admin": "^1.2.6",
16
- "@contember/layout": "^1.2.6",
17
- "@types/node": "^18",
18
- "@types/react": "^18",
19
- "@types/react-dom": "^18",
20
- "react": "^18",
21
- "react-dom": "^18",
22
- "typescript": "^5.3.3",
23
- "vite": "^4.5.1"
24
- }
25
- }
@@ -1,8 +0,0 @@
1
- {
2
- "files": [],
3
- "include": [],
4
- "references": [
5
- { "path": "./admin"},
6
- { "path": "./api"}
7
- ]
8
- }
package/src/utils/npm.ts DELETED
@@ -1,26 +0,0 @@
1
- import getRegistryInfo from 'registry-info'
2
- import getPackageJson from 'get-package-json-from-registry'
3
- import npa from 'npm-package-arg'
4
- import downloadTarball from 'download-tarball'
5
- import { readdir } from 'node:fs/promises'
6
- import { join } from 'node:path'
7
- import { tmpdir } from 'node:os'
8
-
9
- export const downloadPackage = async (pkgName: string): Promise<string> => {
10
- const { scope } = npa(pkgName)
11
- const { authorization } = getRegistryInfo(scope)
12
- const headers = authorization ? { authorization } : {}
13
-
14
- const pkg = await getPackageJson(pkgName)
15
- const {
16
- dist: { tarball },
17
- } = pkg
18
-
19
- const tmpDir = join(tmpdir(), 'contember-' + Math.random())
20
- await downloadTarball({ url: tarball, gotOpts: { headers }, dir: tmpDir })
21
- const dirContent = await readdir(tmpDir)
22
- if (dirContent.length !== 1 || dirContent[0] !== 'package') {
23
- throw 'Invalid NPM package'
24
- }
25
- return join(tmpDir, 'package')
26
- }
@@ -1,80 +0,0 @@
1
- import { isAbsolute, join } from 'node:path'
2
- import * as fs from 'node:fs/promises'
3
- import { copy } from 'fs-extra'
4
- import { replaceFileContent, pathExists } from './fs'
5
- import { downloadPackage } from './npm'
6
- import { resourcesDir } from '../pathUtils'
7
- import { readYaml } from './yaml'
8
-
9
- const localTemplates: Record<string, string> = {
10
- ['@contember/template-workspace']: join(resourcesDir, 'templates/template-workspace'),
11
- ['@contember/template-project']: join(resourcesDir, 'templates/template-project'),
12
- }
13
- export const installTemplate = async (
14
- template: string,
15
- targetDir: string,
16
- requiredTemplateType: string,
17
- variables: Record<string, string> = {},
18
- ) => {
19
- let removeTemplate = () => {}
20
- if (localTemplates[template]) {
21
- template = localTemplates[template]
22
- }
23
- if (!isAbsolute(template)) {
24
- template = await downloadPackage(template)
25
- removeTemplate = async () => {
26
- await fs.unlink(template)
27
- }
28
- }
29
- const templateConfigFile = join(template, 'contember.template.yaml')
30
- if (!(await pathExists(templateConfigFile))) {
31
- throw `${template} is not a Contember template`
32
- }
33
- const config = (await readYaml(templateConfigFile)) as {
34
- type?: string
35
- remove?: string[]
36
- patchPackageJson?: boolean
37
- rename?: Record<string, string>
38
- copy?: Record<string, string>
39
- replaceVariables?: string[]
40
- }
41
- const nodeModulesDir = join(template, 'node_modules')
42
- const skippedFiles = new Set([...(config.remove || []).map(it => join(template, it)), templateConfigFile])
43
- await copy(template, targetDir, {
44
- filter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),
45
- })
46
- await removeTemplate()
47
-
48
- if (config.patchPackageJson) {
49
- await replaceFileContent(join(targetDir, 'package.json'), content => {
50
- const {
51
- name,
52
- version,
53
- 'scripts-template': scripts,
54
- scripts: _nullScripts,
55
- license,
56
- ...json
57
- } = JSON.parse(content)
58
- return JSON.stringify({ scripts, ...json }, null, ' ')
59
- })
60
- }
61
- for (const [source, target] of Object.entries(config.rename || {})) {
62
- await fs.rename(join(targetDir, source), join(targetDir, target))
63
- }
64
- for (const [source, target] of Object.entries(config.copy || {})) {
65
- await copy(join(targetDir, source), join(targetDir, target))
66
- }
67
-
68
- for (const file of config.replaceVariables || []) {
69
- const path = join(targetDir, file)
70
- if (!(await pathExists(path))) {
71
- continue
72
- }
73
- await replaceFileContent(path, content =>
74
- Object.entries(variables).reduce(
75
- (content, [key, value]) => content.replace(new RegExp(`\{${key}\}`, 'g'), value),
76
- content,
77
- ),
78
- )
79
- }
80
- }
@@ -1,7 +0,0 @@
1
- declare module 'download-tarball' {
2
- export default function downloadTarball(args: {
3
- url: string
4
- dir: string
5
- gotOpts?: { headers?: Record<string, any> }
6
- }): Promise<void>
7
- }
@@ -1,3 +0,0 @@
1
- declare module 'get-package-json-from-registry' {
2
- export default function getPackageJson(packageName: string): any
3
- }
@@ -1,7 +0,0 @@
1
- declare module 'registry-info' {
2
- export default function getRegistryInfo(scope: string | null): {
3
- registryUrl: string
4
- authToken: string
5
- authorization: string
6
- }
7
- }