Skip to content

Commit

Permalink
Merge pull request #297 from Scrivito/prettier_2
Browse files Browse the repository at this point in the history
Prettier 1 => 2 (+ eslint updated)
  • Loading branch information
dcsaszar committed Mar 26, 2020
2 parents 5bc29a7 + 6504b4a commit 195053e
Show file tree
Hide file tree
Showing 77 changed files with 224 additions and 198 deletions.
2 changes: 1 addition & 1 deletion .prettierrc.json
@@ -1 +1 @@
{ "trailingComma": "es5" }
{}
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,6 +1,6 @@
---
language: node_js
node_js: 8
node_js: 10
sudo: false
cache:
directories:
Expand Down
2 changes: 1 addition & 1 deletion generator-scrivito/app/index.js
Expand Up @@ -12,7 +12,7 @@ module.exports = class extends Generator {
name: "type",
message: "What do you want to generate?",
choices: ["An Obj class", "A Widget class"],
}).then(answers => {
}).then((answers) => {
if (answers.type === "An Obj class") {
this.composeWith("scrivito:obj");
}
Expand Down
2 changes: 1 addition & 1 deletion generator-scrivito/generators/obj/index.js
Expand Up @@ -23,7 +23,7 @@ module.exports = class extends Generator {
}
return true;
},
}).then(answers => {
}).then((answers) => {
const objClassName = answers.objClassName;
const folder = `src/Objs/${objClassName}`;
const humanFriendlyName = lodash.startCase(objClassName);
Expand Down
2 changes: 1 addition & 1 deletion generator-scrivito/generators/widget/index.js
Expand Up @@ -23,7 +23,7 @@ module.exports = class extends Generator {
}
return true;
},
}).then(answers => {
}).then((answers) => {
const widgetClassName = answers.widgetClassName;
const folder = `src/Widgets/${widgetClassName}`;
const humanFriendlyName = lodash.startCase(
Expand Down
14 changes: 11 additions & 3 deletions generator-scrivito/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion generator-scrivito/package.json
Expand Up @@ -18,6 +18,6 @@
"yeoman-generator": "^3.2.0"
},
"devDependencies": {
"prettier": "^1.18.2"
"prettier": "^2.0.2"
}
}
101 changes: 58 additions & 43 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions package.json
Expand Up @@ -14,8 +14,8 @@
"@babel/core": "^7.8.7",
"@babel/preset-env": "^7.8.7",
"@babel/preset-react": "^7.9.4",
"@typescript-eslint/eslint-plugin": "^2.23.0",
"@typescript-eslint/parser": "^2.23.0",
"@typescript-eslint/eslint-plugin": "^2.25.0",
"@typescript-eslint/parser": "^2.25.0",
"autotrack": "^2.4.1",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
Expand All @@ -29,16 +29,16 @@
"es-check": "^5.1.0",
"escape-html": "^1.0.3",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.10.0",
"eslint-config-react-app": "^5.2.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^6.10.1",
"eslint-config-react-app": "^5.2.1",
"eslint-import-resolver-webpack": "^0.12.1",
"eslint-plugin-flowtype": "^3.13.0",
"eslint-plugin-flowtype": "^4.7.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^1.7.0",
"eslint-plugin-react-hooks": "^2.5.1",
"express": "^4.17.1",
"file-loader": "^5.1.0",
"filesize": "^6.1.0",
Expand All @@ -54,7 +54,7 @@
"mini-css-extract-plugin": "^0.9.0",
"moment-from-now": "0.0.4",
"node-sass": "^4.13.1",
"prettier": "^1.19.1",
"prettier": "^2.0.2",
"puppeteer": "^2.1.1",
"react": "^16.8.6",
"react-cookie-consent": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions prerender/extendRedirects.js
Expand Up @@ -10,8 +10,8 @@ exports.extendRedirects = async function extendRedirects(
sourceDir
) {
const explicitRedirects = prerenderedFiles
.filter(f => f.endsWith(".html") && f.toLowerCase() !== f)
.map(file => `${file.substring(0, file.length - 5)} ${file} 200`);
.filter((f) => f.endsWith(".html") && f.toLowerCase() !== f)
.map((file) => `${file.substring(0, file.length - 5)} ${file} 200`);
const sourceRedirects = await fse.readFile(`${sourceDir}/_redirects`, "utf8");
const placeholder = "# PRERENDERED-UPPERCASE-ROUTES-PLACEHOLDER";
if (sourceRedirects.indexOf(placeholder) === -1) {
Expand Down
2 changes: 1 addition & 1 deletion prerender/startServer.js
Expand Up @@ -5,7 +5,7 @@ exports.startServer = function startServer(sourceDir) {
const staticMiddleware = express.static(sourceDir);
app.use(staticMiddleware);

return new Promise(resolve => {
return new Promise((resolve) => {
const server = app.listen(8080, () => resolve(server));
});
};
6 changes: 3 additions & 3 deletions prerender/storePrerenderedContent.js
Expand Up @@ -35,7 +35,7 @@ async function storePrerenderedContent() {
);

await Promise.all(
filesToBeRemoved.map(async filename => {
filesToBeRemoved.map(async (filename) => {
log(`✨ Removing now obsolete file ${filename}...`);
await fse.remove(path.join(TARGET_DIR, filename));
filesRemoved += 1;
Expand All @@ -55,7 +55,7 @@ async function storePrerenderedContent() {
const page = await visitUrl(browser, url);

log(`🖥️️ Redefining window.storeResult...`);
await page.exposeFunction("storeResult", args =>
await page.exposeFunction("storeResult", (args) =>
storeResult(TARGET_DIR, storedFiles, args)
);

Expand Down Expand Up @@ -86,7 +86,7 @@ function log(message, ...args) {
console.log(`[storePrerenderedContent] ${message}`, ...args);
}

storePrerenderedContent().catch(e => {
storePrerenderedContent().catch((e) => {
reportError("An error occurred!", e);
process.exitCode = 1;
});
2 changes: 1 addition & 1 deletion prerender/visitUrl.js
Expand Up @@ -10,7 +10,7 @@ exports.visitUrl = async function visitUrl(browser, url) {
}

console.log(` 🖥️️ [visitUrl] Registering console log...`);
page.on("console", msg => console.log(" 🖥️️ [console]", msg.text()));
page.on("console", (msg) => console.log(" 🖥️️ [console]", msg.text()));

return page;
};
20 changes: 10 additions & 10 deletions readme.mdown
Expand Up @@ -50,12 +50,12 @@ The Scrivito example app JS requires the tenant ID of your CMS. The ID is taken

To specify it, proceed as follows:

* Go to your [Scrivito Websites](https://my.scrivito.com/tenants/).
* Click the CMS to use.
* Open the “Settings” tab.
* Scroll down to the “Anonymous access for the Scrivito Javascript SDK” section.
* Copy the value after SCRIVITO_TENANT= to the clipboard.
* In the project directory, open/create the file `.env` and paste the ID after the `SCRIVITO_TENANT` key. The file should then look like this:
- Go to your [Scrivito Websites](https://my.scrivito.com/tenants/).
- Click the CMS to use.
- Open the “Settings” tab.
- Scroll down to the “Anonymous access for the Scrivito Javascript SDK” section.
- Copy the value after SCRIVITO_TENANT= to the clipboard.
- In the project directory, open/create the file `.env` and paste the ID after the `SCRIVITO_TENANT` key. The file should then look like this:

```
SCRIVITO_TENANT=0123456789ABCDEF0123456789ABCDEF
Expand All @@ -67,8 +67,8 @@ See `.env.example` for an example.

To enable resource sharing between your CMS and your web application, specify the URL of your app in the CMS settings.

* Like above, navigate to the “Deployment” tab of the CMS to use with your app.
* Make sure that `http://localhost:8080` is added to the "Other authorized URLs".
- Like above, navigate to the “Deployment” tab of the CMS to use with your app.
- Make sure that `http://localhost:8080` is added to the "Other authorized URLs".

See [Getting Started with ScrivitoJS](https://scrivito.com/getting-started-with-scrivitojs-f729f073bf4672d8) for more information.

Expand All @@ -83,13 +83,13 @@ To see development in action, let's change the `ButtonWidget` so that it prefixe
Open up the react component responsible for rendering a `ButtonWidget`. It's located at `src/Widgets/ButtonWidget/ButtonWidgetComponent.js`. Now look for the `Scrivito.LinkTag` and insert

```jsx
{ '🚀 ' }
{"🚀 "}
```

before

```jsx
{ text }<i className="fa fa-angle-right fa-4" aria-hidden="true" />
{text}<i className="fa fa-angle-right fa-4" aria-hidden="true" />
```

After saving the file, your browser should automatically reload [http://localhost:8080](http://localhost:8080) with your new emoji button. Of course you can choose another emoji, check out [emojipedia.org](https://emojipedia.org).
Expand Down

0 comments on commit 195053e

Please sign in to comment.