Skip to content

release plan : increment version from 0.0.0 #831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/bin/new-plugin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ console.log(`- Creating new plugin ${pluginName}`);
path.join(pluginDir, 'CHANGELOG.md'),
`# Changes to PostCSS ${pluginName}

### 1.0.0 (Unreleased)
### Unreleased (major)

- Initial version
`,
Expand All @@ -74,7 +74,7 @@ console.log(`- Creating new plugin ${pluginName}`);
const packageInfo = JSON.parse(await fsp.readFile(path.join(pluginDir, 'package.json'), 'utf8'));
packageInfo.name = packageName;
packageInfo.description = `TODO: Add description for ${pluginName}`;
packageInfo.version = '1.0.0';
packageInfo.version = '0.0.0';
packageInfo.homepage = `https://github.com/csstools/postcss-plugins/tree/main/plugins/${pluginSlug}#readme`;
packageInfo.bugs = 'https://github.com/csstools/postcss-plugins/issues';
packageInfo.csstools.exportName = exportName;
Expand Down
23 changes: 23 additions & 0 deletions .github/bin/release-plan/npm-version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@ import fs from 'fs/promises';
import path from 'path';

export async function npmVersion(increment, packageDirectory) {
{
const packageInfo = JSON.parse(await fs.readFile(path.join(packageDirectory, 'package.json')));
if (packageInfo.version === '0.0.0') {
switch (increment) {
case 'major':
packageInfo.version = '1.0.0';
break;
case 'minor':
packageInfo.version = '0.1.0';
break;
case 'patch':
packageInfo.version = '0.0.1';
break;

default:
throw new Error(`Unknown increment "${increment}"`);
}

await fs.writeFile(path.join(packageDirectory, 'package.json'), JSON.stringify(packageInfo, null, '\t'));
return packageInfo.version;
}
}

await new Promise((resolve, reject) => {
const versionCmd = spawn(
'npm',
Expand Down