Skip to content

Commit 967ef67

Browse files
committed
build: add license plugin to include licenses of bundled dependencies
1 parent f1cdce3 commit 967ef67

File tree

4 files changed

+241
-2
lines changed

4 files changed

+241
-2
lines changed

LICENSE

Lines changed: 153 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
# create-vue core license
2+
3+
create-vue is released under the MIT license:
4+
15
MIT License
26

3-
Copyright (c) 2021 vuejs
7+
Copyright (c) 2021-present vuejs
48

59
Permission is hereby granted, free of charge, to any person obtaining a copy
610
of this software and associated documentation files (the "Software"), to deal
@@ -19,3 +23,151 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1923
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2024
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2125
SOFTWARE.
26+
27+
## Licenses of bundled dependencies
28+
29+
The published create-vue artifact additionally contains code with the following licenses:
30+
MIT
31+
32+
## Bundled dependencies
33+
34+
## kleur
35+
36+
License: MIT
37+
By: Luke Edwards
38+
Repository: git+https://github.com/lukeed/kleur.git
39+
40+
> The MIT License (MIT)
41+
>
42+
> Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
43+
>
44+
> Permission is hereby granted, free of charge, to any person obtaining a copy
45+
> of this software and associated documentation files (the "Software"), to deal
46+
> in the Software without restriction, including without limitation the rights
47+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
48+
> copies of the Software, and to permit persons to whom the Software is
49+
> furnished to do so, subject to the following conditions:
50+
>
51+
> The above copyright notice and this permission notice shall be included in
52+
> all copies or substantial portions of the Software.
53+
>
54+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
55+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
56+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
57+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
58+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
59+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
60+
> THE SOFTWARE.
61+
>
62+
63+
## kolorist
64+
65+
License: MIT
66+
By: Marvin Hagemeister
67+
Repository: git+https://github.com/marvinhagemeister/kolorist.git
68+
69+
> The MIT License (MIT)
70+
>
71+
> Copyright (c) 2020-present Marvin Hagemeister
72+
>
73+
> Permission is hereby granted, free of charge, to any person obtaining a copy
74+
> of this software and associated documentation files (the "Software"), to deal
75+
> in the Software without restriction, including without limitation the rights
76+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
77+
> copies of the Software, and to permit persons to whom the Software is
78+
> furnished to do so, subject to the following conditions:
79+
>
80+
> The above copyright notice and this permission notice shall be included in all
81+
> copies or substantial portions of the Software.
82+
>
83+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
84+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
85+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
86+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
87+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
88+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
89+
> SOFTWARE.
90+
91+
## minimist
92+
93+
License: MIT
94+
By: James Halliday
95+
Repository: git://github.com/substack/minimist.git
96+
97+
> This software is released under the MIT license:
98+
>
99+
> Permission is hereby granted, free of charge, to any person obtaining a copy of
100+
> this software and associated documentation files (the "Software"), to deal in
101+
> the Software without restriction, including without limitation the rights to
102+
> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
103+
> the Software, and to permit persons to whom the Software is furnished to do so,
104+
> subject to the following conditions:
105+
>
106+
> The above copyright notice and this permission notice shall be included in all
107+
> copies or substantial portions of the Software.
108+
>
109+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
110+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
111+
> FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
112+
> COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
113+
> IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
114+
> CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
115+
>
116+
117+
## prompts
118+
119+
License: MIT
120+
By: Terkel Gjervig
121+
Repository: git+https://github.com/terkelg/prompts.git
122+
123+
> MIT License
124+
>
125+
> Copyright (c) 2018 Terkel Gjervig Nielsen
126+
>
127+
> Permission is hereby granted, free of charge, to any person obtaining a copy
128+
> of this software and associated documentation files (the "Software"), to deal
129+
> in the Software without restriction, including without limitation the rights
130+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
131+
> copies of the Software, and to permit persons to whom the Software is
132+
> furnished to do so, subject to the following conditions:
133+
>
134+
> The above copyright notice and this permission notice shall be included in all
135+
> copies or substantial portions of the Software.
136+
>
137+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
138+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
139+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
140+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
141+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
142+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
143+
> SOFTWARE.
144+
>
145+
146+
## sisteransi
147+
148+
License: MIT
149+
By: Terkel Gjervig
150+
Repository: git+https://github.com/terkelg/sisteransi.git
151+
152+
> MIT License
153+
>
154+
> Copyright (c) 2018 Terkel Gjervig Nielsen
155+
>
156+
> Permission is hereby granted, free of charge, to any person obtaining a copy
157+
> of this software and associated documentation files (the "Software"), to deal
158+
> in the Software without restriction, including without limitation the rights
159+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
160+
> copies of the Software, and to permit persons to whom the Software is
161+
> furnished to do so, subject to the following conditions:
162+
>
163+
> The above copyright notice and this permission notice shall be included in all
164+
> copies or substantial portions of the Software.
165+
>
166+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
167+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
168+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
169+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
170+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
171+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
172+
> SOFTWARE.
173+
>

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"scripts": {
1717
"prepare": "husky install",
1818
"format": "prettier --write .",
19-
"build": "esbuild --bundle index.js --format=cjs --platform=node --target=node14 --outfile=outfile.cjs",
19+
"build": "zx ./scripts/build.mjs",
2020
"snapshot": "zx ./scripts/snapshot.mjs",
2121
"pretest": "run-s build snapshot",
2222
"test": "zx ./scripts/test.mjs",
@@ -35,6 +35,7 @@
3535
"homepage": "https://github.com/vuejs/create-vue#readme",
3636
"devDependencies": {
3737
"esbuild": "^0.13.15",
38+
"esbuild-plugin-license": "^1.0.4",
3839
"husky": "^7.0.4",
3940
"kolorist": "^1.5.1",
4041
"lint-staged": "^12.2.0",

pnpm-lock.yaml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/build.mjs

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import * as esbuild from 'esbuild'
2+
import esbuildPluginLicense from 'esbuild-plugin-license'
3+
4+
const CORE_LICENSE = `MIT License
5+
6+
Copyright (c) 2021-present vuejs
7+
8+
Permission is hereby granted, free of charge, to any person obtaining a copy
9+
of this software and associated documentation files (the "Software"), to deal
10+
in the Software without restriction, including without limitation the rights
11+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
copies of the Software, and to permit persons to whom the Software is
13+
furnished to do so, subject to the following conditions:
14+
15+
The above copyright notice and this permission notice shall be included in all
16+
copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
SOFTWARE.
25+
`
26+
27+
await esbuild.build({
28+
bundle: true,
29+
entryPoints: ['index.js'],
30+
outfile: 'outfile.cjs',
31+
format: 'cjs',
32+
platform: 'node',
33+
target: 'node14',
34+
35+
plugins: [
36+
esbuildPluginLicense.default({
37+
thirdParty: {
38+
includePrivate: false,
39+
output: {
40+
file: 'LICENSE',
41+
template(allDependencies) {
42+
// There's a bug in the plugin that it also includes the `create-vue` package itself
43+
const dependencies = allDependencies.filter((d) => d.packageJson.name !== 'create-vue')
44+
const licenseText =
45+
`# create-vue core license\n\n` +
46+
`create-vue is released under the MIT license:\n\n` +
47+
CORE_LICENSE +
48+
`\n## Licenses of bundled dependencies\n\n` +
49+
`The published create-vue artifact additionally contains code with the following licenses:\n` +
50+
[...new Set(dependencies.map((dependency) => dependency.packageJson.license))].join(
51+
', '
52+
) +
53+
'\n\n' +
54+
`## Bundled dependencies\n\n` +
55+
dependencies
56+
.map((dependency) => {
57+
return (
58+
`## ${dependency.packageJson.name}\n\n` +
59+
`License: ${dependency.packageJson.license}\n` +
60+
`By: ${dependency.packageJson.author.name}\n` +
61+
`Repository: ${dependency.packageJson.repository.url}\n\n` +
62+
dependency.licenseText
63+
.split('\n')
64+
.map((line) => (line ? `> ${line}` : '>'))
65+
.join('\n')
66+
)
67+
})
68+
.join('\n\n')
69+
70+
return licenseText
71+
}
72+
}
73+
}
74+
})
75+
]
76+
})

0 commit comments

Comments
 (0)