mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 07:00:11 +01:00
Move website task out of gulp
This commit is contained in:
parent
240b684846
commit
207f0cf42a
11 changed files with 586 additions and 4361 deletions
|
|
@ -11,17 +11,16 @@
|
|||
* @typedef { { name:string; contrib:string; modulePrefix:string; rootPath:string; paths:IPluginPaths } } IPlugin
|
||||
* @typedef { { METADATA: {CORE:{paths:ICorePaths}; PLUGINS:IPlugin[];} } } IMetadata
|
||||
*/
|
||||
/** @typedef {import('../build/utils').IFile} IFile */
|
||||
|
||||
const glob = require('glob');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const { REPO_ROOT, removeDir, ensureDir } = require('../build/utils');
|
||||
const { REPO_ROOT, removeDir, ensureDir, readFiles, writeFiles } = require('../build/utils');
|
||||
const ts = require('typescript');
|
||||
/**@type { IMetadata } */
|
||||
const metadata = require('../metadata.js');
|
||||
|
||||
/** @typedef {{ path:string; contents:Buffer;}} IFile */
|
||||
|
||||
removeDir(`release`);
|
||||
|
||||
// dev folder
|
||||
|
|
@ -466,42 +465,3 @@ function releaseThirdPartyNotices() {
|
|||
|
||||
writeFiles([tpn], `release`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} pattern
|
||||
* @param {{ base:string; ignore?:string[] }} options
|
||||
* @returns {IFile[]}
|
||||
*/
|
||||
function readFiles(pattern, options) {
|
||||
let files = glob.sync(pattern, { cwd: REPO_ROOT, ignore: options.ignore });
|
||||
// remove dirs
|
||||
files = files.filter((file) => {
|
||||
const fullPath = path.join(REPO_ROOT, file);
|
||||
const stats = fs.statSync(fullPath);
|
||||
return stats.isFile();
|
||||
});
|
||||
|
||||
const base = options.base;
|
||||
const baseLength = base === '' ? 0 : base.endsWith('/') ? base.length : base.length + 1;
|
||||
return files.map((file) => {
|
||||
const fullPath = path.join(REPO_ROOT, file);
|
||||
const contents = fs.readFileSync(fullPath);
|
||||
const relativePath = file.substring(baseLength);
|
||||
return {
|
||||
path: relativePath,
|
||||
contents
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {IFile[]} files
|
||||
* @param {string} dest
|
||||
*/
|
||||
function writeFiles(files, dest) {
|
||||
for (const file of files) {
|
||||
const fullPath = path.join(REPO_ROOT, dest, file.path);
|
||||
ensureDir(path.dirname(fullPath));
|
||||
fs.writeFileSync(fullPath, file.contents);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue