Skip to content

Commit 5934c64

Browse files
committed
fix(release): Correctly release esm version as ES5
1 parent 1fd1797 commit 5934c64

File tree

15 files changed

+94
-85
lines changed

15 files changed

+94
-85
lines changed

.travis.yml

+32-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
11
language: node_js
22
node_js:
3-
- "12"
3+
- "lts/*"
44
cache: yarn
5-
deploy:
6-
local_dir: .docs
7-
provider: pages
8-
skip_cleanup: true
9-
github_token: $GH_TOKEN
10-
on:
11-
branch: master
12-
condition: '"$TRAVIS_JOB_NUMBER" == *.1'
13-
script:
14-
- "(yarn lint && yarn test --ci --coverage) || travis_terminate"
15-
- 'if [[ "$TRAVIS_JOB_NUMBER" == *.1 ]]; then yarn build:storybook || travis_terminate 1; fi'
16-
- yarn release
17-
after_success:
18-
- bash <(curl -s https://codecov.io/bash)
5+
stages:
6+
- test
7+
- name: deploy
8+
if: branch = master
9+
- name: release
10+
if: branch = master AND type != pull_request
11+
jobs:
12+
include:
13+
- stage: test
14+
script:
15+
- yarn lint
16+
- yarn test --ci --coverage
17+
after_success:
18+
- bash <(curl -s https://codecov.io/bash)
19+
- stage: deploy
20+
script: yarn build:storybook
21+
deploy:
22+
local_dir: .docs
23+
provider: pages
24+
skip_cleanup: true
25+
github_token: $GH_TOKEN
26+
on:
27+
branch: master
28+
- stage: release
29+
script: skip
30+
deploy:
31+
provider: script
32+
skip_cleanup: true
33+
script: yarn release
34+
on:
35+
branch: master

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2017 @researchgate/react-intersection-observer authors
3+
Copyright (c) @researchgate/react-intersection-observer authors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

docs/docs/components/HigherOrderComponent/WithIntersectionObserver.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from 'react';
2-
import Observer from '../../../../lib/es/src';
2+
import Observer from '../../../..';
33

44
export default (threshold) => (BaseComponent) => {
55
const displayName =

docs/docs/components/Hook/Hook.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState } from 'react';
2-
import { useIntersectionObserver } from '../../../../lib/es/src';
2+
import { useIntersectionObserver } from '../../../..';
33

44
const Hook = () => {
55
const [visibility, setVisibility] = useState('invisible');

docs/docs/components/HookOnlyOnce/HookOnlyOnce.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState } from 'react';
2-
import { useIntersectionObserver } from '../../../../lib/es/src';
2+
import { useIntersectionObserver } from '../../../..';
33

44
const HookOnlyOnce = () => {
55
const [visibility, setVisibility] = useState('invisible');

docs/docs/components/ImpressionTracking/AdImpression.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { action } from '@storybook/addon-actions';
4-
import Observer from '../../../../lib/es/src';
4+
import Observer from '../../../..';
55

66
const tracked = action('tracked');
77

docs/docs/components/OnlyOnce/OnlyOnce.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react';
22
import { decorateAction } from '@storybook/addon-actions';
3-
import Observer from '../../../../lib/es/src';
3+
import Observer from '../../../..';
44

55
const storyBookAction = decorateAction([
66
(args) =>

docs/docs/components/Playground/PlaygroundRootMargin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { Component } from 'react';
22
import { decorateAction } from '@storybook/addon-actions';
33
import { select } from '@storybook/addon-knobs/react';
4-
import Observer from '../../../../lib/es/src';
4+
import Observer from '../../../..';
55

66
const storyBookAction = decorateAction([
77
(args) =>

docs/docs/components/WindowFrame/WindowFrame.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react';
22
import { decorateAction } from '@storybook/addon-actions';
3-
import Observer from '../../../../lib/es/src';
3+
import Observer from '../../../..';
44

55
const storyBookAction = decorateAction([
66
(args) =>

docs/docs/components/WindowRoot/WindowRoot.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react';
22
import { decorateAction } from '@storybook/addon-actions';
3-
import Observer from '../../../../lib/es/src';
3+
import Observer from '../../../..';
44

55
const storyBookAction = decorateAction([
66
(args) =>

docs/docs/components/WithRootMargin/WithRootMargin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react';
22
import { decorateAction } from '@storybook/addon-actions';
3-
import Observer from '../../../../lib/es/src';
3+
import Observer from '../../../..';
44

55
const storyBookAction = decorateAction([
66
(args) =>

docs/docs/components/WithThresholds/WithThresholds.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react';
22
import { decorateAction } from '@storybook/addon-actions';
3-
import Observer from '../../../../lib/es/src';
3+
import Observer from '../../../..';
44

55
const storyBookAction = decorateAction([
66
(args) =>

package.json

+7-12
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
},
1212
"dependencies": {},
1313
"devDependencies": {
14-
"@babel/cli": "7.10.5",
1514
"@babel/core": "7.11.1",
1615
"@babel/preset-typescript": "7.10.4",
1716
"@researchgate/babel-preset": "2.0.3",
@@ -20,14 +19,13 @@
2019
"@storybook/addon-knobs": "5.3.19",
2120
"@storybook/addon-options": "5.3.19",
2221
"@storybook/react": "5.3.19",
23-
"@types/react": "16.9.46",
2422
"@testing-library/react-hooks": "3.4.1",
2523
"@types/jest": "26.0.10",
24+
"@types/react": "16.9.46",
2625
"@types/react-dom": "16.9.8",
2726
"@typescript-eslint/eslint-plugin": "3.9.0",
2827
"@typescript-eslint/parser": "3.9.0",
29-
"babel-loader": "8.1.0",
30-
"cross-env": "7.0.2",
28+
"babel-loader": "^8.1.0",
3129
"intersection-observer": "0.11.0",
3230
"npm-run-all": "4.1.5",
3331
"prop-types": "15.7.2",
@@ -56,8 +54,8 @@
5654
],
5755
"license": "MIT",
5856
"main": "lib/js/index.js",
59-
"module": "lib/es/src/index.js",
60-
"types": "typings/src/index.d.ts",
57+
"module": "lib/es/index.js",
58+
"types": "typings/index.d.ts",
6159
"peerDependencies": {
6260
"react": "^16.3.2",
6361
"react-dom": "^16.3.2"
@@ -67,9 +65,6 @@
6765
"url": "https://github.com/researchgate/react-intersection-observer.git"
6866
},
6967
"prettier": "@researchgate/prettier-config",
70-
"resolutions": {
71-
"serialize-javascript": "3.1.0"
72-
},
7368
"spire": {
7469
"extends": [
7570
[
@@ -84,9 +79,9 @@
8479
]
8580
},
8681
"scripts": {
87-
"build": "run-s build:js build:typescript",
88-
"build:js": "cross-env BABEL_ENV=production BABEL_OUTPUT=cjs babel src -x .ts,.tsx -d lib/js",
89-
"build:typescript": "cross-env tsc --build",
82+
"build": "run-s build:esm build:cjs",
83+
"build:esm": "tsc --build",
84+
"build:cjs": "tsc --outDir ./lib/js --module CommonJS",
9085
"build:storybook": "build-storybook -o .docs",
9186
"clean:lib": "rm -rf lib",
9287
"clean:typescript": "tsc --build --clean",

tsconfig.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"compilerOptions": {
3-
"target": "es2018",
3+
"target": "ES5",
44
"moduleResolution": "node",
5+
"module": "ES2015",
56
"strict": true,
67
"strictNullChecks": true,
78
"noImplicitAny": true,
@@ -11,7 +12,7 @@
1112
"forceConsistentCasingInFileNames": true,
1213
"declaration": true,
1314
"jsx": "react",
14-
"rootDir": ".",
15+
"rootDir": "src",
1516
"declarationDir": "./typings",
1617
"outDir": "./lib/es"
1718
},

0 commit comments

Comments
 (0)