Giter VIP home page Giter VIP logo

zerotemplate's Introduction

ZeroNet Template

Template for creating and developing ZeroNet sites.

Description

This project provides a template for creating and developing ZeroNet sites.

It supports NPM dependencies and it uses Gulp and Browserify for bundling scripts. It also supports SASS and automatic deployments with Travis CI.

Usage

Requirements

You must have Git and Node.js installed on your computer. It is recommended that use the latest versions.

It is also recommended to also install Python and ZeroNet for easier developing and deploying. You need to use Python 3 version of ZeroNet.

Start

If you don't already have your own ZeroNet site, you should create it from ZeroNet. Details are available in ZeroNet documentation. You must have a site's address and a private key.

You can then clone or fork this repository and install dependencies. It already contains an example site and code with ZeroFrame API.

$ git clone https://github.com/filips123/ZeroTemplate.git my-new-site
$ cd my-new-site
$ yarn

You should commit changes to develop branch.

Development

Site dependencies and details

You should edit package.json to provide your own information and dependencies needed for your site.

It is also recommended to update README.md to provide information about your site. You can then edit the files and add your own code.

ZeroNet files

Each site must have valid src/content.json. Details about are it availible in ZeroNet documentation.

You should copy address and signers_sign (and other keys related with addressed and signatures) from original content.json that was generated at site creation.

It is recommended that it doesn't contain modified, files, files_optional and signs because they will be auto-generated on each siteSign.

Other files

The site is contained in src/ directory.

Scripts are stored in src/js/ and each site must contain the main script (src/js/index.js). Styles are stored in src/css/ and src/sass.

It is recommended that scripts follow Standard style. You can run linting with yarn lint.

Your index.html (or any other HTML file) should include JS from js/all.js?lang={lang}&site_modified={site_modified} and CSS from css/all.css?site_modified={site_modified}. Additional query parameters will ensure that the files will be correctly updated.

Deploying

Manual deployment

You can build the site with yarn build. This will bundle all scripts and styles and copy static files to dist/. You can then copy that directory to your site directory in ZeroNet, sign the changes and publish them.

Automatic deployment

After you finish your changes, you can run yarn deploy. This will automatically build, sign and publish your site which may take a few minutes.

Local Python copy of ZeroNet is required for this task. You must set a path to it (location of zeronet.py file) with --zeronet argument.

$ yarn deploy --zeronet=/path/to/zeronet

During deploy, you will be asked for your site's private key. You must enter it to finish deploy.

You can also specify your private key with --privkey argument. Note that your private key will then be visible in command's output.

$ yarn deploy --zeronet=/path/to/zeronet --privkey=sEcReTkEy

If you would like to prevent publishing your site publicly, you can use the --no-publish option. Site files will still be built and signed.

$ yarn deploy --zeronet=/path/to/zeronet --privkey=sEcReTkEy --no-publish

Continuous deployment

You can also use continuous deployment with Travis CI.

During development, any changes must be committed to develop branch. When you want to release them, you will just have to merge it into master and publish the changes. Travis CI will then automatically install ZeroNet, sign the changes and publish your site.

To make this working, you will have to (securely) set ZERONET_PRIVKEY environment variable in Travis CI. It must contain your private key.

zerotemplate's People

Contributors

anoadragon453 avatar dependabot[bot] avatar filips123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

zerotemplate's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.