@langri-sha/projen-license 0.1.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/CHANGELOG.json +38 -0
- package/CHANGELOG.md +16 -0
- package/lib/index.d.ts +29 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +32 -0
- package/lib/index.js.map +1 -0
- package/license +10 -0
- package/package.json +35 -0
- package/readme +32 -0
- package/src/index.ts +49 -0
- package/src/license.d.ts +29 -0
package/CHANGELOG.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@langri-sha/projen-license",
|
|
3
|
+
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Sat, 25 May 2024 03:25:02 GMT",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"tag": "@langri-sha/projen-license_v0.1.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "filip.dupanovic@gmail.com",
|
|
12
|
+
"package": "@langri-sha/projen-license",
|
|
13
|
+
"commit": "1b0960cb6ed3918c64dbc464cb2baa83f5dc9bdd",
|
|
14
|
+
"comment": "feat(license): Update documentation"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "filip.dupanovic@gmail.com",
|
|
18
|
+
"package": "@langri-sha/projen-license",
|
|
19
|
+
"commit": "1b0960cb6ed3918c64dbc464cb2baa83f5dc9bdd",
|
|
20
|
+
"comment": "feat(projen): Add NPM ignore files"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "filip.dupanovic@gmail.com",
|
|
24
|
+
"package": "@langri-sha/projen-license",
|
|
25
|
+
"commit": "1b0960cb6ed3918c64dbc464cb2baa83f5dc9bdd",
|
|
26
|
+
"comment": "feat(license): Add component for generating licenses"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "filip.dupanovic@gmail.com",
|
|
30
|
+
"package": "@langri-sha/projen-license",
|
|
31
|
+
"commit": "1b0960cb6ed3918c64dbc464cb2baa83f5dc9bdd",
|
|
32
|
+
"comment": "feat(project): Add projenrc file to subprojects"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Change Log - @langri-sha/projen-license
|
|
2
|
+
|
|
3
|
+
This log was last generated on Sat, 25 May 2024 03:25:02 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
<!-- Start content -->
|
|
6
|
+
|
|
7
|
+
## 0.1.0
|
|
8
|
+
|
|
9
|
+
Sat, 25 May 2024 03:25:02 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- feat(license): Update documentation (filip.dupanovic@gmail.com)
|
|
14
|
+
- feat(projen): Add NPM ignore files (filip.dupanovic@gmail.com)
|
|
15
|
+
- feat(license): Add component for generating licenses (filip.dupanovic@gmail.com)
|
|
16
|
+
- feat(project): Add projenrc file to subprojects (filip.dupanovic@gmail.com)
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="src/license" />
|
|
2
|
+
import { FileBase, type IResolver, Project } from 'projen';
|
|
3
|
+
import { type Spdx } from 'license-o-matic';
|
|
4
|
+
export interface LicenseOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Name of tile license file.
|
|
7
|
+
*
|
|
8
|
+
* @default "license"
|
|
9
|
+
*/
|
|
10
|
+
readonly filename?: string;
|
|
11
|
+
/**
|
|
12
|
+
* License identifier.
|
|
13
|
+
*/
|
|
14
|
+
readonly spdx: Spdx | string;
|
|
15
|
+
/**
|
|
16
|
+
* Copyright year.
|
|
17
|
+
*/
|
|
18
|
+
readonly year: string;
|
|
19
|
+
/**
|
|
20
|
+
* Copyright holder.
|
|
21
|
+
*/
|
|
22
|
+
readonly copyrightHolder: string;
|
|
23
|
+
}
|
|
24
|
+
export declare class License extends FileBase {
|
|
25
|
+
#private;
|
|
26
|
+
constructor(project: Project, { copyrightHolder, filename, spdx, year }: LicenseOptions);
|
|
27
|
+
protected synthesizeContent(_: IResolver): string | undefined;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAC1D,OAAsB,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAE1D,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAA;IAE5B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB;;OAEG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;CACjC;AAED,qBAAa,OAAQ,SAAQ,QAAQ;;gBAIjC,OAAO,EAAE,OAAO,EAChB,EAAE,eAAe,EAAE,QAAoB,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,cAAc;IAavE,SAAS,CAAC,iBAAiB,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS;CAG9D"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _License_text;
|
|
13
|
+
import { FileBase } from 'projen';
|
|
14
|
+
import licenseOMatic from 'license-o-matic';
|
|
15
|
+
export class License extends FileBase {
|
|
16
|
+
constructor(project, { copyrightHolder, filename = 'license', spdx, year }) {
|
|
17
|
+
super(project, filename, {
|
|
18
|
+
marker: false,
|
|
19
|
+
committed: true,
|
|
20
|
+
});
|
|
21
|
+
_License_text.set(this, void 0);
|
|
22
|
+
__classPrivateFieldSet(this, _License_text, licenseOMatic.getLicense(spdx.toLowerCase())({
|
|
23
|
+
copyrightHolder,
|
|
24
|
+
year,
|
|
25
|
+
}), "f");
|
|
26
|
+
}
|
|
27
|
+
synthesizeContent(_) {
|
|
28
|
+
return __classPrivateFieldGet(this, _License_text, "f");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
_License_text = new WeakMap();
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAA2B,MAAM,QAAQ,CAAA;AAC1D,OAAO,aAA4B,MAAM,iBAAiB,CAAA;AA0B1D,MAAM,OAAO,OAAQ,SAAQ,QAAQ;IAGnC,YACE,OAAgB,EAChB,EAAE,eAAe,EAAE,QAAQ,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,EAAkB;QAErE,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE;YACvB,MAAM,EAAE,KAAK;YACb,SAAS,EAAE,IAAI;SAChB,CAAC,CAAA;QATJ,gCAAa;QAWX,uBAAA,IAAI,iBAAS,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YACxD,eAAe;YACf,IAAI;SACL,CAAC,MAAA,CAAA;IACJ,CAAC;IAES,iBAAiB,CAAC,CAAY;QACtC,OAAO,uBAAA,IAAI,qBAAM,CAAA;IACnB,CAAC;CACF"}
|
package/license
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2024 Filip Dupanović <filip.dupanovic@gmail.com> (https://langri-sha.com)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
|
|
8
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@langri-sha/projen-license",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Filip Dupanović",
|
|
7
|
+
"email": "filip.dupanovic@gmail.com",
|
|
8
|
+
"url": "https://langri-sha.com",
|
|
9
|
+
"organization": false
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "lib/index.js",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"prepublishOnly": "rm -rf lib; tsc --project tsconfig.build.json"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"license-o-matic": "^1.2.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@langri-sha/jest-test": "0.7.1",
|
|
21
|
+
"@langri-sha/tsconfig": "0.9.0",
|
|
22
|
+
"projen": "0.81.15"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"projen": "^0.81.15"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">= 20.12.0"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.mts and run \"npx projen\".",
|
|
34
|
+
"types": "lib/index.d.ts"
|
|
35
|
+
}
|
package/readme
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @langri-sha/projen-license
|
|
2
|
+
|
|
3
|
+
A [projen] component for generating license files using [`license-o-matic`].
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Install dependencies:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install -D projen @langri-sha/projen-license
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then, create an `License` component for your projects:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import { Project } from 'projen'
|
|
17
|
+
import { License } from '@langri-sha/license'
|
|
18
|
+
|
|
19
|
+
const project = new Project({
|
|
20
|
+
name: 'my-project',
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
new License(project, {
|
|
24
|
+
filename: 'license',
|
|
25
|
+
spdx: 'MIT',
|
|
26
|
+
copyrightHolder: 'John Smith <john.smith@example.com>',
|
|
27
|
+
copyrightYear: '2000',
|
|
28
|
+
})
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
[license-o-matic]: https://www.npmjs.com/package/license-o-matic
|
|
32
|
+
[projen]: https://projen.io/
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { FileBase, type IResolver, Project } from 'projen'
|
|
2
|
+
import licenseOMatic, { type Spdx } from 'license-o-matic'
|
|
3
|
+
|
|
4
|
+
export interface LicenseOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Name of tile license file.
|
|
7
|
+
*
|
|
8
|
+
* @default "license"
|
|
9
|
+
*/
|
|
10
|
+
readonly filename?: string
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* License identifier.
|
|
14
|
+
*/
|
|
15
|
+
readonly spdx: Spdx | string
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Copyright year.
|
|
19
|
+
*/
|
|
20
|
+
readonly year: string
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Copyright holder.
|
|
24
|
+
*/
|
|
25
|
+
readonly copyrightHolder: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export class License extends FileBase {
|
|
29
|
+
#text: string
|
|
30
|
+
|
|
31
|
+
constructor(
|
|
32
|
+
project: Project,
|
|
33
|
+
{ copyrightHolder, filename = 'license', spdx, year }: LicenseOptions,
|
|
34
|
+
) {
|
|
35
|
+
super(project, filename, {
|
|
36
|
+
marker: false,
|
|
37
|
+
committed: true,
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
this.#text = licenseOMatic.getLicense(spdx.toLowerCase())({
|
|
41
|
+
copyrightHolder,
|
|
42
|
+
year,
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
protected synthesizeContent(_: IResolver): string | undefined {
|
|
47
|
+
return this.#text
|
|
48
|
+
}
|
|
49
|
+
}
|
package/src/license.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare module 'license-o-matic' {
|
|
2
|
+
export type Spdx =
|
|
3
|
+
| 'mit'
|
|
4
|
+
| 'apache-2.0'
|
|
5
|
+
| 'gpl-3.0-only'
|
|
6
|
+
| 'mpl-2.0'
|
|
7
|
+
| 'unlicense'
|
|
8
|
+
| 'lgpl-3.0-only'
|
|
9
|
+
| 'isc'
|
|
10
|
+
| 'abstyles-license'
|
|
11
|
+
| 'academic-free-license-v3'
|
|
12
|
+
| 'apple-public-source-license-2.0'
|
|
13
|
+
| 'attribution-assurance-license'
|
|
14
|
+
| 'bsd-zero-clause-license'
|
|
15
|
+
| 'eclipse-public-license-version-2.0'
|
|
16
|
+
| 'educational-community-license-v-2.0(ecl-2.0).js'
|
|
17
|
+
| 'mozilla-public-license-2.0(mpl-2.0)'
|
|
18
|
+
| 'open-software-license-3.0(osl-3.0)'
|
|
19
|
+
| 'sun-public-license-version-1.0(spl-1.0)'
|
|
20
|
+
|
|
21
|
+
const _default: {
|
|
22
|
+
getIdentifiers(): Spdx[]
|
|
23
|
+
getLicense(
|
|
24
|
+
spdx: Spdx | string,
|
|
25
|
+
): ({ copyrightHolder: string, year: string }) => string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export = _default
|
|
29
|
+
}
|