@anolilab/semantic-release-clean-package-json 1.0.0-alpha.1
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/CHANGELOG.md +9 -0
- package/LICENSE.md +21 -0
- package/README.md +206 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +98 -0
- package/dist/index.d.mts +98 -0
- package/dist/index.d.ts +98 -0
- package/dist/index.mjs +1 -0
- package/package.json +76 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
## @anolilab/semantic-release-clean-package-json 1.0.0-alpha.1 (2025-01-15)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* new clean-package-json package for semantic-release ([#106](https://github.com/anolilab/semantic-release/issues/106)) ([94218d7](https://github.com/anolilab/semantic-release/commit/94218d72b21e698f46b96749d9216209782d381a))
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* **semantic-release-clean-package-json:** fixed circular dependency ([93b51f9](https://github.com/anolilab/semantic-release/commit/93b51f9c03503e10f0c0a23dcd55273622b40aa0))
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 anolilab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h3>anolilab semantic-release-clean-package-json</h3>
|
|
3
|
+
<p>
|
|
4
|
+
Clean package.json before publish by removing unnecessary properties
|
|
5
|
+
</p>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<br />
|
|
9
|
+
|
|
10
|
+
<div align="center">
|
|
11
|
+
|
|
12
|
+
[![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url]
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<div align="center">
|
|
19
|
+
<p>
|
|
20
|
+
<sup>
|
|
21
|
+
Daniel Bannert's open source work is supported by the community on <a href="https://github.com/sponsors/prisis">GitHub Sponsors</a>
|
|
22
|
+
</sup>
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npm install @anolilab/semantic-release-clean-package-json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
yarn add @anolilab/semantic-release-clean-package-json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
pnpm add @anolilab/semantic-release-clean-package-json
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
The plugin can be configured in the [**semantic-release** configuration file](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration):
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"plugins": [
|
|
49
|
+
"@semantic-release/commit-analyzer",
|
|
50
|
+
"@semantic-release/release-notes-generator",
|
|
51
|
+
"@anolilab/semantic-release-pnpm",
|
|
52
|
+
"@anolilab/semantic-release-clean-package-json"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Steps that are used
|
|
58
|
+
|
|
59
|
+
| Step | Description |
|
|
60
|
+
| --------- | -------------------------------------------------------------------------------------------------------- |
|
|
61
|
+
| `prepare` | Modifing the `package.json` file with the [default preserved properties](#default-preserved-properties). |
|
|
62
|
+
|
|
63
|
+
### Options
|
|
64
|
+
|
|
65
|
+
| Options | Description | Default |
|
|
66
|
+
| --------- | -------------------------- | ------- |
|
|
67
|
+
| `pkgRoot` | Directory path to publish. | `.` |
|
|
68
|
+
| `keep` | Property names to keep. | `[]` |
|
|
69
|
+
|
|
70
|
+
**Note**: The `pkgRoot` directory must contain a `package.json`. The version will be updated only in the `package.json` and `npm-shrinkwrap.json` within the `pkgRoot` directory.
|
|
71
|
+
|
|
72
|
+
**Note**: If you use a [shareable configuration](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/shareable-configurations.md#shareable-configurations) that defines one of these options you can set it to `false` in your [**semantic-release** configuration](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration) in order to use the default value.
|
|
73
|
+
|
|
74
|
+
### Examples
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"plugins": [
|
|
79
|
+
"@semantic-release/commit-analyzer",
|
|
80
|
+
"@semantic-release/release-notes-generator",
|
|
81
|
+
"@anolilab/semantic-release-pnpm",
|
|
82
|
+
[
|
|
83
|
+
"@anolilab/semantic-release-clean-package-json",
|
|
84
|
+
{
|
|
85
|
+
"keep": ["custom filed"]
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"@semantic-release/github"
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
<!-- Copied from https://github.com/privatenumber/clean-pkg-json/blob/develop/src/default-keep-properties.ts -->
|
|
94
|
+
<!-- MIT License -->
|
|
95
|
+
<!-- Copyright (c) Hiroki Osame <hiroki.osame@gmail.com> -->
|
|
96
|
+
|
|
97
|
+
### Default preserved properties
|
|
98
|
+
|
|
99
|
+
By default, these properties are preserved in `package.json`:
|
|
100
|
+
|
|
101
|
+
#### [npm](https://docs.npmjs.com/cli/v8/configuring-npm/package-json)
|
|
102
|
+
|
|
103
|
+
- `name`
|
|
104
|
+
- `version`
|
|
105
|
+
- `private`
|
|
106
|
+
- `publishConfig`
|
|
107
|
+
- `scripts.preinstall`
|
|
108
|
+
- `scripts.install`
|
|
109
|
+
- `scripts.postinstall`
|
|
110
|
+
- `scripts.dependencies`
|
|
111
|
+
- `files`
|
|
112
|
+
- `bin`
|
|
113
|
+
- `browser`
|
|
114
|
+
- `main`
|
|
115
|
+
- `man`
|
|
116
|
+
- `dependencies`
|
|
117
|
+
- `peerDependencies`
|
|
118
|
+
- `peerDependenciesMeta`
|
|
119
|
+
- `bundledDependencies`
|
|
120
|
+
- `optionalDependencies`
|
|
121
|
+
- `engines`
|
|
122
|
+
- `os`
|
|
123
|
+
- `cpu`
|
|
124
|
+
- `description`
|
|
125
|
+
- `keywords`
|
|
126
|
+
- `author`
|
|
127
|
+
- `contributors`
|
|
128
|
+
- `license`
|
|
129
|
+
- `homepage`
|
|
130
|
+
- `repository`
|
|
131
|
+
- `bugs`
|
|
132
|
+
- `funding`
|
|
133
|
+
|
|
134
|
+
#### CDNs
|
|
135
|
+
|
|
136
|
+
- [`jsdelivr`](https://www.jsdelivr.com/features#publishing-packages)
|
|
137
|
+
- [`unpkg`](https://unpkg.com/)
|
|
138
|
+
|
|
139
|
+
#### [Node.js](https://nodejs.org/api/packages.html#nodejs-packagejson-field-definitions)
|
|
140
|
+
|
|
141
|
+
- `type`
|
|
142
|
+
- `exports`
|
|
143
|
+
- `imports`
|
|
144
|
+
|
|
145
|
+
#### [VSCode Extension Manifest](https://code.visualstudio.com/api/references/extension-manifest)
|
|
146
|
+
|
|
147
|
+
- `publisher`
|
|
148
|
+
- `displayName`
|
|
149
|
+
- `categories`
|
|
150
|
+
- `galleryBanner`
|
|
151
|
+
- `preview`
|
|
152
|
+
- `contributes`
|
|
153
|
+
- `activationEvents`
|
|
154
|
+
- `badges`
|
|
155
|
+
- `markdown`
|
|
156
|
+
- `qna`
|
|
157
|
+
- `sponsor`
|
|
158
|
+
- `extensionPack`
|
|
159
|
+
- `extensionDependencies`
|
|
160
|
+
- `extensionKind`
|
|
161
|
+
- `icon`
|
|
162
|
+
|
|
163
|
+
#### [Angular Package Format](https://angular.io/guide/angular-package-format#legacy-resolution-keys)
|
|
164
|
+
|
|
165
|
+
- `fesm2020`
|
|
166
|
+
- `fesm2015`
|
|
167
|
+
- `esm2020`
|
|
168
|
+
- `es2020`
|
|
169
|
+
|
|
170
|
+
#### [TypeScript](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html)
|
|
171
|
+
|
|
172
|
+
- `types`
|
|
173
|
+
- `typings`
|
|
174
|
+
- `typesVersions`
|
|
175
|
+
|
|
176
|
+
#### Bundlers (Webpack, Rollup, esbuild)
|
|
177
|
+
|
|
178
|
+
- [`module`](https://stackoverflow.com/questions/42708484/what-is-the-module-package-json-field-for)
|
|
179
|
+
- [`sideEffects`](https://webpack.js.org/guides/tree-shaking/)
|
|
180
|
+
|
|
181
|
+
## Supported Node.js Versions
|
|
182
|
+
|
|
183
|
+
Libraries in this ecosystem make the best effort to track [Node.js’ release schedule](https://github.com/nodejs/release#release-schedule).
|
|
184
|
+
Here’s [a post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
|
|
185
|
+
|
|
186
|
+
## Contributing
|
|
187
|
+
|
|
188
|
+
If you would like to help take a look at the [list of issues](https://github.com/anolilab/semantic-release/issues) and check our [Contributing](.github/CONTRIBUTING.md) guidelines.
|
|
189
|
+
|
|
190
|
+
> **Note:** please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
|
|
191
|
+
|
|
192
|
+
## Credits
|
|
193
|
+
|
|
194
|
+
- [Daniel Bannert](https://github.com/prisis)
|
|
195
|
+
- [All Contributors](https://github.com/anolilab/semantic-release/graphs/contributors)
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
The anolilab semantic-release-clean-package-json is open-sourced software licensed under the [MIT][license-url]
|
|
200
|
+
|
|
201
|
+
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
|
|
202
|
+
[typescript-url]: "typescript"
|
|
203
|
+
[license-image]: https://img.shields.io/npm/l/@anolilab/semantic-release-clean-package-json?color=blueviolet&style=for-the-badge
|
|
204
|
+
[license-url]: LICENSE.md "license"
|
|
205
|
+
[npm-image]: https://img.shields.io/npm/v/@anolilab/semantic-release-clean-package-json/latest.svg?style=for-the-badge&logo=npm
|
|
206
|
+
[npm-url]: https://www.npmjs.com/package/@anolilab/semantic-release-clean-package-json/v/latest "npm"
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var f=Object.defineProperty;var t=(e,n)=>f(e,"name",{value:n,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@visulima/fs"),d=require("@visulima/path"),m=require("@visulima/fs/error"),y=require("aggregate-error"),j=require("@semantic-release/error"),u=t(e=>e&&typeof e=="object"&&"default"in e?e.default:e,"_interopDefaultCompat"),c=u(y),k=u(j),v=["name","version","private","publishConfig","scripts.preinstall","scripts.install","scripts.postinstall","scripts.dependencies","files","bin","browser","main","man","jsdelivr","unpkg","dependencies","peerDependencies","peerDependenciesMeta","bundledDependencies","optionalDependencies","engines","os","cpu","description","keywords","author","contributors","license","homepage","repository","bugs","funding","type","exports","imports","sponsor","publisher","displayName","categories","galleryBanner","preview","contributes","activationEvents","badges","markdown","qna","extensionPack","extensionDependencies","extensionKind","icon","fesm2020","fesm2015","esm2020","es2020","types","typings","typesVersions","module","sideEffects"];var h=Object.defineProperty,p=t((e,n)=>h(e,"name",{value:n,configurable:!0}),"e");const w={ENOPKG:p(()=>({details:"A [package.json file](https://docs.npmjs.com/files/package.json) at the root of your project is required to release on npm.\nPlease follow the [npm guideline](https://docs.npmjs.com/getting-started/creating-node-modules) to create a valid `package.json` file.",message:"Missing `package.json` file."}),"ENOPKG"),ENOPKGNAME:p(()=>({details:"The `package.json`'s [name](https://docs.npmjs.com/files/package.json#name) property is required in order to publish a package to the npm registry.\nPlease make sure to add a valid `name` for your package in your `package.json`.",message:"Missing `name` property in `package.json`."}),"ENOPKGNAME")};var b=Object.defineProperty,P=t((e,n)=>b(e,"name",{value:n,configurable:!0}),"o");const l=P((e,n={})=>{const{details:s,message:o}=w[e](n);return new k(o,e,s)},"default");var E=Object.defineProperty,g=t((e,n)=>E(e,"name",{value:n,configurable:!0}),"n");const N=g(async e=>{const n={type:"file"};e&&(n.cwd=e);const s=await a.findUp("package.json",n);if(!s)throw new m.NotFoundError("No such file or directory, for package.json found.");return{packageJson:await a.readJson(s),path:s}},"findPackageJson"),O=g(async({pkgRoot:e},{cwd:n})=>{try{const{packageJson:s}=await N(e?d.resolve(n,e):n);if(!s.name)throw new c([l("ENOPKGNAME")]);return s}catch(s){throw s.code==="ENOENT"?new c([l("ENOPKG")]):s}},"default");var $=Object.defineProperty,q=t((e,n)=>$(e,"name",{value:n,configurable:!0}),"p");const K=q(async(e,n)=>{const s=await O(e,n),o=new Set([...v,...e.keep??[]]);n.logger.log(`Keeping the following properties: ${[...o].join(", ")}`);for(const r in s)if(!o.has(r)){if(r==="scripts"){for(const i in s.scripts)o.has(`${r}.${i}`)||delete s.scripts[i];if(s.scripts&&Object.keys(s.scripts).length>0)continue}n.logger.log(`Removing property "${r}"`),delete s[r]}await a.writeJson(d.join(n.cwd,"package.json"),s,{detectIndent:!0})},"prepare");exports.prepare=K;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import stream from 'node:stream';
|
|
2
|
+
|
|
3
|
+
interface BranchObject {
|
|
4
|
+
channel?: string | false | undefined;
|
|
5
|
+
name: string;
|
|
6
|
+
prerelease?: boolean | string | undefined;
|
|
7
|
+
range?: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
type BranchSpec$1 = BranchObject | string;
|
|
10
|
+
type PluginSpec<T = any> = string | [string, T];
|
|
11
|
+
interface Options {
|
|
12
|
+
[name: string]: any;
|
|
13
|
+
branches?: BranchSpec$1 | ReadonlyArray<BranchSpec$1> | undefined;
|
|
14
|
+
ci?: boolean | undefined;
|
|
15
|
+
dryRun?: boolean | undefined;
|
|
16
|
+
extends?: ReadonlyArray<string> | string | undefined;
|
|
17
|
+
plugins?: ReadonlyArray<PluginSpec> | undefined;
|
|
18
|
+
repositoryUrl?: string | undefined;
|
|
19
|
+
tagFormat?: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
interface Commit {
|
|
22
|
+
author: {
|
|
23
|
+
email: string;
|
|
24
|
+
name: string;
|
|
25
|
+
short: string;
|
|
26
|
+
};
|
|
27
|
+
body: string;
|
|
28
|
+
commit: {
|
|
29
|
+
long: string;
|
|
30
|
+
short: string;
|
|
31
|
+
};
|
|
32
|
+
committer: {
|
|
33
|
+
email: string;
|
|
34
|
+
name: string;
|
|
35
|
+
short: string;
|
|
36
|
+
};
|
|
37
|
+
committerDate: string;
|
|
38
|
+
hash: string;
|
|
39
|
+
message: string;
|
|
40
|
+
subject: string;
|
|
41
|
+
tree: {
|
|
42
|
+
long: string;
|
|
43
|
+
short: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface CommonContext {
|
|
48
|
+
branch: BranchSpec;
|
|
49
|
+
branches: BranchSpec[];
|
|
50
|
+
cwd: string;
|
|
51
|
+
env: "object";
|
|
52
|
+
logger: {
|
|
53
|
+
error: (...message: string[]) => void;
|
|
54
|
+
log: (...message: string[]) => void;
|
|
55
|
+
success: (...message: string[]) => void;
|
|
56
|
+
};
|
|
57
|
+
options: Options;
|
|
58
|
+
stderr: stream.Writable;
|
|
59
|
+
stdout: stream.Writable;
|
|
60
|
+
}
|
|
61
|
+
type CommonContext2 = CommonContext & {
|
|
62
|
+
releases: Release[];
|
|
63
|
+
};
|
|
64
|
+
type CommonContext3 = CommonContext2 & {
|
|
65
|
+
commits: Commit[];
|
|
66
|
+
lastRelease: Release;
|
|
67
|
+
};
|
|
68
|
+
type CommonContext4 = CommonContext3 & {
|
|
69
|
+
nextRelease: Release;
|
|
70
|
+
};
|
|
71
|
+
type PrepareContext = CommonContext4;
|
|
72
|
+
interface BranchSpec {
|
|
73
|
+
name: string;
|
|
74
|
+
tags?: Tag[];
|
|
75
|
+
}
|
|
76
|
+
interface Tag {
|
|
77
|
+
channel?: string;
|
|
78
|
+
gitHead?: string;
|
|
79
|
+
gitTag?: string;
|
|
80
|
+
version?: string;
|
|
81
|
+
}
|
|
82
|
+
interface Release {
|
|
83
|
+
channel?: string | null;
|
|
84
|
+
gitHead?: string;
|
|
85
|
+
gitTag?: string;
|
|
86
|
+
name?: string;
|
|
87
|
+
type?: "build" | "major" | "minor" | "patch" | "premajor" | "preminor" | "prepatch" | "prerelease" | undefined;
|
|
88
|
+
version: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface PluginConfig {
|
|
92
|
+
keep?: string[];
|
|
93
|
+
pkgRoot?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare const prepare: (pluginConfig: PluginConfig, context: PrepareContext) => Promise<void>;
|
|
97
|
+
|
|
98
|
+
export { prepare };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import stream from 'node:stream';
|
|
2
|
+
|
|
3
|
+
interface BranchObject {
|
|
4
|
+
channel?: string | false | undefined;
|
|
5
|
+
name: string;
|
|
6
|
+
prerelease?: boolean | string | undefined;
|
|
7
|
+
range?: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
type BranchSpec$1 = BranchObject | string;
|
|
10
|
+
type PluginSpec<T = any> = string | [string, T];
|
|
11
|
+
interface Options {
|
|
12
|
+
[name: string]: any;
|
|
13
|
+
branches?: BranchSpec$1 | ReadonlyArray<BranchSpec$1> | undefined;
|
|
14
|
+
ci?: boolean | undefined;
|
|
15
|
+
dryRun?: boolean | undefined;
|
|
16
|
+
extends?: ReadonlyArray<string> | string | undefined;
|
|
17
|
+
plugins?: ReadonlyArray<PluginSpec> | undefined;
|
|
18
|
+
repositoryUrl?: string | undefined;
|
|
19
|
+
tagFormat?: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
interface Commit {
|
|
22
|
+
author: {
|
|
23
|
+
email: string;
|
|
24
|
+
name: string;
|
|
25
|
+
short: string;
|
|
26
|
+
};
|
|
27
|
+
body: string;
|
|
28
|
+
commit: {
|
|
29
|
+
long: string;
|
|
30
|
+
short: string;
|
|
31
|
+
};
|
|
32
|
+
committer: {
|
|
33
|
+
email: string;
|
|
34
|
+
name: string;
|
|
35
|
+
short: string;
|
|
36
|
+
};
|
|
37
|
+
committerDate: string;
|
|
38
|
+
hash: string;
|
|
39
|
+
message: string;
|
|
40
|
+
subject: string;
|
|
41
|
+
tree: {
|
|
42
|
+
long: string;
|
|
43
|
+
short: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface CommonContext {
|
|
48
|
+
branch: BranchSpec;
|
|
49
|
+
branches: BranchSpec[];
|
|
50
|
+
cwd: string;
|
|
51
|
+
env: "object";
|
|
52
|
+
logger: {
|
|
53
|
+
error: (...message: string[]) => void;
|
|
54
|
+
log: (...message: string[]) => void;
|
|
55
|
+
success: (...message: string[]) => void;
|
|
56
|
+
};
|
|
57
|
+
options: Options;
|
|
58
|
+
stderr: stream.Writable;
|
|
59
|
+
stdout: stream.Writable;
|
|
60
|
+
}
|
|
61
|
+
type CommonContext2 = CommonContext & {
|
|
62
|
+
releases: Release[];
|
|
63
|
+
};
|
|
64
|
+
type CommonContext3 = CommonContext2 & {
|
|
65
|
+
commits: Commit[];
|
|
66
|
+
lastRelease: Release;
|
|
67
|
+
};
|
|
68
|
+
type CommonContext4 = CommonContext3 & {
|
|
69
|
+
nextRelease: Release;
|
|
70
|
+
};
|
|
71
|
+
type PrepareContext = CommonContext4;
|
|
72
|
+
interface BranchSpec {
|
|
73
|
+
name: string;
|
|
74
|
+
tags?: Tag[];
|
|
75
|
+
}
|
|
76
|
+
interface Tag {
|
|
77
|
+
channel?: string;
|
|
78
|
+
gitHead?: string;
|
|
79
|
+
gitTag?: string;
|
|
80
|
+
version?: string;
|
|
81
|
+
}
|
|
82
|
+
interface Release {
|
|
83
|
+
channel?: string | null;
|
|
84
|
+
gitHead?: string;
|
|
85
|
+
gitTag?: string;
|
|
86
|
+
name?: string;
|
|
87
|
+
type?: "build" | "major" | "minor" | "patch" | "premajor" | "preminor" | "prepatch" | "prerelease" | undefined;
|
|
88
|
+
version: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface PluginConfig {
|
|
92
|
+
keep?: string[];
|
|
93
|
+
pkgRoot?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare const prepare: (pluginConfig: PluginConfig, context: PrepareContext) => Promise<void>;
|
|
97
|
+
|
|
98
|
+
export { prepare };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import stream from 'node:stream';
|
|
2
|
+
|
|
3
|
+
interface BranchObject {
|
|
4
|
+
channel?: string | false | undefined;
|
|
5
|
+
name: string;
|
|
6
|
+
prerelease?: boolean | string | undefined;
|
|
7
|
+
range?: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
type BranchSpec$1 = BranchObject | string;
|
|
10
|
+
type PluginSpec<T = any> = string | [string, T];
|
|
11
|
+
interface Options {
|
|
12
|
+
[name: string]: any;
|
|
13
|
+
branches?: BranchSpec$1 | ReadonlyArray<BranchSpec$1> | undefined;
|
|
14
|
+
ci?: boolean | undefined;
|
|
15
|
+
dryRun?: boolean | undefined;
|
|
16
|
+
extends?: ReadonlyArray<string> | string | undefined;
|
|
17
|
+
plugins?: ReadonlyArray<PluginSpec> | undefined;
|
|
18
|
+
repositoryUrl?: string | undefined;
|
|
19
|
+
tagFormat?: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
interface Commit {
|
|
22
|
+
author: {
|
|
23
|
+
email: string;
|
|
24
|
+
name: string;
|
|
25
|
+
short: string;
|
|
26
|
+
};
|
|
27
|
+
body: string;
|
|
28
|
+
commit: {
|
|
29
|
+
long: string;
|
|
30
|
+
short: string;
|
|
31
|
+
};
|
|
32
|
+
committer: {
|
|
33
|
+
email: string;
|
|
34
|
+
name: string;
|
|
35
|
+
short: string;
|
|
36
|
+
};
|
|
37
|
+
committerDate: string;
|
|
38
|
+
hash: string;
|
|
39
|
+
message: string;
|
|
40
|
+
subject: string;
|
|
41
|
+
tree: {
|
|
42
|
+
long: string;
|
|
43
|
+
short: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface CommonContext {
|
|
48
|
+
branch: BranchSpec;
|
|
49
|
+
branches: BranchSpec[];
|
|
50
|
+
cwd: string;
|
|
51
|
+
env: "object";
|
|
52
|
+
logger: {
|
|
53
|
+
error: (...message: string[]) => void;
|
|
54
|
+
log: (...message: string[]) => void;
|
|
55
|
+
success: (...message: string[]) => void;
|
|
56
|
+
};
|
|
57
|
+
options: Options;
|
|
58
|
+
stderr: stream.Writable;
|
|
59
|
+
stdout: stream.Writable;
|
|
60
|
+
}
|
|
61
|
+
type CommonContext2 = CommonContext & {
|
|
62
|
+
releases: Release[];
|
|
63
|
+
};
|
|
64
|
+
type CommonContext3 = CommonContext2 & {
|
|
65
|
+
commits: Commit[];
|
|
66
|
+
lastRelease: Release;
|
|
67
|
+
};
|
|
68
|
+
type CommonContext4 = CommonContext3 & {
|
|
69
|
+
nextRelease: Release;
|
|
70
|
+
};
|
|
71
|
+
type PrepareContext = CommonContext4;
|
|
72
|
+
interface BranchSpec {
|
|
73
|
+
name: string;
|
|
74
|
+
tags?: Tag[];
|
|
75
|
+
}
|
|
76
|
+
interface Tag {
|
|
77
|
+
channel?: string;
|
|
78
|
+
gitHead?: string;
|
|
79
|
+
gitTag?: string;
|
|
80
|
+
version?: string;
|
|
81
|
+
}
|
|
82
|
+
interface Release {
|
|
83
|
+
channel?: string | null;
|
|
84
|
+
gitHead?: string;
|
|
85
|
+
gitTag?: string;
|
|
86
|
+
name?: string;
|
|
87
|
+
type?: "build" | "major" | "minor" | "patch" | "premajor" | "preminor" | "prepatch" | "prerelease" | undefined;
|
|
88
|
+
version: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface PluginConfig {
|
|
92
|
+
keep?: string[];
|
|
93
|
+
pkgRoot?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare const prepare: (pluginConfig: PluginConfig, context: PrepareContext) => Promise<void>;
|
|
97
|
+
|
|
98
|
+
export { prepare };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var l=Object.defineProperty;var r=(n,e)=>l(n,"name",{value:e,configurable:!0});import{findUp as g,readJson as m,writeJson as f}from"@visulima/fs";import{resolve as u,join as y}from"@visulima/path";import{NotFoundError as k}from"@visulima/fs/error";import i from"aggregate-error";import j from"@semantic-release/error";const w=["name","version","private","publishConfig","scripts.preinstall","scripts.install","scripts.postinstall","scripts.dependencies","files","bin","browser","main","man","jsdelivr","unpkg","dependencies","peerDependencies","peerDependenciesMeta","bundledDependencies","optionalDependencies","engines","os","cpu","description","keywords","author","contributors","license","homepage","repository","bugs","funding","type","exports","imports","sponsor","publisher","displayName","categories","galleryBanner","preview","contributes","activationEvents","badges","markdown","qna","extensionPack","extensionDependencies","extensionKind","icon","fesm2020","fesm2015","esm2020","es2020","types","typings","typesVersions","module","sideEffects"];var h=Object.defineProperty,p=r((n,e)=>h(n,"name",{value:e,configurable:!0}),"e");const v={ENOPKG:p(()=>({details:"A [package.json file](https://docs.npmjs.com/files/package.json) at the root of your project is required to release on npm.\nPlease follow the [npm guideline](https://docs.npmjs.com/getting-started/creating-node-modules) to create a valid `package.json` file.",message:"Missing `package.json` file."}),"ENOPKG"),ENOPKGNAME:p(()=>({details:"The `package.json`'s [name](https://docs.npmjs.com/files/package.json#name) property is required in order to publish a package to the npm registry.\nPlease make sure to add a valid `name` for your package in your `package.json`.",message:"Missing `name` property in `package.json`."}),"ENOPKGNAME")};var b=Object.defineProperty,E=r((n,e)=>b(n,"name",{value:e,configurable:!0}),"o");const c=E((n,e={})=>{const{details:s,message:o}=v[n](e);return new j(o,n,s)},"default");var N=Object.defineProperty,d=r((n,e)=>N(n,"name",{value:e,configurable:!0}),"n");const P=d(async n=>{const e={type:"file"};n&&(e.cwd=n);const s=await g("package.json",e);if(!s)throw new k("No such file or directory, for package.json found.");return{packageJson:await m(s),path:s}},"findPackageJson"),O=d(async({pkgRoot:n},{cwd:e})=>{try{const{packageJson:s}=await P(n?u(e,n):e);if(!s.name)throw new i([c("ENOPKGNAME")]);return s}catch(s){throw s.code==="ENOENT"?new i([c("ENOPKG")]):s}},"default");var $=Object.defineProperty,K=r((n,e)=>$(n,"name",{value:e,configurable:!0}),"p");const q=K(async(n,e)=>{const s=await O(n,e),o=new Set([...w,...n.keep??[]]);e.logger.log(`Keeping the following properties: ${[...o].join(", ")}`);for(const t in s)if(!o.has(t)){if(t==="scripts"){for(const a in s.scripts)o.has(`${t}.${a}`)||delete s.scripts[a];if(s.scripts&&Object.keys(s.scripts).length>0)continue}e.logger.log(`Removing property "${t}"`),delete s[t]}await f(y(e.cwd,"package.json"),s,{detectIndent:!0})},"prepare");export{q as prepare};
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@anolilab/semantic-release-clean-package-json",
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
|
+
"description": "Clean package.json before publish by removing unnecessary properties",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"anolilab",
|
|
7
|
+
"semantic-release-clean-package-json"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://github.com/anolilab/semantic-release/tree/main/packages/semantic-release-clean-package-json",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/anolilab/semantic-release/issues"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/anolilab/semantic-release.git",
|
|
16
|
+
"directory": "packages/semantic-release-clean-package-json"
|
|
17
|
+
},
|
|
18
|
+
"funding": [
|
|
19
|
+
{
|
|
20
|
+
"type": "github",
|
|
21
|
+
"url": "https://github.com/sponsors/prisis"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "consulting",
|
|
25
|
+
"url": "https://anolilab.com/support"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"author": {
|
|
30
|
+
"name": "Daniel Bannert",
|
|
31
|
+
"email": "d.bannert@anolilab.de"
|
|
32
|
+
},
|
|
33
|
+
"sideEffects": false,
|
|
34
|
+
"type": "module",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"require": {
|
|
38
|
+
"types": "./dist/index.d.cts",
|
|
39
|
+
"default": "./dist/index.cjs"
|
|
40
|
+
},
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./dist/index.d.mts",
|
|
43
|
+
"default": "./dist/index.mjs"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"./package.json": "./package.json"
|
|
47
|
+
},
|
|
48
|
+
"main": "dist/index.cjs",
|
|
49
|
+
"module": "dist/index.mjs",
|
|
50
|
+
"types": "dist/index.d.ts",
|
|
51
|
+
"typesVersions": {
|
|
52
|
+
">=5.0": {
|
|
53
|
+
".": [
|
|
54
|
+
"./dist/index.d.ts"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"files": [
|
|
59
|
+
"dist",
|
|
60
|
+
"README.md",
|
|
61
|
+
"CHANGELOG.md"
|
|
62
|
+
],
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"@semantic-release/error": "^4.0.0",
|
|
65
|
+
"@visulima/fs": "^2.3.7",
|
|
66
|
+
"@visulima/path": "^1.3.3",
|
|
67
|
+
"aggregate-error": "^5.0.0"
|
|
68
|
+
},
|
|
69
|
+
"engines": {
|
|
70
|
+
"node": ">=18.0.0 <=23.x"
|
|
71
|
+
},
|
|
72
|
+
"publishConfig": {
|
|
73
|
+
"access": "public",
|
|
74
|
+
"provenance": true
|
|
75
|
+
}
|
|
76
|
+
}
|