fix: versioning

This commit is contained in:
cha0s 2024-01-21 06:56:53 -06:00
parent 1bcd198aaf
commit f892113ca2
6 changed files with 22 additions and 8 deletions

View File

@ -3,6 +3,6 @@
"packages/*"
],
"useNx": true,
"version": "2.0.3"
"version": "3.0.0"
}

View File

@ -1,5 +1,6 @@
{
"name": "@flecks/monorepo",
"version": "3.0.0",
"private": true,
"repository": {
"type": "git",

View File

@ -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;
};

View File

@ -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]) => {

View File

@ -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",

View File

@ -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);