-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ed92cb4
Showing
11 changed files
with
13,122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import '@storybook/addon-actions/register'; | ||
import '@storybook/addon-links/register'; | ||
import "@storybook/addon-knobs/register"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { configure, addDecorator } from '@storybook/react'; | ||
import { withKnobs } from "@storybook/addon-knobs"; | ||
|
||
addDecorator(withKnobs); | ||
|
||
// automatically import all files ending in *.stories.js | ||
const req = require.context('../src', true, /.stories.js$/); | ||
function loadStories() { | ||
req.keys().forEach(filename => req(filename)); | ||
} | ||
|
||
configure(loadStories, module); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# DECSYS Component Boilerplate | ||
|
||
This repository contains everything needed to create an Interactive Response Component for the DECSYS Survey Platform. | ||
|
||
- It implements a very basic component as an example | ||
- it provides build scripts and dependencies for easily building a component ready to use with the DECSYS Survey Platform. | ||
|
||
# Getting Started | ||
|
||
1. Either: | ||
- Download the latest code from `master` and use it as a starting point for your own component. | ||
- Clone this repository, then set the remote `origin` to another git repository for your own component. | ||
1. `npm install`. | ||
1. Make changes to the files in `src/` to build your component. | ||
- Add or remove `dependencies` using `npm` | ||
- Don't modify the `devDependencies` as the build processes depend on them, and are preconfigured for outputting a module the Survey Platform can use. | ||
- Don't modify the `peerDependencies` as they are correctly configured for dependencies the Survey Platform will fulfill. | ||
1. `npm run storybook` to test your component visually and interactively. | ||
1. `npm run build` to build a distributable version of your component which can be used in the Survey Platform. | ||
|
||
ℹ For an example of how to build a component using this boilerplate, documentation will be linked here soon. `//TODO:` | ||
|
||
ℹ The first party DECSYS components may also be interesting points of reference. Look for any repository that ends in `-component` in the DECSYS' GitHub organisation. | ||
|
||
ℹ Check out the [Wiki](https://github.com/decsys/component-boilerplate/wiki) for more detailed information. | ||
|
||
# Licensing | ||
|
||
At this time, this software has no license, and therefore all rights are reserved as per author copyright, with the exception of rights waived under the GitHub Terms of Service. | ||
|
||
Please don't modify, distribute or use this software until a license is in place. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const fs = require("fs"); | ||
const pkg = require("../package.json"); | ||
|
||
const filePath = `dist/${pkg.bundle}.js`; | ||
|
||
fs.readFile(filePath, "utf-8", (err, data) => { | ||
if (err) throw err; | ||
|
||
// replace the opening `var` with a `const` so it's module scoped | ||
data = data.replace(/^var/, "const"); | ||
|
||
// append our esm exports | ||
data += ` | ||
export const name = DecsysComponent.default.name; | ||
export default DecsysComponent.default; | ||
`; | ||
|
||
fs.writeFile(filePath, data, "utf-8", err => { | ||
if (err) throw err; | ||
console.log("Fixed bundle exports for browser module use."); | ||
}); | ||
}); |
Oops, something went wrong.