Skip to content

Commit

Permalink
fix: add files omitted from previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
biggyspender committed Feb 24, 2021
1 parent 491b403 commit e626f41
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ coverage
.idea
dist
lib
build
compiled
.awcache
.rpt2_cache
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "",
"keywords": [],
"sideEffects": false,
"main": "dist/ts-iterable-functions.umd.js",
"module": "dist/ts-iterable-functions.es5.js",
"module": "lib/ts-iterable-functions.js",
"typings": "lib/ts-iterable-functions.d.ts",
"files": [
"dist/**/*",
Expand All @@ -22,7 +21,7 @@
},
"scripts": {
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
"prebuild": "rimraf dist lib",
"prebuild": "rimraf build lib",
"build": "tsc --module commonjs && rollup -c rollup.config.ts",
"build-docs": "typedoc",
"start": "rollup -c rollup.config.ts -w",
Expand Down Expand Up @@ -95,6 +94,7 @@
"coveralls": "^3.1.0",
"cross-env": "^7.0.3",
"cz-conventional-changelog": "^3.3.0",
"glob": "^7.1.6",
"husky": "^4.3.8",
"jest": "^26.6.3",
"jest-config": "^26.6.3",
Expand Down
17 changes: 13 additions & 4 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import sourceMaps from 'rollup-plugin-sourcemaps'
import camelCase from 'lodash.camelcase'
import typescript from 'rollup-plugin-typescript2'
import json from '@rollup/plugin-json'
import * as glob from 'glob'
import * as path from 'path'

const pkg = require('./package.json')

Expand All @@ -13,11 +15,18 @@ const externals = ["tslib", "ts-functional-pipe", "ts-comparer-builder"]

const umdGlobals = externals => externals.map(moduleName => [moduleName, camelCase(moduleName)]).reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {})

const files = glob.sync("src/**/*.ts")
.map(f => ({ parsed: path.parse(f), path: f }))
.map(f => ({ jsPath: path.relative("src", path.join(`${f.parsed.dir}`, `${f.parsed.name}`)), filePath: f.path }))
.reduce((acc, { jsPath, filePath }) => ({ ...acc, [jsPath]: filePath }), {})

console.log(JSON.stringify(files, null, 2))

export default {
input: `src/${libraryName}.ts`,
input: files,
output: [
{ file: pkg.main, name: camelCase(libraryName), format: 'umd', sourcemap: true, globals: umdGlobals(externals) },
{ file: pkg.module, format: 'es', sourcemap: true },
//{ dir: "umd", name: camelCase(libraryName), format: 'umd', sourcemap: true, globals: umdGlobals(externals) },
{ dir: "lib", format: 'cjs', sourcemap: true },
],
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
external: externals,
Expand All @@ -38,5 +47,5 @@ export default {

// Resolve source maps to the original source
sourceMaps(),
],
]
}
2 changes: 1 addition & 1 deletion test/ts-iterable-functions.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import getIdentity from '../src/transformers/helpers/getIdentity'
import { getIdentity } from '../src/transformers/helpers/getIdentity'
import { pp } from 'ts-functional-pipe'
import {
aggregate,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"declarationDir": "lib",
"outDir": "lib",
"outDir": "build",
"typeRoots": [
"node_modules/@types"
],
Expand Down

0 comments on commit e626f41

Please sign in to comment.