mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
Towards publishing
This commit is contained in:
parent
f1fc190711
commit
103da73f28
4 changed files with 37 additions and 69 deletions
5
.github/workflows/publish/computeState.js
vendored
5
.github/workflows/publish/computeState.js
vendored
|
|
@ -29,6 +29,8 @@ if (!/^((true)|(false)|())$/.test(STR_NIGHTLY)) {
|
|||
|
||||
const NIGHTLY = EVENT_NAME === 'schedule' || STR_NIGHTLY === 'true';
|
||||
|
||||
const distTag = NIGHTLY ? 'next' : 'latest';
|
||||
|
||||
const latestMonacoEditorVersion = npmGetLatestVersion('monaco-editor');
|
||||
const version = (() => {
|
||||
if (NIGHTLY) {
|
||||
|
|
@ -57,10 +59,11 @@ const skipMonacoEditorCore = (() => {
|
|||
})();
|
||||
|
||||
const skipMonacoEditor = (() => {
|
||||
return /** @type {'true'|'false'} */ (String(npmExists('monaco-editor-core', version)));
|
||||
return /** @type {'true'|'false'} */ (String(npmExists('monaco-editor', version)));
|
||||
})();
|
||||
|
||||
console.log(`
|
||||
::set-output name=dist_tag::${distTag}
|
||||
::set-output name=version::${version}
|
||||
::set-output name=vscode_branch::${vscodeBranch}
|
||||
::set-output name=skip_monaco_editor_core::${skipMonacoEditorCore}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,14 @@
|
|||
//@ts-check
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../../../');
|
||||
const packagejsonPath = path.join(REPO_ROOT, 'package.json');
|
||||
const packagejson = JSON.parse(fs.readFileSync(packagejsonPath).toString());
|
||||
packagejson['devDependencies']['monaco-editor-core'] = 'file:../vscode/out-monaco-editor-core';
|
||||
fs.writeFileSync(packagejsonPath, JSON.stringify(packagejson, null, '\t') + '\n');
|
||||
if (process.argv.length !== 5) {
|
||||
console.error(
|
||||
`usage: node setDevDependencyVersion.js <PATH_TO_PACKAGE_JSON_FILE> <PACKAGE> <VERSION>`
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const packagejson = JSON.parse(fs.readFileSync(process.argv[2]).toString());
|
||||
packagejson['devDependencies'][process.argv[3]] = process.argv[4];
|
||||
fs.writeFileSync(process.argv[2], JSON.stringify(packagejson, null, '\t') + '\n');
|
||||
50
.github/workflows/publish/setNightlyVersion.js
vendored
50
.github/workflows/publish/setNightlyVersion.js
vendored
|
|
@ -1,50 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//@ts-check
|
||||
|
||||
const fs = require('fs');
|
||||
const cp = require('child_process');
|
||||
|
||||
if (process.argv.length !== 3) {
|
||||
console.error(`usage: node setNightlyVersion.js <PATH_TO_PACKAGE_JSON_FILE>`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const packagejson = JSON.parse(fs.readFileSync(process.argv[2]).toString());
|
||||
const packageName = packagejson.name;
|
||||
if (packageName !== 'monaco-editor' && packageName !== 'monaco-editor-core') {
|
||||
console.error(`expected name to be 'monaco-editor' or 'monaco-editor-core'`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
/** @type {string} */
|
||||
const latestVersion = (() => {
|
||||
const output = cp.execSync(`npm show ${packageName} version`).toString();
|
||||
const version = output.split(/\r\n|\r|\n/g)[0];
|
||||
if (!/\d+\.\d+\.\d+/.test(version)) {
|
||||
console.log('unrecognized package.json version: ' + version);
|
||||
process.exit(1);
|
||||
}
|
||||
return version;
|
||||
})();
|
||||
|
||||
if (!/^0\.(\d+)\.(\d+)$/.test(latestVersion)) {
|
||||
console.error(`version ${latestVersion} does not match 0.x.y`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const devVersion = (() => {
|
||||
const pieces = latestVersion.split('.');
|
||||
const minor = parseInt(pieces[1], 10);
|
||||
const date = new Date();
|
||||
const yyyy = date.getUTCFullYear();
|
||||
const mm = String(date.getUTCMonth() + 1).padStart(2, '0');
|
||||
const dd = String(date.getUTCDate()).padStart(2, '0');
|
||||
return `0.${minor + 1}.0-dev.${yyyy}${mm}${dd}`;
|
||||
})();
|
||||
|
||||
packagejson.version = devVersion;
|
||||
fs.writeFileSync(process.argv[2], JSON.stringify(packagejson, null, '\t') + '\n');
|
||||
Loading…
Add table
Add a link
Reference in a new issue