geocld / sparkee Goto Github PK
View Code? Open in Web Editor NEWA publish tool for monorepo,just like lerna but support pnpm.
A publish tool for monorepo,just like lerna but support pnpm.
The two problems described occur due to the configuration of the sparkee-cliff-monorepo.toml
tag_pattern = "@*"
.
It assumes that every package name in a monorepo starts with @
. My main-package for example is called savescum
and the web package @savescum/web
.
I tested the whole thing and with the following pattern #14 & #15 are solved.
tag_pattern = "*@[0-9]*"
To exclude Releases
from changelog (like here) I will add the following to the commit exclude pattern:
{ message = "^release:", skip = true },
And since the automatic link tagging for the version inside the changelog does not work, without using compare branches, I will remove the square brackets for the monorepo template.
In utils/changelog.ts
is the template code:
([{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }}))
Generates the following markdown example link output:
([a9d4050](a9d4050212a18f6b3bd76e2e41fbb9045d268b80))
In singlerepo it works and the link automatic leads to the commit url:
https://github.com/username/repo/commit/a9d4050212a18f6b3bd76e2e41fbb9045d268b80
In monorepo it instead leads to the changelogs repos package root:
https://github.com/username/repot/blob/main/packages/core/a9d4050212a18f6b3bd76e2e41fbb9045d268b80
`https://github.com/${commit.repo.username}/${commit.repo.name}/commit/${commit.id}`
@Geocld Can you fix it?
It took me some time to figure out, why I always got the message when running publish:
WARN No packages have changed since last release, you can run --force to publish all packages.
When I checked the sparkee code, I realized it checks only the packages src
folder and package.json
for changes:
const { stdout: hasChanges } = await exec(`git diff ${lastTag} -- ${join(folder, 'src')} ${join(folder, 'package.json')}`)
But in my test monorepo I created just an index.js
file inside the pk1 root, not in src
folder.
Thanks for making this great package. I have tested many publish cli's for monorepos in the last days and I love this one, cause it is so simple.
Before the recent changes we used read-yaml-file:
try {
const pnpmWorkspace = await readYamlFile<PnpmWorkspace>(fs.readFileSync(PNPM_WORKSPACE, 'utf8'))
// ... never executed cause `read-yaml-file` expects a `path` not file content & throws error
} catch (err) {
// always executed
folders = await glob('packages/*')
}
I fixed this changing:
const pnpmWorkspace = await readYamlFile<PnpmWorkspace>(PNPM_WORKSPACE)
let wPackages = pnpmWorkspace.packages
// this code now is a new problem
wPackages = wPackages.map((wp) => {
return `${wp.split('/')[0]}/*`
})
await Promise.all(
wPackages.map(async (wp) => {
const wFolders = await glob(wp)
folders = folders.concat(wFolders)
})
)
Now the problem is that pnpm-workspace.yaml can have multiple entries, with and without globs *
and with and without excludes !
.
packages:
- 'docs'
- 'another-single-package'
- 'packages/*'
- 'multiple-sub-packages/**/*'
- '!**/__tests__/**'
After reading the yml, pnpmWorkspace
is:
{
packages: [
'docs',
'another-single-package',
'packages/*',
'multiple-sub-packages/**/*',
'!**/__tests__/**'
]
}
After the map function folders
is:
[
'docs/node_modules',
'docs/package.json',
'docs/src',
'docs/tsconfig.json',
'packages/one',
'packages/two',
'multiple-sub-packages/another-subfolder',
'multiple-sub-packages/subfolder'
]
Now the glob function fails and throws:
[Error: ENOENT: no such file or directory, open 'docs/node_modules/package.json'] {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: '/docs/node_modules/package.json'
}
Add two capabilities:
# Changelog
to the top of CHANGELOG.md
(following two line breaks)append
to prepend
(or add an option to use prepend
or append
)
prepend
is enabled and the file CHANGELOG.md
exists, check if the first line is # Changelog\n\n
and prepend the new release between heading and last releaseThe CHANGELOG.md
should have the heading Changelog
as this is expected.
When using a changelog generator, the expected behaviour is, the new release gets prepended to the top of CHANGELOG.md
, instead of beeing appended to the bottom.
EDIT: The heading could also be an userOption header
, like stated in conventional-changelog-config-spec.
Yes, just let me known!
I released a new version of savescum. Sparkee excluded v0.1.1 from the changelog and merged all changes from v0.1.1 into v1.1.2.
So at first I thought git-cliff is cool. But there are multiple reasons I would prefer to drop git-cliff and write the changelog generator by ourselfs.
Before using git-cliff, it was possible to configure the changelog generator using spark.json logPresetTypes
.
Now in addition to spark.conf you need another .toml configuration file.
At the moment, the spark.json is actually obsolete, since it holds only two options:
moduleManager
packages
Those options are resolved on init either using package.json or pnpm-workspace.yaml.
When keeping git-cliff it would make sense to drop spark.json and resolve the options at run time, from package.json or pnpm-workspace.yaml.
It would be great if you willing to drop git-cliff and replace it with a custom changelog generator.
I be willing to implement the changelog generator.
We should add vitest
cases for testing the cli stdout
/stdin
. For that purpose each cli command
must be it's own module.
I think this is also good practice, cause it will have 1:1
the same file structure like the core/
folder.
sparkee/
└── src/
├── commands/
│ ├── index.ts # exports all commands
│ ├── info.ts
│ ├── init-cliff.ts
│ ├── init.ts
│ ├── log.ts
│ ├── publish.ts
│ └── run.ts
├── common/
├── core/
├── types/
├── utils/
└── index.ts
When using sparkee the first time in a monorepo to publish
a package which already has git-tags and no changelog, sparkee generates a changelog which includes EVERY commit that has been made to the package, since the creation of the git-repository.
See the savescum repo.
Here is what I did:
Sparkee should only include a range
of commits made between the two releases of v0.1.0 and v0.1.1.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.