Skip to content

Commit cf39b4a

Browse files
feat: Publish the package with a lib directory (#1119)
BREAKING CHANGE: Import paths of subdirectories must contain the lib directory. Such as `import { MessageStrip } from 'fundamental-react/lib/MessageStrip'`
1 parent b09fa78 commit cf39b4a

File tree

11 files changed

+25
-27
lines changed

11 files changed

+25
-27
lines changed

.storybook/custom/components/Import.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const Import = () => {
1111
customStyle={{ padding: 10, whiteSpace: 'pre-wrap', fontSize: 14 }}
1212
language='javascript'
1313
style={googlecode}>
14-
{`import { ${groups[groups.length - 1]} } from 'fundamental-react/${groups[1]}';`}
14+
{`import { ${groups[groups.length - 1]} } from 'fundamental-react/lib/${groups[1]}';`}
1515
</SyntaxHighlighter>)
1616
}
1717

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ For an existing react application, follow the steps below:
4444

4545
1. Import components as needed. See [Component Documentation](https://sap.github.io/fundamental-react/) for examples and API details.
4646
```javascript
47-
import { MessageStrip } from 'fundamental-react/MessageStrip';
47+
import { MessageStrip } from 'fundamental-react/lib/MessageStrip';
4848
```
4949
or
5050
```javascript

ci-scripts/publish-rc.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ npm run std-version -- --prerelease rc --no-verify
99

1010
git push --follow-tags "https://$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG" "$TRAVIS_BRANCH" > /dev/null 2>&1;
1111

12-
npm run build:copy-files
13-
14-
npm publish lib --tag prerelease
12+
npm publish --tag prerelease

ci-scripts/publish.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ echo "$std_ver"
1515

1616
git push --follow-tags "https://$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG" master > /dev/null 2>&1;
1717

18-
npm run build:copy-files
19-
20-
npm publish lib
18+
npm publish
2119

2220
# run this after publish to make sure GitHub finishes updating from the push
2321
npm run release:create -- --repo $TRAVIS_REPO_SLUG --tag $release_tag --branch master

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
"private": false,
55
"description": "SAP Fundamental Library, implemented in React",
66
"license": "Apache-2.0",
7-
"main": "index.js",
7+
"main": "lib/index.js",
88
"homepage": "https://sap.github.io/fundamental-react",
99
"repository": {
1010
"type": "git",
1111
"url": "https://github.com/SAP/fundamental-react"
1212
},
13+
"files": [
14+
"lib"
15+
],
1316
"scripts": {
14-
"build:copy-files": "cp -rf package.json README.md NOTICE.txt LICENSE.txt CHANGELOG.md lib",
1517
"build:index": "babel-node devtools/buildIndexFiles.js",
1618
"build:storybook": "babel-node devtools/buildVisualStories.js && babel-node scripts/copy-assets.js",
1719
"build:cjs": "cross-env NODE_ENV=production BABEL_ENV=cjs babel src --ignore \"src/**/*.test.js\",\"src/**/*.stories.js\",\"src/Docs/*.stories.mdx\" --out-dir lib",
1820
"build": "npm run build:index && rm -rf lib && npm run build:cjs",
1921
"deploy": "gh-pages -d storybook-static",
20-
"dry-run": "npm run build && npm run build:copy-files && npm publish lib --dry-run",
22+
"dry-run": "npm run build && npm publish --dry-run",
2123
"lint": "npm run lint:code && npm run lint:style",
2224
"lint:fix": "npm run lint:code:fix && npm run lint:style:fix",
2325
"lint:code": "eslint . --ext .js,.jsx",

src/Button/__stories__/Button.stories.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from '@storybook/addon-knobs';
88

99
export default {
10-
title: 'Component API/Button',
10+
title: 'Component API/Button/Button',
1111
component: Button
1212
};
1313

src/Button/__stories__/ButtonSegmented.stories.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ButtonSegmented from '../ButtonSegmented';
44
import React from 'react';
55

66
export default {
7-
title: 'Component API/ButtonSegmented',
7+
title: 'Component API/Button/ButtonSegmented',
88
component: ButtonSegmented
99
};
1010

src/Button/__stories__/__snapshots__/Button.stories.storyshot

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Storyshots Component API/Button Dev 1`] = `
3+
exports[`Storyshots Component API/Button/Button Dev 1`] = `
44
<div
55
dir="ltr"
66
>
@@ -14,7 +14,7 @@ exports[`Storyshots Component API/Button Dev 1`] = `
1414
</div>
1515
`;
1616

17-
exports[`Storyshots Component API/Button Icons 1`] = `
17+
exports[`Storyshots Component API/Button/Button Icons 1`] = `
1818
<div
1919
dir="ltr"
2020
>
@@ -104,7 +104,7 @@ exports[`Storyshots Component API/Button Icons 1`] = `
104104
</div>
105105
`;
106106

107-
exports[`Storyshots Component API/Button Options 1`] = `
107+
exports[`Storyshots Component API/Button/Button Options 1`] = `
108108
<div
109109
dir="ltr"
110110
>
@@ -133,7 +133,7 @@ exports[`Storyshots Component API/Button Options 1`] = `
133133
</div>
134134
`;
135135

136-
exports[`Storyshots Component API/Button Primary 1`] = `
136+
exports[`Storyshots Component API/Button/Button Primary 1`] = `
137137
<div
138138
dir="ltr"
139139
>
@@ -146,7 +146,7 @@ exports[`Storyshots Component API/Button Primary 1`] = `
146146
</div>
147147
`;
148148

149-
exports[`Storyshots Component API/Button Sizes 1`] = `
149+
exports[`Storyshots Component API/Button/Button Sizes 1`] = `
150150
<div
151151
dir="ltr"
152152
>
@@ -169,7 +169,7 @@ exports[`Storyshots Component API/Button Sizes 1`] = `
169169
</div>
170170
`;
171171

172-
exports[`Storyshots Component API/Button States 1`] = `
172+
exports[`Storyshots Component API/Button/Button States 1`] = `
173173
<div
174174
dir="ltr"
175175
>
@@ -338,7 +338,7 @@ exports[`Storyshots Component API/Button States 1`] = `
338338
</div>
339339
`;
340340

341-
exports[`Storyshots Component API/Button Types 1`] = `
341+
exports[`Storyshots Component API/Button/Button Types 1`] = `
342342
<div
343343
dir="ltr"
344344
>

src/Button/__stories__/__snapshots__/ButtonSegmented.stories.storyshot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Storyshots Component API/ButtonSegmented Compact 1`] = `
3+
exports[`Storyshots Component API/Button/ButtonSegmented Compact 1`] = `
44
<div
55
dir="ltr"
66
>
@@ -32,7 +32,7 @@ exports[`Storyshots Component API/ButtonSegmented Compact 1`] = `
3232
</div>
3333
`;
3434

35-
exports[`Storyshots Component API/ButtonSegmented Primary 1`] = `
35+
exports[`Storyshots Component API/Button/ButtonSegmented Primary 1`] = `
3636
<div
3737
dir="ltr"
3838
>

src/Tabs/__stories__/TabGroup.stories.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import TabContent from '../_TabContent';
55
import TabGroup from '../TabGroup';
66

77
export default {
8-
title: 'Component API/TabGroup',
8+
title: 'Component API/Tabs/TabGroup',
99
component: TabGroup,
1010
subcomponents: { Tab, TabContent }
1111
};

0 commit comments

Comments
 (0)