├── .editorconfig ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── index.js ├── package.json └── project.sublime-project /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = crlf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | insert_final_newline = false 13 | max_line_length = off 14 | trim_trailing_whitespace = false 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/sublimetext,visualstudio,webstorm+all,visualstudiocode 3 | 4 | ### SublimeText ### 5 | # cache files for sublime text 6 | *.tmlanguage.cache 7 | *.tmPreferences.cache 8 | *.stTheme.cache 9 | 10 | # workspace files are user-specific 11 | *.sublime-workspace 12 | 13 | # project files should be checked into the repository, unless a significant 14 | # proportion of contributors will probably not be using SublimeText 15 | # *.sublime-project 16 | 17 | # sftp configuration file 18 | sftp-config.json 19 | 20 | # Package control specific files 21 | Package Control.last-run 22 | Package Control.ca-list 23 | Package Control.ca-bundle 24 | Package Control.system-ca-bundle 25 | Package Control.cache/ 26 | Package Control.ca-certs/ 27 | Package Control.merged-ca-bundle 28 | Package Control.user-ca-bundle 29 | oscrypto-ca-bundle.crt 30 | bh_unicode_properties.cache 31 | 32 | # Sublime-github package stores a github token in this file 33 | # https://packagecontrol.io/packages/sublime-github 34 | GitHub.sublime-settings 35 | 36 | ### VisualStudioCode ### 37 | .vscode/* 38 | !.vscode/settings.json 39 | !.vscode/tasks.json 40 | !.vscode/launch.json 41 | !.vscode/extensions.json 42 | .history 43 | 44 | ### WebStorm+all ### 45 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 46 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 47 | 48 | # User-specific stuff: 49 | .idea/**/workspace.xml 50 | .idea/**/tasks.xml 51 | .idea/dictionaries 52 | 53 | # Sensitive or high-churn files: 54 | .idea/**/dataSources/ 55 | .idea/**/dataSources.ids 56 | .idea/**/dataSources.xml 57 | .idea/**/dataSources.local.xml 58 | .idea/**/sqlDataSources.xml 59 | .idea/**/dynamic.xml 60 | .idea/**/uiDesigner.xml 61 | 62 | # Gradle: 63 | .idea/**/gradle.xml 64 | .idea/**/libraries 65 | 66 | # CMake 67 | cmake-build-debug/ 68 | 69 | # Mongo Explorer plugin: 70 | .idea/**/mongoSettings.xml 71 | 72 | ## File-based project format: 73 | *.iws 74 | 75 | ## Plugin-specific files: 76 | 77 | # IntelliJ 78 | /out/ 79 | 80 | # mpeltonen/sbt-idea plugin 81 | .idea_modules/ 82 | 83 | # JIRA plugin 84 | atlassian-ide-plugin.xml 85 | 86 | # Cursive Clojure plugin 87 | .idea/replstate.xml 88 | 89 | # Ruby plugin and RubyMine 90 | /.rakeTasks 91 | 92 | # Crashlytics plugin (for Android Studio and IntelliJ) 93 | com_crashlytics_export_strings.xml 94 | crashlytics.properties 95 | crashlytics-build.properties 96 | fabric.properties 97 | 98 | ### WebStorm+all Patch ### 99 | # Ignores the whole idea folder 100 | # See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 101 | 102 | .idea/ 103 | 104 | ### VisualStudio ### 105 | ## Ignore Visual Studio temporary files, build results, and 106 | ## files generated by popular Visual Studio add-ons. 107 | ## 108 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 109 | 110 | # User-specific files 111 | *.suo 112 | *.user 113 | *.userosscache 114 | *.sln.docstates 115 | 116 | # User-specific files (MonoDevelop/Xamarin Studio) 117 | *.userprefs 118 | 119 | # Build results 120 | [Dd]ebug/ 121 | [Dd]ebugPublic/ 122 | [Rr]elease/ 123 | [Rr]eleases/ 124 | x64/ 125 | x86/ 126 | bld/ 127 | [Bb]in/ 128 | [Oo]bj/ 129 | [Ll]og/ 130 | 131 | # Visual Studio 2015 cache/options directory 132 | .vs/ 133 | # Uncomment if you have tasks that create the project's static files in wwwroot 134 | #wwwroot/ 135 | 136 | # MSTest test Results 137 | [Tt]est[Rr]esult*/ 138 | [Bb]uild[Ll]og.* 139 | 140 | # NUNIT 141 | *.VisualState.xml 142 | TestResult.xml 143 | 144 | # Build Results of an ATL Project 145 | [Dd]ebugPS/ 146 | [Rr]eleasePS/ 147 | dlldata.c 148 | 149 | # .NET Core 150 | project.lock.json 151 | project.fragment.lock.json 152 | artifacts/ 153 | **/Properties/launchSettings.json 154 | 155 | *_i.c 156 | *_p.c 157 | *_i.h 158 | *.ilk 159 | *.meta 160 | *.obj 161 | *.pch 162 | *.pdb 163 | *.pgc 164 | *.pgd 165 | *.rsp 166 | *.sbr 167 | *.tlb 168 | *.tli 169 | *.tlh 170 | *.tmp 171 | *.tmp_proj 172 | *.log 173 | *.vspscc 174 | *.vssscc 175 | .builds 176 | *.pidb 177 | *.svclog 178 | *.scc 179 | 180 | # Chutzpah Test files 181 | _Chutzpah* 182 | 183 | # Visual C++ cache files 184 | ipch/ 185 | *.aps 186 | *.ncb 187 | *.opendb 188 | *.opensdf 189 | *.sdf 190 | *.cachefile 191 | *.VC.db 192 | *.VC.VC.opendb 193 | 194 | # Visual Studio profiler 195 | *.psess 196 | *.vsp 197 | *.vspx 198 | *.sap 199 | 200 | # TFS 2012 Local Workspace 201 | $tf/ 202 | 203 | # Guidance Automation Toolkit 204 | *.gpState 205 | 206 | # ReSharper is a .NET coding add-in 207 | _ReSharper*/ 208 | *.[Rr]e[Ss]harper 209 | *.DotSettings.user 210 | 211 | # JustCode is a .NET coding add-in 212 | .JustCode 213 | 214 | # TeamCity is a build add-in 215 | _TeamCity* 216 | 217 | # DotCover is a Code Coverage Tool 218 | *.dotCover 219 | 220 | # Visual Studio code coverage results 221 | *.coverage 222 | *.coveragexml 223 | 224 | # NCrunch 225 | _NCrunch_* 226 | .*crunch*.local.xml 227 | nCrunchTemp_* 228 | 229 | # MightyMoose 230 | *.mm.* 231 | AutoTest.Net/ 232 | 233 | # Web workbench (sass) 234 | .sass-cache/ 235 | 236 | # Installshield output folder 237 | [Ee]xpress/ 238 | 239 | # DocProject is a documentation generator add-in 240 | DocProject/buildhelp/ 241 | DocProject/Help/*.HxT 242 | DocProject/Help/*.HxC 243 | DocProject/Help/*.hhc 244 | DocProject/Help/*.hhk 245 | DocProject/Help/*.hhp 246 | DocProject/Help/Html2 247 | DocProject/Help/html 248 | 249 | # Click-Once directory 250 | publish/ 251 | 252 | # Publish Web Output 253 | *.[Pp]ublish.xml 254 | *.azurePubxml 255 | # TODO: Uncomment the next line to ignore your web deploy settings. 256 | # By default, sensitive information, such as encrypted password 257 | # should be stored in the .pubxml.user file. 258 | #*.pubxml 259 | *.pubxml.user 260 | *.publishproj 261 | 262 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 263 | # checkin your Azure Web App publish settings, but sensitive information contained 264 | # in these scripts will be unencrypted 265 | PublishScripts/ 266 | 267 | # NuGet Packages 268 | *.nupkg 269 | # The packages folder can be ignored because of Package Restore 270 | **/packages/* 271 | # except build/, which is used as an MSBuild target. 272 | !**/packages/build/ 273 | # Uncomment if necessary however generally it will be regenerated when needed 274 | #!**/packages/repositories.config 275 | # NuGet v3's project.json files produces more ignorable files 276 | *.nuget.props 277 | *.nuget.targets 278 | 279 | # Microsoft Azure Build Output 280 | csx/ 281 | *.build.csdef 282 | 283 | # Microsoft Azure Emulator 284 | ecf/ 285 | rcf/ 286 | 287 | # Windows Store app package directories and files 288 | AppPackages/ 289 | BundleArtifacts/ 290 | Package.StoreAssociation.xml 291 | _pkginfo.txt 292 | 293 | # Visual Studio cache files 294 | # files ending in .cache can be ignored 295 | *.[Cc]ache 296 | # but keep track of directories ending in .cache 297 | !*.[Cc]ache/ 298 | 299 | # Others 300 | ClientBin/ 301 | ~$* 302 | *~ 303 | *.dbmdl 304 | *.dbproj.schemaview 305 | *.jfm 306 | *.pfx 307 | *.publishsettings 308 | orleans.codegen.cs 309 | 310 | # Since there are multiple workflows, uncomment next line to ignore bower_components 311 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 312 | #bower_components/ 313 | 314 | # RIA/Silverlight projects 315 | Generated_Code/ 316 | 317 | # Backup & report files from converting an old project file 318 | # to a newer Visual Studio version. Backup files are not needed, 319 | # because we have git ;-) 320 | _UpgradeReport_Files/ 321 | Backup*/ 322 | UpgradeLog*.XML 323 | UpgradeLog*.htm 324 | 325 | # SQL Server files 326 | *.mdf 327 | *.ldf 328 | *.ndf 329 | 330 | # Business Intelligence projects 331 | *.rdl.data 332 | *.bim.layout 333 | *.bim_*.settings 334 | 335 | # Microsoft Fakes 336 | FakesAssemblies/ 337 | 338 | # GhostDoc plugin setting file 339 | *.GhostDoc.xml 340 | 341 | # Node.js Tools for Visual Studio 342 | .ntvs_analysis.dat 343 | node_modules/ 344 | 345 | # Typescript v1 declaration files 346 | typings/ 347 | 348 | # Visual Studio 6 build log 349 | *.plg 350 | 351 | # Visual Studio 6 workspace options file 352 | *.opt 353 | 354 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 355 | *.vbw 356 | 357 | # Visual Studio LightSwitch build output 358 | **/*.HTMLClient/GeneratedArtifacts 359 | **/*.DesktopClient/GeneratedArtifacts 360 | **/*.DesktopClient/ModelManifest.xml 361 | **/*.Server/GeneratedArtifacts 362 | **/*.Server/ModelManifest.xml 363 | _Pvt_Extensions 364 | 365 | # Paket dependency manager 366 | .paket/paket.exe 367 | paket-files/ 368 | 369 | # FAKE - F# Make 370 | .fake/ 371 | 372 | # JetBrains Rider 373 | *.sln.iml 374 | 375 | # CodeRush 376 | .cr/ 377 | 378 | # Python Tools for Visual Studio (PTVS) 379 | __pycache__/ 380 | *.pyc 381 | 382 | # Cake - Uncomment if you are using it 383 | # tools/** 384 | # !tools/packages.config 385 | 386 | # Telerik's JustMock configuration file 387 | *.jmconfig 388 | 389 | # BizTalk build output 390 | *.btp.cs 391 | *.btm.cs 392 | *.odx.cs 393 | *.xsd.cs 394 | 395 | ### VisualStudio Patch ### 396 | # By default, sensitive information, such as encrypted password 397 | # should be stored in the .pubxml.user file. 398 | 399 | # End of https://www.gitignore.io/api/sublimetext,visualstudio,webstorm+all,visualstudiocode 400 | 401 | *.tgz 402 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .git/ 2 | .gitignore 3 | .editorconfig 4 | *.tgz 5 | *.sublime-project 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Appius 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Create file plugin for WebPack 2 | [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) 3 | 4 | Very simple plugin to create a file at the end of the build process with the particular text. 5 | 6 | ## Installation 7 | ``` 8 | npm i create-file-webpack --save-dev 9 | ``` 10 | 11 | ## Usage 12 | ```js 13 | const CreateFileWebpack = require('create-file-webpack') 14 | 15 | // webpack config 16 | { 17 | plugins: [ 18 | new CreateFileWebpack({options}) 19 | ] 20 | } 21 | ``` 22 | 23 | ## List of possible options: 24 | 25 | ````js 26 | var opts = { 27 | // path to folder in which the file will be created 28 | path: './dist', 29 | // file name 30 | fileName: 'index.js', 31 | // content of the file 32 | content: 'export * from ./module.umd.js' 33 | }; 34 | ```` 35 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var CreateFilePlugin = (function () { 3 | const write = require('write'); 4 | const path = require('path'); 5 | 6 | function CreateFilePlugin(options){ 7 | if (options === void 0) { 8 | throw new Error(`Please provide 'options' for the CreateFilePlugin config`); 9 | } 10 | 11 | if (options.path == null) { 12 | throw new Error(`Please provide 'options.path' in the CreateFilePlugin config`); 13 | } 14 | 15 | if (options.fileName == null) { 16 | throw new Error(`Please provide 'options.fileName' in the CreateFilePlugin config`); 17 | } 18 | 19 | if (options.content == null) { 20 | throw new Error(`Please provide 'options.content' in the CreateFilePlugin config`); 21 | } 22 | 23 | this.options = options; 24 | } 25 | 26 | function _createFile(filePath, fileName, content) { 27 | return () => { 28 | const fullPath = path.join(filePath, fileName); 29 | write.sync(fullPath, content); 30 | } 31 | } 32 | 33 | CreateFilePlugin.prototype.apply = function (compiler) { 34 | const createFile = () => _createFile(this.options.path, this.options.fileName, this.options.content); 35 | 36 | if (!!compiler.hooks) { 37 | compiler.hooks.done.tap('CreateFileWebpack', createFile()); 38 | } else { 39 | compiler.plugin('done', createFile()); 40 | } 41 | }; 42 | 43 | return CreateFilePlugin; 44 | })(); 45 | 46 | module.exports = CreateFilePlugin; 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-file-webpack", 3 | "version": "1.0.2", 4 | "description": "Webpack plugin for creating the file with the particular content", 5 | "main": "index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/Appius/create-file-webpack.git" 9 | }, 10 | "keywords": [ 11 | "webpack", 12 | "webpack-plugin" 13 | ], 14 | "author": "Appius", 15 | "license": "MIT", 16 | "bugs": { 17 | "url": "https://github.com/Appius/create-file-webpack/issues" 18 | }, 19 | "homepage": "https://github.com/Appius/create-file-webpack#readme", 20 | "dependencies": { 21 | "path": "^0.12.7", 22 | "write": "^1.0.3" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /project.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": 3 | [ 4 | { 5 | "path": "." 6 | } 7 | ] 8 | } 9 | --------------------------------------------------------------------------------