Skip to content

Commit

Permalink
[.vsix packaging] Generate a .vsix for all built-ins
Browse files Browse the repository at this point in the history
This commit does a bit of massaging so that "vsce" will
accept to package the built-ins we build onto a .vsix file.

To generate it:
$> cd <repo root>/vscode-builtin-extensions
$> yarn package

The resulting .vsix file will be saved in the repo root

Signed-off-by: Marc Dumais <marc.dumais@ericsson.com>
  • Loading branch information
marcdumais-work committed Dec 4, 2019
1 parent 124eea7 commit f7dd9c2
Show file tree
Hide file tree
Showing 5 changed files with 585 additions and 328 deletions.
3 changes: 2 additions & 1 deletion browser-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"name": "browser-app",
"version": "0.0.0",
"dependencies": {
"vscode-builtin-extensions": "0.0.0"
"vscode-builtin-extensions": "0.0.0",
"@theia/plugin-ext-vscode": "next"
},
"devDependencies": {
"@theia/cli": "next"
Expand Down
3 changes: 2 additions & 1 deletion electron-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"name": "electron-app",
"version": "0.0.0",
"dependencies": {
"vscode-builtin-extensions": "0.0.0"
"vscode-builtin-extensions": "0.0.0",
"@theia/plugin-ext-vscode": "next"
},
"devDependencies": {
"@theia/cli": "next",
Expand Down
58 changes: 58 additions & 0 deletions src/package-vsix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* Package built-in VS Code extensions in a .vsix extension pack
*/
// @ts-check
const fs = require('fs');
const os = require('os');
const yargs = require('yargs');
const archiver = require('archiver');
const { theiaExtension, extensions, run, vscode } = require('./paths.js');

let version = '0.2.1';

(async () => {
// const result = [];
const packMembers = [];

const pckPath = theiaExtension('package.json');
// if (!fs.existsSync(pckPath)) {
// continue;
// }
const extpackpckContent = fs.readFileSync(pckPath, 'utf-8');
const pck = JSON.parse(extpackpckContent);


for (const extension of await fs.readdirSync(extensions())) {
if (extension.startsWith('ms-vscode')) {
// skip marketplace extensions
continue;
}
const pckPath = extensions(extension, 'package.json');
if (!fs.existsSync(pckPath)) {
continue;
}
const originalContent = fs.readFileSync(pckPath, 'utf-8');
const extpck = JSON.parse(originalContent);

packMembers.push(`${extpck.publisher}.${extpck.name}`);
}
pck.extensionPack = packMembers;

// console.log(packMembers.join(os.EOL));

try {
fs.writeFileSync(pckPath, JSON.stringify(pck, undefined, 2), 'utf-8');
console.log('pwd: ' + await run('pwd', []));
await run('yarn', ['package']);
// result.push(pck.name + ': sucessfully published');
} catch (e) {
// result.push(pck.name + ': failed to publish');
if (e) {
console.error(e)
};
} finally {
// fs.writeFileSync(pckPath, originalContent, 'utf-8');
}


})();
19 changes: 14 additions & 5 deletions vscode-builtin-extensions/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"name": "vscode-builtin-extensions",
"publisher": "theia-ide",
"engines": {
"vscode": "^1.33.0"
},
"keywords": [
"theia-extension"
],
Expand All @@ -9,18 +13,23 @@
"src",
"extensions"
],
"dependencies": {
"@theia/plugin-ext-vscode": "next"
},
"dependencies": {},
"devDependencies": {
"rimraf": "latest",
"typescript": "latest"
"typescript": "latest",
"inversify": "^5.0.1",
"vsce": "1.70.0"
},
"repository": {
"type": "git",
"url": "https://github.com/theia-ide/vscode-builtin-extensions.git"
},
"scripts": {
"prepare": "yarn run clean && yarn run build",
"clean": "rimraf lib",
"build": "tsc",
"watch": "tsc -w"
"watch": "tsc -w",
"package": "vsce package -o ../"
},
"theiaExtensions": [
{
Expand Down
Loading

0 comments on commit f7dd9c2

Please sign in to comment.