Skip to content

Commit cbddcd4

Browse files
committed
Merge branch 'main' of github.com:BuilderIO/builder into contentstack-data-plugin
2 parents 4260cbe + 3508bc7 commit cbddcd4

33 files changed

+17579
-88
lines changed

examples/next-js-simple/README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Before using this example, make sure you have the following:
1111

1212
A basic understanding of the following is helpful too:
1313
* The [command line](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Command_line)
14-
* JavaScript and [React](https://reactjs.org/).
14+
* JavaScript and [React](https://reactjs.org/)
1515
* [Next.js](https://nextjs.org/)
1616
* What it means to [clone a GitHub repo](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)
1717

@@ -52,23 +52,20 @@ For this example, click **Add Builder to an existing site or app**.
5252
5353
<figure>
5454
<img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F19683b4ef3f54eb78e8c2fa6c65759a7" alt="Builder.io Welcome screen for creating a new Organization" width="600" style="display: block; margin: auto"/>
55-
<figcaption style="text-align: center">You can choose to create a new Builder site or Add Builder to an existing application.</figcaption>
5655
</figure>
5756
5857
**If you don't have the introductory prompt for creating a space, take the following steps. If you do have the prompt in the previous step, skip to step 4.**
5958

6059
1. Click on the Organization icon on the bottom left.
6160

6261
<figure>
63-
<img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F279657f9a38743e99a028173200d6f76" alt="Space icon with two people standing together" width="600" style="display: block; margin: auto"/>
64-
<figcaption style="text-align: center">The Organization icon features two figures and is on the left sidebar at the bottom.</figcaption>
62+
<img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F279657f9a38743e99a028173200d6f76" alt="Organization icon with two people standing together" width="600" style="display: block; margin: auto"/>
6563
</figure>
6664

6765
1. Hover over **Builder.io** and choose **+ New Space**.
6866

6967
<figure>
7068
<img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F32d67ac4249c40fda0486fb7f38ac71b" alt="Menu options for creating a new space" width="400" style="display: block; margin: auto"/>
71-
<figcaption style="text-align: center">Access the menu for creating a new space by clicking on the Organization icon.</figcaption>
7269
</figure>
7370

7471
1. Click **Add Builder to an existing site or app**.
@@ -79,7 +76,6 @@ For this example, click **Add Builder to an existing site or app**.
7976

8077
<figure>
8178
<img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3b434d77529f4ae392a3d481a926092d" alt="Dialogue for creating a new space" width="400" style="display: block; margin: auto"/>
82-
<figcaption style="text-align: center">Enter a name for your new space, such as "My Next.js App".</figcaption>
8379
</figure>
8480

8581
Now that you have a new space, the next step is connecting "My Next.js App" with your application.
@@ -92,14 +88,12 @@ To connect your Builder.io space and your application, set the site URL and get
9288

9389
<figure>
9490
<img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd26eb45cd52a4cada42413cd5c99419d" alt="Account icon in left sidenav" width="200" style="display: block; margin: auto"/>
95-
<figcaption style="text-align: center">The Account icon takes you to important data about this space.</figcaption>
9691
</figure>
9792

9893
1. Change the Site URL to `http://localhost:3000` and click to copy the Public API Key.
9994

10095
<figure>
10196
<img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Faec18bf8ccf543ab94c4230a7791c894" alt="Change the Site URL in account settings." width="400" style="display: block; margin: auto"/>
102-
<figcaption style="text-align: center">The Site URL and API Key are in the **Space** tab.</figcaption>
10397
</figure>
10498

10599
1. In your code editor, configure `.env.production` and `.env.development` with the [Public API Key](https://builder.io/account/space) by adding a line to each file as follows, but using your Public API Key that you copied in the previous step.
@@ -142,6 +136,7 @@ You can deploy anywhere you like, but for this project we recommend [Vercel](htt
142136

143137
## Next steps
144138

139+
* Learn how to [use your react components in our visual editor](https://www.builder.io/c/docs/custom-react-components)
145140
* For more information on previewing your applications, see [Editing and previewing directly on your site](https://www.builder.io/c/docs/guides/preview-url).
146141
* See [Getting started with the visual editor](https://www.builder.io/c/docs/guides/page-building) for an introduction to editing your pages without having to code.
147142
* Check out [Builder best practices](https://www.builder.io/c/docs/best-practices) for guidance on how to approach site development with Builder.
Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
import type { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
2-
import { NextSeo } from 'next-seo'
32
import { useRouter } from 'next/router'
43
import { BuilderComponent, Builder, builder } from '@builder.io/react'
5-
import builderConfig from '@config/builder'
64
import DefaultErrorPage from 'next/error'
75
import Head from 'next/head'
8-
import { resolveBuilderContent } from '@lib/resolve-builder-content'
9-
import { Link } from '@components/Link/Link'
106

7+
const BUILDER_API_KEY = 'PUT YOUR API KEY HERE'
8+
builder.init(BUILDER_API_KEY)
9+
10+
// tells you what paths are being built
1111
export async function getStaticProps({
1212
params,
1313
}: GetStaticPropsContext<{ path: string[] }>) {
14-
const page = await resolveBuilderContent('page', {
15-
urlPath: '/' + (params?.path?.join('/') || ''),
14+
const page = await builder.get('page', {
15+
userAttributes: {
16+
urlPath: '/' + (params?.page?.join('/') || ''),
17+
}
1618
})
19+
.toPromise() || null
1720

1821
return {
1922
props: {
@@ -26,10 +29,11 @@ export async function getStaticProps({
2629
}
2730
}
2831

32+
// returns a list
2933
export async function getStaticPaths() {
3034
const pages = await builder.getAll('page', {
3135
options: { noTargeting: true },
32-
apiKey: builderConfig.apiKey,
36+
omit: "data.blocks"
3337
})
3438

3539
return {
@@ -38,7 +42,9 @@ export async function getStaticPaths() {
3842
}
3943
}
4044

41-
export default function Path({
45+
46+
// React Component
47+
export default function Page({
4248
page,
4349
}: InferGetStaticPropsType<typeof getStaticProps>) {
4450
const router = useRouter()
@@ -58,30 +64,13 @@ export default function Path({
5864
)
5965
}
6066

61-
const { title, description, image } = page?.data! || {}
6267
return (
6368
<>
6469
<Head>
6570
<meta name="viewport" content="width=device-width, initial-scale=1" />
6671
</Head>
67-
<NextSeo
68-
title={title}
69-
description={description}
70-
openGraph={{
71-
type: 'website',
72-
title,
73-
description,
74-
images: [
75-
{
76-
url: image,
77-
width: 800,
78-
height: 600,
79-
alt: title,
80-
},
81-
],
82-
}}
83-
/>
84-
<BuilderComponent renderLink={Link} model="page" content={page} />
72+
73+
<BuilderComponent model="page" content={page} />
8574
</>
8675
)
87-
}
76+
}

packages/commerce-plugin-tools/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/commerce-plugin-tools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@builder.io/commerce-plugin-tools",
3-
"version": "0.2.1-4",
3+
"version": "0.2.1",
44
"description": "",
55
"keywords": [],
66
"main": "dist/index.umd.js",

packages/commerce-plugin-tools/src/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ export const registerCommercePlugin = async (
6464
Builder.register('editor.onLoad', onEditorLoad(config, apiOperations, resourceName));
6565
Builder.registerEditor({
6666
name: `${config.name}${capitalize(resourceName)}`,
67+
isDataResource: true,
68+
pluginId: config.id,
6769
component: (props: ResourcesPickerButtonProps) => (
6870
<ErrorBoundary>
6971
<ResourcesPickerButton {...props} {...contextProps} />

packages/data-plugin-tools/.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
node_modules
2+
coverage
3+
.nyc_output
4+
.DS_Store
5+
*.log
6+
.vscode
7+
.idea
8+
dist
9+
compiled
10+
.awcache
11+
.rpt2_cache
12+
docs
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
language: node_js
2+
cache:
3+
directories:
4+
- ~/.npm
5+
notifications:
6+
email: false
7+
node_js:
8+
- '10'
9+
- '11'
10+
- '8'
11+
- '6'
12+
script:
13+
- npm run test:prod && npm run build
14+
after_success:
15+
- npm run travis-deploy-once "npm run report-coverage"
16+
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then npm run travis-deploy-once "npm run deploy-docs"; fi
17+
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then npm run travis-deploy-once "npm run semantic-release"; fi
18+
branches:
19+
except:
20+
- /^v\d+\.\d+\.\d+$/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
We're really glad you're reading this, because we need volunteer developers to help this project come to fruition. 👏
2+
3+
## Instructions
4+
5+
These steps will guide you through contributing to this project:
6+
7+
- Fork the repo
8+
- Clone it and install dependencies
9+
10+
git clone https://github.com/YOUR-USERNAME/typescript-library-starter
11+
npm install
12+
13+
Keep in mind that after running `npm install` the git repo is reset. So a good way to cope with this is to have a copy of the folder to push the changes, and the other to try them.
14+
15+
Make and commit your changes. Make sure the commands npm run build and npm run test:prod are working.
16+
17+
Finally send a [GitHub Pull Request](https://github.com/alexjoverm/typescript-library-starter/compare?expand=1) with a clear list of what you've done (read more [about pull requests](https://help.github.com/articles/about-pull-requests/)). Make sure all of your commits are atomic (one feature per commit).

packages/data-plugin-tools/LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2021 Builder.io, Inc <[email protected]>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

packages/data-plugin-tools/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Experimental

0 commit comments

Comments
 (0)