Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
beforan committed May 3, 2019
0 parents commit ed92cb4
Show file tree
Hide file tree
Showing 11 changed files with 13,122 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
3 changes: 3 additions & 0 deletions .storybook/addons.js
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";
12 changes: 12 additions & 0 deletions .storybook/config.js
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);
31 changes: 31 additions & 0 deletions README.md
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.
23 changes: 23 additions & 0 deletions build/esm-export.js
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.");
});
});
Loading

0 comments on commit ed92cb4

Please sign in to comment.