]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
build: add license plugin to include licenses of bundled dependencies
authorHaoqun Jiang <haoqunjiang@gmail.com>
Mon, 31 Jan 2022 13:30:50 +0000 (21:30 +0800)
committerHaoqun Jiang <haoqunjiang@gmail.com>
Mon, 31 Jan 2022 13:30:50 +0000 (21:30 +0800)
LICENSE
package.json
pnpm-lock.yaml
scripts/build.mjs [new file with mode: 0644]

diff --git a/LICENSE b/LICENSE
index 1db151babe64856991f2815ee1c87e996b8639d5..67ac4d3cb750520505f85c17b2de04cd961e6e34 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,10 @@
+# create-vue core license
+
+create-vue is released under the MIT license:
+
 MIT License
 
-Copyright (c) 2021 vuejs
+Copyright (c) 2021-present vuejs
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 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
 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.
+
+## Licenses of bundled dependencies
+
+The published create-vue artifact additionally contains code with the following licenses:
+MIT
+
+## Bundled dependencies
+
+## kleur
+
+License: MIT
+By: Luke Edwards
+Repository: git+https://github.com/lukeed/kleur.git
+
+> The MIT License (MIT)
+>
+> Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
+>
+> 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:
+>
+> The above copyright notice and this permission notice shall be included in
+> all copies or substantial portions of the Software.
+>
+> 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.
+>
+
+## kolorist
+
+License: MIT
+By: Marvin Hagemeister
+Repository: git+https://github.com/marvinhagemeister/kolorist.git
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2020-present Marvin Hagemeister
+>
+> 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:
+>
+> The above copyright notice and this permission notice shall be included in all
+> copies or substantial portions of the Software.
+>
+> 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.
+
+## minimist
+
+License: MIT
+By: James Halliday
+Repository: git://github.com/substack/minimist.git
+
+> This software is released under the MIT license:
+>
+> 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:
+>
+> The above copyright notice and this permission notice shall be included in all
+> copies or substantial portions of the Software.
+>
+> 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.
+>
+
+## prompts
+
+License: MIT
+By: Terkel Gjervig
+Repository: git+https://github.com/terkelg/prompts.git
+
+> MIT License
+>
+> Copyright (c) 2018 Terkel Gjervig Nielsen
+>
+> 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:
+>
+> The above copyright notice and this permission notice shall be included in all
+> copies or substantial portions of the Software.
+>
+> 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.
+>
+
+## sisteransi
+
+License: MIT
+By: Terkel Gjervig
+Repository: git+https://github.com/terkelg/sisteransi.git
+
+> MIT License
+>
+> Copyright (c) 2018 Terkel Gjervig Nielsen
+>
+> 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:
+>
+> The above copyright notice and this permission notice shall be included in all
+> copies or substantial portions of the Software.
+>
+> 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.
+>
\ No newline at end of file
index 46c7152a93977411b4dc8224b6ad0c0f6e9bd6c2..37738a92d1e62898f71f3af06fd40808207c73d9 100644 (file)
@@ -16,7 +16,7 @@
   "scripts": {
     "prepare": "husky install",
     "format": "prettier --write .",
-    "build": "esbuild --bundle index.js --format=cjs --platform=node --target=node14 --outfile=outfile.cjs",
+    "build": "zx ./scripts/build.mjs",
     "snapshot": "zx ./scripts/snapshot.mjs",
     "pretest": "run-s build snapshot",
     "test": "zx ./scripts/test.mjs",
@@ -35,6 +35,7 @@
   "homepage": "https://github.com/vuejs/create-vue#readme",
   "devDependencies": {
     "esbuild": "^0.13.15",
+    "esbuild-plugin-license": "^1.0.4",
     "husky": "^7.0.4",
     "kolorist": "^1.5.1",
     "lint-staged": "^12.2.0",
index c929cfb9e009593fdb397ee75f37d8e7ba5820b6..85f68465a301dd4fce65fa57abcc7215da9ae077 100644 (file)
@@ -5,6 +5,7 @@ importers:
   .:
     specifiers:
       esbuild: ^0.13.15
+      esbuild-plugin-license: ^1.0.4
       husky: ^7.0.4
       kolorist: ^1.5.1
       lint-staged: ^12.2.0
@@ -15,6 +16,7 @@ importers:
       zx: ^4.3.0
     devDependencies:
       esbuild: 0.13.15
+      esbuild-plugin-license: 1.0.4_esbuild@0.13.15
       husky: 7.0.4
       kolorist: 1.5.1
       lint-staged: 12.3.2
@@ -3722,6 +3724,14 @@ packages:
     dev: true
     optional: true
 
+  /esbuild-plugin-license/1.0.4_esbuild@0.13.15:
+    resolution: {integrity: sha512-u4HTZCO69MypH12W0c5wzWRfTdlVhOgQB5Z44A1Gn8NgqWy1B7VB36lT+PQFQ7hdrRTLabGGjmCjvsOUGF4s6Q==}
+    peerDependencies:
+      esbuild: '*'
+    dependencies:
+      esbuild: 0.13.15
+    dev: true
+
   /esbuild-sunos-64/0.13.15:
     resolution: {integrity: sha512-lbivT9Bx3t1iWWrSnGyBP9ODriEvWDRiweAs69vI+miJoeKwHWOComSRukttbuzjZ8r1q0mQJ8Z7yUsDJ3hKdw==}
     cpu: [x64]
diff --git a/scripts/build.mjs b/scripts/build.mjs
new file mode 100644 (file)
index 0000000..9690d9c
--- /dev/null
@@ -0,0 +1,76 @@
+import * as esbuild from 'esbuild'
+import esbuildPluginLicense from 'esbuild-plugin-license'
+
+const CORE_LICENSE = `MIT License
+
+Copyright (c) 2021-present vuejs
+
+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:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+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.
+`
+
+await esbuild.build({
+  bundle: true,
+  entryPoints: ['index.js'],
+  outfile: 'outfile.cjs',
+  format: 'cjs',
+  platform: 'node',
+  target: 'node14',
+
+  plugins: [
+    esbuildPluginLicense.default({
+      thirdParty: {
+        includePrivate: false,
+        output: {
+          file: 'LICENSE',
+          template(allDependencies) {
+            // There's a bug in the plugin that it also includes the `create-vue` package itself
+            const dependencies = allDependencies.filter((d) => d.packageJson.name !== 'create-vue')
+            const licenseText =
+              `# create-vue core license\n\n` +
+              `create-vue is released under the MIT license:\n\n` +
+              CORE_LICENSE +
+              `\n## Licenses of bundled dependencies\n\n` +
+              `The published create-vue artifact additionally contains code with the following licenses:\n` +
+              [...new Set(dependencies.map((dependency) => dependency.packageJson.license))].join(
+                ', '
+              ) +
+              '\n\n' +
+              `## Bundled dependencies\n\n` +
+              dependencies
+                .map((dependency) => {
+                  return (
+                    `## ${dependency.packageJson.name}\n\n` +
+                    `License: ${dependency.packageJson.license}\n` +
+                    `By: ${dependency.packageJson.author.name}\n` +
+                    `Repository: ${dependency.packageJson.repository.url}\n\n` +
+                    dependency.licenseText
+                      .split('\n')
+                      .map((line) => (line ? `> ${line}` : '>'))
+                      .join('\n')
+                  )
+                })
+                .join('\n\n')
+
+            return licenseText
+          }
+        }
+      }
+    })
+  ]
+})