Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ add sanity project #9

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules
*/node_modules

# testing
/coverage
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
Below you will find some information on how to perform common tasks.<br>
You can find the most recent version of this guide [here](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md).

## Sanity-backend
Get access to the sanity version by logging onto the
[email protected] going to manage.sanity.io and adding yourself as
a user ( assuming this wont go over the free plan. If so, remove someone
other than [email protected] and proceed ).

## TL;DR

Get the website up and running
Expand Down
9 changes: 9 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Sanity Clean Content Studio

Congratulations, you have now installed the Sanity Content Studio, an open source real-time content editing environment connected to the Sanity backend.

Now you can do the following things:

- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme)
- [Join the community Slack](https://slack.sanity.io/?utm_source=readme)
- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme)
6 changes: 6 additions & 0 deletions backend/config/.checksums
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"#": "Used by Sanity to keep track of configuration file checksums, do not delete or modify!",
"@sanity/default-layout": "bb034f391ba508a6ca8cd971967cbedeb131c4d19b17b28a0895f32db5d568ea",
"@sanity/default-login": "6fb6d3800aa71346e1b84d95bbcaa287879456f2922372bb0294e30b968cd37f",
"@sanity/data-aspects": "d199e2c199b3e26cd28b68dc84d7fc01c9186bf5089580f2e2446994d36b3cb6"
}
3 changes: 3 additions & 0 deletions backend/config/@sanity/data-aspects.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"listOptions": {}
}
6 changes: 6 additions & 0 deletions backend/config/@sanity/default-layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"toolSwitcher": {
"order": [],
"hidden": []
}
}
7 changes: 7 additions & 0 deletions backend/config/@sanity/default-login.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"providers": {
"mode": "append",
"redirectOnSingle": false,
"entries": []
}
}
9 changes: 9 additions & 0 deletions backend/migrations/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable no-console */
import baseClient from "part:@sanity/base/client";
import ConfigStore from "configstore";
const authToken = new ConfigStore("sanity", {}, { globalConfigPath: true }).get(
"authToken"
);
const client = baseClient.config({ token: authToken });

export default client;
20 changes: 20 additions & 0 deletions backend/migrations/importDocuments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import documents from "../stammespraak";
import * as bluebird from "bluebird";
/* eslint-disable no-console */
import client from "part:@sanity/base/client";

const main = async () => {
const { dataset } = client.config();

await bluebird.map(
documents.documents,
async doc => {
console.log(doc);
await client.create(doc).catch(err => console.error(err));
},
{ concurrency: 2 }
);
console.log("done with work");
};

main();
30 changes: 30 additions & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "stammesprak",
"private": true,
"version": "1.0.0",
"description": "",
"main": "package.json",
"author": "Haakon Magnus Borch <[email protected]>",
"license": "UNLICENSED",
"scripts": {
"start": "sanity start",
"test": "sanity check"
},
"keywords": [
"sanity"
],
"dependencies": {
"@sanity/base": "^0.142.2",
"@sanity/components": "^0.142.5",
"@sanity/core": "^0.142.5",
"@sanity/default-layout": "^0.142.5",
"@sanity/default-login": "^0.142.3",
"@sanity/desk-tool": "^0.142.5",
"@sanity/vision": "^0.142.5",
"bluebird": "^3.5.5",
"prop-types": "^15.6",
"react": "^16.2",
"react-dom": "^16.2"
},
"devDependencies": {}
}
1 change: 1 addition & 0 deletions backend/plugins/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
User-specific packages can be placed here
24 changes: 24 additions & 0 deletions backend/sanity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"root": true,
"project": {
"name": "stammespråk"
},
"api": {
"projectId": "5q8exn0v",
"dataset": "production"
},
"plugins": [
"@sanity/base",
"@sanity/components",
"@sanity/default-layout",
"@sanity/default-login",
"@sanity/desk-tool",
"@sanity/vision"
],
"parts": [
{
"name": "part:@sanity/base/schema",
"path": "./schemas/schema.js"
}
]
}
29 changes: 29 additions & 0 deletions backend/schemas/definition.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export default {
name: "definition",
type: "document",
title: "Stammespråk",
fields: [
{
name: "definition",
title: "definisjon",
type: "text"
},
{
name: "word",
title: "ord",
type: "text"
},
{
name: "user",
title: "oppretter",
type: "text"
}
],

preview: {
select: {
title: "word",
subtitle: "user"
}
}
};
17 changes: 17 additions & 0 deletions backend/schemas/schema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// First, we must import the schema creator
import createSchema from "part:@sanity/base/schema-creator";

// Then import schema types from any plugins that might expose them
import schemaTypes from "all:part:@sanity/base/schema-type";
import definition from "./definition";
// Then we give our schema to the builder and provide the result to Sanity
export default createSchema({
// We name our schema
name: "default",
// Then proceed to concatenate our document type
// to the ones provided by any plugins that are installed
types: schemaTypes.concat([
definition
/* Your types here! */
])
});
Loading