Skip to content

Commit

Permalink
Fix fix script
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsen1 committed Apr 2, 2020
1 parent 9b1f89e commit c8cf139
Show file tree
Hide file tree
Showing 29 changed files with 111 additions and 116 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/build-eslint-jest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [master]
pull_request:
types: [opened, edited, synchronize, reopened]
types: [opened, edited, synchronize, reopened]

jobs:
build:
Expand All @@ -15,24 +15,24 @@ jobs:
fail-fast: false
name: Node ${{ matrix.node-version }} latest
steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Node and Yarn Versions
run: |
node --version
yarn --version
- name: Install using lockfile
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Run ESLint
run: yarn lint
env:
CI: true
- name: Run Jest Tests
run: yarn test
env:
CI: true
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Node and Yarn Versions
run: |
node --version
yarn --version
- name: Install using lockfile
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Run ESLint
run: yarn lint
env:
CI: true
- name: Run Jest Tests
run: yarn test
env:
CI: true
8 changes: 4 additions & 4 deletions .github/workflows/netlify-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Starting Netlify Deploy
runs-on: ubuntu-latest
steps:
- name: POST build hook
run: |
set -e
curl -X POST https://api.netlify.com/build_hooks/5e72a1a0d832c03eb1f56934
- name: POST build hook
run: |
set -e
curl -X POST https://api.netlify.com/build_hooks/5e72a1a0d832c03eb1f56934
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"statusBarItem.hoverBackground": "#ce7350",
"statusBar.foreground": "#e7e7e7"
},
"peacock.color": "#b85833",
}
"peacock.color": "#b85833"
}
20 changes: 10 additions & 10 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ We pledge to act and interact in ways that contribute to an open, welcoming, div

Examples of behavior that contributes to a positive environment for our community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Before interacting with the Redwood community, please read and understand our [Code of Conduct](https://github.com/redwoodjs/redwood/blob/master/CODE_OF_CONDUCT.md).

**Table of Contents**

- [Local Package Development](##Local-Package-Development-Setup)
- [CLI Package Development](##CLI-Package-Development)

Expand Down Expand Up @@ -88,10 +89,12 @@ yarn rw dev web
```

## CLI Package Development

We are using [Yargs](https://yargs.js.org/)
_Historical note: originally implemented in react-ink (too slow!) then converted._

### Example

Example dev command:

```
Expand Down
21 changes: 14 additions & 7 deletions docs/assets.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Assets and Files

There are two methods for adding assets to a Redwood app: Webpack imports and directly adding to the `/public` folder.

## Importing Assets

In general, it's best to import files directly into a template, page, or component. This allows Webpack to include that file in the bundle, ensuring correct processing for the distribution folder while providing error checks and correct paths along the way.

### Example Asset Import with Webpack

Using `import`, we can do the following:
```javascript
import React from "react"
import logo from "./my-logo.jpg"

```javascript
import React from 'react'
import logo from './my-logo.jpg'

function Header() {
return <img src={logo} alt="Logo" />
Expand All @@ -20,20 +23,22 @@ export default Header

Webpack will correctly handle the file path and add the file to the distribution folder within `/dist/media` (created when Webpack builds for production).

>Note: In this example, the file `my-logo.jpg` is located in the same directory as the component. This is recommended practice to keep all files related to a component in a single directory.
> Note: In this example, the file `my-logo.jpg` is located in the same directory as the component. This is recommended practice to keep all files related to a component in a single directory.
Behind the scenes, we are using Webpack's ["file-loader"](https://webpack.js.org/loaders/file-loader/) and ["url-loader"](https://webpack.js.org/loaders/url-loader/) (which transforms images less than 10kb into data URIs for improved performance).

## Directly Adding Assets using the "Public" Folder

Alternately, you can add files directly to the folder "web/public", effectively adding static files to your app. All included files and folders will be copied into the production build `web/dist` folder. They will also be available during development when you run `yarn rw dev`.

Because assets in this folder are bypassing the javascript module system, **this folder should be used sparingly** for assets such as favicons, robots.txt, manifests, libraries incompatible with Webpack, etc.

>Note: files will *not* hot reload while the development server is running. You'll need to manually stop/start to access file changes.
> Note: files will _not_ hot reload while the development server is running. You'll need to manually stop/start to access file changes.
Behind the scenes, Redwood is using Webpack's ["copy-webpack-plugin"](https://github.com/webpack-contrib/copy-webpack-plugin).

### Example Use

Assuming `public/` includes the following:

- `favicon.png`
Expand All @@ -44,9 +49,11 @@ Running `yarn build` will copy the file `favicon.png` to `/dist/favicon.png`. Th
```html
<link rel="icon" type="image/png" href="/favicon.png" />
```

and

```html
<img src="/static-files/my-logo.jpg"> alt="Logo" />
<img src="/static-files/my-logo.jpg" /> alt="Logo" />
```

>Note: because the directory `dist/` becomes your production root, it should not be included in the path.
> Note: because the directory `dist/` becomes your production root, it should not be included in the path.
4 changes: 2 additions & 2 deletions docs/redwood.toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This table contains the configuration for web side.

### web.host

The hostname (string) to listen to for the web server, defaults to `localhost`. When running the server within containers/VMs, using `0.0.0.0` would allow network connections to/from the host.
The hostname (string) to listen to for the web server, defaults to `localhost`. When running the server within containers/VMs, using `0.0.0.0` would allow network connections to/from the host.

### web.port

Expand All @@ -24,7 +24,7 @@ This table contains the configuration for api side.

## api.host

The hostname (string) to listen to for the web server, defaults to `localhost`. When running the server within containers/VMs, using `0.0.0.0` would allow network connections to/from the host.
The hostname (string) to listen to for the web server, defaults to `localhost`. When running the server within containers/VMs, using `0.0.0.0` would allow network connections to/from the host.

## api.port

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
"build:types": "tsc --build --clean && tsc --build",
"test": "lerna run test --stream -- --colors",
"lint": "yarn eslint './packages/'",
"lint:fix": "yarn lint --fix"
"lint:fix": "yarn prettier --write . && yarn lint --fix"
}
}
2 changes: 1 addition & 1 deletion packages/api/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { "extends": "../../babel.config.js" }
module.exports = { extends: '../../babel.config.js' }
11 changes: 3 additions & 8 deletions packages/api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo",
"baseUrl": ".",
"rootDir": "src",
"outDir": "dist",
"outDir": "dist"
},
"include": [
"src"
],
"exclude": [
"**/__tests__",
"**/__mocks__"
]
"include": ["src"],
"exclude": ["**/__tests__", "**/__mocks__"]
}
2 changes: 1 addition & 1 deletion packages/cli/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { "extends": "../../babel.config.js" }
module.exports = { extends: '../../babel.config.js' }
2 changes: 1 addition & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The Redwood CLI comes with RedwoodJS (which means no extra software to install!)

The [`yarn`](https://classic.yarnpkg.com/en/docs/install) package is required to use the Redwood CLI.

Be sure to prefix all Redwood CLI commands with `yarn `. For example, `yarn redwood new`.
Be sure to prefix all Redwood CLI commands with `yarn`. For example, `yarn redwood new`.

Additionally, you can use `rw` as shorthand for `redwood`. For example, `yarn rw new`.

Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/commands/generate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ you would create `src/commands/generate/commands/page.js`. The file name does no

The generator must export the following:

`command`: A yargs command definition.
`desc`: A description of the generator shown during help.
`builder`: A function that describes the arguments for the command.
`handler`: The function that's invoked by the command.
`command`: A yargs command definition.
`desc`: A description of the generator shown during help.
`builder`: A function that describes the arguments for the command.
`handler`: The function that's invoked by the command.

A typicall generator writes files.

Expand Down
2 changes: 1 addition & 1 deletion packages/core/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { "extends": "../../babel.config.js" }
module.exports = { extends: '../../babel.config.js' }
6 changes: 3 additions & 3 deletions packages/core/src/loaders/cell-loader.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function(source: string) {
export default function (source: string) {
const exports: string[] = []

const names = [
Expand All @@ -8,10 +8,10 @@ export default function(source: string) {
'Failure',
'Empty',
'beforeQuery',
'afterQuery'
'afterQuery',
]

names.forEach(name => {
names.forEach((name) => {
source.match(`export const ${name}`) && exports.push(name)
})

Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/loaders/routes-auto-loader.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import { loader } from 'webpack'
import { processPagesDir } from '@redwoodjs/internal'

export default function(this: loader.LoaderContext, source: string) {
export default function (this: loader.LoaderContext, source: string) {
// Process the dir to find all Page dependencies.
const deps = processPagesDir()

// Remove any deps that have been explicitly declared in the Routes file. When one
// is present, the user is requesting that the module be included in the main
// bundle.
const filteredDeps = deps.filter(dep => {
const filteredDeps = deps.filter((dep) => {
const re = new RegExp(`^\\s*import\\s+${dep.const}\\s+from`, 'm')
return !source.match(re)
})

// Inform Webpack that we're pulling external dependencies so it can do the
// right thing with watched files, etc.
filteredDeps.forEach(entry => {
filteredDeps.forEach((entry) => {
this.addDependency(entry.path)
})

// Grab the import strings from the deps and get them ready to be appended
// onto the Routes file.
const importString = filteredDeps.map(x => x.importStatement).join('\n')
const importString = filteredDeps.map((x) => x.importStatement).join('\n')

// Give 'em what they want!
return importString + '\n\n' + source
Expand Down
4 changes: 1 addition & 3 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
"outDir": "dist",
"rootDir": "src"
},
"references": [
{"path": "../internal"}
]
"references": [{ "path": "../internal" }]
}
2 changes: 1 addition & 1 deletion packages/create-redwood-app/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { "extends": "../../babel.config.js" }
module.exports = { extends: '../../babel.config.js' }
2 changes: 1 addition & 1 deletion packages/dev-server/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { "extends": "../../babel.config.js" }
module.exports = { extends: '../../babel.config.js' }
4 changes: 1 addition & 3 deletions packages/dev-server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
"outDir": "dist",
"rootDir": "src"
},
"include": [
"src"
]
"include": ["src"]
}
2 changes: 1 addition & 1 deletion packages/eslint-plugin-redwood/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { "extends": "../../babel.config.js" }
module.exports = { extends: '../../babel.config.js' }
2 changes: 1 addition & 1 deletion packages/internal/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { "extends": "../../babel.config.js" }
module.exports = { extends: '../../babel.config.js' }
9 changes: 2 additions & 7 deletions packages/internal/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
"outDir": "dist",
"rootDir": "src"
},
"include": [
"src"
],
"exclude": [
"**/__tests__",
"**/__mocks__"
]
"include": ["src"],
"exclude": ["**/__tests__", "**/__mocks__"]
}
2 changes: 1 addition & 1 deletion packages/router/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { "extends": "../../babel.config.js" }
module.exports = { extends: '../../babel.config.js' }
2 changes: 1 addition & 1 deletion packages/web/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { "extends": "../../babel.config.js" }
module.exports = { extends: '../../babel.config.js' }
Loading

0 comments on commit c8cf139

Please sign in to comment.