Skip to content

Commit

Permalink
feat: Publish the package with a lib directory (#1119)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Import paths of subdirectories must contain the lib directory.  Such as `import { MessageStrip } from 'fundamental-react/lib/MessageStrip'`
  • Loading branch information
sam-kvale-sap committed Jul 6, 2020
1 parent b09fa78 commit cf39b4a
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .storybook/custom/components/Import.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Import = () => {
customStyle={{ padding: 10, whiteSpace: 'pre-wrap', fontSize: 14 }}
language='javascript'
style={googlecode}>
{`import { ${groups[groups.length - 1]} } from 'fundamental-react/${groups[1]}';`}
{`import { ${groups[groups.length - 1]} } from 'fundamental-react/lib/${groups[1]}';`}
</SyntaxHighlighter>)
}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ For an existing react application, follow the steps below:

1. Import components as needed. See [Component Documentation](https://sap.github.io/fundamental-react/) for examples and API details.
```javascript
import { MessageStrip } from 'fundamental-react/MessageStrip';
import { MessageStrip } from 'fundamental-react/lib/MessageStrip';
```
or
```javascript
Expand Down
4 changes: 1 addition & 3 deletions ci-scripts/publish-rc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ npm run std-version -- --prerelease rc --no-verify

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

npm run build:copy-files

npm publish lib --tag prerelease
npm publish --tag prerelease
4 changes: 1 addition & 3 deletions ci-scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ echo "$std_ver"

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

npm run build:copy-files

npm publish lib
npm publish

# run this after publish to make sure GitHub finishes updating from the push
npm run release:create -- --repo $TRAVIS_REPO_SLUG --tag $release_tag --branch master
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@
"private": false,
"description": "SAP Fundamental Library, implemented in React",
"license": "Apache-2.0",
"main": "index.js",
"main": "lib/index.js",
"homepage": "https://sap.github.io/fundamental-react",
"repository": {
"type": "git",
"url": "https://github.com/SAP/fundamental-react"
},
"files": [
"lib"
],
"scripts": {
"build:copy-files": "cp -rf package.json README.md NOTICE.txt LICENSE.txt CHANGELOG.md lib",
"build:index": "babel-node devtools/buildIndexFiles.js",
"build:storybook": "babel-node devtools/buildVisualStories.js && babel-node scripts/copy-assets.js",
"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",
"build": "npm run build:index && rm -rf lib && npm run build:cjs",
"deploy": "gh-pages -d storybook-static",
"dry-run": "npm run build && npm run build:copy-files && npm publish lib --dry-run",
"dry-run": "npm run build && npm publish --dry-run",
"lint": "npm run lint:code && npm run lint:style",
"lint:fix": "npm run lint:code:fix && npm run lint:style:fix",
"lint:code": "eslint . --ext .js,.jsx",
Expand Down
2 changes: 1 addition & 1 deletion src/Button/__stories__/Button.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@storybook/addon-knobs';

export default {
title: 'Component API/Button',
title: 'Component API/Button/Button',
component: Button
};

Expand Down
2 changes: 1 addition & 1 deletion src/Button/__stories__/ButtonSegmented.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ButtonSegmented from '../ButtonSegmented';
import React from 'react';

export default {
title: 'Component API/ButtonSegmented',
title: 'Component API/Button/ButtonSegmented',
component: ButtonSegmented
};

Expand Down
14 changes: 7 additions & 7 deletions src/Button/__stories__/__snapshots__/Button.stories.storyshot
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Component API/Button Dev 1`] = `
exports[`Storyshots Component API/Button/Button Dev 1`] = `
<div
dir="ltr"
>
Expand All @@ -14,7 +14,7 @@ exports[`Storyshots Component API/Button Dev 1`] = `
</div>
`;

exports[`Storyshots Component API/Button Icons 1`] = `
exports[`Storyshots Component API/Button/Button Icons 1`] = `
<div
dir="ltr"
>
Expand Down Expand Up @@ -104,7 +104,7 @@ exports[`Storyshots Component API/Button Icons 1`] = `
</div>
`;

exports[`Storyshots Component API/Button Options 1`] = `
exports[`Storyshots Component API/Button/Button Options 1`] = `
<div
dir="ltr"
>
Expand Down Expand Up @@ -133,7 +133,7 @@ exports[`Storyshots Component API/Button Options 1`] = `
</div>
`;

exports[`Storyshots Component API/Button Primary 1`] = `
exports[`Storyshots Component API/Button/Button Primary 1`] = `
<div
dir="ltr"
>
Expand All @@ -146,7 +146,7 @@ exports[`Storyshots Component API/Button Primary 1`] = `
</div>
`;

exports[`Storyshots Component API/Button Sizes 1`] = `
exports[`Storyshots Component API/Button/Button Sizes 1`] = `
<div
dir="ltr"
>
Expand All @@ -169,7 +169,7 @@ exports[`Storyshots Component API/Button Sizes 1`] = `
</div>
`;

exports[`Storyshots Component API/Button States 1`] = `
exports[`Storyshots Component API/Button/Button States 1`] = `
<div
dir="ltr"
>
Expand Down Expand Up @@ -338,7 +338,7 @@ exports[`Storyshots Component API/Button States 1`] = `
</div>
`;

exports[`Storyshots Component API/Button Types 1`] = `
exports[`Storyshots Component API/Button/Button Types 1`] = `
<div
dir="ltr"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Component API/ButtonSegmented Compact 1`] = `
exports[`Storyshots Component API/Button/ButtonSegmented Compact 1`] = `
<div
dir="ltr"
>
Expand Down Expand Up @@ -32,7 +32,7 @@ exports[`Storyshots Component API/ButtonSegmented Compact 1`] = `
</div>
`;

exports[`Storyshots Component API/ButtonSegmented Primary 1`] = `
exports[`Storyshots Component API/Button/ButtonSegmented Primary 1`] = `
<div
dir="ltr"
>
Expand Down
2 changes: 1 addition & 1 deletion src/Tabs/__stories__/TabGroup.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import TabContent from '../_TabContent';
import TabGroup from '../TabGroup';

export default {
title: 'Component API/TabGroup',
title: 'Component API/Tabs/TabGroup',
component: TabGroup,
subcomponents: { Tab, TabContent }
};
Expand Down
8 changes: 4 additions & 4 deletions src/Tabs/__stories__/__snapshots__/TabGroup.stories.storyshot
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Component API/TabGroup Disabled 1`] = `
exports[`Storyshots Component API/Tabs/TabGroup Disabled 1`] = `
<div
dir="ltr"
>
Expand Down Expand Up @@ -114,7 +114,7 @@ exports[`Storyshots Component API/TabGroup Disabled 1`] = `
</div>
`;

exports[`Storyshots Component API/TabGroup Primary 1`] = `
exports[`Storyshots Component API/Tabs/TabGroup Primary 1`] = `
<div
dir="ltr"
>
Expand Down Expand Up @@ -224,7 +224,7 @@ exports[`Storyshots Component API/TabGroup Primary 1`] = `
</div>
`;

exports[`Storyshots Component API/TabGroup Selected Index 1`] = `
exports[`Storyshots Component API/Tabs/TabGroup Selected Index 1`] = `
<div
dir="ltr"
>
Expand Down Expand Up @@ -334,7 +334,7 @@ exports[`Storyshots Component API/TabGroup Selected Index 1`] = `
</div>
`;

exports[`Storyshots Component API/TabGroup Sizes 1`] = `
exports[`Storyshots Component API/Tabs/TabGroup Sizes 1`] = `
<div
dir="ltr"
>
Expand Down

0 comments on commit cf39b4a

Please sign in to comment.