Skip to content

Commit d3d036d

Browse files
fix: semantic release fixes (#14)
1 parent f024063 commit d3d036d

File tree

4 files changed

+99
-4
lines changed

4 files changed

+99
-4
lines changed

circle.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ jobs:
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

package-lock.json

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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": {
@@ -18,12 +18,10 @@
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": {
@@ -36,11 +34,13 @@
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"

scripts/publish-prep.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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)

0 commit comments

Comments
 (0)