Giter Site home page Giter Site logo

sparkee's People

Contributors

geocld avatar jrson83 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

sparkee's Issues

bug: grouped post for #14 & #15

Description

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.

bug: changelog `commit.id` link breaks in monorepo

Description

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

Solution

  • Update monorepo template to include the generated url to a users repo, like in JS (I don't know the template syntax):
`https://github.com/${commit.repo.username}/${commit.repo.name}/commit/${commit.id}`

@Geocld Can you fix it?

docs: missing note that only changes inside the `src` folders of packages are tracked

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.

bug: after fixing `pnpmWorkspace` load bug, it resolves wrong folders

Description

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'
}

feat: better `CHANGELOG.md` handling

Summary of the feature being proposed

Add two capabilities:

  • If no changelog file exists, add the h1 heading # Changelog to the top of CHANGELOG.md (following two line breaks)
  • Change default behaviour from changelog release append to prepend (or add an option to use prepend or append)
    • If 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 release

What value does this feature bring?

The 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.

Are you willing to implement this feature yourself?

Yes, just let me known!

proposal: drop git-cliff

Proposal

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.

Git-cliff

  1. It's complicated
  2. The templates are horrible
  3. The template syntax is horrible
  4. It does not work with monorepo at the moment though
  5. Additional config file

Configuration files

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.

Solution

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.

feat: add `cli` tests

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
  • I be willing to help implement this feature.

bug: initial generated changelog includes every package commit in monorepo

Description

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.

Example

See the savescum repo.

Here is what I did:

  1. I created the tag [email protected] and published to npm and pushed the release.
  2. I made two commits to the savescum package:
  1. I used sparkee to publish [email protected] and generate a changelog.
  2. The changelog includes every commit made to the package in the changelog.

Expected result

Sparkee should only include a range of commits made between the two releases of v0.1.0 and v0.1.1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.