Skip to content

Environment, Building, and Testing

RePod edited this page May 31, 2019 · 3 revisions

Usually a PR with appropriate changes to _src/psdle.base.js is enough but just in case you want to go the mile or tinker easier then you'll want the environment I use (or not, because it's horrible and slapped together like something else around here).

It's not clean or efficient, but it does what it needs to.


Unless otherwise noted:

  • The repository folder is defined as the folder that contains README.md
  • The shell is defined as whatever interface (cmd, powershell, etc) you will use to interact with NodeJS/NPM
  • Shell commands are relative to the repository folder

Environment

  • NodeJS latest Current (non-LTS)
    • Dependencies in package.json are usually kept up to date, but are not a huge concern.
  • Windows Command Prompt
    • Not required. Only necessary for deployment and zipping the extension (for deployment).
  • Git in PATH
    • Not required. Only necessary for deployment.
  • A web browser, latest preferred
    • Highly recommended for functional code changes, not a high priority for translations.
  • A PlayStation Store account
    • For regular testing, although entitlement injecting is possible.
    • Eventually add fake list generation again.

To finalize setup:

  • Clone the repository as you would (Git)
  • Open your shell to the repository folder
  • Run npm install to get dependencies
  • For your own sanity, npm install -g grunt to get grunt in PATH

Building (and grunt tasks)

To see available grunt tasks, run grunt -h in shell and refer to the "Available tasks" section.

At the time of writing these consist of:

Options marked with * have methods exposed via the grunt API and should instead
be specified inside the Gruntfile wherever possible.

Available tasks
         cssmin  Minify CSS *
       includes  Include other files within files. *
         uglify  Minify files with UglifyJS. *
           copy  Copy files. *
         concat  Concatenate files. *
 string-replace  String Replace Task. *
           exec  Execute shell commands. *
    concat-json  Merge Multiple JSON Files *
        minlang  Concat and minify language files. Never automate, shouldn't
                 need often.
        compile  Bake in language JSON and minified CSS, then bake in version.
         chrome  Alias for "exec:chrome_deploy" task.
        release  Generate PSDLE release, compiles first.
         deploy  Run release then deploy script.
        default  Runs compile.

If outdated a more recent set can be found at the bottom of Gruntfile.js

By default with no argument, grunt will run the same thing as grunt default which as described runs grunt compile.

For general testing, changes are made to _src/psdle.base.js then grunt compile is ran to minify and bake in languages and CSS. However, this is wasteful when those files are irrelevant so grunt includes is recommended to skip minifying of languages and CSS.

If you are modifying or testing languages or CSS in a very limited capacity though use grunt minlang or grunt cssmin respectively to update their minified versions for use in grunt includes. For constant changes of them and _src/psdle.base.js then just use grunt compile.

Additional reading
Translating
_src/README.md

Testing

After running grunt compile or grunt includes your changes will be finalized in _src/psdle.includes.js. This is what you should use for testing your changes. PSDLE's version property is "Testing" for grunt includes or the current date for grunt compile.

There's a few ways to test this in the browser, but the easiest accessible one is opening your browser's developer console (Firefox: Ctrl+Shift+K, Chrome: Ctrl+Shift+J) and submitting the contents of _src/psdle.includes.js.