Skip to content

Commit

Permalink
Provide experimental Flow and TypeScript type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
artkravchenko committed Oct 23, 2017
1 parent e54e7a8 commit d114088
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
"version": "0.1.5",
"description": "Set up, format and translate phrases easily",
"main": "dist/t8on.js",
"typescript": {
"definition": "dist/t8on.d.ts"
},
"scripts": {
"build": "run-p build:lib build:umd",
"build": "run-p build:lib build:umd build:typedefs",
"build:lib": "cross-env BABEL_ENV=cjs babel src --loose -o dist/t8on.js",
"build:typedefs": "node ./res/copy-typedefs.js",
"build:umd": "webpack --config res/umd.config.js",
"clean": "rm -rf .nyc_output coverage dist",
"coverage": "cross-env BABEL_ENV=test nyc report --reporter=text-lcov | coveralls",
Expand Down
11 changes: 11 additions & 0 deletions res/copy-typedefs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const fs = require('fs');
const path = require('path');

const DIST_PATH = path.join(__dirname, '../dist');
const DEFS_PATH = path.join(__dirname, '../typedefs');

const flow = fs.readFileSync(path.join(DEFS_PATH, 't8on.js.flow'), 'utf-8');
const ts = fs.readFileSync(path.join(DEFS_PATH, 't8on.d.ts'), 'utf-8');

fs.writeFileSync(path.join(DIST_PATH, 't8on.js.flow'), flow, 'utf-8');
fs.writeFileSync(path.join(DIST_PATH, 't8on.d.ts'), ts, 'utf-8');

0 comments on commit d114088

Please sign in to comment.