@contember/create 2.0.0-alpha.9 → 2.0.0-beta.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/dist/development/run.cjs +0 -2
- package/dist/development/run.cjs.map +1 -1
- package/dist/development/run.js +0 -2
- package/dist/development/run.js.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/development/src/lib/FileSystem.cjs.map +1 -1
- package/dist/development/src/lib/FileSystem.js.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.cjs +1 -8
- package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.js +2 -9
- package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/development/src/lib/version.cjs.map +1 -1
- package/dist/development/src/paths.cjs +3 -1
- package/dist/development/src/paths.cjs.map +1 -1
- package/dist/development/src/paths.js +4 -2
- package/dist/development/src/paths.js.map +1 -1
- package/dist/production/run.cjs +0 -2
- package/dist/production/run.cjs.map +1 -1
- package/dist/production/run.js +0 -2
- package/dist/production/run.js.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/production/src/lib/FileSystem.cjs.map +1 -1
- package/dist/production/src/lib/FileSystem.js.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.cjs +1 -8
- package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.js +2 -9
- package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/production/src/lib/version.cjs.map +1 -1
- package/dist/production/src/paths.cjs +3 -1
- package/dist/production/src/paths.cjs.map +1 -1
- package/dist/production/src/paths.js +4 -2
- package/dist/production/src/paths.js.map +1 -1
- package/dist/types/lib/TemplateInstaller.d.ts +1 -3
- package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
- package/dist/types/paths.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -31
- package/resources/templates/template-workspace/.github/scripts/setup-actions-variables.sh +36 -0
- package/resources/templates/template-workspace/.github/workflows/deploy.yaml +23 -0
- package/resources/templates/template-workspace/admin/lib/binding/binding.tsx +12 -2
- package/resources/templates/template-workspace/admin/lib/binding/delete.tsx +34 -23
- package/resources/templates/template-workspace/admin/lib/binding/hooks.tsx +5 -6
- package/resources/templates/template-workspace/admin/lib/binding/identity.tsx +34 -3
- package/resources/templates/template-workspace/admin/lib/binding/navigation-guard-dialog.tsx +39 -0
- package/resources/templates/template-workspace/admin/lib/binding/persist.tsx +10 -60
- package/resources/templates/template-workspace/admin/lib/block-repeater/block-repeater.tsx +109 -39
- package/resources/templates/template-workspace/admin/lib/buttons/link-back-button.tsx +1 -1
- package/resources/templates/template-workspace/admin/lib/datagrid/cells.tsx +90 -10
- package/resources/templates/template-workspace/admin/lib/datagrid/column-header.tsx +12 -4
- package/resources/templates/template-workspace/admin/lib/datagrid/column-leaf.tsx +21 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/columns.tsx +367 -36
- package/resources/templates/template-workspace/admin/lib/datagrid/elements.tsx +6 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/export.tsx +9 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/boolean.tsx +22 -5
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/common.tsx +3 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/date.tsx +25 -2
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/defined.tsx +103 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/enum.tsx +83 -27
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/index.ts +1 -1
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/mobile.tsx +0 -1
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/number.tsx +21 -5
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/relation.tsx +170 -43
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/text.tsx +48 -5
- package/resources/templates/template-workspace/admin/lib/datagrid/grid.tsx +97 -25
- package/resources/templates/template-workspace/admin/lib/datagrid/index.ts +30 -4
- package/resources/templates/template-workspace/admin/lib/datagrid/labels.tsx +31 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/layout-switcher.tsx +3 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/loader.tsx +44 -2
- package/resources/templates/template-workspace/admin/lib/datagrid/pagination.tsx +8 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/table.tsx +15 -1
- package/resources/templates/template-workspace/admin/lib/datagrid/tiles.tsx +13 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/toolbar.tsx +27 -2
- package/resources/templates/template-workspace/admin/lib/dict.ts +54 -5
- package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +1 -1
- package/resources/templates/template-workspace/admin/lib/editor/common/editor-canvas.tsx +2 -2
- package/resources/templates/template-workspace/admin/lib/editor/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/editor/rich-text-view.tsx +17 -0
- package/resources/templates/template-workspace/admin/lib/field/formatted-field.tsx +10 -0
- package/resources/templates/template-workspace/admin/lib/field/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/form/container.tsx +43 -45
- package/resources/templates/template-workspace/admin/lib/form/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/form/inputs.tsx +56 -23
- package/resources/templates/template-workspace/admin/lib/form/select.tsx +61 -30
- package/resources/templates/template-workspace/admin/lib/form/ui.tsx +11 -2
- package/resources/templates/template-workspace/admin/lib/form/upload-repeaters.tsx +188 -0
- package/resources/templates/template-workspace/admin/lib/form/upload.tsx +57 -242
- package/resources/templates/template-workspace/admin/lib/formatting/formatting.ts +23 -0
- package/resources/templates/template-workspace/admin/lib/labels/enum-labels.ts +9 -0
- package/resources/templates/template-workspace/admin/lib/labels/field-labels.ts +7 -0
- package/resources/templates/template-workspace/admin/lib/labels/index.ts +2 -0
- package/resources/templates/template-workspace/admin/lib/layout/layout.tsx +3 -3
- package/resources/templates/template-workspace/admin/lib/repeater/repeater.tsx +97 -64
- package/resources/templates/template-workspace/admin/lib/select/filter.tsx +3 -2
- package/resources/templates/template-workspace/admin/lib/select/index.ts +0 -1
- package/resources/templates/template-workspace/admin/lib/select/list.tsx +78 -26
- package/resources/templates/template-workspace/admin/lib/select/multi-select.tsx +12 -19
- package/resources/templates/template-workspace/admin/lib/select/select.tsx +40 -23
- package/resources/templates/template-workspace/admin/lib/select/sortable-select.tsx +23 -18
- package/resources/templates/template-workspace/admin/lib/select/ui.tsx +3 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/invite.tsx +5 -3
- package/resources/templates/template-workspace/admin/lib/tenant/forms/memberships-control.tsx +28 -16
- package/resources/templates/template-workspace/admin/lib/tenant/forms/password-reset.tsx +9 -6
- package/resources/templates/template-workspace/admin/lib/tenant/forms/passwordless-signin-init.tsx +31 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/passwordless-signin.tsx +59 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/update-project-member.tsx +5 -3
- package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInvite.ts +1 -1
- package/resources/templates/template-workspace/admin/lib/tenant/listing/member-list.tsx +6 -5
- package/resources/templates/template-workspace/admin/lib/tenant/listing/person-list.tsx +2 -1
- package/resources/templates/template-workspace/admin/lib/ui/alert-dialog.tsx +2 -1
- package/resources/templates/template-workspace/admin/lib/ui/collapsible.tsx +9 -0
- package/resources/templates/template-workspace/admin/lib/ui/dialog.tsx +2 -1
- package/resources/templates/template-workspace/admin/lib/ui/dropdown.tsx +2 -1
- package/resources/templates/template-workspace/admin/lib/ui/input.tsx +14 -10
- package/resources/templates/template-workspace/admin/lib/ui/menu.tsx +2 -3
- package/resources/templates/template-workspace/admin/lib/ui/popover.tsx +2 -1
- package/resources/templates/template-workspace/admin/lib/ui/property-list.tsx +33 -0
- package/resources/templates/template-workspace/admin/lib/ui/select.tsx +80 -0
- package/resources/templates/template-workspace/admin/lib/ui/sheet.tsx +3 -2
- package/resources/templates/template-workspace/admin/lib/ui/textarea.tsx +9 -1
- package/resources/templates/template-workspace/admin/lib/upload/view.tsx +160 -165
- package/resources/templates/template-workspace/admin/lib/utils/createComponentOpenHooks.tsx +38 -0
- package/resources/templates/template-workspace/admin/lib/utils/uic.tsx +3 -3
- package/resources/templates/template-workspace/admin/package.json +21 -20
- package/resources/templates/template-workspace/package.json +3 -3
- package/src/lib/TemplateInstaller.ts +2 -9
- package/src/paths.ts +4 -3
- package/src/run.ts +0 -2
- package/tsconfig.settings.json +0 -4
- package/dist/development/src/lib/PackageDownloader.cjs +0 -33
- package/dist/development/src/lib/PackageDownloader.cjs.map +0 -1
- package/dist/development/src/lib/PackageDownloader.js +0 -33
- package/dist/development/src/lib/PackageDownloader.js.map +0 -1
- package/dist/production/src/lib/PackageDownloader.cjs +0 -33
- package/dist/production/src/lib/PackageDownloader.cjs.map +0 -1
- package/dist/production/src/lib/PackageDownloader.js +0 -33
- package/dist/production/src/lib/PackageDownloader.js.map +0 -1
- package/dist/types/lib/PackageDownloader.d.ts +0 -7
- package/dist/types/lib/PackageDownloader.d.ts.map +0 -1
- package/resources/templates/template-workspace/admin/.env.production +0 -3
- package/resources/templates/template-workspace/admin/lib/select/pagination.tsx +0 -48
- package/src/lib/PackageDownloader.ts +0 -33
- 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,33 +0,0 @@
|
|
|
1
|
-
import npa from "npm-package-arg";
|
|
2
|
-
import getRegistryInfo from "registry-info";
|
|
3
|
-
import getPackageJson from "get-package-json-from-registry";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
import downloadTarball from "download-tarball";
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
9
|
-
class PackageDownloader {
|
|
10
|
-
constructor(fs) {
|
|
11
|
-
this.fs = fs;
|
|
12
|
-
__publicField(this, "downloadPackage", async (pkgName) => {
|
|
13
|
-
const { scope } = npa(pkgName);
|
|
14
|
-
const { authorization } = getRegistryInfo(scope);
|
|
15
|
-
const headers = authorization ? { authorization } : {};
|
|
16
|
-
const pkg = await getPackageJson(pkgName);
|
|
17
|
-
const {
|
|
18
|
-
dist: { tarball }
|
|
19
|
-
} = pkg;
|
|
20
|
-
const tmpDir = await this.fs.createTempDir();
|
|
21
|
-
await downloadTarball({ url: tarball, gotOpts: { headers }, dir: tmpDir });
|
|
22
|
-
const dirContent = await this.fs.readDir(tmpDir);
|
|
23
|
-
if (dirContent.length !== 1 || dirContent[0] !== "package") {
|
|
24
|
-
throw "Invalid NPM package";
|
|
25
|
-
}
|
|
26
|
-
return join(tmpDir, "package");
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
PackageDownloader
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=PackageDownloader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PackageDownloader.js","sources":["../../../../../packages/create/src/lib/PackageDownloader.ts"],"sourcesContent":["import npa from 'npm-package-arg'\nimport getRegistryInfo from 'registry-info'\nimport getPackageJson from 'get-package-json-from-registry'\nimport { join } from 'node:path'\nimport downloadTarball from 'download-tarball'\nimport { FileSystem } from './FileSystem'\n\nexport class PackageDownloader {\n\n\tconstructor(\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t}\n\n\tdownloadPackage = async (pkgName: string): Promise<string> => {\n\t\tconst { scope } = npa(pkgName)\n\t\tconst { authorization } = getRegistryInfo(scope)\n\t\tconst headers = authorization ? { authorization } : {}\n\n\t\tconst pkg = await getPackageJson(pkgName)\n\t\tconst {\n\t\t\tdist: { tarball },\n\t\t} = pkg\n\n\t\tconst tmpDir = await this.fs.createTempDir()\n\t\tawait downloadTarball({ url: tarball, gotOpts: { headers }, dir: tmpDir })\n\t\tconst dirContent = await this.fs.readDir(tmpDir)\n\t\tif (dirContent.length !== 1 || dirContent[0] !== 'package') {\n\t\t\tthrow 'Invalid NPM package'\n\t\t}\n\t\treturn join(tmpDir, 'package')\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAOO,MAAM,kBAAkB;AAAA,EAE9B,YACkB,IAChB;AADgB,SAAA,KAAA;AAIlB,kBAAA,MAAA,mBAAkB,OAAO,YAAqC;AAC7D,YAAM,EAAE,MAAA,IAAU,IAAI,OAAO;AAC7B,YAAM,EAAE,cAAA,IAAkB,gBAAgB,KAAK;AAC/C,YAAM,UAAU,gBAAgB,EAAE,cAAA,IAAkB,CAAA;AAE9C,YAAA,MAAM,MAAM,eAAe,OAAO;AAClC,YAAA;AAAA,QACL,MAAM,EAAE,QAAQ;AAAA,MACb,IAAA;AAEJ,YAAM,SAAS,MAAM,KAAK,GAAG,cAAc;AACrC,YAAA,gBAAgB,EAAE,KAAK,SAAS,SAAS,EAAE,WAAW,KAAK,OAAA,CAAQ;AACzE,YAAM,aAAa,MAAM,KAAK,GAAG,QAAQ,MAAM;AAC/C,UAAI,WAAW,WAAW,KAAK,WAAW,CAAC,MAAM,WAAW;AACrD,cAAA;AAAA,MACP;AACO,aAAA,KAAK,QAAQ,SAAS;AAAA,IAAA,CAC9B;AAAA,EAnBA;AAoBD;"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const npa = require("npm-package-arg");
|
|
4
|
-
const getRegistryInfo = require("registry-info");
|
|
5
|
-
const getPackageJson = require("get-package-json-from-registry");
|
|
6
|
-
const node_path = require("node:path");
|
|
7
|
-
const downloadTarball = require("download-tarball");
|
|
8
|
-
var __defProp = Object.defineProperty;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
11
|
-
class PackageDownloader {
|
|
12
|
-
constructor(fs) {
|
|
13
|
-
this.fs = fs;
|
|
14
|
-
__publicField(this, "downloadPackage", async (pkgName) => {
|
|
15
|
-
const { scope } = npa(pkgName);
|
|
16
|
-
const { authorization } = getRegistryInfo(scope);
|
|
17
|
-
const headers = authorization ? { authorization } : {};
|
|
18
|
-
const pkg = await getPackageJson(pkgName);
|
|
19
|
-
const {
|
|
20
|
-
dist: { tarball }
|
|
21
|
-
} = pkg;
|
|
22
|
-
const tmpDir = await this.fs.createTempDir();
|
|
23
|
-
await downloadTarball({ url: tarball, gotOpts: { headers }, dir: tmpDir });
|
|
24
|
-
const dirContent = await this.fs.readDir(tmpDir);
|
|
25
|
-
if (dirContent.length !== 1 || dirContent[0] !== "package") {
|
|
26
|
-
throw "Invalid NPM package";
|
|
27
|
-
}
|
|
28
|
-
return node_path.join(tmpDir, "package");
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.PackageDownloader = PackageDownloader;
|
|
33
|
-
//# sourceMappingURL=PackageDownloader.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PackageDownloader.cjs","sources":["../../../../../packages/create/src/lib/PackageDownloader.ts"],"sourcesContent":["import npa from 'npm-package-arg'\nimport getRegistryInfo from 'registry-info'\nimport getPackageJson from 'get-package-json-from-registry'\nimport { join } from 'node:path'\nimport downloadTarball from 'download-tarball'\nimport { FileSystem } from './FileSystem'\n\nexport class PackageDownloader {\n\n\tconstructor(\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t}\n\n\tdownloadPackage = async (pkgName: string): Promise<string> => {\n\t\tconst { scope } = npa(pkgName)\n\t\tconst { authorization } = getRegistryInfo(scope)\n\t\tconst headers = authorization ? { authorization } : {}\n\n\t\tconst pkg = await getPackageJson(pkgName)\n\t\tconst {\n\t\t\tdist: { tarball },\n\t\t} = pkg\n\n\t\tconst tmpDir = await this.fs.createTempDir()\n\t\tawait downloadTarball({ url: tarball, gotOpts: { headers }, dir: tmpDir })\n\t\tconst dirContent = await this.fs.readDir(tmpDir)\n\t\tif (dirContent.length !== 1 || dirContent[0] !== 'package') {\n\t\t\tthrow 'Invalid NPM package'\n\t\t}\n\t\treturn join(tmpDir, 'package')\n\t}\n}\n"],"names":["join"],"mappings":";;;;;;;;;;AAOO,MAAM,kBAAkB;AAAA,EAE9B,YACkB,IAChB;AADgB,SAAA,KAAA;AAIlB,kBAAA,MAAA,mBAAkB,OAAO,YAAqC;AAC7D,YAAM,EAAE,MAAA,IAAU,IAAI,OAAO;AAC7B,YAAM,EAAE,cAAA,IAAkB,gBAAgB,KAAK;AAC/C,YAAM,UAAU,gBAAgB,EAAE,cAAA,IAAkB,CAAA;AAE9C,YAAA,MAAM,MAAM,eAAe,OAAO;AAClC,YAAA;AAAA,QACL,MAAM,EAAE,QAAQ;AAAA,MACb,IAAA;AAEJ,YAAM,SAAS,MAAM,KAAK,GAAG,cAAc;AACrC,YAAA,gBAAgB,EAAE,KAAK,SAAS,SAAS,EAAE,WAAW,KAAK,OAAA,CAAQ;AACzE,YAAM,aAAa,MAAM,KAAK,GAAG,QAAQ,MAAM;AAC/C,UAAI,WAAW,WAAW,KAAK,WAAW,CAAC,MAAM,WAAW;AACrD,cAAA;AAAA,MACP;AACO,aAAAA,UAAA,KAAK,QAAQ,SAAS;AAAA,IAAA,CAC9B;AAAA,EAnBA;AAoBD;;"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import npa from "npm-package-arg";
|
|
2
|
-
import getRegistryInfo from "registry-info";
|
|
3
|
-
import getPackageJson from "get-package-json-from-registry";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
import downloadTarball from "download-tarball";
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
9
|
-
class PackageDownloader {
|
|
10
|
-
constructor(fs) {
|
|
11
|
-
this.fs = fs;
|
|
12
|
-
__publicField(this, "downloadPackage", async (pkgName) => {
|
|
13
|
-
const { scope } = npa(pkgName);
|
|
14
|
-
const { authorization } = getRegistryInfo(scope);
|
|
15
|
-
const headers = authorization ? { authorization } : {};
|
|
16
|
-
const pkg = await getPackageJson(pkgName);
|
|
17
|
-
const {
|
|
18
|
-
dist: { tarball }
|
|
19
|
-
} = pkg;
|
|
20
|
-
const tmpDir = await this.fs.createTempDir();
|
|
21
|
-
await downloadTarball({ url: tarball, gotOpts: { headers }, dir: tmpDir });
|
|
22
|
-
const dirContent = await this.fs.readDir(tmpDir);
|
|
23
|
-
if (dirContent.length !== 1 || dirContent[0] !== "package") {
|
|
24
|
-
throw "Invalid NPM package";
|
|
25
|
-
}
|
|
26
|
-
return join(tmpDir, "package");
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
PackageDownloader
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=PackageDownloader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PackageDownloader.js","sources":["../../../../../packages/create/src/lib/PackageDownloader.ts"],"sourcesContent":["import npa from 'npm-package-arg'\nimport getRegistryInfo from 'registry-info'\nimport getPackageJson from 'get-package-json-from-registry'\nimport { join } from 'node:path'\nimport downloadTarball from 'download-tarball'\nimport { FileSystem } from './FileSystem'\n\nexport class PackageDownloader {\n\n\tconstructor(\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t}\n\n\tdownloadPackage = async (pkgName: string): Promise<string> => {\n\t\tconst { scope } = npa(pkgName)\n\t\tconst { authorization } = getRegistryInfo(scope)\n\t\tconst headers = authorization ? { authorization } : {}\n\n\t\tconst pkg = await getPackageJson(pkgName)\n\t\tconst {\n\t\t\tdist: { tarball },\n\t\t} = pkg\n\n\t\tconst tmpDir = await this.fs.createTempDir()\n\t\tawait downloadTarball({ url: tarball, gotOpts: { headers }, dir: tmpDir })\n\t\tconst dirContent = await this.fs.readDir(tmpDir)\n\t\tif (dirContent.length !== 1 || dirContent[0] !== 'package') {\n\t\t\tthrow 'Invalid NPM package'\n\t\t}\n\t\treturn join(tmpDir, 'package')\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAOO,MAAM,kBAAkB;AAAA,EAE9B,YACkB,IAChB;AADgB,SAAA,KAAA;AAIlB,kBAAA,MAAA,mBAAkB,OAAO,YAAqC;AAC7D,YAAM,EAAE,MAAA,IAAU,IAAI,OAAO;AAC7B,YAAM,EAAE,cAAA,IAAkB,gBAAgB,KAAK;AAC/C,YAAM,UAAU,gBAAgB,EAAE,cAAA,IAAkB,CAAA;AAE9C,YAAA,MAAM,MAAM,eAAe,OAAO;AAClC,YAAA;AAAA,QACL,MAAM,EAAE,QAAQ;AAAA,MACb,IAAA;AAEJ,YAAM,SAAS,MAAM,KAAK,GAAG,cAAc;AACrC,YAAA,gBAAgB,EAAE,KAAK,SAAS,SAAS,EAAE,WAAW,KAAK,OAAA,CAAQ;AACzE,YAAM,aAAa,MAAM,KAAK,GAAG,QAAQ,MAAM;AAC/C,UAAI,WAAW,WAAW,KAAK,WAAW,CAAC,MAAM,WAAW;AACrD,cAAA;AAAA,MACP;AACO,aAAA,KAAK,QAAQ,SAAS;AAAA,IAAA,CAC9B;AAAA,EAnBA;AAoBD;"}
|
|
@@ -1 +0,0 @@
|
|
|
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,OAAO,CAAC,MAAM,CAAC,CAiBzD;CACD"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import { MouseEventHandler } from 'react'
|
|
3
|
-
import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react'
|
|
4
|
-
import { DataViewChangePageTrigger, useDataViewPagingInfo } from '@contember/react-dataview'
|
|
5
|
-
import { Button } from '../ui/button'
|
|
6
|
-
import { dict } from '../dict'
|
|
7
|
-
|
|
8
|
-
export const SelectPagination = () => {
|
|
9
|
-
const scrollToTop: MouseEventHandler = e => {
|
|
10
|
-
const el = (e.target as HTMLElement).closest('[data-radix-scroll-area-viewport]')
|
|
11
|
-
if (el) {
|
|
12
|
-
requestAnimationFrame(() => {
|
|
13
|
-
el.scrollTo({ top: 0, behavior: 'smooth' })
|
|
14
|
-
})
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
const pageInfo = useDataViewPagingInfo()
|
|
18
|
-
if ((pageInfo.pagesCount ?? 1) <= 1) {
|
|
19
|
-
return null
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div className="flex gap-6 lg:gap-8 justify-center items-center">
|
|
24
|
-
<div className={'flex gap-1'}>
|
|
25
|
-
<DataViewChangePageTrigger page="previous">
|
|
26
|
-
<Button
|
|
27
|
-
size={'xs'}
|
|
28
|
-
variant="outline"
|
|
29
|
-
onClick={scrollToTop}
|
|
30
|
-
>
|
|
31
|
-
<span className="sr-only">{dict.select.paginationPreviousPage}</span>
|
|
32
|
-
<ChevronLeftIcon className="h-3 w-3"/>
|
|
33
|
-
</Button>
|
|
34
|
-
</DataViewChangePageTrigger>
|
|
35
|
-
<DataViewChangePageTrigger page="next">
|
|
36
|
-
<Button
|
|
37
|
-
size={'xs'}
|
|
38
|
-
variant="outline"
|
|
39
|
-
onClick={scrollToTop}
|
|
40
|
-
>
|
|
41
|
-
<span className="sr-only">{dict.select.paginationNextPage}</span>
|
|
42
|
-
<ChevronRightIcon className="h-3 w-3"/>
|
|
43
|
-
</Button>
|
|
44
|
-
</DataViewChangePageTrigger>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import npa from 'npm-package-arg'
|
|
2
|
-
import getRegistryInfo from 'registry-info'
|
|
3
|
-
import getPackageJson from 'get-package-json-from-registry'
|
|
4
|
-
import { join } from 'node:path'
|
|
5
|
-
import downloadTarball from 'download-tarball'
|
|
6
|
-
import { FileSystem } from './FileSystem'
|
|
7
|
-
|
|
8
|
-
export class PackageDownloader {
|
|
9
|
-
|
|
10
|
-
constructor(
|
|
11
|
-
private readonly fs: FileSystem,
|
|
12
|
-
) {
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
downloadPackage = async (pkgName: string): Promise<string> => {
|
|
16
|
-
const { scope } = npa(pkgName)
|
|
17
|
-
const { authorization } = getRegistryInfo(scope)
|
|
18
|
-
const headers = authorization ? { authorization } : {}
|
|
19
|
-
|
|
20
|
-
const pkg = await getPackageJson(pkgName)
|
|
21
|
-
const {
|
|
22
|
-
dist: { tarball },
|
|
23
|
-
} = pkg
|
|
24
|
-
|
|
25
|
-
const tmpDir = await this.fs.createTempDir()
|
|
26
|
-
await downloadTarball({ url: tarball, gotOpts: { headers }, dir: tmpDir })
|
|
27
|
-
const dirContent = await this.fs.readDir(tmpDir)
|
|
28
|
-
if (dirContent.length !== 1 || dirContent[0] !== 'package') {
|
|
29
|
-
throw 'Invalid NPM package'
|
|
30
|
-
}
|
|
31
|
-
return join(tmpDir, 'package')
|
|
32
|
-
}
|
|
33
|
-
}
|