diff --git a/lerna.json b/lerna.json index 0fc05f6..e44ed5b 100644 --- a/lerna.json +++ b/lerna.json @@ -3,6 +3,6 @@ "packages/*" ], "useNx": true, - "version": "2.0.3" + "version": "3.0.0" } diff --git a/package.json b/package.json index 3d4c4ae..7a6f1bc 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "@flecks/monorepo", + "version": "3.0.0", "private": true, "repository": { "type": "git", diff --git a/packages/create-app/build/move.js b/packages/create-app/build/move.js index 04fcbba..deddbc4 100644 --- a/packages/create-app/build/move.js +++ b/packages/create-app/build/move.js @@ -1,7 +1,7 @@ const {stat} = require('fs/promises'); const {basename, dirname, join} = require('path'); -const {JsonStream, transform} = require('@flecks/core/server'); +const {transform} = require('@flecks/core/server'); const FileTree = require('./tree'); @@ -35,10 +35,5 @@ exports.move = async (name, source) => { done(); }), ); - // Pretty print all JSON. - fileTree.glob('**/*.json') - .forEach((path) => { - fileTree.pipe(path, new JsonStream.PrettyPrint()); - }); return fileTree; }; diff --git a/packages/create-app/build/tree.js b/packages/create-app/build/tree.js index be0205d..bd45df7 100644 --- a/packages/create-app/build/tree.js +++ b/packages/create-app/build/tree.js @@ -1,7 +1,7 @@ const {createReadStream, createWriteStream} = require('fs'); const {mkdir, stat} = require('fs/promises'); -const {glob} = require('@flecks/core/server'); +const {glob, JsonStream} = require('@flecks/core/server'); const minimatch = require('minimatch'); const {dirname, join} = require('path'); @@ -46,6 +46,11 @@ module.exports = class FileTree { } async writeTo(destination) { + // Pretty print all JSON. + this.glob('**/*.json') + .forEach((path) => { + this.pipe(path, new JsonStream.PrettyPrint()); + }); return Promise.all( Object.entries(this.files) .map(async ([path, stream]) => { diff --git a/packages/create-app/template/package.json.noconflict b/packages/create-app/template/package.json.noconflict index b2b2020..8176151 100644 --- a/packages/create-app/template/package.json.noconflict +++ b/packages/create-app/template/package.json.noconflict @@ -1,5 +1,6 @@ { "private": true, + "version": "1.0.0", "scripts": { "build": "FLECKS_ENV__flecks_server__start=0 npm run build:only", "build:only": "flecks build", diff --git a/packages/create-fleck/build/cli.js b/packages/create-fleck/build/cli.js index 307b3d5..c394704 100644 --- a/packages/create-fleck/build/cli.js +++ b/packages/create-fleck/build/cli.js @@ -6,6 +6,7 @@ const {join} = require('path'); const addFleckToYml = require('@flecks/core/build/add-fleck-to-yml'); const {program} = require('@flecks/core/build/commands'); const Server = require('@flecks/core/build/server'); +const {transform} = require('@flecks/core/server'); const build = require('@flecks/create-app/build/build'); const {move, testDestination} = require('@flecks/create-app/build/move'); const {validate} = require('@flecks/create-app/server'); @@ -83,6 +84,17 @@ const target = async (fleck) => { throw error; } const fileTree = await move(name, join(__dirname, '..', 'template')); + if (isMonorepo) { + const {version} = require(join(FLECKS_CORE_ROOT, 'package.json')); + // Inherit version from monorepo root. + fileTree.pipe( + 'package.json', + transform((chunk, encoding, done, stream) => { + stream.push(JSON.stringify({...JSON.parse(chunk), version})); + done(); + }), + ); + } // Write the tree. await fileTree.writeTo(destination); await build(packageManager, destination);