Skip to content

Commit

Permalink
Prepare demo
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriy-kudelko committed Jul 13, 2023
1 parent 33b9cd7 commit abc9a50
Show file tree
Hide file tree
Showing 319 changed files with 5,399 additions and 408 deletions.
10 changes: 0 additions & 10 deletions .editorconfig

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules
.env
.idea
.yarn/install-state.gz
dist
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 100
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# flex-plugins
## Instructions

### Prerequisites

You will need a Twilio account with Flex `1.34.1` installed.

```bash
yarn install
yarn start
```

Navigate to http://localhost:3000/custom-route to explore cases.
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"name": "flex-plugins",
"packageManager": "[email protected]",
"engines": {
"node": "14"
},
"workspaces": [
"packages/*",
"plugins/*"
]
],
"devDependencies": {
"prettier": "3.0.0"
},
"scripts": {
"library:build": "yarn workspace shared-component-library build",
"plugin:start": "yarn workspace plugin-sample dev",
"start": "yarn library:build && yarn plugin:start"
}
}
1 change: 1 addition & 0 deletions packages/shared-component-library/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# shared-component-library
38 changes: 38 additions & 0 deletions packages/shared-component-library/build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import * as esbuild from 'esbuild';
import { globSync } from 'glob';
import { dtsPlugin } from 'esbuild-plugin-d.ts';

import { createRequire } from 'module';
const require = createRequire(import.meta.url);

const packageJson = require('./package.json');

const entryPoints = globSync([
'src/index.ts',
]);

const getExternalPeers = ({ peerDependencies }) => {
const externals = Object.keys(peerDependencies);
const wildcards = externals.map((packageName) => `${packageName}/*`);

return [
...externals,
...wildcards,
];
};

await esbuild.build({
outbase: 'src',
entryPoints,
bundle: true,
format: 'cjs',
outdir: 'dist',
color: true,
logLevel: 'info',
sourcemap: 'linked',
minify: false,
plugins: [
dtsPlugin(),
],
external: getExternalPeers(packageJson),
});
37 changes: 37 additions & 0 deletions packages/shared-component-library/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "shared-component-library",
"version": "1.0.0",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"packageManager": "[email protected]",
"peerDependencies": {
"@twilio-paste/core": "19.5.0",
"@twilio-paste/icons": "11.2.2",
"esbuild": "^0.18.11",
"esbuild-plugin-d.ts": "^1.1.0",
"react": "16.13.1",
"react-dom": "16.13.1"
},
"devDependencies": {
"@rollup/plugin-commonjs": "25.0.2",
"@rollup/plugin-node-resolve": "15.1.0",
"@rollup/plugin-typescript": "11.1.2",
"@twilio-paste/core": "19.5.0",
"@twilio-paste/icons": "11.2.2",
"@types/react": "^16",
"@types/react-dom": "^16",
"esbuild": "0.18.11",
"esbuild-plugin-d.ts": "1.1.0",
"glob": "10.3.3",
"react": "16.13.1",
"react-dom": "16.13.1",
"rollup": "3.26.2",
"rollup-plugin-dts": "5.3.0",
"rollup-plugin-peer-deps-external": "2.2.4",
"typescript": "5.1.6"
},
"scripts": {
"build": "node build.mjs",
"build:rollup": "rollup -c --bundleConfigAsCjs"
}
}
33 changes: 33 additions & 0 deletions packages/shared-component-library/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "@rollup/plugin-typescript";
import dts from "rollup-plugin-dts";
import peerDepsExternal from "rollup-plugin-peer-deps-external";

const packageJson = require("./package.json");

export default [
{
input: "src/index.ts",
output: [
{
file: packageJson.main,
format: "cjs",
sourcemap: true,
},
],
plugins: [
peerDepsExternal(),
resolve(),
commonjs(),
typescript({
include: ['./src/**/*.{ts,tsx}'],
}),
],
},
{
input: "src/index.ts",
output: [{ file: "dist/index.d.ts", format: "es" }],
plugins: [dts.default()],
},
];
19 changes: 19 additions & 0 deletions packages/shared-component-library/src/components/CustomContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React, { createContext, ReactNode, useContext } from 'react';

export interface CustomContextValue {
version: string;
}

export const CustomContext = createContext<CustomContextValue>({
version: '0.0.0',
});

export const useCustomContext = () => useContext(CustomContext);

export interface CustomContextProviderProps {
children: ReactNode;
}

export function CustomContextProvider({ children }: CustomContextProviderProps) {
return <CustomContext.Provider value={{ version: '1.0.0' }}>{children}</CustomContext.Provider>;
}
Loading

0 comments on commit abc9a50

Please sign in to comment.