Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing the extensions Folder and the New Extension Scaffold #4111

Merged
merged 34 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0f39a4b
wip: create essential plugins scaffold
adrians5j Apr 30, 2024
9c732d6
wip: create essential plugins scaffold
adrians5j May 4, 2024
71958c8
wip: create essential plugins scaffold
adrians5j May 4, 2024
3ac716a
wip: create essential plugins scaffold
adrians5j May 4, 2024
4f61e64
wip: create api-sls-cms package
adrians5j May 4, 2024
441742f
wip: create api-sls-cms package
adrians5j May 4, 2024
91a29ba
wip: create essential plugins scaffold
adrians5j May 5, 2024
e807266
wip: create essential plugins scaffold
adrians5j May 5, 2024
3a532f5
wip: create essential plugins scaffold
adrians5j May 5, 2024
49a9a39
wip: create essential plugins scaffold
adrians5j May 5, 2024
8716306
wip: create essential plugins scaffold
adrians5j May 5, 2024
9bcacb1
wip: create essential plugins scaffold
adrians5j May 6, 2024
ca301df
wip: create essential plugins scaffold
adrians5j May 6, 2024
c8317cd
wip: create essential plugins scaffold
adrians5j May 6, 2024
199486a
wip: create essential plugins scaffold
adrians5j May 6, 2024
5e92fae
wip: create essential plugins scaffold
adrians5j May 6, 2024
d447aa7
wip: create essential plugins scaffold
adrians5j May 6, 2024
a34be3a
wip: create essential plugins scaffold
adrians5j May 6, 2024
90ae35a
wip: create essential plugins scaffold
adrians5j May 6, 2024
0093eb0
wip: create essential plugins scaffold
adrians5j May 6, 2024
e862801
wip: create essential plugins scaffold
adrians5j May 6, 2024
a43eac9
wip: move theme into extensions
adrians5j May 6, 2024
3ca1c70
wip: move theme into extensions
adrians5j May 6, 2024
41a89bd
wip: move theme into extensions
adrians5j May 6, 2024
90a12cd
wip: move theme into extensions
adrians5j May 6, 2024
7066825
wip: create essential plugins scaffold
adrians5j May 6, 2024
c00b7f4
wip: create essential plugins scaffold
adrians5j May 6, 2024
15eb2f2
Merge remote-tracking branch 'refs/remotes/origin/next' into adrian/p…
adrians5j May 6, 2024
e4ae8e5
chore: prettier
adrians5j May 6, 2024
e65ce7e
wip: create essential plugins scaffold
adrians5j May 6, 2024
2a77a29
wip: create essential plugins scaffold
adrians5j May 6, 2024
13fd3c8
wip: create essential plugins scaffold
adrians5j May 6, 2024
56440eb
Merge remote-tracking branch 'refs/remotes/origin/next' into adrian/p…
adrians5j May 7, 2024
413e326
fix: correct `theme` path
adrians5j May 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/admin/src/App.auth0.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { Admin } from "@webiny/app-serverless-cms";
import { Auth0 } from "@webiny/app-admin-auth0";
import { Extensions } from "./Extensions";
import "./App.scss";

export const App = () => {
Expand All @@ -13,6 +14,7 @@ export const App = () => {
}}
rootAppClientId={String(process.env.REACT_APP_AUTH0_CLIENT_ID)}
/>
<Extensions />
</Admin>
);
};
2 changes: 2 additions & 0 deletions apps/admin/src/App.editor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { Admin } from "@webiny/app-serverless-cms";
import { Cognito } from "@webiny/app-admin-users-cognito";
import { Extensions } from "./Extensions";
import { Editor } from "@webiny/app-page-builder-editor";
import "./App.scss";

Expand All @@ -9,6 +10,7 @@ export const App = () => {
<Admin>
<Cognito />
<Editor />
<Extensions />
</Admin>
);
};
2 changes: 2 additions & 0 deletions apps/admin/src/App.fm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useCallback } from "react";
import { Admin, createComponentPlugin } from "@webiny/app-serverless-cms";
import { FileManagerFileItem, FileManagerRenderer, OverlayLayout } from "@webiny/app-admin";
import { Cognito } from "@webiny/app-admin-users-cognito";
import { Extensions } from "./Extensions";
import "./App.scss";

const CustomFileManager = createComponentPlugin(FileManagerRenderer, () => {
Expand Down Expand Up @@ -36,6 +37,7 @@ export const App = () => {
<Admin>
<Cognito />
<CustomFileManager />
<Extensions />
</Admin>
);
};
2 changes: 2 additions & 0 deletions apps/admin/src/App.okta.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { Admin } from "@webiny/app-serverless-cms";
import { Okta } from "@webiny/app-admin-okta";
import { Extensions } from "./Extensions";
import "./App.scss";

import { oktaFactory, rootAppClientId } from "./okta";
Expand All @@ -9,6 +10,7 @@ export const App = () => {
return (
<Admin>
<Okta factory={oktaFactory} rootAppClientId={rootAppClientId} />
<Extensions />
</Admin>
);
};
2 changes: 2 additions & 0 deletions apps/admin/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React from "react";
import { Admin } from "@webiny/app-serverless-cms";
import { Cognito } from "@webiny/app-admin-users-cognito";
import { Extensions } from "./Extensions";
import "./App.scss";

export const App = () => {
return (
<Admin>
<Cognito />
<Extensions />
</Admin>
);
};
6 changes: 6 additions & 0 deletions apps/admin/src/Extensions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This file is automatically updated via scaffolding utilities.
import React from "react";

export const Extensions = () => {
return <></>;
};
4 changes: 4 additions & 0 deletions apps/api/graphql/src/extensions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// This file is automatically updated via scaffolding utilities.
export const extensions = () => {
return [];
};
11 changes: 8 additions & 3 deletions apps/api/graphql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ import { createAco } from "@webiny/api-aco";
import { createAcoPageBuilderContext } from "@webiny/api-page-builder-aco";
import { createAuditLogs } from "@webiny/api-audit-logs";
import { createBackgroundTasks } from "@webiny/api-background-tasks-ddb";
import scaffoldsPlugins from "./plugins/scaffolds";
import { createBenchmarkEnablePlugin } from "~/plugins/benchmarkEnable";
import { createCountDynamoDbTask } from "~/plugins/countDynamoDbTask";
import { createContinuingTask } from "~/plugins/continuingTask";
import { createWebsockets } from "@webiny/api-websockets";
import { createRecordLocking } from "@webiny/api-record-locking";

import scaffoldsPlugins from "./plugins/scaffolds";
import { extensions } from "./extensions";

const debug = process.env.DEBUG === "true";
const documentClient = getDocumentClient();

Expand Down Expand Up @@ -107,7 +109,6 @@ export const handler = createHandler({
createAcoPageBuilderContext(),
createAcoHcmsContext(),
createHcmsTasks(),
scaffoldsPlugins(),
createFileModelModifier(({ modifier }) => {
modifier.addField({
id: "customField1",
Expand All @@ -134,7 +135,11 @@ export const handler = createHandler({
}),
createAuditLogs(),
createCountDynamoDbTask(),
createContinuingTask()
createContinuingTask(),

// Leave this at the end.
scaffoldsPlugins(),
extensions()
],
debug
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"apps/custom",
"apps/website",
"apps/website/prerendering/*",
"apps/theme",
"apps/core/dynamoToElastic",
"apps/api/apw/*",
"apps/api/fileManager/*",
Expand All @@ -18,6 +17,7 @@
"apps/api/pageBuilder/updateSettings",
"apps/api/pageBuilder/import/*",
"apps/api/pageBuilder/export/*",
"extensions/theme",
"scripts/buildPackages",
"scripts/prepublishOnly"
]
Expand Down
1 change: 1 addition & 0 deletions packages/api-serverless-cms/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@webiny/project-utils").createBabelConfigForNode({ path: __dirname });
21 changes: 21 additions & 0 deletions packages/api-serverless-cms/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Webiny

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions packages/api-serverless-cms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# @webiny/api-serverless-cms
[![](https://img.shields.io/npm/dw/@webiny/api-serverless-cms.svg)](https://www.npmjs.com/package/@webiny/api-serverless-cms)
[![](https://img.shields.io/npm/v/@webiny/api-serverless-cms.svg)](https://www.npmjs.com/package/@webiny/api-serverless-cms)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

## Install
```
npm install --save @webiny/api-serverless-cms
```

Or if you prefer yarn:
```
yarn add @webiny/api-serverless-cms
```
47 changes: 47 additions & 0 deletions packages/api-serverless-cms/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "@webiny/api-serverless-cms",
"version": "0.0.0",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/webiny/webiny-js.git"
},
"description": "Core package for all of our API packages.",
"license": "MIT",
"dependencies": {
"@webiny/api": "0.0.0",
"@webiny/api-aco": "0.0.0",
"@webiny/api-file-manager": "0.0.0",
"@webiny/api-form-builder": "0.0.0",
"@webiny/api-headless-cms": "0.0.0",
"@webiny/api-i18n": "0.0.0",
"@webiny/api-i18n-content": "0.0.0",
"@webiny/api-page-builder": "0.0.0",
"@webiny/api-page-builder-aco": "0.0.0",
"@webiny/api-prerendering-service": "0.0.0",
"@webiny/api-security": "0.0.0",
"@webiny/api-tenancy": "0.0.0",
"@webiny/handler-client": "0.0.0",
"@webiny/handler-graphql": "0.0.0"
},
"devDependencies": {
"@babel/cli": "^7.23.9",
"@babel/core": "^7.24.0",
"@babel/preset-env": "^7.24.0",
"@babel/preset-typescript": "^7.23.3",
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.13",
"typescript": "4.7.4"
},
"publishConfig": {
"access": "public",
"directory": "dist"
},
"scripts": {
"build": "yarn webiny run build",
"watch": "yarn webiny run watch"
},
"gitHead": "8476da73b653c89cc1474d968baf55c1b0ae0e5f"
}
43 changes: 43 additions & 0 deletions packages/api-serverless-cms/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { ClientContext } from "@webiny/handler-client/types";
import { TenancyContext } from "@webiny/api-tenancy/types";
import { SecurityContext } from "@webiny/api-security/types";
import { I18NContext } from "@webiny/api-i18n/types";
import { I18NContentContext } from "@webiny/api-i18n-content/types";
import { PbContext } from "@webiny/api-page-builder/graphql/types";
import { PrerenderingServiceClientContext } from "@webiny/api-prerendering-service/client/types";
import { FileManagerContext } from "@webiny/api-file-manager/types";
import { FormBuilderContext } from "@webiny/api-form-builder/types";
import { CmsContext } from "@webiny/api-headless-cms/types";
import { AcoContext } from "@webiny/api-aco/types";
import { PbAcoContext } from "@webiny/api-page-builder-aco/types";
import { createContextPlugin as baseCreateContextPlugin, ContextPluginCallable } from "@webiny/api";
import {
createGraphQLSchemaPlugin as baseCreateGraphQLSchemaPlugin,
GraphQLSchemaPluginConfig
} from "@webiny/handler-graphql";

export interface Context
extends ClientContext,
TenancyContext,
SecurityContext,
I18NContext,
I18NContentContext,
PbContext,
PrerenderingServiceClientContext,
FileManagerContext,
FormBuilderContext,
AcoContext,
PbAcoContext,
CmsContext {}

export const createContextPlugin = <T extends Context = Context>(
callable: ContextPluginCallable<T>
) => {
return baseCreateContextPlugin<T>(callable);
};

export const createGraphQLSchemaPlugin = <T extends Context = Context>(
config: GraphQLSchemaPluginConfig<T>
) => {
return baseCreateGraphQLSchemaPlugin<T>(config);
};
27 changes: 27 additions & 0 deletions packages/api-serverless-cms/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"extends": "../../tsconfig.build.json",
"include": ["src"],
"references": [
{ "path": "../api/tsconfig.build.json" },
{ "path": "../api-aco/tsconfig.build.json" },
{ "path": "../api-file-manager/tsconfig.build.json" },
{ "path": "../api-form-builder/tsconfig.build.json" },
{ "path": "../handler-graphql/tsconfig.build.json" },
{ "path": "../api-headless-cms/tsconfig.build.json" },
{ "path": "../api-i18n/tsconfig.build.json" },
{ "path": "../api-i18n-content/tsconfig.build.json" },
{ "path": "../api-page-builder/tsconfig.build.json" },
{ "path": "../api-page-builder-aco/tsconfig.build.json" },
{ "path": "../api-prerendering-service/tsconfig.build.json" },
{ "path": "../api-security/tsconfig.build.json" },
{ "path": "../api-tenancy/tsconfig.build.json" },
{ "path": "../handler-client/tsconfig.build.json" }
],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"declarationDir": "./dist",
"paths": { "~/*": ["./src/*"], "~tests/*": ["./__tests__/*"] },
"baseUrl": "."
}
}
58 changes: 58 additions & 0 deletions packages/api-serverless-cms/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"extends": "../../tsconfig.json",
"include": ["src", "__tests__"],
"references": [
{ "path": "../api" },
{ "path": "../api-aco" },
{ "path": "../api-file-manager" },
{ "path": "../api-form-builder" },
{ "path": "../handler-graphql" },
{ "path": "../api-headless-cms" },
{ "path": "../api-i18n" },
{ "path": "../api-i18n-content" },
{ "path": "../api-page-builder" },
{ "path": "../api-page-builder-aco" },
{ "path": "../api-prerendering-service" },
{ "path": "../api-security" },
{ "path": "../api-tenancy" },
{ "path": "../handler-client" }
],
"compilerOptions": {
"rootDirs": ["./src", "./__tests__"],
"outDir": "./dist",
"declarationDir": "./dist",
"paths": {
"~/*": ["./src/*"],
"~tests/*": ["./__tests__/*"],
"@webiny/api/*": ["../api/src/*"],
"@webiny/api": ["../api/src"],
"@webiny/api-aco/*": ["../api-aco/src/*"],
"@webiny/api-aco": ["../api-aco/src"],
"@webiny/api-file-manager/*": ["../api-file-manager/src/*"],
"@webiny/api-file-manager": ["../api-file-manager/src"],
"@webiny/api-form-builder/*": ["../api-form-builder/src/*"],
"@webiny/api-form-builder": ["../api-form-builder/src"],
"@webiny/handler-graphql/*": ["../handler-graphql/src/*"],
"@webiny/handler-graphql": ["../handler-graphql/src"],
"@webiny/api-headless-cms/*": ["../api-headless-cms/src/*"],
"@webiny/api-headless-cms": ["../api-headless-cms/src"],
"@webiny/api-i18n/*": ["../api-i18n/src/*"],
"@webiny/api-i18n": ["../api-i18n/src"],
"@webiny/api-i18n-content/*": ["../api-i18n-content/src/*"],
"@webiny/api-i18n-content": ["../api-i18n-content/src"],
"@webiny/api-page-builder/*": ["../api-page-builder/src/*"],
"@webiny/api-page-builder": ["../api-page-builder/src"],
"@webiny/api-page-builder-aco/*": ["../api-page-builder-aco/src/*"],
"@webiny/api-page-builder-aco": ["../api-page-builder-aco/src"],
"@webiny/api-prerendering-service/*": ["../api-prerendering-service/src/*"],
"@webiny/api-prerendering-service": ["../api-prerendering-service/src"],
"@webiny/api-security/*": ["../api-security/src/*"],
"@webiny/api-security": ["../api-security/src"],
"@webiny/api-tenancy/*": ["../api-tenancy/src/*"],
"@webiny/api-tenancy": ["../api-tenancy/src"],
"@webiny/handler-client/*": ["../handler-client/src/*"],
"@webiny/handler-client": ["../handler-client/src"]
},
"baseUrl": "."
}
}
8 changes: 8 additions & 0 deletions packages/api-serverless-cms/webiny.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { createWatchPackage, createBuildPackage } = require("@webiny/project-utils");

module.exports = {
commands: {
build: createBuildPackage({ cwd: __dirname }),
watch: createWatchPackage({ cwd: __dirname })
}
};
1 change: 1 addition & 0 deletions packages/cli-plugin-scaffold-extensions/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@webiny/project-utils").createBabelConfigForNode({ path: __dirname });
21 changes: 21 additions & 0 deletions packages/cli-plugin-scaffold-extensions/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Webiny

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading