Commit 9bc9129d authored by Andrea Ruggiero's avatar Andrea Ruggiero
Browse files

Add readme.md

parent e9d6aed3
Pipeline #6395 passed with stages
in 43 seconds
......@@ -4,14 +4,26 @@ before_script:
- yarn
stages:
- build
- deploy
deployExtension:
deploy:
stage: deploy
when: manual
only:
- master #to be invoked only on master merge
- master
script:
- sed -i 's/%version%/$CI_PIPELINE_IID/' public/manifest.json
- yarn build
- yarn deploy
\ No newline at end of file
- yarn deploy
build:
stage: build
only:
- master
script:
- sed -i 's/%version%/$CI_PIPELINE_IID/' public/manifest.json
- yarn build
artifacts:
paths:
- extension.zip
\ No newline at end of file
![Global Game Jam 2019](http://www.globalgamejam.it/wp-content/uploads/2018/11/ggj18_fb_eventheader_1920x1080px.jpg)
# Cock O' The
A game that can be played anywhere on the Internet, with as many levels as there are webpages :)
## How to build
* Run `yarn` to install all the needed deps
* Run `yarn build` to build production package
* Run `yarn deploy` to prepare a chrome-compatible zip package
### Note
If you pass these environments variable to deploy script, you can automatize
the deployment to the chrome web store
```js
const UPLOAD_TO_CHROME = false // Should the deploy upload the zip to the chrome web store
const REFRESH_TOKEN = '' // Chrome web store api refresh token
const EXTENSION_ID = '' // Chrome web store extension id
const CLIENT_SECRET = '' // Chrome web store api client secret
const CLIENT_ID = '' // Chrome web store api client id
```
## How to contribute
### Disclaimer
We build this game in less than 48hours without sleeping during Global Game Jam 2019.
We are seriously not responsible for any of the consequence caused to the reading of this code.
We will not answer any question about `How` or `Why`. We do not remember any of these things.
### Easy mode
* Run `yarn dev` to start up a webserver on port `9000` that will host the javascript compiled bundle.
* Open chrome and go to `chrome://extensions`
* Enable developer mode in the top-right of the page, if you haven't done yet
* Click on `Upload a non packaged extension` (I don't know the exact english translation)
* Select the `test` folder
* Enjoy :P
Note that every time you apply a change to some js file, webpack will automatically recompile
the javascript bundle. You will have to just reload the webpage
Webpack will also automatically open a new tab pointing to localhost:9000 with the injected script.
You can modify this template applying changes to `public/index.html`
### Complex mode
* Run `yarn watch` to start up `webpack --watch`
* Manually inject the `bundle.js` file
## How to use
### Manually inject script in the webpage
```
javascript:document.head.innerHTML += '<script src="http://localhost:9000/bundle.js"></script>'
```
or
```js
const script = document.createElement('script');
script.onload = function () {
};
script.src = "http://localhost:9000/bundle.js";
document.head.appendChild(script);
```
\ No newline at end of file
```
replace `http://localhost:9000/bundle.js` with the address where the compiled javascripts file are hosted
### Use chrome extension
Read adobe how to build a zip-compatible package for chrome that will auto-inject the bundle
# Team
* [Andrea Ruggiero](https://pupax.me) <andrea@ruggiero.top> (considered the lead developer)
* Davide Volta (considered the lead designer)
* Pietro Martocchi (considered the art director)
* Andrea Ruggiero (considered the game advisor)
Note that roles were given using a random algorithm. We also do not know what game advisor mean, we will accept merge requests that
describe this role.
# Thanks
Thanks to:
* [Global Game Jam 2019](https://globalgamejam.org/) for offering such a great experience! 🔝🔝🔝🔝🔝
* [WebPack](https://webpack.js.org/) package images, mp3, svgs, javascript into just one file. Wonderful! Thank You!
* [Babel](https://babeljs.io/) I can't no longer develop using old-style JavaScript, thank you!
* All the libraries listed in the `package.json` file!
\ No newline at end of file
const zipFolder = require('zip-folder');
const fs = require('fs')
let folder = 'dist';
let zipName = 'extension.zip';
const folder = 'dist';
const zipName = 'extension.zip';
// credentials and IDs from gitlab-ci.yml file (your appropriate config file)
let REFRESH_TOKEN = process.env.REFRESH_TOKEN;
let EXTENSION_ID = process.env.EXTENSION_ID;
let CLIENT_SECRET = process.env.CLIENT_SECRET;
let CLIENT_ID = process.env.CLIENT_ID;
const webStore = require('chrome-webstore-upload')({
extensionId: EXTENSION_ID,
clientId: CLIENT_ID,
clientSecret: CLIENT_SECRET,
refreshToken: REFRESH_TOKEN
});
const UPLOAD_TO_CHROME = process.env.UPLOAD_TO_CHROME === 'true' || process.env.UPLOAD_TO_CHROME === true
const REFRESH_TOKEN = process.env.REFRESH_TOKEN;
const EXTENSION_ID = process.env.EXTENSION_ID;
const CLIENT_SECRET = process.env.CLIENT_SECRET;
const CLIENT_ID = process.env.CLIENT_ID;
let webStore = null
if (UPLOAD_TO_CHROME) {
webStore = require('chrome-webstore-upload')({
extensionId: EXTENSION_ID,
clientId: CLIENT_ID,
clientSecret: CLIENT_SECRET,
refreshToken: REFRESH_TOKEN
});
}
// zipping the output folder
zipFolder(folder, zipName, function (err) {
......@@ -24,7 +29,9 @@ zipFolder(folder, zipName, function (err) {
process.exit(1);
} else {
console.log(`Successfully Zipped ${folder} and saved as ${zipName}`);
uploadZip(); // on successful zipping, call upload
if (UPLOAD_TO_CHROME) {
uploadZip(); // on successful zipping, call upload
}
}
});
......
{
"name": "Inject Project10 in every page",
"version": "1.0",
"version": "%version%",
"manifest_version": 2,
"icons": {
"16": "icon16.png",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment