MCPcopy
hub / github.com/glorious-codes/glorious-demo

github.com/glorious-codes/glorious-demo @v0.12.0 sqlite

repository ↗ · DeepWiki ↗ · release v0.12.0 ↗
135 symbols 292 edges 47 files 0 documented · 0%
README

Glorious Demo

The easiest way to demonstrate your code in action.

CircleCI Coverage Status

Installation

npm install @glorious/demo --save

Basic Usage

<link rel="stylesheet" href="https://github.com/glorious-codes/glorious-demo/raw/v0.12.0/node_modules/@glorious/demo/dist/gdemo.min.css">
<script src="https://github.com/glorious-codes/glorious-demo/raw/v0.12.0/node_modules/@glorious/demo/dist/gdemo.min.js"></script>

Note: If you're not into package management, load it from a third-party CDN provider.

// Constructor receives a selector that indicates
// where to inject the demonstration in your page.
const demo = new GDemo('#container');

const code = `
function greet(){
  console.log("Hello World!");
}

greet();
`

demo
  .openApp('editor', {minHeight: '350px', windowTitle: 'demo.js'})
  .write(code, {onCompleteDelay: 1500})
  .openApp('terminal', {minHeight: '350px', promptString: '$'})
  .command('node ./demo', {onCompleteDelay: 500})
  .respond('Hello World!')
  .command('')
  .end();

NOTE: Check here to know how to use Prism to get your code highlighted.

API

openApp

Opens or maximizes an open application.

/*
** @applicationType: String [required]
** @options: Object [optional]
*/

// Possible values are 'editor' or 'terminal'
const applicationType = 'terminal';

const openAppOptions = {
  minHeight: '350px',
  windowTitle: 'bash',
  id: 'someId', // Identifies an application, in case of multiple instances
  inanimate: true, // Turns off application's window animation
  promptString: '~/my-project $', // For 'terminal' applications only
  initialContent: 'Some text', // For 'editor' applications only
  onCompleteDelay: 1000 // Delay before executing the next method
}

demo.openApp(applicationType, openAppOptions).end();

write

Writes some code in the open Editor application.

/*
** @codeSample: String [required]
** @options: Object [optional]
*/

// Tabs and line breaks will be preserved
const codeSample = `
function sum(a, b) {
  return a + b;
}

sum();
`;

const writeOptions = {
  id: 'someId', // Identifies an application, in case of multiple instances
  onCompleteDelay: 500 // Delay before executing the next method
}

demo.openApp('editor').write(codeSample, writeOptions).end();

command

Writes some command in the open Terminal application.

/*
** @command: String [required]
** @options: Object [optional]
*/

const command = 'npm install @glorious/demo --save';

// Redefines prompt string for this and following commands
const promptString = '$'

// Can optionally be an HTML string:
const promptString = '<span class="my-custom-class">$</span>'

const commandOptions = {
  id: 'someId', // Identifies an application, in case of multiple instances
  promptString, // Sets a custom string. Default: ~/demo $
  onCompleteDelay: 500 // Delay before executing the next method
}

demo.openApp('terminal').command(command, commandOptions).end();

respond

Shows some response on the open Terminal application.

/*
** @response: String [required]
** @options: Object [optional]
*/

// Line breaks will be preserved
const response = `
+ @glorious/demo successfully installed!
+ v0.1.0
`;

// Can optionally be an HTML string:
const response = `


<span class="my-custom-class">+</span> @glorious/demo successfully installed!




<span class="my-custom-class">+</span> v0.6.0


`;

const respondOptions = {
  id: 'someId', // Identifies an application, in case of multiple instances
  onCompleteDelay: 500 // Delay before executing the next method
}

demo.openApp('terminal').respond(response, respondOptions).end();

end

Indicates the end of the demonstration. The method returns a promise in case you want to perform some action at the end of the demonstration.

demo.openApp('terminal')
    .command('node demo')
    .respond('Hello World!')
    .end()
    .then(() => {
      // Custom code to be performed at the end of the demostration goes here.
    });

IMPORTANT: Do not forget to invoke it at the end of your demo. Otherwise, the demo won't be played.

Contributing

  1. Install Node. Download the "Recommend for Most Users" version.

  2. Clone the repo:

git clone git@github.com:glorious-codes/glorious-demo.git
  1. Go to the project directory:
cd glorious-demo
  1. Install the project dependencies:
npm install
  1. Build the project:
npm run build

Tests

Ensure that all code that you have added is covered with unit tests:

npm run test -- --coverage

Core symbols most depended-on inside this repo

openApplication
called by 17
src/scripts/components/desktop/desktop.js
play
called by 10
src/scripts/components/player/player.js
write
called by 8
src/scripts/components/editor-application/editor-application.js
command
called by 7
src/scripts/components/terminal-application/terminal-application.js
openApp
called by 6
src/scripts/index.js
maximizeApplication
called by 5
src/scripts/components/desktop/desktop.js
setText
called by 5
src/scripts/components/terminal-response-line/terminal-response-line.js
end
called by 4
src/scripts/index.js

Shape

Function 60
Method 53
Class 22

Languages

TypeScript100%

Modules by API surface

src/scripts/components/application/application.js19 symbols
src/scripts/components/editor-application/editor-application.js14 symbols
src/scripts/components/terminal-application/terminal-application.js13 symbols
src/scripts/components/player/player.js11 symbols
src/scripts/components/editor-line/editor-line.js11 symbols
src/scripts/index.js9 symbols
src/scripts/components/desktop/desktop.js9 symbols
src/scripts/components/terminal-command-line/terminal-command-line.js8 symbols
src/scripts/components/terminal-response-line/terminal-response-line.js7 symbols
src/scripts/components/cursor/cursor.js7 symbols
src/scripts/services/type-html-text/type-html-text.js5 symbols
src/scripts/components/terminal-line/terminal-line.js4 symbols

Dependencies from manifests, versioned

@babel/core7.6.4 · 1×
@babel/preset-env7.6.3 · 1×
@glorious/fyzer0.1.1 · 1×
babel-jest24.9.0 · 1×
babel-loader8.0.6 · 1×
css-loader3.5.2 · 1×
eslint5.6.0 · 1×
html-loader0.5.5 · 1×
html-loader-jest0.2.1 · 1×
jest24.9.0 · 1×
mini-css-extract-plugin0.8.0 · 1×
optimize-css-assets-webpack-plugin5.0.3 · 1×

For agents

$ claude mcp add glorious-demo \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact