Code Monkey home page Code Monkey logo

defold.github.io's Introduction

defold.github.io

New www.defold.com leveraging GitHub Pages and Jekyll+Liquid to generate a static site. The structure of the static site as well as many of the pages are stored in this repository. Some other parts of the site such as content of the learn section and the asset portal is hosted in other GitHub repositories:

HOW TO UPDATE THE SITE WITH NEW CONTENT

The site uses the update.py script from this repository to update the site with updated content from external sources/repositories.

Requirements

You need to make sure to have the following dependencies installed before using update.py:

  • Python 3.x
  • Lunr.py (search)
  • Requests (http requests)

Install lunr.py and requests using:

pip3 install --user lunr==0.5.5
pip3 install --user requests
pip3 install --user pyyaml
pip3 install --user markdown==3.4.1
pip3 install --user pygments==2.13.0

Usage

The update.py script should be run from a terminal. The syntax is as follows:

python3 update.py [--download] docs codepad refdoc examples asset-portal games-showcase

You can use this script when testing locally (see below). The script is also used by GitHub Actions when automatically updating the site when one of the external sources/repositories have changed (see below).

Options

The script accepts the following options:

  • --download - Download the required files for each command. If the option is omitted the files are expected to already exist on disk ready for processing.
  • --githubtoken - GitHub authentication token when committing changes.

Commands

The script accepts the following commands:

  • docs - Import manuals, tutorials and FAQ from github.com/defold/doc
  • codepad - Import CodePad from github.com/defold/codepad
  • refdoc - Import API reference from latest release at d.defold.com
  • examples - Import examples from github.com/defold/examples
  • asset-portal - Import Asset Portal content from github.com/defold/asset-portal
  • games-showcase - Import Showcase content from github.com/defold/games-showcase
  • searchindex - Generates the search index
  • commit - Commit changes to GitHub (for CI use)

HOW TO TEST THE SITE LOCALLY

It is recommended that you generate and test the site locally before pushing the changes to the repository. You generate and test the site locally by running serve.sh.

Requirements

You need to make sure you have the following dependencies installed before attempting to generate the site locally using serve.sh:

  • Ruby
  • bundler gem
  • jekyll
  • github-pages gem

1 Install Ruby

Most macOS versions ship with Ruby preinstalled. It is however recommended that you install a separate Ruby version as you will very likely run into permission issues if trying to install any Ruby gems with the system version of Ruby. The quickest way to install a new Ruby version on macOS/Linux us to use rbenv or ruby. To install it on macOS you first need to install brew:

1.1 Install brew (macOS)

Open a terminal window and install brew by running the following command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

1.2 Install ruby

brew install ruby

Also add the it to the PATH vaiable in you shell profile (e.g. ~/.zshrc):

export PATH="/opt/homebrew/opt/ruby/bin:$PATH"

1.3 Install rbenv (deprecated)

Open a terminal window and install rbenv by running the following commands:

# use brew to install rbenv
brew install rbenv
# install rbenv shell support every time a shell is started
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

Now close the terminal window. Open a new terminal window and install a new Ruby version (this version corresponds to the one defined in the .ruby-version file of this repository):

# use rbenv to install user local version of ruby 2.7.5
rbenv install --local 2.7.5

2 Install gems

Open a terminal window and install the required Ruby gems by running the following command:

gem install bundler jekyll github-pages

This will install the gems defined in the Gemfile (bundler, jekyll, github-pages). You are now ready to launch the site locally.

Usage

Launch/serve the site locally using:

As a first step, you need to install dependencies:

bundle install
./serve.sh

Once the site has been built you can test it by pointing your browser to localhost:4000.

You can use the update.py script to pull in and process content from external sources (docs, asset portal etc)

How to test local reference documentation

Copy the refdoc.zip to the main folder:

cp $DYNAMO_HOME/share/ref-doc.zip refdoc_alpha.zip
cp $DYNAMO_HOME/share/ref-doc.zip refdoc_beta.zip
cp $DYNAMO_HOME/share/ref-doc.zip refdoc_stable.zip
./update.py refdoc
./serve.sh

How to test local documentaion

By setting the DM_DOC_DIR environment variable, you can load the documentation directory from your local folder:

DM_DOC_DIR=/Users/username/work/doc python update.py docs

Automatic site update using GitHub Actions

The site uses GitHub actions to automatically trigger update.py when an external source/repository has been updated. The script is also triggered once every hour to update the asset portal star count for GitHub hosted assets. The following workflows/jobs have been set up using GitHub Actions:

Search

Site search

The site search is based on Lunr.js. The search index is generated using the Python equivalent of Lunr. Version 0.5.5 of lunr.py uses Lunr.js version 2.3.6.

Page search

Functionality for searching and marking within a single page using Mark.js.

Credits

This site uses the following assets:

defold.github.io's People

Contributors

aglitchman avatar agulev avatar andsveking avatar britzl avatar defold-services avatar dependabot[bot] avatar devendrakanojiya avatar duckwhale avatar eangelin avatar fabtjar avatar flexyourbrain avatar jcash avatar jhonnyg avatar mikatuo avatar neonlifes avatar vlaaad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

defold.github.io's Issues

Separate Lua modules from C++ headers

Now have a very airy and mixed list of Lua modules, and C++ header names under the Api Reference.

I wish to separate the two into a collapsible tree structure:

  • Lua modules
    • buffer
    • ...
  • C++ SDK
    • dmArray
    • ....

Also, the line spacing is quite high, and I have trouble overviewing the api on a 5K screen.

Site update issues

  • The GitHub OctoCat logo in the top right is not retina resolution.
  • Same for the tilted editor screenshots next to the "No setup" section.
  • The "Turn-key solution" and "Custom configuration" sections collapse badly when I shrink browser width.
  • The Forum card under Learn Defold should probably stretch down further?
  • On Product, the headline reads "Features", but the title is "Technology".
  • The "Hammerwatch Coliseum" image is broken on Showcase.
  • The "Look your Loot" image is not retina.
  • On safari, the https://defold.com/examples/simple_move/ example opens a crazy huge game instance at the top. (edited)
  • If I go to https://www.defold.com instead of https://defold.com I get the angry "This Connection is not Private" phishing warning. Discovered when navigating from the forum back to defold.com from the top bar. (edited)
  • The Terms & Conditions link at the bottom is dead. Same for the Privacy Policy. (edited)
  • Oh, and the "Truly cross-platform" platform list entries do not align horizontally across the columns.

Separate concept of "namespace" and file name

Currently multiple documents cannot share the same "@namespace".
If they do, only one of these "@document" tags' info will be added.
And, since a document has a separate include file path, this gets wrong quickly.

E.g. hash.h and dstrings.h both reside in the global namespace, but you need two different includes to use these functions.

Add "copy text" button for code snippets

Sometimes on different hardware/browser etc it is really hard copy the code snippets manually (e.g. scrolling + keeping button pressed on a trackpad).

I suggest we add a little "Copy" button to our code snippets.

Add categories to the API ref

The API ref currently has two main categories: Lua and C. One improvement would be to split Lua into: Defold (Defold API ref), Lua (Lua language ref) and Extension.

Duplicate Constant sections in api reference

In e.g. render api documentation, the "Constants" section has VERY large text.

Also, I think there is a slight naming discrepancy (Function/Functions, Constant/Constants)
which could be fixed at the same time.

Suggested actions:

  • Rename "Constant" section to "Constants"
  • Rename "Function" section to "Functions"
  • Decrease the size of the constants in the verbose "Constants" section.
Screenshot 2023-10-10 at 10 33 39

Minor website bugs

Hello!
Found a few small bugs on the site.

  1. Assets page: Submit Asset button at the bottom of the page is partially covered by the site footer.
  2. Foundation page: Clicking or highlighting text on the board members cards opens a photo.
  3. Showcase page: Monkey Mart game is not displayed. Fruit Mahjong game is duplicated.

Checked on Chrome for Mac.
Also, as a small wish, I would like to see a link to Defold repository on Github on the main page as it was before.
And thanks to the Defold team for everything you do for the engine!

Make examples compatable with Defold 1.8.0

defold.github.io/update.py

Lines 562 to 572 in 4e8e0a1

print("...processing index.html")
replace_in_file(os.path.join(examples_dir, "index.html"), "\<\!DOCTYPE html\>.*\<body\>", "", flags=re.DOTALL)
replace_in_file(os.path.join(examples_dir, "index.html"), "\<\/body\>.*", "", flags=re.DOTALL)
replace_in_file(os.path.join(examples_dir, "index.html"), "resize_game_canvas\(\)\;", "")
replace_in_file(os.path.join(examples_dir, "index.html"), "window.addEventListener.*", "")
replace_in_file(os.path.join(examples_dir, "index.html"), 'width=\"720\" height=\"720\"', 'width="680" height="680" style="max-width:100%"')
replace_in_file(os.path.join(examples_dir, "index.html"), 'dmloader.js', '/examples/dmloader.js')
replace_in_file(os.path.join(examples_dir, "index.html"), '\"archive\"', '"/examples/archive"')
replace_in_file(os.path.join(examples_dir, "index.html"), 'EngineLoader\.load\(\"canvas\", \"Defoldexamples\"\)', 'EngineLoader.load("canvas", "/examples/Defoldexamples")')
replace_in_file(os.path.join(examples_dir, "index.html"), "engine_arguments: \[", "engine_arguments: [ '--config=examples.start={{ page.collection }}', ")
os.rename(os.path.join(examples_dir, "index.html"), "_includes/example.html")

Typo in profiler API reference page

In the profiler API reference page there is a typo regarding the available platforms for the function profiler.get_memory_usage() it is written "Androd" when it was supposed to be "Android".

image

This typo is persistent in all versions, stable, beta and alpha.

Bug: Frontpage image's blend mode not working in Safari on small screens

On MacOs (Safari) or on iPhones (Safari) front-page image is not darkened when width is < 800 px. The white text could be less readable on lighter backgrounds.

Stackoverflow

Possible fixes:

  1. Darken the image in a photo editor
  2. Set text-shadow: 2px 2px 1px black, -2px 2px 1px black, -2px -2px 1px black, 2px -2px 1px black; or similar to improve readability
  3. Set background-repeat: no-repeat but then it doesn't look good too.
  4. Other?
Screen.Recording.2023-09-19.at.6.03.15.PM.mov

Missing website links on asset pages

Asset pages do not contain links to the website that is specified in "website_url" from the json file of the asset. So some pages of non-github assets don't have links to the assets themselves.

Videos link to the wrong page

The YouTube links on the videos page are in the form https://youtube.com/embed/XXXXXXXXXXX rather than https://youtube.com/watch?v=XXXXXXXXXXX, so clicking on the video title takes you to a page like this:
Screenshot from 2024-04-27 13-32-40
instead of the actual video page:
image

Add a broken link checker

Find a way to automatically check for broken links. Can this be done when GitHub Pages generates the site?

Minor layout bug on the Showcase page

When viewing from a mobile device, in the second section of games with half width image, the image and text extend outside the right edge of the screen.
Browser Firefox for Android, 1080x2400.

Screenshot_2023-03-20-16-33-0 5x

Unable to locate a Java Runtime when running "python update.py --download codepad"

Was following the README and got an error when running

python3 update.py --download docs codepad refdoc examples assets

The initial error:

The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

And after installing Java 8 getting a different error, so looks like Java 17 is required:

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/dynamo/bob/Bob has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Logs:

Downloading https://github.com/defold/doc/archive/master.zip to ./doc-master.zip
Unpacking /var/folders/02/fj8dwp59007_d6m9cw6jy9mr0000gn/T/tmpaxpvm4kq/doc-master.zip
Processing docs
...languages
...index
...manuals (en)
...faq (en)
...manuals (zh)
...faq (zh)
...manuals (es)
...faq (es)
...manuals (gr)
...faq (gr)
...manuals (ko)
...faq (ko)
...manuals (pl)
...faq (pl)
...manuals (pt)
...faq (pt)
...manuals (ru)
...faq (ru)
...shared includes (en)
...shared includes (zh)
...shared includes (es)
...shared includes (gr)
...shared includes (ko)
...shared includes (pl)
...shared includes (pt)
...shared includes (ru)
...tutorials
...index (incl. languages)
...shared images
Done
Downloading https://github.com/defold/codepad/archive/master.zip to ./codepad-master.zip
Downloading http://d.defold.com/archive/e0073d0f7156b733e97a53c46924355fbf60dc77/bob/bob.jar to ./bob_e0073d0f7156b733e97a53c46924355fbf60dc77.jar
Unpacking /var/folders/02/fj8dwp59007_d6m9cw6jy9mr0000gn/T/tmp5ryqp6n8/codepad-master.zip
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

Traceback (most recent call last):
  File "/Users/mikatuo/dev/defold.github.io/update.py", line 1091, in <module>
    process_codepad(download = args.download)
  File "/Users/mikatuo/dev/defold.github.io/update.py", line 603, in process_codepad
    rmcopytree(os.path.join(input_dir, "build", "default", "DefoldCodePad"), codepad_dir)
  File "/Users/mikatuo/dev/defold.github.io/update.py", line 104, in rmcopytree
    shutil.copytree(src, dst)
  File "/opt/homebrew/Cellar/[email protected]/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shutil.py", line 559, in copytree
    with os.scandir(src) as itr:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/02/fj8dwp59007_d6m9cw6jy9mr0000gn/T/tmp5ryqp6n8/codepad-master/build/default/DefoldCodePad'

...

Downloading https://github.com/defold/examples/archive/master.zip to ./examples-master.zip
Processing examples
Unpacking /var/folders/02/fj8dwp59007_d6m9cw6jy9mr0000gn/T/tmp6vmldm59/examples-master.zip
..building app
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

Combine CSS

Combine all CSS files into a single file to reduce load time

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.