Comments (4)
I'm having the same issue. Do you got any results?
from gatsby-starter-mate.
@Kmancoop @Aeziren FYI small modification in setup.ts
solves the issue.
all these variables:
const spaceId = await prompt(PROMPTS.spaceId);
const deliveryToken = await prompt(PROMPTS.deliveryToken);
const managementToken = await prompt(PROMPTS.managementToken);
are treated later as a string, while they are objects.
Long story short here is working script that you can use
// bin/setup.ts
import spaceImport from 'contentful-import';
import { prompt } from 'enquirer';
import chalk from 'chalk';
import os from 'os';
import path from 'path';
import { writeFileSync, readFileSync } from 'fs';
const ROOT_PATH = path.resolve();
const CONFIG_FILE_PATH = path.resolve(ROOT_PATH, '.env');
const CONFIG_PATH = path.resolve(ROOT_PATH, 'bin', 'contentful-config.json');
const MESSAGES = {
welcome: `
To set up this project you need to provide your Space ID
and the belonging API access tokens.
You can find all the needed information in your Contentful space under:
${chalk.yellow(
`app.contentful.com ${chalk.red('->')} Space Settings ${chalk.red(
'->',
)} API keys`,
)}
The ${chalk.green('Content Management API Token')}
will be used to import and write data to your space.
The ${chalk.green('Content Delivery API Token')}
will be used to ship published production-ready content in your Gatsby app.
The ${chalk.green('Content Preview API Token')}
will be used to show not published data in your development environment.
Ready? Let's do it! 🎉
`,
env: 'Writing config file...',
importing: 'Importing content into your Contentful ...',
done: `
All set! You can now run:
${chalk.yellow('yarn start')}
to see it in action.`,
};
const PROMPTS = {
spaceId: {
type: 'input',
name: 'spaceId',
message: 'Your Space ID',
},
deliveryToken: {
type: 'password',
name: 'deliveryToken',
message: 'Your Content Delivery API access token',
},
managementToken: {
type: 'password',
name: 'managementToken',
message: 'Your Content Management API access token',
},
};
export const setup = async () => {
console.log(MESSAGES.welcome);
const spaceId = await prompt(PROMPTS.spaceId);
const deliveryToken = await prompt(PROMPTS.deliveryToken); // changed
const managementToken = await prompt(PROMPTS.managementToken); // changed
console.log(MESSAGES.env);
const envData = [`SPACE_ID=${spaceId.spaceId}`, `ACCESS_TOKEN=${deliveryToken.deliveryToken}`];
writeFileSync(CONFIG_FILE_PATH, envData.join(os.EOL));
console.log(MESSAGES.importing);
const content = JSON.parse(readFileSync(CONFIG_PATH, 'utf-8'));
await spaceImport({ spaceId:spaceId.spaceId, managementToken:managementToken.managementToken, content }); // changed
console.log(MESSAGES.done);
};
setup();
from gatsby-starter-mate.
#896 solves the issue @EmaSuriano do you mind merge this pr? 👀
from gatsby-starter-mate.
Should be fixed with the #896 by @rythm-of-the-red-man :)
from gatsby-starter-mate.
Related Issues (20)
- update to theme HOT 2
- No back button navigation? HOT 1
- React has detected a change in the order of Hooks called by EmotionCssPropInternal HOT 4
- how can i overwrite ? HOT 1
- Icons not changable HOT 3
- Problem with EmotionCssPropInternal
- Failing at yarn setup HOT 3
- Tutorial for editing the code in the theme HOT 1
- Getting the ERROR #85923 GRAPHQL.. lots of google, can't fix! HOT 1
- Quick start fails with react updated to 17.0.2 HOT 5
- Peer dependencies are broken and npm install fails HOT 1
- How to custom queries? HOT 2
- Use local markdown files instead of Contentful HOT 2
- Add server side rendering HOT 1
- in http://localhost:8000/ not showing output HOT 5
- Why the src folder empty? HOT 7
- Cannot change social media HOT 4
- Error when running yarn setup HOT 4
- No pages HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby-starter-mate.