-
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 to GH releases
Signed-off-by: Marc Dumais <[email protected]>
- Loading branch information
1 parent
8681348
commit bb9d30f
Showing
3 changed files
with
87 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ tasks: | |
yarn | ||
command: > | ||
jwm & | ||
yarn package-vsix:next | ||
github: | ||
prebuilds: | ||
branches: false |
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,80 @@ | ||
/** | ||
* Package individual built-in VS Code extensions in .vsix packages | ||
* The .vsix end-up in <repo root>/out | ||
*/ | ||
// @ts-check | ||
const fs = require('fs-extra') | ||
const yargs = require('yargs'); | ||
const { root, 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 vscePath = await run('yarn', ['bin'], root()); | ||
const vsce = vscePath.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', '/node_modules'); | ||
|
||
if (fs.existsSync(extensionsNodeModulesPath) && fs.existsSync(extensions('typescript-language-features'))) { | ||
await fs.copy(extensionsNodeModulesPath, tsLangFeaturesNMPath); | ||
} | ||
|
||
if (!fs.existsSync(root('out'))) { | ||
await fs.mkdir(root('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); | ||
pck.publisher = "theia-ide"; | ||
pck.repository = repository; | ||
pck.version = version; | ||
// avoid having vsce run scripts during packaging, such as "vscode-prepublish" | ||
pck.scripts = {}; | ||
|
||
try { | ||
fs.writeFileSync(pckPath, JSON.stringify(pck, undefined, 2), 'utf-8'); | ||
await run(vsce, ['package', '--yarn', '-o', root('out')], extensions(extension)); | ||
// 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'); | ||
} | ||
|
||
// console.log(pck.name, ': publishing...'); | ||
} | ||
// console.log(result.join(os.EOL)); | ||
})(); |