From c4fa782fc2e680d64b27d4230fb306cc4718d56a Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Thu, 31 Aug 2023 09:57:50 +0200 Subject: [PATCH] Restore manual running from the repository (#4150) --- build/simpleserver.ts | 102 ------------------------------------------ test/manual/index.js | 16 +++---- 2 files changed, 5 insertions(+), 113 deletions(-) diff --git a/build/simpleserver.ts b/build/simpleserver.ts index 76224554..bdfe8e51 100644 --- a/build/simpleserver.ts +++ b/build/simpleserver.ts @@ -10,8 +10,6 @@ import yaserver = require('yaserver'); import { REPO_ROOT } from './utils'; import { ensureDir } from './fs'; -const WEBSITE_GENERATED_PATH = path.join(REPO_ROOT, 'website/playground/new-samples'); - generateTestSamplesTask(); const SERVER_ROOT = path.normalize(path.join(REPO_ROOT, '../')); @@ -53,106 +51,6 @@ function generateTestSamplesTask() { const destination = path.join(REPO_ROOT, 'test/manual/generated/all-samples.js'); ensureDir(path.dirname(destination)); fs.writeFileSync(destination, prefix + JSON.stringify(samples, null, '\t') + suffix); - - /** @type {{ chapter: string; name: string; id: string; path: string; }[]} */ - const PLAY_SAMPLES = require(path.join(WEBSITE_GENERATED_PATH, 'all.js')).PLAY_SAMPLES; - /** @type {{ path: string; name: string; }[]} */ - const locations = []; - for (let i = 0; i < PLAY_SAMPLES.length; i++) { - const sample = PLAY_SAMPLES[i]; - const sampleId = sample.id; - const samplePath = path.join(WEBSITE_GENERATED_PATH, sample.path); - - const html = fs.readFileSync(path.join(samplePath, 'sample.html')); - const js = fs.readFileSync(path.join(samplePath, 'sample.js')); - const css = fs.readFileSync(path.join(samplePath, 'sample.css')); - - const result = [ - '', - '', - '', - '', - ' ', - ' ', - '', - '', - '', - '[<< BACK]
', - 'THIS IS A GENERATED FILE VIA `npm run simpleserver`', - '', - '
', - '', - '
', - '
', - '', - '', - html, - '', - '', - '
', - '
', - '', - '', - '', - '', - '' - ]; - - const destination = path.join( - REPO_ROOT, - 'test/manual/generated/playground/' + sampleId + '.html' - ); - ensureDir(path.dirname(destination)); - fs.writeFileSync(destination, result.join('\n')); - locations.push({ - path: sampleId + '.html', - name: sample.chapter + ' > ' + sample.name - }); - } - - const index = [ - '', - '', - '', - '', - ' ', - '', - '', - '[<< BACK]
', - 'THIS IS A GENERATED FILE VIA `npm run simpleserver`

', - locations - .map(function (location) { - return ( - '' + - location.name + - '' - ); - }) - .join('
\n'), - '', - '', - '' - ]; - fs.writeFileSync( - path.join(REPO_ROOT, 'test/manual/generated/playground/index.html'), - index.join('\n') - ); } function createSimpleServer(rootDir: string, port: number) { diff --git a/test/manual/index.js b/test/manual/index.js index f18a3d5e..b1942b89 100644 --- a/test/manual/index.js +++ b/test/manual/index.js @@ -1,4 +1,4 @@ -/// +/// define(['require', './samples'], function (require, SAMPLES) { const domutils = require('vs/base/browser/dom'); @@ -20,16 +20,10 @@ define(['require', './samples'], function (require, SAMPLES) { renderWhitespace: true }); - editor.addCommand( - { - ctrlCmd: true, - key: 'F9' - }, - function (ctx, args) { - alert('Command Running!!'); - console.log(ctx); - } - ); + editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.F9, function (ctx, args) { + alert('Command Running!!'); + console.log(ctx); + }); editor.addAction({ id: 'my-unique-id',