Skip to content

Commit dc5da17

Browse files
authored
chore: Publish shared packages (#171)
* refactor: rename shared packages * refactor: move shared libs to `packages` * refactor: update dependencies to shared packages * chore: make shared packages public * chore: fix build script * chore: publish packages via ci * chore: update CircleCI version to 2.1 * chore: remove es6-promise from packages * chore: update package-lock.json * chore: update package-lock using original file * chore: pin app-base versions * chore: add dam-app-base docs * chore: link package docs * chore: add sku-app-base docs * chore: update app-base tests * chore: fix dam app base docs * chore: remove Hash type * chore: export all types from index.tsx
1 parent 0dc16ee commit dc5da17

File tree

113 files changed

+2267
-201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+2267
-201
lines changed

.circleci/config.yml

+36-19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,37 @@
1-
version: 2
1+
version: 2.1
2+
3+
commands:
4+
publish:
5+
steps:
6+
- run:
7+
name: Setup NPM
8+
command: |
9+
echo $'@contentful:registry=https://registry.npmjs.org/
10+
//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> ~/.npmrc
11+
- run:
12+
name: Publish packages
13+
command: npm run publish-packages -- --yes
14+
15+
deploy:
16+
steps:
17+
- run:
18+
name: Install pip
19+
command: sudo apt-get install python-pip python-dev
20+
- run:
21+
name: Install awscli
22+
command: sudo pip install awscli
23+
- run:
24+
name: Deploy apps to test
25+
command: |
26+
STATIC_S3_BASE="s3://cf-apps-static-dev/apps-test-$CIRCLE_SHA1" \
27+
STATIC_JIRA_S3_BASE="s3://cf-apps-static-dev/apps-test-$CIRCLE_SHA1/jira" \
28+
STAGE='test' npm run deploy
29+
- run:
30+
name: Deploy apps to prod
31+
command: |
32+
STATIC_S3_BASE="s3://cf-apps-static/apps" \
33+
STATIC_JIRA_S3_BASE="s3://cf-apps-jira" \
34+
STAGE='prd' npm run deploy
235
336
jobs:
437
all:
@@ -26,24 +59,8 @@ jobs:
2659
if [ "$CIRCLE_BRANCH" != "master" ]; then
2760
circleci-agent step halt
2861
fi
29-
- run:
30-
name: Install pip
31-
command: sudo apt-get install python-pip python-dev
32-
- run:
33-
name: Install awscli
34-
command: sudo pip install awscli
35-
- run:
36-
name: Deploy apps to test
37-
command: |
38-
STATIC_S3_BASE="s3://cf-apps-static-dev/apps-test-$CIRCLE_SHA1" \
39-
STATIC_JIRA_S3_BASE="s3://cf-apps-static-dev/apps-test-$CIRCLE_SHA1/jira" \
40-
STAGE='test' npm run deploy
41-
- run:
42-
name: Deploy apps to prod
43-
command: |
44-
STATIC_S3_BASE="s3://cf-apps-static/apps" \
45-
STATIC_JIRA_S3_BASE="s3://cf-apps-jira" \
46-
STAGE='prd' npm run deploy
62+
- publish
63+
- deploy
4764

4865
workflows:
4966
version: 2

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
This repository contains the source code for most apps on the [marketplace](https://www.contentful.com/marketplace/) and helpful resources to build your own apps for Contentful.
66

7+
This repository also includes two packages that help you developing your own apps:
8+
* [dam-app-base](packages/dam-app-base)
9+
* [sku-app-base](packages/sku-app-base)
10+
711
## Installing an app
812

913
Head over to the [marketplace](https://www.contentful.com/marketplace/) and follow the installation flow to set up any of the apps in your Contentful space.

apps/brandfolder/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"contentful-cli": "1.2.12"
1313
},
1414
"dependencies": {
15-
"shared-dam-app": "^1.0.0"
15+
"@contentful/dam-app-base": "1.0.1"
1616
},
1717
"scripts": {
1818
"start": "contentful-extension-scripts start --serve-only",

apps/brandfolder/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pick from 'lodash/pick';
2-
import { setup } from 'shared-dam-app';
2+
import { setup } from '@contentful/dam-app-base';
33

44
const CTF_APP_URL = 'https://brandfolder.ctfapps.net';
55
const BF_EMBED_URL = `https://integration-panel-ui.brandfolder-svc.com?channel=message&appName=Contentful&origin=${CTF_APP_URL}&initMsg=hi`;

apps/bynder/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"contentful-cli": "1.2.12"
1313
},
1414
"dependencies": {
15-
"shared-dam-app": "^1.0.0"
15+
"@contentful/dam-app-base": "1.0.1"
1616
},
1717
"scripts": {
1818
"start": "contentful-extension-scripts start --serve-only",

apps/bynder/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pick from 'lodash/pick';
2-
import { setup } from 'shared-dam-app';
2+
import { setup } from '@contentful/dam-app-base';
33

44
import logo from './logo.svg';
55

apps/cloudinary/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dependencies": {
1616
"cloudinary-core": "^2.8.0",
1717
"core-js": "3.1.4",
18-
"shared-dam-app": "^1.0.0"
18+
"@contentful/dam-app-base": "1.0.1"
1919
},
2020
"scripts": {
2121
"start": "contentful-extension-scripts start --serve-only",

apps/cloudinary/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pick from 'lodash/pick';
22
import { Cloudinary as cloudinaryCore } from 'cloudinary-core';
33

4-
import { setup } from 'shared-dam-app';
4+
import { setup } from '@contentful/dam-app-base';
55

66
import logo from './logo.svg';
77

apps/commercelayer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dependencies": {
1616
"@commercelayer/js-auth": "2.0.1",
1717
"core-js": "3.4.1",
18-
"shared-sku-app": "^1.0.0"
18+
"@contentful/sku-app-base": "1.0.0"
1919
},
2020
"scripts": {
2121
"start": "contentful-extension-scripts start --serve-only",

apps/commercelayer/src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import difference from 'lodash/difference';
33
import chunk from 'lodash/chunk';
44
import flatMap from 'lodash/flatMap';
55

6-
import { setup, renderSkuPicker } from 'shared-sku-app';
6+
import { setup, renderSkuPicker } from '@contentful/sku-app-base';
77

88
import logo from './logo.svg';
99
import { dataTransformer } from './dataTransformer';
@@ -49,7 +49,7 @@ async function getAccessToken(clientId, endpoint) {
4949

5050
/**
5151
* This function is needed to make the pagination of Commerce Layer work with the
52-
* shared-sku-app library.
52+
* @contentful/sku-app-base library.
5353
*
5454
* When fetching the SKUs via the Commerce Layer JS SDK the metadata object which
5555
* includes the total count of records needed by the shared-sku-picker paginator

apps/dropbox/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"contentful-cli": "1.2.12"
1313
},
1414
"dependencies": {
15-
"shared-dam-app": "^1.0.0"
15+
"@contentful/dam-app-base": "1.0.1"
1616
},
1717
"scripts": {
1818
"start": "contentful-extension-scripts start --serve-only",

apps/dropbox/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pick from 'lodash/pick';
2-
import { setup } from 'shared-dam-app';
2+
import { setup } from '@contentful/dam-app-base';
33

44
import logo from './logo.svg';
55

apps/frontify/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"contentful-cli": "1.2.12"
1313
},
1414
"dependencies": {
15-
"shared-dam-app": "^1.0.0"
15+
"@contentful/dam-app-base": "1.0.1"
1616
},
1717
"scripts": {
1818
"start": "contentful-extension-scripts start --serve-only",

apps/frontify/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { setup } from 'shared-dam-app';
1+
import { setup } from '@contentful/dam-app-base';
22

33
import logo from './logo.svg';
44

apps/mux/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
1. Go to this project: `cd apps/mux` (no need to npm install again, because bootstrap already did that via lerna)
88
1. `npm start` - now the mux app is running on http://localhost:1234
99

10-
**Notes**: `shared-dam-app` gets installed by lerna when running `npm run bootstrap` from the root directory. If you're getting errors related to this you should probably `rm -rf node_modules` from this project, cd back into the root and run `npm i && npm run bootstrap` again.
10+
**Notes**: `@contentful/dam-app-base` gets installed by lerna when running `npm run bootstrap` from the root directory. If you're getting errors related to this you should probably `rm -rf node_modules` from this project, cd back into the root and run `npm i && npm run bootstrap` again.
1111

1212
## Contentful app setup
1313

apps/mux/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"prop-types": "^15.7.2",
4545
"react": "^16.13.1",
4646
"react-dom": "^16.13.1",
47-
"shared-dam-app": "^1.0.0"
47+
"@contentful/dam-app-base": "1.0.1"
4848
},
4949
"scripts": {
5050
"start": "contentful-extension-scripts start --serve-only",

apps/mux/src/config.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
ContentType,
3232
CompatibleFields,
3333
SelectedFields,
34-
} from 'shared-dam-app/src/utils';
34+
} from '@contentful/dam-app-base';
3535
import MuxLogoSvg from './mux-logo.svg';
3636
import './config.css';
3737
import ApiClient from './apiClient';

apps/saleor/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"graphql": "^15.3.0",
2020
"graphql-tag": "^2.11.0",
2121
"lodash": "^4.17.20",
22-
"shared-sku-app": "^1.0.0",
22+
"@contentful/sku-app-base": "1.0.0",
2323
"typescript": "^4.0.3"
2424
},
2525
"scripts": {

apps/saleor/src/DataParser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { uniqBy } from 'lodash';
2-
import { Product } from 'shared-sku-app';
2+
import { Product } from '@contentful/sku-app-base';
33
import { ITEMS_OFFSET } from './constants';
44
import {
55
ApiData,

apps/saleor/src/PaginatedFetcher.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { uniq } from 'lodash';
22
import { ClientConfig, Identifiers, ProductVariantsData } from './types';
3-
import { Pagination, Product } from 'shared-sku-app';
3+
import { Pagination, Product } from '@contentful/sku-app-base';
44
import DataParser from './DataParser';
55
import ApiClient from './ApiClient';
66
import { extractProductsAndVariantsIdentifiers } from './utils';

apps/saleor/src/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { OpenCustomWidgetOptions } from 'contentful-ui-extensions-sdk';
2-
import { Pagination } from 'shared-sku-app';
2+
import { Pagination } from '@contentful/sku-app-base';
33
import logo from './app-logo.svg';
44

55
export const DIALOG_ID = 'sku-picker-root';

apps/saleor/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DialogExtensionSDK, FieldExtensionSDK } from 'contentful-ui-extensions-sdk';
2-
import { setup, renderSkuPicker } from 'shared-sku-app';
2+
import { setup, renderSkuPicker } from '@contentful/sku-app-base';
33
import { dialogConfig, DIALOG_ID, SKUPickerConfig, strings } from './constants';
44

55
import PaginatedFetcher from './PaginatedFetcher';

apps/saleor/src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Pagination, Product } from 'shared-sku-app';
1+
import { Pagination, Product } from '@contentful/sku-app-base';
22

33
export interface ClientConfig {
44
apiEndpoint: string;

apps/shopify/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"dependencies": {
1616
"core-js": "3.4.1",
17-
"shared-sku-app": "^1.0.0",
17+
"@contentful/sku-app-base": "1.0.0",
1818
"shopify-buy": "^2.8.1"
1919
},
2020
"scripts": {

apps/shopify/src/dataTransformer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const previewsToVariants = ({ apiEndpoint }) => ({ sku, id, image, produc
4141
return {
4242
id,
4343
image: get(image, ['src'], ''),
44-
// TODO: Remove sku:id when shared-sku-app supports internal IDs
44+
// TODO: Remove sku:id when @contentful/sku-app-base supports internal IDs
4545
// as an alternative piece of info to persist instead of the SKU.
4646
// For now this is a temporary hack.
4747
sku: id,

apps/shopify/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { setup, renderSkuPicker } from 'shared-sku-app';
1+
import { setup, renderSkuPicker } from '@contentful/sku-app-base';
22
import { fetchProductPreviews, makeProductSearchResolver } from './productResolvers';
33

44
import logo from './logo.svg';

lerna.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"packages": [
33
"apps/**/*",
4-
"lib/*"
4+
"packages/*"
55
],
6-
"version": "0.0.0"
6+
"version": "0.0.0",
7+
"publish": {
8+
"message": "chore: publish %s [skip ci]",
9+
"conventionalCommits": true
10+
}
711
}

lib/shared-dam-app/src/interfaces.ts

-27
This file was deleted.

lib/shared-dam-app/src/utils.ts

-2
This file was deleted.

lib/shared-sku-app/src/interfaces.ts

-53
This file was deleted.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"lint": "lerna run lint --concurrency=2",
88
"build": "lerna run build --concurrency=1",
99
"test": "lerna run test:ci --concurrency=2",
10-
"deploy": "lerna run deploy --concurrency=2"
10+
"deploy": "lerna run deploy --concurrency=2",
11+
"publish-packages": "lerna publish --concurrency=2"
1112
},
1213
"dependencies": {
1314
"lerna": "^3.20.2"
File renamed without changes.
File renamed without changes.

lib/shared-dam-app/.gitignore renamed to packages/dam-app-base/.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ yarn-error.log*
1919
node_modules/
2020

2121
# Build
22-
build/*
23-
!/build/index.html
22+
lib
File renamed without changes.

0 commit comments

Comments
 (0)