Skip to content

Commit 2ac5abb

Browse files
committed
initial commit
1 parent 8514da2 commit 2ac5abb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+764
-620
lines changed

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
# template-react-app
1+
# template-react-static
22

3-
> React template for web app, powered by [Poi](https://poi.js.org/).
4-
5-
- [x] [prettier](https://github.com/prettier/prettier) + eslint
6-
- [x] PWA support (by [offline-plugin](https://github.com/NekR/offline-plugin) & [pwacompat](https://github.com/GoogleChromeLabs/pwacompat))
7-
- [x] [TailwindCSS](https://tailwindcss.com/) & SASS
8-
- [x] Routing & code splitting (by [curi](https://github.com/pshrmn/curi))
3+
> React template for static websites development, powered by [React Static](https://github.com/nozzle/react-static).
94
105
## Usage
116

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,11 @@
1818
"devDependencies": {
1919
"ava": "^0.21.0",
2020
"sao": "^0.22.1"
21+
},
22+
"dependencies": {
23+
"ejs": "^2.6.1"
24+
},
25+
"resolutions": {
26+
"ejs": "^2.6.1"
2127
}
2228
}

sao.js

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// https://sao.js.org/#/create?id=config-file
22

3-
const { exec } = require('child_process');
4-
53
module.exports = {
64
prompts: {
75
name: {
@@ -12,50 +10,11 @@ module.exports = {
1210
message: 'How would you describe the new project?',
1311
default: 'my web project',
1412
},
15-
tailwindcss: {
16-
message: 'TailwindCSS?',
17-
type: 'confirm',
18-
default: true,
19-
},
20-
routing: {
21-
message: 'Routing?',
22-
type: 'confirm',
23-
default: true,
24-
},
25-
pwa: {
26-
message: 'PWA support?',
27-
type: 'confirm',
28-
default: true,
29-
},
30-
},
31-
data({ username = 'dwarvesf' }) {
32-
return {
33-
website: `github.com/${username}`,
34-
};
35-
},
36-
filters: {
37-
'static/manifest.json': 'pwa',
38-
'tailwind.js': 'tailwindcss',
39-
'src/styles/tailwind.scss': 'tailwindcss',
40-
'src/pages/**': 'routing',
41-
'src/router/**': 'routing',
42-
'src/App.css': '!routing',
4313
},
4414
move: {
4515
gitignore: '.gitignore',
4616
},
4717
showTip: true,
4818
gitInit: true,
4919
installDependencies: true,
50-
post(context, stream) {
51-
// run eslint --fix
52-
exec(`cd ${context.folderPath} && yarn lint:fix`, (err, stdout, stderr) => {
53-
if (err) {
54-
console.log(err.message);
55-
return;
56-
}
57-
stdout && console.log(stdout);
58-
stderr && console.log(stderr);
59-
})
60-
},
6120
};

template/.babelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"presets": ["poi"],
2+
"extends": "react-static/.babelrc",
33
"plugins": [
4-
"react-hot-loader/babel"
4+
"macros"
55
]
66
}

template/.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# editorconfig.org
12
root = true
23

34
[*]

template/.eslintrc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ module.exports = {
2626
printWidth: 80,
2727
tabWidth: 2,
2828
useTabs: false,
29-
semi: true,
29+
semi: false,
3030
singleQuote: true,
31-
trailingComma: 'all',
3231
bracketSpacing: true,
32+
trailingComma: 'es5',
3333
},
3434
],
3535
'react/prop-types': 'off',
3636
camelcase: 'off',
3737
},
38-
};
38+
}

template/.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

template/.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"eslint.packageManager": "yarn",
3+
"prettier.eslintIntegration": true
4+
}

template/gitignore

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
# dependencies
22
node_modules
33

4-
# logs
5-
npm-debug.log*
6-
yarn-debug.log*
7-
yarn-error.log*
4+
# testing
5+
/coverage
86

9-
# production build
7+
# production
108
/dist
9+
/tmp
10+
11+
# netlify functions build
12+
.functions
1113

1214
# misc
1315
.DS_Store
1416
.env
15-
.env.*
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

template/index.ejs

Lines changed: 0 additions & 35 deletions
This file was deleted.

template/netlify.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build]
2+
command = "yarn build"
3+
publish = "dist"

template/package.json

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
{
2-
"name": "<%= _.folderName %>",
3-
"private": true,
2+
"name": "dwarves-opensource",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
46
"scripts": {
5-
"dev": "poi",
6-
"build": "poi build",
7-
"build:analyze": "poi build --bundle-report",
8-
"serve": "serve dist -l 8000",
7+
"dev": "react-static start",
8+
"stage": "react-static build --staging",
9+
"build": "rm -rf dist; react-static build",
10+
"build:analyze": "BUNDLE_ANALYZE=1 react-static build",
11+
"serve": "serve dist -s -l 8000",
912
"lint": "eslint --ext .js,.jsx --ignore-path .gitignore .",
1013
"lint:fix": "eslint --fix --ext .js,.jsx --ignore-path .gitignore ."
1114
},
12-
"dependencies": {<% if (routing) { %>
13-
"@curi/core": "^1.0.0-beta.35",
14-
"@curi/react": "^1.0.0-beta.26",
15-
"@curi/route-active": "^1.0.0-beta.6",
16-
"@hickory/browser": "^1.0.0-beta.7",<% } %>
17-
"loadable-components": "2.2.2",<% if (pwa) { %>
18-
"offline-plugin": "^5.0.3",<% } %>
19-
"react": "^16.4.0",
20-
"react-dom": "^16.4.0"
15+
"dependencies": {
16+
"axios": "^0.16.2",
17+
"nprogress": "^0.2.0",
18+
"react": "^16.4.1",
19+
"react-dom": "^16.4.1",
20+
"react-router": "^4.2.0",
21+
"react-static": "^5.9.7"
2122
},
2223
"devDependencies": {
23-
"@poi/plugin-bundle-report": "^10.0.1",
24-
"@poi/plugin-eslint": "^10.0.2",<% if (pwa) { %>
25-
"@poi/plugin-offline": "^10.0.1",<% } %>
26-
"babel-eslint": "^8.2.3",
27-
"babel-preset-poi": "^10.0.1",
28-
"eslint": "^4.19.1",
24+
"babel-eslint": "^8.2.2",
25+
"babel-plugin-macros": "^2.3.0",
26+
"babel-plugin-transform-imports": "^1.5.0",
2927
"eslint-config-prettier": "^2.9.0",
3028
"eslint-config-standard": "^11.0.0",
3129
"eslint-plugin-import": "^2.9.0",
@@ -34,18 +32,18 @@
3432
"eslint-plugin-promise": "^3.7.0",
3533
"eslint-plugin-react": "^7.7.0",
3634
"eslint-plugin-standard": "^3.0.1",
37-
"node-sass": "^4.9.0",
38-
"poi": "^10.2.9",
39-
"postcss-flexbugs-fixes": "^3.3.0",
40-
"purgecss-webpack-plugin": "^1.2.0",
41-
"purgecss-whitelister": "^2.1.0",
42-
"react-hot-loader": "^4.3.0",
43-
"sass-loader": "^6.0.7",
44-
"serve": "^7.2.0"<% if(tailwindcss) { %>,
45-
"tailwindcss": "^0.5.3"<% } %>
35+
"lqip.macro": "^0.1.5",
36+
"node-sass": "^4.9.3",
37+
"prettier": "^1.12.1",
38+
"purgecss-webpack-plugin": "^0.22.0",
39+
"purgecss-whitelister": "^1.2.0",
40+
"react-hot-loader": "^4.2.0",
41+
"sass-loader": "^7.1.0",
42+
"serve": "^9.4.2",
43+
"tailwindcss": "^0.5.2"
4644
},
4745
"resolutions": {
48-
"react": "16.4.0",
49-
"react-dom": "16.4.0"
46+
"react": "16.4.1",
47+
"react-dom": "16.4.1"
5048
}
5149
}

template/poi.config.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

template/postcss.config.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

template/public/_headers

Whitespace-only changes.

template/public/_redirects

Whitespace-only changes.

template/public/favicons/favicon.ico

3.78 KB
Binary file not shown.

template/public/robots.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
User-agent: *

template/purgecss.config.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
1-
const path = require('path');
2-
const glob = require('glob');
3-
const PurgecssPlugin = require('purgecss-webpack-plugin');
4-
const PurgecssWhitelister = require('purgecss-whitelister');
1+
import glob from 'glob'
2+
import PurgecssPlugin from 'purgecss-webpack-plugin'
3+
import PurgecssWhitelister from 'purgecss-whitelister'
54

6-
// Custom PurgeCSS extractor for Tailwind that allows special characters in
7-
// class names.
8-
// https://github.com/FullHuman/purgecss#extractor
95
class TailwindExtractor {
106
static extract(content) {
11-
return content.match(/[A-Za-z0-9-_:/]+/g) || [];
7+
return content.match(/[A-Za-z0-9-_:/]+/g) || []
128
}
139
}
1410

15-
module.exports = new PurgecssPlugin({
16-
// files to scan for class names.
17-
paths: glob.sync(path.join(__dirname, './src/**/*.js')),
11+
export default new PurgecssPlugin({
12+
// Specify the locations of any files you want to scan for class names.
13+
paths: glob.sync('src/**/*.js'),
1814
extractors: [
1915
{
2016
extractor: TailwindExtractor,
2117
extensions: ['js', 'jsx'],
2218
},
2319
],
24-
whitelist: ['html', 'body'].concat(PurgecssWhitelister([])),
20+
whitelist: ['html', 'body'].concat(
21+
PurgecssWhitelister(['src/css/nprogress.css'])
22+
),
2523
whitelistPatterns: [
26-
/^module__*/, // css module
24+
/^module__.+/, // css modules
2725
],
28-
});
26+
})

template/src/App.css

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)