diff --git a/tools/mirror.mjs b/tools/mirror.mjs index 378639d364a8077860eb259f1e420a94413b7620..58a01795511ea2699be54214061c41085152ac8d 100644 --- a/tools/mirror.mjs +++ b/tools/mirror.mjs @@ -18,11 +18,32 @@ const sources = [ ".gitignore" ] +const projects = [ + "arkoala-arkts", + "incremental", + "interop", + "ui2abc" +] + const gitignoreOhos = `out sdk koala_build.log ` +function generatePackageJson(configPath) { + + const packageJson = { + "name": "root", + "private": true, + "//": "DO NOT ADD dependencies or devDependencies clauses to this level! Keep subfolders autonomous.", + "scripts": { + "prepare": `${ projects.map(name => { return `cd ${name} && npm i && cd ..`}).join(" && ") }`, + } + } + + fs.writeFileSync(configPath, JSON.stringify(packageJson, null, 4), 'utf-8'); +} + // Improve: need remove const excludes = [ ".gitlab-ci.yml", @@ -70,6 +91,8 @@ function main() { fs.mkdirSync(outPath) + generatePackageJson(path.join(outPath, "package.json")) + const matches = (file, patterns) => patterns.some(p => file.endsWith(p) || file.match(`/${p}/`)) sources.forEach(project => {