Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test case for Flow + ESM #559

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions examples/flow/destructuring.js.flow
@@ -0,0 +1,9 @@
// @flow

const {format} = require('date-fns')
const {eo} = require('date-fns/locale')

const dateString : string = '2017-01-25T21:28:15.000Z'
const formatString : string = 'DD.MM.YYYY HH:mm:ss'
const result : string = format('2017-01-25T21:28:15.000Z', 'dddd, DD MMMM HH:mm:ss', {locale: eo})
console.log(result === 'merkredo, 25 januaro 21:28:15')
8 changes: 5 additions & 3 deletions examples/flow/package.json
Expand Up @@ -14,13 +14,15 @@
"build": "yarn run build-date-fns && yarn run flow-check && yarn run build-babel",
"flow-check": "flow check",
"build-date-fns": "env PACKAGE_OUTPUT_PATH=\"$(pwd)/node_modules/date-fns\" ../../scripts/build/package.sh",
"build-babel": "yarn run build-babel-example && yarn run build-babel-fp && yarn run build-babel-misc",
"build-babel": "yarn run build-babel-example && yarn run build-babel-fp && yarn run build-babel-misc && yarn build-babel-destructuring",
"build-babel-example": "mkdir -p dist && babel example.js.flow --out-file dist/example.js",
"build-babel-fp": "mkdir -p dist && babel fp.js.flow --out-file dist/fp.js",
"build-babel-misc": "mkdir -p dist && babel misc.js.flow --out-file dist/misc.js",
"test": "yarn run test-example && yarn run test-fp && yarn run test-misc",
"build-babel-destructuring": "mkdir -p dist && babel destructuring.js.flow --out-file dist/destructuring.js",
"test": "yarn run test-example && yarn run test-fp && yarn run test-misc && yarn run test-destructuring",
"test-example": "test $(env TZ=UTC node ./dist/example.js) = true",
"test-fp": "test $(env TZ=UTC node ./dist/fp.js) = true",
"test-misc": "test $(env TZ=UTC node ./dist/misc.js) = true"
"test-misc": "test $(env TZ=UTC node ./dist/misc.js) = true",
"test-destructuring": "test $(env TZ=UTC node ./dist/destructuring.js) = true"
}
}
3 changes: 3 additions & 0 deletions scripts/build/package.sh
Expand Up @@ -38,6 +38,9 @@ do
cp -r "./src/$fnDir" "$dir/esm/"
done

# Copy global flow typing
cp ./src/index.js.flow "$dir/esm/index.js.flow"

# Copy esm indices
cp ./src/esm/index.js "$dir/esm/index.js"
cp ./src/esm/fp/index.js "$dir/esm/fp/index.js"
Expand Down