Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ jobs:
- run:
name: Install npm
command: npm install
- run:
name: Prep Dist Folder
command: npm run dist
- run:
name: Build
command: npm run build
Expand Down
58 changes: 58 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "typescript-monads",
"version": "0.0.0-development",
"description": "Write better TypeScript code",
"main": "dist/index.js",
"main": "index.js",
"author": "Patrick Michalina <patrickmichalina@mac.com> (https://patrickmichalina.com)",
"license": "MIT",
"repository": {
Expand All @@ -18,12 +18,10 @@
"either",
"functional"
],
"files": [
"dist/"
],
"scripts": {
"test": "jest",
"build": "tsc",
"dist": "node_modules/.bin/ts-node ./scripts/publish-prep.ts",
"lint": "tslint --project tsconfig.json --config tslint.json"
},
"release": {
Expand All @@ -36,11 +34,13 @@
},
"devDependencies": {
"@types/jest": "^23.3.1",
"@types/node": "^10.5.8",
"codecov": "^3.0.4",
"jest": "23.4.2",
"jest-junit": "^5.1.0",
"semantic-release": "^15.9.8",
"ts-jest": "23.1.3",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
"tslint-immutable": "^4.6.0",
"typescript": "^3.0.1"
Expand Down
34 changes: 34 additions & 0 deletions scripts/publish-prep.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { mkdir, copyFileSync } from 'fs'
import { resolve } from 'path'

const targetDir = 'dist'
const filesToCopy: ReadonlyArray<string> = [
'package.json',
'README.md',
'LICENSE'
]

function run(dir: string) {
return function(files: ReadonlyArray<string>) {
mkdir(resolve(dir), dirResolved(files)(dir))
}
}

function mapper(dir: string) {
return function (file: string) {
return {
from: resolve(file),
to: resolve(dir, file)
}
}
}

function dirResolved(files: ReadonlyArray<string>) {
return function(dir: string) {
return function (_err?: any) {
files.map(mapper(dir)).forEach(paths => copyFileSync(paths.from, paths.to))
}
}
}

run(targetDir)(filesToCopy)