@versatiles/release-tool 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,6 +9,35 @@ Tools used internally for:
9
9
  * creating Markdown documentation of executables: [`vrt cmd2md`](#subcommand-vrt-cmd2md)
10
10
  * inserting Markdown into documents: [`vrt insertmd`](#subcommand-vrt-insertmd)
11
11
  * updating "Table of Content" in Markdown files: [`vrt inserttoc`](#subcommand-vrt-inserttoc)
12
+ * releasing the current version as npm package: [`vrt release-npm`](#subcommand-vrt-release-npm)
13
+
14
+ # Installation
15
+
16
+ ```bash
17
+ npm i -D @versatiles/release-tool
18
+ ```
19
+
20
+ # configure scripts
21
+
22
+ You need to configure the scripts in the package.json:
23
+
24
+ ```JSON
25
+ {
26
+ "scripts": {
27
+ "check": "npm run lint && npm run build && npm run test",
28
+ "prepack": "npm run build && npm run doc",
29
+ "release": "vrt release-npm",
30
+ ...
31
+ },
32
+ ...
33
+ }
34
+ ```
35
+
36
+ * `scripts.check` is **required** by the release command. Here you can lint, build and test your code.
37
+ * `scripts.prepack` is **recommended** to ensure that all files are up-to-date before releasing. Here you can build code and documentation.
38
+ * `scripts.release` is **recommended** to make it easy to release a new version.
39
+
40
+ Have a look at this [package.json](https://github.com/versatiles-org/node-release-tool/blob/main/package.json) as an example.
12
41
 
13
42
  # Command `vrt`
14
43
 
@@ -25,12 +25,8 @@ export async function release(directory, branch = 'main') {
25
25
  panic('package.json is missing "version"');
26
26
  if (!('scripts' in pkg) || (typeof pkg.scripts !== 'object') || (pkg.scripts == null))
27
27
  panic('package.json is missing "scripts"');
28
- const { scripts } = pkg;
29
- for (const scriptName of ['lint', 'build', 'test', 'doc']) {
30
- if (!(scriptName in scripts)) {
31
- panic(`missing npm script "${scriptName}" in package.json`);
32
- }
33
- }
28
+ if (!('check' in pkg.scripts))
29
+ panic('missing npm script "check" in package.json');
34
30
  // get last version
35
31
  const tag = await check('get last github tag', getLastGitHubTag());
36
32
  const shaLast = tag?.sha;
@@ -46,14 +42,8 @@ export async function release(directory, branch = 'main') {
46
42
  const releaseNotes = await check('prepare release notes', getReleaseNotes(nextVersion, shaLast, shaCurrent));
47
43
  // update version
48
44
  await check('update version', setNextVersion(nextVersion));
49
- // lint
50
- await check('lint', shell.run('npm run lint'));
51
- // build
52
- await check('build', shell.run('npm run build'));
53
- // test
54
- await check('run tests', shell.run('npm run test'));
55
45
  // test
56
- await check('update doc', shell.run('npm run doc'));
46
+ await check('run checks', shell.run('npm run check'));
57
47
  // npm publish
58
48
  await check('npm publish', shell.run('npm publish --access public'));
59
49
  // git push
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versatiles/release-tool",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "VersaTiles release and documentation tools",
5
5
  "bin": {
6
6
  "vrt": "./dist/index.js"
@@ -15,6 +15,7 @@
15
15
  "doc": "npx vrt cmd2md vrt | npx vrt insertmd README.md '# Command'",
16
16
  "lint": "eslint . --color",
17
17
  "prepack": "npm run build && npm run doc",
18
+ "release": "npx vrt release-npm",
18
19
  "test-coverage": "NODE_OPTIONS=--experimental-vm-modules jest --coverage",
19
20
  "test": "NODE_OPTIONS=--experimental-vm-modules jest",
20
21
  "upgrade": "npm-check-updates -u && rm -f package-lock.json; rm -rf node_modules; npm i && npm update"
@@ -30,7 +31,7 @@
30
31
  "devDependencies": {
31
32
  "@types/inquirer": "^9.0.7",
32
33
  "@types/jest": "^29.5.11",
33
- "@types/node": "^20.11.10",
34
+ "@types/node": "^20.11.15",
34
35
  "@typescript-eslint/eslint-plugin": "^6.20.0",
35
36
  "@typescript-eslint/parser": "^6.20.0",
36
37
  "eslint": "^8.56.0",