Skip to content

Commit

Permalink
fix: versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
cha0s committed Jan 21, 2024
1 parent 1bcd198 commit f892113
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"packages/*"
],
"useNx": true,
"version": "2.0.3"
"version": "3.0.0"
}

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@flecks/monorepo",
"version": "3.0.0",
"private": true,
"repository": {
"type": "git",
Expand Down
7 changes: 1 addition & 6 deletions packages/create-app/build/move.js
Original file line number Diff line number Diff line change
@@ -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');

Expand Down Expand Up @@ -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;
};
7 changes: 6 additions & 1 deletion packages/create-app/build/tree.js
Original file line number Diff line number Diff line change
@@ -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');

Expand Down Expand Up @@ -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]) => {
Expand Down
1 change: 1 addition & 0 deletions packages/create-app/template/package.json.noconflict
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
12 changes: 12 additions & 0 deletions packages/create-fleck/build/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f892113

Please sign in to comment.