diff --git a/LICENSE b/LICENSE index 86f74dc..e8ac7b8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 - present Arthur Fiorette +Copyright (c) 2021-present Arthur Fiorette & Contributors 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 diff --git a/build/webpack.config.js b/build/webpack.config.js index ecab5a6..c3b91c5 100644 --- a/build/webpack.config.js +++ b/build/webpack.config.js @@ -4,6 +4,10 @@ const path = require('path'); const TerserWebpackPlugin = require('terser-webpack-plugin'); const { DefinePlugin } = require('webpack'); +// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment +const { version } = require('../package.json'); + +const COPYRIGHT = `// Axios Cache Interceptor v${version} MIT License Copyright (c) 2021-present Arthur Fiorette & Contributors\n`; /** @type {(...args: string[]) => string} */ const root = (...p) => path.resolve(__dirname, '..', ...p); @@ -84,7 +88,29 @@ const config = ({ minimizer: [new TerserWebpackPlugin({ parallel: true })] }, - plugins: [new DefinePlugin({ __ACI_DEV__: devBuild })] + plugins: [ + // Chooses the right environment + new DefinePlugin({ __ACI_DEV__: devBuild }), + + // Add a banner to the top of each file + { + apply: (compiler) => { + compiler.hooks.emit.tapAsync('FileListPlugin', (comp, cb) => { + for (const chunk of comp.chunks) { + for (const filename of chunk.files) { + const assets = comp.assets[filename]; + + // @ts-expect-error - _value is not a public property + // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + assets._value = COPYRIGHT + assets._value; + } + } + + cb(); + }); + } + } + ] }); module.exports = [ diff --git a/tsconfig.json b/tsconfig.json index 6474b4c..7092787 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -33,7 +33,7 @@ // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - "resolveJsonModule": false, /* Enable importing .json files */ + "resolveJsonModule": true, /* Enable importing .json files */ // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ /* JavaScript Support */