Add run-vscode-extension script
MODIFY
scripts/_constants.cjs
scripts/_constants.cjs
*/
const path = require('path');
+const os = require('os');
+exports.devFolder = path.join(os.tmpdir(), 'rome-dev');
exports.root = path.join(__dirname, '..');
exports.packages = path.join(exports.root, 'packages', '@romejs');
exports.generatorsFolder = path.join(

MODIFY
scripts/_utils.cjs
scripts/_utils.cjs
* LICENSE file in the root directory of this source tree.
*/
+const {root, devFolder} = require('./_constants.cjs');
const child = require('child_process');
const path = require('path');
const fs = require('fs');
@@ -56,3 +57,21 @@ exports.getBuilderName = function(name) {
return startingCapitals.slice(0, -1).toLowerCase() + rest;
}
};
+
+exports.inverse = function(str) {
+ return `\u001b[7m ${str} \u001b[27m`;
+};
+
+exports.buildTrunk = function() {
+ exports.unlink(devFolder);
+ fs.mkdirSync(devFolder);
+
+ console.log(exports.inverse('Building trunk'));
+ exports.execNode([
+ path.join(__dirname, 'vendor/rome.cjs'),
+ 'bundle',
+ path.join(root, 'packages/@romejs/cli/bin/rome.ts'),
+ devFolder,
+ '--quiet',
+ ]);
+};

MODIFY
scripts/dev-rome
scripts/dev-rome
require('./_setup.cjs');
-const {root, argv} = require('./_constants.cjs');
-const {unlink, execNode} = require('./_utils.cjs');
+const {argv, devFolder} = require('./_constants.cjs');
+const {execNode, buildTrunk, inverse} = require('./_utils.cjs');
const path = require('path');
-const fs = require('fs');
-const os = require('os');
-const DEV_FOLDER = path.join(os.tmpdir(), 'rome-dev');
-
-function inverse(str) {
- return `\u001b[7m ${str} \u001b[27m`;
-}
-
-unlink(DEV_FOLDER);
-fs.mkdirSync(DEV_FOLDER);
-
-console.log(inverse('Building trunk'));
-execNode([
- path.join(__dirname, 'vendor/rome.cjs'),
- 'bundle',
- path.join(root, 'packages/@romejs/cli/bin/rome.ts'),
- DEV_FOLDER,
- '--quiet',
-]);
+buildTrunk();
process.env.ROME_CACHE = '0';
console.log(inverse('Executing trunk'));
-execNode([path.join(DEV_FOLDER, 'index.js'), ...argv]);
+execNode([path.join(devFolder, 'index.js'), ...argv]);

ADD
scripts/run-vscode-extension
+#!/usr/bin/env node
+
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+const {argv, root} = require('./_constants.cjs');
+const {buildTrunk, inverse, exec, execNode} = require('./_utils.cjs');
+const path = require('path');
+
+const extensionFolder = path.join(root, 'packages/@romejs-integration/vscode');
+
+buildTrunk();
+
+console.log(inverse('Compiling Extension'));
+execNode([
+ path.join('node_modules', '.bin', 'tsc'),
+ '--build',
+ extensionFolder,
+]);
+
+console.log(inverse('Running VSCode'));
+exec('code', [
+ '--extensionDevelopmentPath',
+ extensionFolder,
+ '--disable-extensions',
+ ...argv,
+]);

Add run-vscode-extension script