From a542f4d0806744c5e2333b3786478c4af3b6b750 Mon Sep 17 00:00:00 2001 From: Adrian Smijulj Date: Thu, 17 Oct 2024 10:52:14 +0200 Subject: [PATCH] feat: create `Extensions.tsx` file in `apps/website` (#4336) --- apps/website/src/App.tsx | 7 ++- apps/website/src/Extensions.tsx | 6 +++ packages/cli-plugin-extensions/.babelrc.js | 1 + packages/cli-plugin-extensions/.eslintrc.js | 9 ++++ packages/cli-plugin-extensions/LICENSE | 21 +++++++++ packages/cli-plugin-extensions/README.md | 15 ++++++ packages/cli-plugin-extensions/package.json | 47 +++++++++++++++++++ packages/cli-plugin-extensions/src/index.ts | 1 + .../cli-plugin-extensions/tsconfig.build.json | 15 ++++++ packages/cli-plugin-extensions/tsconfig.json | 12 +++++ .../cli-plugin-extensions/webiny.config.js | 8 ++++ .../template/common/apps/website/src/App.tsx | 7 ++- .../common/apps/website/src/Extensions.tsx | 6 +++ .../template/common/webiny.project.ts | 2 + .../template/ddb-es/dependencies.json | 1 + .../template/ddb-os/dependencies.json | 1 + .../template/ddb/dependencies.json | 1 + yarn.lock | 18 +++++++ 18 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 apps/website/src/Extensions.tsx create mode 100644 packages/cli-plugin-extensions/.babelrc.js create mode 100644 packages/cli-plugin-extensions/.eslintrc.js create mode 100644 packages/cli-plugin-extensions/LICENSE create mode 100644 packages/cli-plugin-extensions/README.md create mode 100644 packages/cli-plugin-extensions/package.json create mode 100644 packages/cli-plugin-extensions/src/index.ts create mode 100644 packages/cli-plugin-extensions/tsconfig.build.json create mode 100644 packages/cli-plugin-extensions/tsconfig.json create mode 100644 packages/cli-plugin-extensions/webiny.config.js create mode 100644 packages/cwp-template-aws/template/common/apps/website/src/Extensions.tsx diff --git a/apps/website/src/App.tsx b/apps/website/src/App.tsx index 42f275b5e53..7d49958e84d 100644 --- a/apps/website/src/App.tsx +++ b/apps/website/src/App.tsx @@ -1,7 +1,12 @@ import React from "react"; import { Website } from "@webiny/app-website"; import "./App.scss"; +import { Extensions } from "./Extensions"; export const App = () => { - return ; + return ( + + + + ); }; diff --git a/apps/website/src/Extensions.tsx b/apps/website/src/Extensions.tsx new file mode 100644 index 00000000000..00cd662531a --- /dev/null +++ b/apps/website/src/Extensions.tsx @@ -0,0 +1,6 @@ +// This file is automatically updated via scaffolding utilities. +import React from "react"; + +export const Extensions = () => { + return <>; +}; diff --git a/packages/cli-plugin-extensions/.babelrc.js b/packages/cli-plugin-extensions/.babelrc.js new file mode 100644 index 00000000000..9da7674cb52 --- /dev/null +++ b/packages/cli-plugin-extensions/.babelrc.js @@ -0,0 +1 @@ +module.exports = require("@webiny/project-utils").createBabelConfigForNode({ path: __dirname }); diff --git a/packages/cli-plugin-extensions/.eslintrc.js b/packages/cli-plugin-extensions/.eslintrc.js new file mode 100644 index 00000000000..1b0a565007b --- /dev/null +++ b/packages/cli-plugin-extensions/.eslintrc.js @@ -0,0 +1,9 @@ +const defaultConfig = require("../../.eslintrc"); + +module.exports = { + ...defaultConfig, + rules: { + ...defaultConfig.rules, + "import/dynamic-import-chunkname": 0 + } +}; diff --git a/packages/cli-plugin-extensions/LICENSE b/packages/cli-plugin-extensions/LICENSE new file mode 100644 index 00000000000..f772d04d4db --- /dev/null +++ b/packages/cli-plugin-extensions/LICENSE @@ -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. diff --git a/packages/cli-plugin-extensions/README.md b/packages/cli-plugin-extensions/README.md new file mode 100644 index 00000000000..24fde440195 --- /dev/null +++ b/packages/cli-plugin-extensions/README.md @@ -0,0 +1,15 @@ +# @webiny/cli-plugin-extensions +[![](https://img.shields.io/npm/dw/@webiny/cli-plugin-extensions.svg)](https://www.npmjs.com/package/@webiny/cli-plugin-extensions) +[![](https://img.shields.io/npm/v/@webiny/cli-plugin-extensions.svg)](https://www.npmjs.com/package/@webiny/cli-plugin-extensions) +[![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/cli-plugin-extensions +``` + +Or if you prefer yarn: +``` +yarn add @webiny/cli-plugin-extensions +``` diff --git a/packages/cli-plugin-extensions/package.json b/packages/cli-plugin-extensions/package.json new file mode 100644 index 00000000000..b45cf91d72f --- /dev/null +++ b/packages/cli-plugin-extensions/package.json @@ -0,0 +1,47 @@ +{ + "name": "@webiny/cli-plugin-extensions", + "version": "0.0.0", + "description": "Scaffolds essential files for creating a new plugin.", + "main": "index.js", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "git+https://github.com/webiny/webiny-js.git", + "directory": "packages/cli-plugin-extensions" + }, + "author": { + "name": "Webiny", + "url": "https://www.webiny.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/webiny/webiny-js/issues" + }, + "homepage": "https://github.com/webiny/webiny-js#readme", + "devDependencies": { + "@babel/cli": "^7.23.9", + "@babel/core": "^7.24.0", + "@babel/preset-env": "^7.24.0", + "@types/inquirer": "8.2.10", + "@types/ncp": "^2.0.4", + "@types/pluralize": "^0.0.29", + "@types/validate-npm-package-name": "^3.0.3", + "@webiny/cli": "0.0.0", + "@webiny/project-utils": "0.0.0", + "rimraf": "^5.0.5", + "typescript": "4.9.5" + }, + "scripts": { + "build": "yarn webiny run build", + "watch": "yarn webiny run watch" + }, + "publishConfig": { + "access": "public", + "directory": "dist" + }, + "adio": { + "ignoreDirs": [ + "template" + ] + } +} diff --git a/packages/cli-plugin-extensions/src/index.ts b/packages/cli-plugin-extensions/src/index.ts new file mode 100644 index 00000000000..4ba9480748f --- /dev/null +++ b/packages/cli-plugin-extensions/src/index.ts @@ -0,0 +1 @@ +export default () => []; diff --git a/packages/cli-plugin-extensions/tsconfig.build.json b/packages/cli-plugin-extensions/tsconfig.build.json new file mode 100644 index 00000000000..f9b687cac81 --- /dev/null +++ b/packages/cli-plugin-extensions/tsconfig.build.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.build.json", + "include": ["src"], + "references": [], + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist", + "declarationDir": "./dist", + "paths": { + "~/*": ["./src/*"], + "~tests/*": ["./__tests__/*"] + }, + "baseUrl": "." + } +} diff --git a/packages/cli-plugin-extensions/tsconfig.json b/packages/cli-plugin-extensions/tsconfig.json new file mode 100644 index 00000000000..cd335e1a088 --- /dev/null +++ b/packages/cli-plugin-extensions/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../tsconfig.json", + "include": ["src", "__tests__"], + "references": [], + "compilerOptions": { + "rootDirs": ["./src", "./__tests__"], + "outDir": "./dist", + "declarationDir": "./dist", + "paths": {}, + "baseUrl": "." + } +} diff --git a/packages/cli-plugin-extensions/webiny.config.js b/packages/cli-plugin-extensions/webiny.config.js new file mode 100644 index 00000000000..6dff86766c9 --- /dev/null +++ b/packages/cli-plugin-extensions/webiny.config.js @@ -0,0 +1,8 @@ +const { createWatchPackage, createBuildPackage } = require("@webiny/project-utils"); + +module.exports = { + commands: { + build: createBuildPackage({ cwd: __dirname }), + watch: createWatchPackage({ cwd: __dirname }) + } +}; diff --git a/packages/cwp-template-aws/template/common/apps/website/src/App.tsx b/packages/cwp-template-aws/template/common/apps/website/src/App.tsx index 42f275b5e53..7d49958e84d 100644 --- a/packages/cwp-template-aws/template/common/apps/website/src/App.tsx +++ b/packages/cwp-template-aws/template/common/apps/website/src/App.tsx @@ -1,7 +1,12 @@ import React from "react"; import { Website } from "@webiny/app-website"; import "./App.scss"; +import { Extensions } from "./Extensions"; export const App = () => { - return ; + return ( + + + + ); }; diff --git a/packages/cwp-template-aws/template/common/apps/website/src/Extensions.tsx b/packages/cwp-template-aws/template/common/apps/website/src/Extensions.tsx new file mode 100644 index 00000000000..00cd662531a --- /dev/null +++ b/packages/cwp-template-aws/template/common/apps/website/src/Extensions.tsx @@ -0,0 +1,6 @@ +// This file is automatically updated via scaffolding utilities. +import React from "react"; + +export const Extensions = () => { + return <>; +}; diff --git a/packages/cwp-template-aws/template/common/webiny.project.ts b/packages/cwp-template-aws/template/common/webiny.project.ts index 34eff57ef66..22f0150936b 100644 --- a/packages/cwp-template-aws/template/common/webiny.project.ts +++ b/packages/cwp-template-aws/template/common/webiny.project.ts @@ -1,6 +1,7 @@ import cliWorkspaces from "@webiny/cli-plugin-workspaces"; import cliPulumiDeploy from "@webiny/cli-plugin-deploy-pulumi"; import cliAwsTemplate from "@webiny/cwp-template-aws/cli"; +import cliExtensions from "@webiny/cli-plugin-extensions"; // Scaffolds. import cliScaffold from "@webiny/cli-plugin-scaffold"; @@ -18,6 +19,7 @@ export default { cliWorkspaces(), cliPulumiDeploy(), cliAwsTemplate(), + cliExtensions(), // Scaffolds. cliScaffold(), diff --git a/packages/cwp-template-aws/template/ddb-es/dependencies.json b/packages/cwp-template-aws/template/ddb-es/dependencies.json index 8ca7f29dafb..abac1b00d20 100644 --- a/packages/cwp-template-aws/template/ddb-es/dependencies.json +++ b/packages/cwp-template-aws/template/ddb-es/dependencies.json @@ -4,6 +4,7 @@ "dependencies": { "@webiny/aws-layers": "latest", "@webiny/cli": "latest", + "@webiny/cli-plugin-extensions": "latest", "@webiny/cli-plugin-scaffold": "latest", "@webiny/cli-plugin-scaffold-admin-app-module": "latest", "@webiny/cli-plugin-scaffold-graphql-service": "latest", diff --git a/packages/cwp-template-aws/template/ddb-os/dependencies.json b/packages/cwp-template-aws/template/ddb-os/dependencies.json index 8ca7f29dafb..abac1b00d20 100644 --- a/packages/cwp-template-aws/template/ddb-os/dependencies.json +++ b/packages/cwp-template-aws/template/ddb-os/dependencies.json @@ -4,6 +4,7 @@ "dependencies": { "@webiny/aws-layers": "latest", "@webiny/cli": "latest", + "@webiny/cli-plugin-extensions": "latest", "@webiny/cli-plugin-scaffold": "latest", "@webiny/cli-plugin-scaffold-admin-app-module": "latest", "@webiny/cli-plugin-scaffold-graphql-service": "latest", diff --git a/packages/cwp-template-aws/template/ddb/dependencies.json b/packages/cwp-template-aws/template/ddb/dependencies.json index 3ce011c2ef2..713233629b9 100644 --- a/packages/cwp-template-aws/template/ddb/dependencies.json +++ b/packages/cwp-template-aws/template/ddb/dependencies.json @@ -4,6 +4,7 @@ "dependencies": { "@webiny/aws-layers": "latest", "@webiny/cli": "latest", + "@webiny/cli-plugin-extensions": "latest", "@webiny/cli-plugin-scaffold": "latest", "@webiny/cli-plugin-scaffold-admin-app-module": "latest", "@webiny/cli-plugin-scaffold-graphql-service": "latest", diff --git a/yarn.lock b/yarn.lock index 24418295f57..88dde13a3dd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16880,6 +16880,24 @@ __metadata: languageName: unknown linkType: soft +"@webiny/cli-plugin-extensions@workspace:packages/cli-plugin-extensions": + version: 0.0.0-use.local + resolution: "@webiny/cli-plugin-extensions@workspace:packages/cli-plugin-extensions" + dependencies: + "@babel/cli": ^7.23.9 + "@babel/core": ^7.24.0 + "@babel/preset-env": ^7.24.0 + "@types/inquirer": 8.2.10 + "@types/ncp": ^2.0.4 + "@types/pluralize": ^0.0.29 + "@types/validate-npm-package-name": ^3.0.3 + "@webiny/cli": 0.0.0 + "@webiny/project-utils": 0.0.0 + rimraf: ^5.0.5 + typescript: 4.9.5 + languageName: unknown + linkType: soft + "@webiny/cli-plugin-scaffold-admin-app-module@workspace:packages/cli-plugin-scaffold-admin-app-module": version: 0.0.0-use.local resolution: "@webiny/cli-plugin-scaffold-admin-app-module@workspace:packages/cli-plugin-scaffold-admin-app-module"