File tree Expand file tree Collapse file tree 4 files changed +99
-4
lines changed Expand file tree Collapse file tree 4 files changed +99
-4
lines changed Original file line number Diff line number Diff line change 4141 - run :
4242 name : Install npm
4343 command : npm install
44+ - run :
45+ name : Prep Dist Folder
46+ command : npm run dist
4447 - run :
4548 name : Build
4649 command : npm run build
Original file line number Diff line number Diff line change 22 "name" : " typescript-monads" ,
33 "version" : " 0.0.0-development" ,
44 "description" : " Write better TypeScript code" ,
5- "main" : " dist/ index.js" ,
5+ "main" : " index.js" ,
66 "author" : " Patrick Michalina <patrickmichalina@mac.com> (https://patrickmichalina.com)" ,
77 "license" : " MIT" ,
88 "repository" : {
1818 " either" ,
1919 " functional"
2020 ],
21- "files" : [
22- " dist/"
23- ],
2421 "scripts" : {
2522 "test" : " jest" ,
2623 "build" : " tsc" ,
24+ "dist" : " node_modules/.bin/ts-node ./scripts/publish-prep.ts" ,
2725 "lint" : " tslint --project tsconfig.json --config tslint.json"
2826 },
2927 "release" : {
3634 },
3735 "devDependencies" : {
3836 "@types/jest" : " ^23.3.1" ,
37+ "@types/node" : " ^10.5.8" ,
3938 "codecov" : " ^3.0.4" ,
4039 "jest" : " 23.4.2" ,
4140 "jest-junit" : " ^5.1.0" ,
4241 "semantic-release" : " ^15.9.8" ,
4342 "ts-jest" : " 23.1.3" ,
43+ "ts-node" : " ^7.0.1" ,
4444 "tslint" : " ^5.11.0" ,
4545 "tslint-immutable" : " ^4.6.0" ,
4646 "typescript" : " ^3.0.1"
Original file line number Diff line number Diff line change 1+ import { mkdir , copyFileSync } from 'fs'
2+ import { resolve } from 'path'
3+
4+ const targetDir = 'dist'
5+ const filesToCopy : ReadonlyArray < string > = [
6+ 'package.json' ,
7+ 'README.md' ,
8+ 'LICENSE'
9+ ]
10+
11+ function run ( dir : string ) {
12+ return function ( files : ReadonlyArray < string > ) {
13+ mkdir ( resolve ( dir ) , dirResolved ( files ) ( dir ) )
14+ }
15+ }
16+
17+ function mapper ( dir : string ) {
18+ return function ( file : string ) {
19+ return {
20+ from : resolve ( file ) ,
21+ to : resolve ( dir , file )
22+ }
23+ }
24+ }
25+
26+ function dirResolved ( files : ReadonlyArray < string > ) {
27+ return function ( dir : string ) {
28+ return function ( _err ?: any ) {
29+ files . map ( mapper ( dir ) ) . forEach ( paths => copyFileSync ( paths . from , paths . to ) )
30+ }
31+ }
32+ }
33+
34+ run ( targetDir ) ( filesToCopy )
You can’t perform that action at this time.
0 commit comments