-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP - package and publish built-ins individually
Signed-off-by: Marc Dumais <[email protected]>
- Loading branch information
1 parent
8681348
commit dea07ff
Showing
10 changed files
with
1,396 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ node_modules_backup | |
lib | ||
*.log | ||
*-app/* | ||
!*-app/package.json | ||
!*-app/package.json | ||
out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"git": { | ||
"requireCleanWorkingDir": false, | ||
"requireUpstream": true, | ||
"requireCommits": false, | ||
"addUntrackedFiles": false, | ||
"commit": true, | ||
"commitMessage": "Release v${version}", | ||
"commitArgs": "-s", | ||
"tag": true, | ||
"tagName": "v${version}", | ||
"tagAnnotation": "Release v${version}", | ||
"tagArgs": "", | ||
"push": true, | ||
"pushArgs": "--follow-tags", | ||
"pushRepo": "origin" | ||
}, | ||
"github": { | ||
"release": true, | ||
"releaseName": "Release ${version}", | ||
"preRelease": true, | ||
"draft": true, | ||
"tokenRef": "GITHUB_TOKEN", | ||
"assets": [ | ||
"out/*.vsix" | ||
], | ||
"timeout": 0, | ||
"proxy": null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,31 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"prepare": "yarn build:extensions && yarn bundle:extensions && yarn build", | ||
"build": "lerna run prepare", | ||
"build:extensions": "yarn --cwd vscode && yarn compile:extensions", | ||
"compile:extensions": "NODE_OPTIONS=--max-old-space-size=8192 node ./src/compile.js", | ||
"bundle:extensions": "NODE_OPTIONS=--max-old-space-size=8192 node ./src/bundle.js", | ||
"publish:latest": "node ./src/publish.js --tag=latest", | ||
"publish:next": "node ./src/publish.js --tag=next", | ||
"rebuild:browser": "theia rebuild:browser", | ||
"rebuild:electron": "theia rebuild:electron" | ||
}, | ||
"devDependencies": { | ||
"@types/archiver": "^3.0.0", | ||
"@types/node": "^8.0.0", | ||
"archiver": "^3.0.3", | ||
"lerna": "2.4.0" | ||
}, | ||
"workspaces": [ | ||
"vscode-builtin-extensions", | ||
"browser-app", | ||
"electron-app" | ||
] | ||
"private": true, | ||
"version": "0.3.0-next.7d7903ea53", | ||
"scripts": { | ||
"prepare": "yarn build:extensions && yarn bundle:extensions && yarn build", | ||
"build": "lerna run prepare", | ||
"build:extensions": "yarn --cwd vscode && yarn compile:extensions", | ||
"compile:extensions": "NODE_OPTIONS=--max-old-space-size=8192 node ./src/compile.js", | ||
"bundle:extensions": "NODE_OPTIONS=--max-old-space-size=8192 node ./src/bundle.js", | ||
"publish:latest": "node ./src/publish.js --tag=latest", | ||
"publish:next": "node ./src/publish.js --tag=next", | ||
"rebuild:browser": "theia rebuild:browser", | ||
"rebuild:electron": "theia rebuild:electron", | ||
"package-vsix:latest": "node src/package-vsix.js --tag latest", | ||
"package-vsix:next": "node src/package-vsix.js --tag next" | ||
}, | ||
"devDependencies": { | ||
"@types/archiver": "^3.0.0", | ||
"@types/node": "^8.0.0", | ||
"archiver": "^3.0.3", | ||
"lerna": "2.4.0", | ||
"vsce": "1.70.0", | ||
"fs-extra": "8.1.0", | ||
"release-it": "12.4.3" | ||
}, | ||
"workspaces": [ | ||
"vscode-builtin-extensions", | ||
"browser-app", | ||
"electron-app" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/** | ||
* Package individual built-in VS Code extensions in .vsix packages | ||
* The .vsix packages end-up in <repo root>/out | ||
*/ | ||
// @ts-check | ||
const fs = require('fs-extra') | ||
const os = require('os'); | ||
const yargs = require('yargs'); | ||
const { root, out, extensions, run, vscode } = require('./paths.js'); | ||
|
||
const { tag } = yargs.option('tag', { | ||
choices: ['latest', 'next'] | ||
}).demandOption('tag').argv; | ||
|
||
const repository = { | ||
"type": "git", | ||
"url": "https://github.com/theia-ide/vscode-builtin-extensions" | ||
}; | ||
|
||
// bump to publish | ||
let version = '0.2.1'; | ||
|
||
(async () => { | ||
|
||
const bin = await run('yarn', ['bin'], root()); | ||
const vsce = bin.trim() + '/vsce'; | ||
|
||
if (tag === 'next') { | ||
const shortRevision = (await run('git', ['rev-parse', '--short', 'HEAD'], vscode())).trim(); | ||
const [, minor] = version.split('.'); | ||
version = `0.${Number(minor) + 1}.0-next.${shortRevision}`; | ||
} | ||
const result = []; | ||
|
||
// typescript-language-features ext needs "extensions/node_modules" content | ||
const extensionsNodeModulesPath = extensions('node_modules'); | ||
const tsLangFeaturesNMPath = extensions('typescript-language-features/'); | ||
if (fs.existsSync(extensionsNodeModulesPath) && fs.existsSync(extensions('typescript-language-features'))) { | ||
await fs.copy(extensionsNodeModulesPath, tsLangFeaturesNMPath); | ||
console.log('Copying node_modules under typescript-language-features'); | ||
} | ||
|
||
if (!fs.existsSync(out())) { | ||
await fs.mkdir(out()); | ||
} | ||
|
||
for (const extension of fs.readdirSync(extensions())) { | ||
// console.log(`extension: ${extension}`); | ||
if (extension.includes('node_modules')) { | ||
continue; | ||
} | ||
const pckPath = extensions(extension, 'package.json'); | ||
if (!fs.existsSync(pckPath)) { | ||
continue; | ||
} | ||
|
||
const originalContent = fs.readFileSync(pckPath, 'utf-8'); | ||
const pck = JSON.parse(originalContent); | ||
// warning: do not meddle with pck.publisher - it's part of the | ||
// extension id and used in places to access some extensions | ||
// pck.publisher = "theia-ide"; | ||
pck.repository = repository; | ||
pck.version = version; | ||
// avoid having vsce run scripts during packaging, such as "vscode-prepublish" | ||
pck.scripts = {}; | ||
|
||
console.log('packaging: ', pck.name, ' ...'); | ||
try { | ||
fs.writeFileSync(pckPath, JSON.stringify(pck, undefined, 2), 'utf-8'); | ||
await run(vsce, ['package', '--yarn', '-o', out()], extensions(extension)); | ||
result.push('sucessfully packaged: ' + pck.name); | ||
} catch (e) { | ||
result.push('failed to packaged: ' + pck.name); | ||
if (e) { | ||
console.error(e) | ||
}; | ||
} finally { | ||
fs.writeFileSync(pckPath, originalContent, 'utf-8'); | ||
} | ||
|
||
} | ||
|
||
console.log('Publishing extensions'); | ||
for (const vsix of fs.readdirSync(out())) { | ||
try { | ||
console.log(`Publish ext name: ${vsix}`); | ||
// await run('yarn', ['release-it', 'upload',`--name "${version}"`, `--tag ${version}`,'--owner marcdumais-work', '--repo vscode-builtin-extensions', '--prerelease', await run('ls', [out(vsix)])]); | ||
// await run('yarn', ['github-release', 'upload',`--name "${version}"`, `--tag ${version}`,'--owner marcdumais-work', '--repo vscode-builtin-extensions', '--prerelease', await run('ls', [out(vsix)])]); | ||
// result.push('sucessfully packaged: ' + pck.name); | ||
} catch (e) { | ||
// result.push('failed to packaged: ' + pck.name); | ||
if (e) { | ||
console.error(e) | ||
}; | ||
} | ||
} | ||
|
||
console.log(result.join(os.EOL)); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.