@contember/create 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.
- package/dist/src/commands/WorkspaceCreateCommand.d.ts +4 -3
- package/dist/src/commands/WorkspaceCreateCommand.d.ts.map +1 -1
- package/dist/src/commands/WorkspaceCreateCommand.js +10 -4
- package/dist/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/src/lib/FileSystem.d.ts +14 -0
- package/dist/src/lib/FileSystem.d.ts.map +1 -0
- package/dist/src/lib/FileSystem.js +54 -0
- package/dist/src/lib/FileSystem.js.map +1 -0
- package/dist/src/lib/PackageDownloader.d.ts +7 -0
- package/dist/src/lib/PackageDownloader.d.ts.map +1 -0
- package/dist/src/lib/PackageDownloader.js +32 -0
- package/dist/src/lib/PackageDownloader.js.map +1 -0
- package/dist/src/lib/TemplateInstaller.d.ts +13 -0
- package/dist/src/lib/TemplateInstaller.d.ts.map +1 -0
- package/dist/src/lib/TemplateInstaller.js +75 -0
- package/dist/src/lib/TemplateInstaller.js.map +1 -0
- package/dist/src/lib/pathUtils.d.ts +3 -0
- package/dist/src/lib/pathUtils.d.ts.map +1 -0
- package/dist/src/lib/pathUtils.js +7 -0
- package/dist/src/lib/pathUtils.js.map +1 -0
- package/dist/src/run.js +7 -3
- package/dist/src/run.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -3
- package/resources/templates/template-workspace/.gitignore.dist +3 -0
- package/resources/templates/template-workspace/admin/.env.development +3 -0
- package/resources/templates/template-workspace/admin/.env.production +3 -0
- package/resources/templates/template-workspace/admin/app/components/layout.tsx +32 -0
- package/resources/templates/template-workspace/admin/app/components/logo.tsx +16 -0
- package/resources/templates/template-workspace/admin/app/components/navigation.tsx +1 -0
- package/resources/templates/template-workspace/admin/app/config.ts +27 -0
- package/resources/templates/template-workspace/admin/app/index.html +15 -0
- package/resources/templates/template-workspace/admin/app/index.tsx +40 -0
- package/resources/templates/template-workspace/admin/app/pages/index.tsx +5 -0
- package/resources/templates/template-workspace/admin/index.css +53 -0
- package/resources/templates/template-workspace/admin/index.html +13 -0
- package/resources/templates/template-workspace/admin/index.tsx +268 -0
- package/resources/templates/template-workspace/admin/lib/binding/binding.tsx +45 -0
- package/resources/templates/template-workspace/admin/lib/binding/delete.tsx +43 -0
- package/resources/templates/template-workspace/admin/lib/binding/hooks.tsx +71 -0
- package/resources/templates/template-workspace/admin/lib/binding/identity.tsx +19 -0
- package/resources/templates/template-workspace/admin/lib/binding/index.ts +5 -0
- package/resources/templates/template-workspace/admin/lib/binding/persist.tsx +70 -0
- package/resources/templates/template-workspace/admin/lib/block-repeater/block-repeater.tsx +224 -0
- package/resources/templates/template-workspace/admin/lib/block-repeater/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/board/board.tsx +240 -0
- package/resources/templates/template-workspace/admin/lib/board/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/buttons/back-button.tsx +20 -0
- package/resources/templates/template-workspace/admin/lib/buttons/index.ts +2 -0
- package/resources/templates/template-workspace/admin/lib/buttons/link-back-button.tsx +21 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/cells.tsx +64 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/column-header.tsx +65 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/columns.tsx +166 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/elements.tsx +42 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/empty.tsx +8 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/export.tsx +17 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/boolean.tsx +76 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/common.tsx +29 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/date.tsx +153 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/enum.tsx +115 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/index.ts +7 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/mobile.tsx +19 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/number.tsx +100 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/relation.tsx +180 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/text.tsx +121 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/grid.tsx +61 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/index.ts +16 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/layout-switcher.tsx +32 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/loader.tsx +10 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/pagination.tsx +103 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/table.tsx +69 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/tiles.tsx +24 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/toolbar.tsx +66 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/ui.tsx +153 -0
- package/resources/templates/template-workspace/admin/lib/dev/index.ts +2 -0
- package/resources/templates/template-workspace/admin/lib/dev/login-panel.tsx +56 -0
- package/resources/templates/template-workspace/admin/lib/dev/todo.tsx +14 -0
- package/resources/templates/template-workspace/admin/lib/dict.ts +324 -0
- package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +135 -0
- package/resources/templates/template-workspace/admin/lib/dimensions/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/editor/block-editor.tsx +111 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/baseEditorPlugins.tsx +66 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/buttons.tsx +83 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/editor-block-toolbar.tsx +17 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/editor-canvas.tsx +30 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/editor-editable-canvas.tsx +50 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/editor-inline-toolbar.tsx +63 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/AnchorRenderer.tsx +36 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/BlockElement.tsx +48 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/HeadingRenderer.tsx +48 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +28 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/ListItemRenderer.tsx +13 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/OrderedListRenderer.tsx +13 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/ParagraphRenderer.tsx +15 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/ScrollTargetRenderer.tsx +30 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/TableCellElementRenderer.tsx +20 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/TableElementRenderer.tsx +96 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/TableRowElementRenderer.tsx +15 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +13 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/index.ts +6 -0
- package/resources/templates/template-workspace/admin/lib/editor/editor-block.tsx +96 -0
- package/resources/templates/template-workspace/admin/lib/editor/index.ts +5 -0
- package/resources/templates/template-workspace/admin/lib/editor/plugins.tsx +36 -0
- package/resources/templates/template-workspace/admin/lib/editor/rich-text.tsx +54 -0
- package/resources/templates/template-workspace/admin/lib/editor/sortable-block.tsx +51 -0
- package/resources/templates/template-workspace/admin/lib/errors/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/errors/use-error-formatter.ts +26 -0
- package/resources/templates/template-workspace/admin/lib/form/container.tsx +63 -0
- package/resources/templates/template-workspace/admin/lib/form/index.ts +5 -0
- package/resources/templates/template-workspace/admin/lib/form/inputs.tsx +99 -0
- package/resources/templates/template-workspace/admin/lib/form/select.tsx +123 -0
- package/resources/templates/template-workspace/admin/lib/form/ui.tsx +29 -0
- package/resources/templates/template-workspace/admin/lib/form/upload.tsx +243 -0
- package/resources/templates/template-workspace/admin/lib/formatting/formatting.ts +62 -0
- package/resources/templates/template-workspace/admin/lib/formatting/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/images/formatImageResizeUrl.ts +23 -0
- package/resources/templates/template-workspace/admin/lib/images/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/layout/index.ts +2 -0
- package/resources/templates/template-workspace/admin/lib/layout/layout.tsx +167 -0
- package/resources/templates/template-workspace/admin/lib/layout/slots.tsx +24 -0
- package/resources/templates/template-workspace/admin/lib/outdated-application-dialog/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +41 -0
- package/resources/templates/template-workspace/admin/lib/repeater/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/repeater/repeater.tsx +142 -0
- package/resources/templates/template-workspace/admin/lib/select/create-new.tsx +34 -0
- package/resources/templates/template-workspace/admin/lib/select/filter.tsx +13 -0
- package/resources/templates/template-workspace/admin/lib/select/highlight.tsx +16 -0
- package/resources/templates/template-workspace/admin/lib/select/index.ts +7 -0
- package/resources/templates/template-workspace/admin/lib/select/list.tsx +49 -0
- package/resources/templates/template-workspace/admin/lib/select/multi-select.tsx +95 -0
- package/resources/templates/template-workspace/admin/lib/select/pagination.tsx +48 -0
- package/resources/templates/template-workspace/admin/lib/select/select.tsx +87 -0
- package/resources/templates/template-workspace/admin/lib/select/sortable-select.tsx +129 -0
- package/resources/templates/template-workspace/admin/lib/select/ui.tsx +80 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/change-my-password.tsx +40 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/common.tsx +94 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/create-api-key.tsx +39 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/index.ts +8 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/invite.tsx +46 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/login.tsx +52 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/memberships-control.tsx +128 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/password-reset-request.tsx +31 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/password-reset.tsx +44 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/update-project-member.tsx +32 -0
- package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInvite.ts +28 -0
- package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInviteUser.tsx +45 -0
- package/resources/templates/template-workspace/admin/lib/tenant/index.ts +3 -0
- package/resources/templates/template-workspace/admin/lib/tenant/listing/api-key-list.tsx +25 -0
- package/resources/templates/template-workspace/admin/lib/tenant/listing/index.ts +4 -0
- package/resources/templates/template-workspace/admin/lib/tenant/listing/member-delete-dialog.tsx +38 -0
- package/resources/templates/template-workspace/admin/lib/tenant/listing/member-list.tsx +147 -0
- package/resources/templates/template-workspace/admin/lib/tenant/listing/person-list.tsx +25 -0
- package/resources/templates/template-workspace/admin/lib/tenant/otp/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/tenant/otp/otp-setup.tsx +146 -0
- package/resources/templates/template-workspace/admin/lib/toast/index.ts +2 -0
- package/resources/templates/template-workspace/admin/lib/toast/toast.tsx +112 -0
- package/resources/templates/template-workspace/admin/lib/toast/toaster.tsx +104 -0
- package/resources/templates/template-workspace/admin/lib/ui/alert-dialog.tsx +59 -0
- package/resources/templates/template-workspace/admin/lib/ui/button.tsx +29 -0
- package/resources/templates/template-workspace/admin/lib/ui/card.tsx +25 -0
- package/resources/templates/template-workspace/admin/lib/ui/dialog.tsx +51 -0
- package/resources/templates/template-workspace/admin/lib/ui/divider.tsx +11 -0
- package/resources/templates/template-workspace/admin/lib/ui/dropdown.tsx +108 -0
- package/resources/templates/template-workspace/admin/lib/ui/input.tsx +62 -0
- package/resources/templates/template-workspace/admin/lib/ui/label.tsx +7 -0
- package/resources/templates/template-workspace/admin/lib/ui/loader.tsx +30 -0
- package/resources/templates/template-workspace/admin/lib/ui/menu.tsx +103 -0
- package/resources/templates/template-workspace/admin/lib/ui/overlay.tsx +33 -0
- package/resources/templates/template-workspace/admin/lib/ui/popover.tsx +31 -0
- package/resources/templates/template-workspace/admin/lib/ui/progress.tsx +25 -0
- package/resources/templates/template-workspace/admin/lib/ui/scroll-area.tsx +45 -0
- package/resources/templates/template-workspace/admin/lib/ui/sheet.tsx +67 -0
- package/resources/templates/template-workspace/admin/lib/ui/sortable.tsx +13 -0
- package/resources/templates/template-workspace/admin/lib/ui/switch.tsx +10 -0
- package/resources/templates/template-workspace/admin/lib/ui/table.tsx +46 -0
- package/resources/templates/template-workspace/admin/lib/ui/textarea.tsx +18 -0
- package/resources/templates/template-workspace/admin/lib/ui/toggle-group.tsx +44 -0
- package/resources/templates/template-workspace/admin/lib/ui/toggle.tsx +29 -0
- package/resources/templates/template-workspace/admin/lib/ui/tooltip.tsx +24 -0
- package/resources/templates/template-workspace/admin/lib/upload/dropzone.tsx +21 -0
- package/resources/templates/template-workspace/admin/lib/upload/index.ts +3 -0
- package/resources/templates/template-workspace/admin/lib/upload/repeater.tsx +12 -0
- package/resources/templates/template-workspace/admin/lib/upload/ui.tsx +57 -0
- package/resources/templates/template-workspace/admin/lib/upload/upload-progress.tsx +130 -0
- package/resources/templates/template-workspace/admin/lib/upload/view.tsx +219 -0
- package/resources/templates/template-workspace/admin/lib/utils/cn.ts +4 -0
- package/resources/templates/template-workspace/admin/lib/utils/dict-format.tsx +3 -0
- package/resources/templates/template-workspace/admin/lib/utils/format-image-resize-url.ts +17 -0
- package/resources/templates/template-workspace/admin/lib/utils/formatting.ts +60 -0
- package/resources/templates/template-workspace/admin/lib/utils/index.ts +2 -0
- package/resources/templates/template-workspace/admin/lib/utils/uic.tsx +79 -0
- package/resources/templates/template-workspace/admin/package.json +63 -0
- package/resources/templates/template-workspace/admin/postcss.config.js +6 -0
- package/resources/templates/template-workspace/admin/public/favicon.png +0 -0
- package/resources/templates/template-workspace/admin/tailwind.config.js +73 -0
- package/resources/templates/template-workspace/admin/tsconfig.json +23 -0
- package/resources/templates/template-workspace/admin/vite-env.d.ts +7 -0
- package/resources/templates/template-workspace/admin/vite.config.ts +39 -0
- package/resources/templates/template-workspace/api/index.ts +7 -0
- package/resources/templates/template-workspace/api/migrations/.gitkeep +1 -0
- package/resources/templates/template-workspace/api/model/index.ts +1 -0
- package/resources/templates/template-workspace/api/package.json +16 -0
- package/resources/templates/template-workspace/api/tsconfig.json +10 -0
- package/resources/templates/template-workspace/biome.json +45 -0
- package/resources/templates/template-workspace/client/package.json +16 -0
- package/resources/templates/template-workspace/client/src/index.ts +1 -0
- package/resources/templates/template-workspace/client/tsconfig.json +9 -0
- package/resources/templates/template-workspace/contember.template.yaml +7 -0
- package/resources/templates/template-workspace/docker-compose.yaml +124 -0
- package/resources/templates/template-workspace/package.json +32 -0
- package/resources/templates/template-workspace/scripts/generate-client.sh +8 -0
- package/resources/templates/template-workspace/tsconfig.json +9 -0
- package/resources/templates/template-workspace/tsconfig.settings.json +15 -0
- package/src/commands/WorkspaceCreateCommand.ts +15 -6
- package/src/lib/FileSystem.ts +24 -0
- package/src/lib/PackageDownloader.ts +33 -0
- package/src/lib/TemplateInstaller.ts +102 -0
- package/src/lib/pathUtils.ts +4 -0
- package/src/run.ts +14 -5
- package/tsconfig.settings.json +5 -1
- package/types/download-tarball/index.d.ts +7 -0
- package/types/get-package-json-from-registry/index.d.ts +3 -0
- package/types/registry-info/index.d.ts +7 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Command, CommandConfiguration, Input } from '@contember/cli-common';
|
|
2
|
+
import { TemplateInstaller } from '../lib/TemplateInstaller';
|
|
2
3
|
type Args = {
|
|
3
4
|
workspaceName: string;
|
|
4
5
|
};
|
|
5
|
-
type Options = {
|
|
6
|
-
template?: string;
|
|
7
|
-
};
|
|
6
|
+
type Options = {};
|
|
8
7
|
export declare class WorkspaceCreateCommand extends Command<Args, Options> {
|
|
8
|
+
private readonly templateInstaller;
|
|
9
|
+
constructor(templateInstaller: TemplateInstaller);
|
|
9
10
|
protected configure(configuration: CommandConfiguration<Args, Options>): void;
|
|
10
11
|
protected execute(input: Input<Args, Options>): Promise<void>;
|
|
11
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspaceCreateCommand.d.ts","sourceRoot":"","sources":["../../../src/commands/WorkspaceCreateCommand.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"WorkspaceCreateCommand.d.ts","sourceRoot":"","sources":["../../../src/commands/WorkspaceCreateCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAqB,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAG/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,KAAK,IAAI,GAAG;IACX,aAAa,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,KAAK,OAAO,GAAG,EACd,CAAA;AAED,qBAAa,sBAAuB,SAAQ,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;IAEhE,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,iBAAiB;IAKtD,SAAS,CAAC,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI;cAK7D,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAUnE"}
|
|
@@ -8,6 +8,10 @@ const cli_common_1 = require("@contember/cli-common");
|
|
|
8
8
|
const node_path_1 = require("node:path");
|
|
9
9
|
const chalk_1 = __importDefault(require("chalk"));
|
|
10
10
|
class WorkspaceCreateCommand extends cli_common_1.Command {
|
|
11
|
+
constructor(templateInstaller) {
|
|
12
|
+
super();
|
|
13
|
+
this.templateInstaller = templateInstaller;
|
|
14
|
+
}
|
|
11
15
|
configure(configuration) {
|
|
12
16
|
configuration.description('Creates a new Contember workspace');
|
|
13
17
|
configuration.argument('workspaceName');
|
|
@@ -15,8 +19,10 @@ class WorkspaceCreateCommand extends cli_common_1.Command {
|
|
|
15
19
|
async execute(input) {
|
|
16
20
|
const workspaceName = input.getArgument('workspaceName');
|
|
17
21
|
const workspaceDirectory = (0, node_path_1.join)(process.cwd(), workspaceName);
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
await this.templateInstaller.installTemplate('@contember/template-workspace', workspaceDirectory, {
|
|
23
|
+
version: (0, cli_common_1.getPackageVersion)(),
|
|
24
|
+
projectName: workspaceName,
|
|
25
|
+
});
|
|
20
26
|
// eslint-disable-next-line no-console
|
|
21
27
|
console.log(createDocs(workspaceDirectory, workspaceName));
|
|
22
28
|
}
|
|
@@ -29,10 +35,10 @@ You can now enter this directory:
|
|
|
29
35
|
$ ${chalk_1.default.greenBright(`cd ${workspaceName}`)}
|
|
30
36
|
|
|
31
37
|
Install NPM dependencies:
|
|
32
|
-
$ ${chalk_1.default.greenBright(`
|
|
38
|
+
$ ${chalk_1.default.greenBright(`yarn install`)}
|
|
33
39
|
|
|
34
40
|
And start the Contember stack:
|
|
35
|
-
$ ${chalk_1.default.greenBright('
|
|
41
|
+
$ ${chalk_1.default.greenBright('yarn start')}
|
|
36
42
|
|
|
37
43
|
The following services will be accessible:
|
|
38
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspaceCreateCommand.js","sourceRoot":"","sources":["../../../src/commands/WorkspaceCreateCommand.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"WorkspaceCreateCommand.js","sourceRoot":"","sources":["../../../src/commands/WorkspaceCreateCommand.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA+F;AAC/F,yCAAgC;AAChC,kDAAyB;AAUzB,MAAa,sBAAuB,SAAQ,oBAAsB;IACjE,YACkB,iBAAoC;QAErD,KAAK,EAAE,CAAA;QAFU,sBAAiB,GAAjB,iBAAiB,CAAmB;IAGtD,CAAC;IAES,SAAS,CAAC,aAAkD;QACrE,aAAa,CAAC,WAAW,CAAC,mCAAmC,CAAC,CAAA;QAC9D,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAA;IACxC,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,KAA2B;QAClD,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,CAAA;QACxD,MAAM,kBAAkB,GAAG,IAAA,gBAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAA;QAC7D,MAAM,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,+BAA+B,EAAE,kBAAkB,EAAE;YACjG,OAAO,EAAE,IAAA,8BAAiB,GAAE;YAC5B,WAAW,EAAE,aAAa;SAC1B,CAAC,CAAA;QACF,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC,CAAA;IAC3D,CAAC;CACD;AAtBD,wDAsBC;AAED,MAAM,UAAU,GAAG,CAAC,kBAA0B,EAAE,aAAqB,EAAE,EAAE,CAAC;oEACN,kBAAkB;;;IAGlF,eAAK,CAAC,WAAW,CAAC,MAAM,aAAa,EAAE,CAAC;;;IAGxC,eAAK,CAAC,WAAW,CAAC,cAAc,CAAC;;;IAGjC,eAAK,CAAC,WAAW,CAAC,YAAY,CAAC;;;;;;;;;;;;CAYlC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import * as fs from 'node:fs/promises';
|
|
3
|
+
import { copy } from 'fs-extra';
|
|
4
|
+
export declare class FileSystem {
|
|
5
|
+
readFile: typeof fs.readFile;
|
|
6
|
+
writeFile: typeof fs.writeFile;
|
|
7
|
+
rename: typeof fs.rename;
|
|
8
|
+
readDir: typeof fs.readdir;
|
|
9
|
+
copy: typeof copy;
|
|
10
|
+
unlink: typeof fs.unlink;
|
|
11
|
+
pathExists: (path: string) => Promise<boolean>;
|
|
12
|
+
createTempDir: () => Promise<string>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=FileSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../../../src/lib/FileSystem.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAG/B,qBAAa,UAAU;IACtB,QAAQ,qBAAc;IACtB,SAAS,sBAAe;IACxB,MAAM,mBAAY;IAClB,OAAO,oBAAa;IACpB,IAAI,cAAO;IACX,MAAM,mBAAY;IAClB,UAAU,SAAgB,MAAM,sBAO/B;IACD,aAAa,wBAEZ;CACD"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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.FileSystem = void 0;
|
|
27
|
+
const fs = __importStar(require("node:fs/promises"));
|
|
28
|
+
const promises_1 = require("node:fs/promises");
|
|
29
|
+
const fs_extra_1 = require("fs-extra");
|
|
30
|
+
const node_os_1 = require("node:os");
|
|
31
|
+
class FileSystem {
|
|
32
|
+
constructor() {
|
|
33
|
+
this.readFile = fs.readFile;
|
|
34
|
+
this.writeFile = fs.writeFile;
|
|
35
|
+
this.rename = fs.rename;
|
|
36
|
+
this.readDir = fs.readdir;
|
|
37
|
+
this.copy = fs_extra_1.copy;
|
|
38
|
+
this.unlink = fs.unlink;
|
|
39
|
+
this.pathExists = async (path) => {
|
|
40
|
+
try {
|
|
41
|
+
await (0, promises_1.access)(path);
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
catch (_a) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this.createTempDir = async () => {
|
|
49
|
+
return await fs.mkdtemp((0, node_os_1.tmpdir)());
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.FileSystem = FileSystem;
|
|
54
|
+
//# sourceMappingURL=FileSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.js","sourceRoot":"","sources":["../../../src/lib/FileSystem.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAsC;AACtC,+CAAyC;AACzC,uCAA+B;AAC/B,qCAAgC;AAEhC,MAAa,UAAU;IAAvB;QACC,aAAQ,GAAG,EAAE,CAAC,QAAQ,CAAA;QACtB,cAAS,GAAG,EAAE,CAAC,SAAS,CAAA;QACxB,WAAM,GAAG,EAAE,CAAC,MAAM,CAAA;QAClB,YAAO,GAAG,EAAE,CAAC,OAAO,CAAA;QACpB,SAAI,GAAG,eAAI,CAAA;QACX,WAAM,GAAG,EAAE,CAAC,MAAM,CAAA;QAClB,eAAU,GAAG,KAAK,EAAE,IAAY,EAAE,EAAE;YACnC,IAAI;gBACH,MAAM,IAAA,iBAAM,EAAC,IAAI,CAAC,CAAA;gBAClB,OAAO,IAAI,CAAA;aACX;YAAC,WAAM;gBACP,OAAO,KAAK,CAAA;aACZ;QACF,CAAC,CAAA;QACD,kBAAa,GAAG,KAAK,IAAI,EAAE;YAC1B,OAAO,MAAM,EAAE,CAAC,OAAO,CAAC,IAAA,gBAAM,GAAE,CAAC,CAAA;QAClC,CAAC,CAAA;IACF,CAAC;CAAA;AAlBD,gCAkBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PackageDownloader.d.ts","sourceRoot":"","sources":["../../../src/lib/PackageDownloader.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,qBAAa,iBAAiB;IAG5B,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,UAAU;IAIhC,eAAe,YAAmB,MAAM,KAAG,QAAQ,MAAM,CAAC,CAiBzD;CACD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PackageDownloader = void 0;
|
|
7
|
+
const npm_package_arg_1 = __importDefault(require("npm-package-arg"));
|
|
8
|
+
const registry_info_1 = __importDefault(require("registry-info"));
|
|
9
|
+
const get_package_json_from_registry_1 = __importDefault(require("get-package-json-from-registry"));
|
|
10
|
+
const node_path_1 = require("node:path");
|
|
11
|
+
const download_tarball_1 = __importDefault(require("download-tarball"));
|
|
12
|
+
class PackageDownloader {
|
|
13
|
+
constructor(fs) {
|
|
14
|
+
this.fs = fs;
|
|
15
|
+
this.downloadPackage = async (pkgName) => {
|
|
16
|
+
const { scope } = (0, npm_package_arg_1.default)(pkgName);
|
|
17
|
+
const { authorization } = (0, registry_info_1.default)(scope);
|
|
18
|
+
const headers = authorization ? { authorization } : {};
|
|
19
|
+
const pkg = await (0, get_package_json_from_registry_1.default)(pkgName);
|
|
20
|
+
const { dist: { tarball }, } = pkg;
|
|
21
|
+
const tmpDir = await this.fs.createTempDir();
|
|
22
|
+
await (0, download_tarball_1.default)({ url: tarball, gotOpts: { headers }, dir: tmpDir });
|
|
23
|
+
const dirContent = await this.fs.readDir(tmpDir);
|
|
24
|
+
if (dirContent.length !== 1 || dirContent[0] !== 'package') {
|
|
25
|
+
throw 'Invalid NPM package';
|
|
26
|
+
}
|
|
27
|
+
return (0, node_path_1.join)(tmpDir, 'package');
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.PackageDownloader = PackageDownloader;
|
|
32
|
+
//# sourceMappingURL=PackageDownloader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PackageDownloader.js","sourceRoot":"","sources":["../../../src/lib/PackageDownloader.ts"],"names":[],"mappings":";;;;;;AAAA,sEAAiC;AACjC,kEAA2C;AAC3C,oGAA2D;AAC3D,yCAAgC;AAChC,wEAA8C;AAG9C,MAAa,iBAAiB;IAE7B,YACkB,EAAc;QAAd,OAAE,GAAF,EAAE,CAAY;QAIhC,oBAAe,GAAG,KAAK,EAAE,OAAe,EAAmB,EAAE;YAC5D,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,yBAAG,EAAC,OAAO,CAAC,CAAA;YAC9B,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,uBAAe,EAAC,KAAK,CAAC,CAAA;YAChD,MAAM,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;YAEtD,MAAM,GAAG,GAAG,MAAM,IAAA,wCAAc,EAAC,OAAO,CAAC,CAAA;YACzC,MAAM,EACL,IAAI,EAAE,EAAE,OAAO,EAAE,GACjB,GAAG,GAAG,CAAA;YAEP,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAA;YAC5C,MAAM,IAAA,0BAAe,EAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA;YAC1E,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YAChD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;gBAC3D,MAAM,qBAAqB,CAAA;aAC3B;YACD,OAAO,IAAA,gBAAI,EAAC,MAAM,EAAE,SAAS,CAAC,CAAA;QAC/B,CAAC,CAAA;IAnBD,CAAC;CAoBD;AAzBD,8CAyBC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PackageDownloader } from './PackageDownloader';
|
|
2
|
+
import { FileSystem } from './FileSystem';
|
|
3
|
+
export declare class TemplateInstaller {
|
|
4
|
+
private readonly resourceDir;
|
|
5
|
+
private readonly packageDownloader;
|
|
6
|
+
private readonly fs;
|
|
7
|
+
private localTemplates;
|
|
8
|
+
constructor(resourceDir: string, packageDownloader: PackageDownloader, fs: FileSystem);
|
|
9
|
+
installTemplate: (template: string, targetDir: string, variables?: Record<string, string>) => Promise<void>;
|
|
10
|
+
private replaceFileContent;
|
|
11
|
+
private readYaml;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=TemplateInstaller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplateInstaller.d.ts","sourceRoot":"","sources":["../../../src/lib/TemplateInstaller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAIzC,qBAAa,iBAAiB;IAO5B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,EAAE;IAPpB,OAAO,CAAC,cAAc,CAErB;gBAGiB,WAAW,EAAE,MAAM,EACnB,iBAAiB,EAAE,iBAAiB,EACpC,EAAE,EAAE,UAAU;IAIhC,eAAe,aACJ,MAAM,aACL,MAAM,cACN,OAAO,MAAM,EAAE,MAAM,CAAC,mBAmEjC;IAED,OAAO,CAAC,kBAAkB,CAIzB;IAED,OAAO,CAAC,QAAQ,CAGf;CACD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TemplateInstaller = void 0;
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
9
|
+
class TemplateInstaller {
|
|
10
|
+
constructor(resourceDir, packageDownloader, fs) {
|
|
11
|
+
this.resourceDir = resourceDir;
|
|
12
|
+
this.packageDownloader = packageDownloader;
|
|
13
|
+
this.fs = fs;
|
|
14
|
+
this.localTemplates = {
|
|
15
|
+
['@contember/template-workspace']: (0, node_path_1.join)(this.resourceDir, 'templates/template-workspace'),
|
|
16
|
+
};
|
|
17
|
+
this.installTemplate = async (template, targetDir, variables = {}) => {
|
|
18
|
+
let removeTemplate = () => {
|
|
19
|
+
};
|
|
20
|
+
if (this.localTemplates[template]) {
|
|
21
|
+
template = this.localTemplates[template];
|
|
22
|
+
}
|
|
23
|
+
if (!(0, node_path_1.isAbsolute)(template)) {
|
|
24
|
+
template = await this.packageDownloader.downloadPackage(template);
|
|
25
|
+
removeTemplate = async () => {
|
|
26
|
+
await this.fs.unlink(template);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const templateConfigFile = (0, node_path_1.join)(template, 'contember.template.yaml');
|
|
30
|
+
if (!(await this.fs.pathExists(templateConfigFile))) {
|
|
31
|
+
throw `${template} is not a Contember template`;
|
|
32
|
+
}
|
|
33
|
+
const config = (await this.readYaml(templateConfigFile));
|
|
34
|
+
const nodeModulesDir = (0, node_path_1.join)(template, 'node_modules');
|
|
35
|
+
const skippedFiles = new Set([...(config.remove || []).map(it => (0, node_path_1.join)(template, it)), templateConfigFile]);
|
|
36
|
+
if (await this.fs.pathExists(targetDir)) {
|
|
37
|
+
throw `${targetDir} already exists`;
|
|
38
|
+
}
|
|
39
|
+
await this.fs.copy(template, targetDir, {
|
|
40
|
+
filter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),
|
|
41
|
+
});
|
|
42
|
+
await removeTemplate();
|
|
43
|
+
if (config.patchPackageJson) {
|
|
44
|
+
await this.replaceFileContent((0, node_path_1.join)(targetDir, 'package.json'), content => {
|
|
45
|
+
const { name, version, 'scripts-template': scripts, scripts: _nullScripts, license, ...json } = JSON.parse(content);
|
|
46
|
+
return JSON.stringify({ scripts, ...json }, null, ' ');
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
for (const [source, target] of Object.entries(config.rename || {})) {
|
|
50
|
+
await this.fs.rename((0, node_path_1.join)(targetDir, source), (0, node_path_1.join)(targetDir, target));
|
|
51
|
+
}
|
|
52
|
+
for (const [source, target] of Object.entries(config.copy || {})) {
|
|
53
|
+
await this.fs.copy((0, node_path_1.join)(targetDir, source), (0, node_path_1.join)(targetDir, target));
|
|
54
|
+
}
|
|
55
|
+
for (const file of config.replaceVariables || []) {
|
|
56
|
+
const path = (0, node_path_1.join)(targetDir, file);
|
|
57
|
+
if (!(await this.fs.pathExists(path))) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
await this.replaceFileContent(path, content => Object.entries(variables).reduce((content, [key, value]) => content.replace(new RegExp(`\{${key}\}`, 'g'), value), content));
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
this.replaceFileContent = async (path, replacer) => {
|
|
64
|
+
const content = await this.fs.readFile(path, { encoding: 'utf8' });
|
|
65
|
+
const newContent = replacer(content);
|
|
66
|
+
await this.fs.writeFile(path, newContent, { encoding: 'utf8' });
|
|
67
|
+
};
|
|
68
|
+
this.readYaml = async (path) => {
|
|
69
|
+
const content = await this.fs.readFile(path, { encoding: 'utf8' });
|
|
70
|
+
return js_yaml_1.default.load(content);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.TemplateInstaller = TemplateInstaller;
|
|
75
|
+
//# sourceMappingURL=TemplateInstaller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplateInstaller.js","sourceRoot":"","sources":["../../../src/lib/TemplateInstaller.ts"],"names":[],"mappings":";;;;;;AAAA,yCAA4C;AAG5C,sDAA4B;AAG5B,MAAa,iBAAiB;IAM7B,YACkB,WAAmB,EACnB,iBAAoC,EACpC,EAAc;QAFd,gBAAW,GAAX,WAAW,CAAQ;QACnB,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,OAAE,GAAF,EAAE,CAAY;QAPxB,mBAAc,GAA2B;YAChD,CAAC,+BAA+B,CAAC,EAAE,IAAA,gBAAI,EAAC,IAAI,CAAC,WAAW,EAAE,8BAA8B,CAAC;SACzF,CAAA;QASD,oBAAe,GAAG,KAAK,EACtB,QAAgB,EAChB,SAAiB,EACjB,YAAoC,EAAE,EACrC,EAAE;YACH,IAAI,cAA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0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathUtils.d.ts","sourceRoot":"","sources":["../../../src/lib/pathUtils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,QAAsE,CAAA;AAC9F,eAAO,MAAM,YAAY,QAAmC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resourcesDir = exports.packageRoot = void 0;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
exports.packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || (0, node_path_1.join)(__dirname, '../../');
|
|
6
|
+
exports.resourcesDir = (0, node_path_1.join)(exports.packageRoot, './resources');
|
|
7
|
+
//# sourceMappingURL=pathUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathUtils.js","sourceRoot":"","sources":["../../../src/lib/pathUtils.ts"],"names":[],"mappings":";;;AAAA,yCAAgC;AAEnB,QAAA,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,IAAI,IAAA,gBAAI,EAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;AACjF,QAAA,YAAY,GAAG,IAAA,gBAAI,EAAC,mBAAW,EAAE,aAAa,CAAC,CAAA"}
|
package/dist/src/run.js
CHANGED
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const cli_common_1 = require("@contember/cli-common");
|
|
5
5
|
const commands_1 = require("./commands");
|
|
6
|
+
const TemplateInstaller_1 = require("./lib/TemplateInstaller");
|
|
7
|
+
const pathUtils_1 = require("./lib/pathUtils");
|
|
8
|
+
const PackageDownloader_1 = require("./lib/PackageDownloader");
|
|
9
|
+
const FileSystem_1 = require("./lib/FileSystem");
|
|
6
10
|
(async () => {
|
|
7
11
|
const commandManager = new cli_common_1.CommandManager({
|
|
8
|
-
['workspace']: () => new commands_1.WorkspaceCreateCommand(),
|
|
12
|
+
['workspace']: () => new commands_1.WorkspaceCreateCommand(new TemplateInstaller_1.TemplateInstaller(pathUtils_1.resourcesDir, new PackageDownloader_1.PackageDownloader(new FileSystem_1.FileSystem()), new FileSystem_1.FileSystem())),
|
|
9
13
|
});
|
|
10
14
|
const nodeVersion = process.version.match(/^v?(\d+)\..+$/);
|
|
11
|
-
if (nodeVersion && Number(nodeVersion[1]) <
|
|
12
|
-
throw `Node >=
|
|
15
|
+
if (nodeVersion && Number(nodeVersion[1]) < 18) {
|
|
16
|
+
throw `Node >= 18 is required`;
|
|
13
17
|
}
|
|
14
18
|
const app = new cli_common_1.Application(commandManager, `Contember installer`);
|
|
15
19
|
await app.runCommand('workspace', process.argv.slice(2));
|
package/dist/src/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/run.ts"],"names":[],"mappings":";;;AACA,sDAAmE;AACnE,
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/run.ts"],"names":[],"mappings":";;;AACA,sDAAmE;AACnE,yCAAmD;AACnD,+DAA2D;AAC3D,+CAA8C;AAC9C,+DAA2D;AAC3D,iDAA6C;AAE7C,CAAC,KAAK,IAAI,EAAE;IACX,MAAM,cAAc,GAAG,IAAI,2BAAc,CAAC;QACzC,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,iCAAsB,CAAC,IAAI,qCAAiB,CACpE,wBAAY,EACZ,IAAI,qCAAiB,CAAC,IAAI,uBAAU,EAAE,CAAC,EACvC,IAAI,uBAAU,EAAE,CAChB,CAAC;KACF,CAAC,CAAA;IAEF,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;IAC1D,IAAI,WAAW,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE;QAC/C,MAAM,wBAAwB,CAAA;KAC9B;IACD,MAAM,GAAG,GAAG,IAAI,wBAAW,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAA;IAClE,MAAM,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AACzD,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACd,sCAAsC;IACtC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IACd,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAChB,CAAC,CAAC,CAAA"}
|