Skip to content

Commit

Permalink
Include the license banner in built files
Browse files Browse the repository at this point in the history
  • Loading branch information
TuckerWhitehouse committed Nov 5, 2020
1 parent da5c3f7 commit 15697f5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"babel-plugin-lodash": "^3.3.4",
"builtin-modules": "^3.1.0",
"lodash": "^4.17.15",
"outdent": "^0.7.1",
"read-pkg-up": "^7.0.0",
"rollup-plugin-alias": "^2.0.1",
"rollup-plugin-babel": "^4.3.3",
Expand Down
21 changes: 21 additions & 0 deletions packages/shared/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ const semver = require('semver')
const readPkgUp = require('read-pkg-up')
const { get, upperFirst, camelCase } = require('lodash')

const outdent = require('outdent')
const license = outdent`
/**
* Copyright ${new Date().getFullYear()} Workgrid Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
`

module.exports = (input) => {
const source = path.resolve(process.cwd(), input)
const cwd = path.dirname(source)
Expand All @@ -57,6 +76,7 @@ module.exports = (input) => {
format: 'cjs',
sourcemap: true,
exports: 'auto',
banner: license,
},
],
preserveSymlinks: true, // yarn workspaces
Expand Down Expand Up @@ -121,6 +141,7 @@ module.exports = (input) => {
name: amdName,
sourcemap: true,
exports: 'auto',
banner: license,
},
],
preserveSymlinks: true, // yarn workspaces
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5138,6 +5138,11 @@ os-browserify@~0.3.0:
resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27"
integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=

outdent@^0.7.1:
version "0.7.1"
resolved "https://registry.yarnpkg.com/outdent/-/outdent-0.7.1.tgz#e9b400443622a97760b0bc74fa3223252ccd02a2"
integrity sha512-VjIzdUHunL74DdhcwMDt5FhNDQ8NYmTkuW0B+usIV2afS9aWT/1c9z1TsnFW349TP3nxmYeUl7Z++XpJRByvgg==

p-any@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/p-any/-/p-any-3.0.0.tgz#79847aeed70b5d3a10ea625296c0c3d2e90a87b9"
Expand Down

0 comments on commit 15697f5

Please sign in to comment.