Skip to content

Commit 46f048a

Browse files
basic unbundled rendering of home page
1 parent 6b4982d commit 46f048a

File tree

11 files changed

+1409
-6860
lines changed

11 files changed

+1409
-6860
lines changed

greenwood.config.js

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require('path');
2-
const pluginGoogleAnalytics = require('./packages/plugin-google-analytics/src/index');
3-
const pluginPolyfills = require('./packages/plugin-polyfills/src/index');
2+
// const pluginGoogleAnalytics = require('./packages/plugin-google-analytics/src/index');
3+
// const pluginPolyfills = require('./packages/plugin-polyfills/src/index');
44

55
const META_DESCRIPTION = 'A modern and performant static site generator supporting Web Component based development';
66
const FAVICON_HREF = '/assets/favicon.ico';
@@ -19,18 +19,19 @@ module.exports = {
1919
{ rel: 'shortcut icon', href: FAVICON_HREF },
2020
{ rel: 'icon', href: FAVICON_HREF },
2121
{ name: 'google-site-verification', content: '4rYd8k5aFD0jDnN0CCFgUXNe4eakLP4NnA18mNnK5P0' }
22-
],
23-
plugins: [
24-
...pluginGoogleAnalytics({
25-
analyticsId: 'UA-147204327-1'
26-
}),
27-
...pluginPolyfills()
28-
],
29-
markdown: {
30-
plugins: [
31-
require('rehype-slug'),
32-
require('rehype-autolink-headings'),
33-
require('remark-github')
34-
]
35-
}
22+
]
23+
// TODO
24+
// plugins: [
25+
// ...pluginGoogleAnalytics({
26+
// analyticsId: 'UA-147204327-1'
27+
// }),
28+
// ...pluginPolyfills()
29+
// ],
30+
// markdown: {
31+
// plugins: [
32+
// require('rehype-slug'),
33+
// require('rehype-autolink-headings'),
34+
// require('remark-github')
35+
// ]
36+
// }
3637
};

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
},
2626
"devDependencies": {
2727
"@ls-lint/ls-lint": "^1.9.2",
28-
"babel-eslint": "^10.0.3",
2928
"chai": "^4.2.0",
3029
"eslint": "^6.8.0",
3130
"jsdom": "^14.0.0",

packages/cli/package.json

+19-48
Original file line numberDiff line numberDiff line change
@@ -25,55 +25,26 @@
2525
"access": "public"
2626
},
2727
"dependencies": {
28-
"@babel/core": "^7.8.3",
29-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
30-
"@babel/plugin-transform-runtime": "^7.8.3",
31-
"@babel/preset-env": "^7.10.4",
32-
"@babel/runtime": "^7.8.3",
33-
"@webcomponents/webcomponentsjs": "^2.3.0",
34-
"apollo-cache-inmemory": "^1.6.3",
35-
"apollo-client": "^2.6.4",
36-
"apollo-link-http": "^1.5.16",
37-
"apollo-server": "^2.9.12",
38-
"babel-loader": "^8.0.5",
39-
"chalk": "^2.4.2",
40-
"colors": "^1.3.3",
28+
"@rollup/plugin-node-resolve": "^9.0.0",
29+
"@webcomponents/webcomponentsjs": "^2.4.4",
30+
"acorn": "^8.0.1",
31+
"acorn-walk": "^8.0.0",
4132
"commander": "^2.20.0",
42-
"copy-webpack-plugin": "^5.0.3",
43-
"core-js": "^3.4.1",
44-
"css-loader": "^2.1.1",
45-
"css-to-string-loader": "^0.1.3",
46-
"cssnano": "^4.1.10",
47-
"file-loader": "^3.0.1",
48-
"filewatcher-webpack-plugin": "^1.2.0",
49-
"front-matter": "^3.0.1",
50-
"fs-extra": "^8.1.0",
51-
"graphql": "^14.5.8",
52-
"graphql-tag": "^2.10.1",
53-
"html-webpack-plugin": "^3.2.0",
54-
"lit-element": "^2.0.1",
55-
"lit-redux-router": "^0.9.3",
56-
"local-web-server": "^2.6.1",
57-
"markdown-toc": "^1.2.0",
58-
"node-fetch": "^2.6.0",
59-
"postcss-loader": "^3.0.0",
60-
"postcss-nested": "^4.1.2",
61-
"postcss-preset-env": "^6.7.0",
33+
"es-module-shims": "^0.5.2",
34+
"front-matter": "^4.0.2",
35+
"htmlparser2": "^4.1.0",
36+
"koa": "^2.13.0",
37+
"livereload": "^0.9.1",
6238
"puppeteer": "^1.20.0",
63-
"pwa-helpers": "^0.9.1",
64-
"redux": "^4.0.1",
65-
"redux-thunk": "^2.3.0",
66-
"style-loader": "^0.23.1",
67-
"wc-markdown-loader": "~0.2.0",
68-
"webpack": "^4.29.6",
69-
"webpack-cli": "^3.3.0",
70-
"webpack-dev-server": "^3.2.1",
71-
"webpack-manifest-plugin": "^2.0.4",
72-
"webpack-merge": "^4.2.1"
73-
},
74-
"devDependencies": {
75-
"glob-promise": "^3.4.0",
76-
"rehype-autolink-headings": "^4.0.0",
77-
"rehype-slug": "^3.0.0"
39+
"rehype-raw": "^4.0.2",
40+
"rehype-stringify": "^8.0.0",
41+
"remark-frontmatter": "^2.0.0",
42+
"remark-parse": "^8.0.3",
43+
"remark-rehype": "^7.0.0",
44+
"rollup": "^2.26.5",
45+
"rollup-plugin-multi-input": "^1.1.1",
46+
"rollup-plugin-postcss": "^3.1.5",
47+
"rollup-plugin-terser": "^7.0.0",
48+
"unified": "^9.2.0"
7849
}
7950
}

packages/cli/src/index.js

+44-34
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,31 @@
55
// https://github.com/ProjectEvergreen/greenwood/issues/141
66
process.setMaxListeners(0);
77

8-
require('colors');
8+
// TODO require('colors');
99

10-
const chalk = require('chalk');
1110
const program = require('commander');
1211
const generateCompilation = require('./lifecycles/compile');
13-
const runProdBuild = require('./tasks/build');
12+
// const runProdBuild = require('./tasks/build');
1413
const runDevServer = require('./tasks/develop');
15-
const ejectConfigFiles = require('./tasks/eject');
16-
const scriptPkg = require('../package.json');
17-
let compilation = {};
18-
let cmdOption = {};
14+
// const ejectConfigFiles = require('./tasks/eject');
15+
const greenwoodPackageJson = require('../package.json');
16+
// let compilation = {};
17+
// let cmdOption = {};
1918
let MODE = '';
2019

21-
console.log(`${chalk.rgb(175, 207, 71)('-------------------------------------------------------')}`);
22-
console.log(`${chalk.rgb(175, 207, 71)('Welcome to Greenwood ♻️')}`);
23-
console.log(`${chalk.rgb(175, 207, 71)('-------------------------------------------------------')}`);
20+
// TODO
21+
// console.log(`${chalk.rgb(175, 207, 71)('-------------------------------------------------------')}`);
22+
// console.log(`${chalk.rgb(175, 207, 71)('Welcome to Greenwood ♻️')}`);
23+
// console.log(`${chalk.rgb(175, 207, 71)('-------------------------------------------------------')}`);
24+
console.info('-------------------------------------------------------');
25+
console.info('Welcome to Greenwood ♻️');
26+
console.info('-------------------------------------------------------');
2427

2528
program
26-
.version(scriptPkg.version)
29+
.version(greenwoodPackageJson.version)
2730
.arguments('<script-mode>')
28-
.usage(`${chalk.green('<script-mode>')} [options]`);
31+
.usage('<script-mode> [options]');
32+
// TODO .usage(`${chalk.green('<script-mode>')} [options]`);
2933

3034
program
3135
.command('build')
@@ -51,56 +55,62 @@ program
5155

5256
program.parse(process.argv);
5357

58+
// TODO pick build by default? Thinking of npx usage...
5459
if (program.parse.length === 0) {
5560
program.help();
5661
}
5762

5863
const run = async() => {
64+
let compilation = {};
5965

6066
try {
6167

6268
switch (MODE) {
63-
64-
case 'build':
65-
compilation = await generateCompilation();
6669

67-
console.log('Building project for production.'.yellow);
70+
// TODO
71+
// case 'build':
72+
// compilation = await generateCompilation();
73+
74+
// console.log('Building project for production.'.yellow);
6875

69-
await runProdBuild(compilation);
76+
// await runProdBuild(compilation);
7077

71-
console.log('...................................'.yellow);
72-
console.log('Static site generation complete!');
73-
console.log('...................................'.yellow);
78+
// console.log('...................................'.yellow);
79+
// console.log('Static site generation complete!');
80+
// console.log('...................................'.yellow);
7481

75-
break;
82+
// break;
7683
case 'develop':
7784
compilation = await generateCompilation();
85+
// console.debug('compilation', compilation);
7886

79-
console.log('Starting local development server'.yellow);
80-
87+
console.info('Starting local development server...');
8188
await runDevServer(compilation);
82-
83-
console.log('Development mode activiated'.green);
8489

8590
break;
86-
case 'eject':
87-
console.log('Ejecting configurations'.yellow);
91+
// TODO
92+
// case 'eject':
93+
// console.log('Ejecting configurations'.yellow);
8894

89-
await ejectConfigFiles(cmdOption.all);
90-
91-
console.log(`Configurations ejected successfully to ${process.cwd()}`.green);
95+
// await ejectConfigFiles(cmdOption.all);
96+
97+
// console.log(`Configurations ejected successfully to ${process.cwd()}`.green);
9298

93-
break;
99+
// break;
94100
default:
95-
console.log('Error: missing command. try checking --help if you\'re encountering issues');
101+
console.info(`
102+
Error: missing command. try using the --help flag if
103+
you're encountering issues running Greenwood. Visit our docs for more
104+
info: https://www.greenwoodjs.io/docs/
105+
`);
96106
break;
97107

98108
}
99109
process.exit(0); // eslint-disable-line no-process-exit
100110
} catch (err) {
101-
console.error(`${err}`.red);
111+
console.error(err);
102112
process.exit(1); // eslint-disable-line no-process-exit
103113
}
104114
};
105115

106-
run();
116+
run();

packages/cli/src/lifecycles/compile.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
require('colors');
1+
// TODO require('colors');
22
const initConfig = require('./config');
33
const initContext = require('./context');
44
const generateGraph = require('./graph');
5-
const generateScaffolding = require('./scaffold');
5+
// const generateScaffolding = require('./scaffold');
66

77
module.exports = generateCompilation = () => {
88
return new Promise(async (resolve, reject) => {
@@ -15,20 +15,21 @@ module.exports = generateCompilation = () => {
1515
};
1616

1717
// read from defaults/config file
18-
console.log('Reading project config');
18+
console.info('Initializing project config');
1919
compilation.config = await initConfig();
2020

2121
// determine whether to use default template or user detected workspace
22-
console.log('Initializing project workspace contexts');
22+
console.info('Initializing project workspace contexts');
2323
compilation.context = await initContext(compilation);
24-
24+
2525
// generate a graph of all pages / components to build
26-
console.log('Generating graph of workspace files...');
26+
// TODO make this async somehow / run in parallel?
27+
console.info('Generating graph of workspace files...');
2728
compilation = await generateGraph(compilation);
2829

29-
// generate scaffolding
30-
console.log('Scaffolding out project files...');
31-
await generateScaffolding(compilation);
30+
// // generate scaffolding
31+
// console.log('Scaffolding out project files...');
32+
// await generateScaffolding(compilation);
3233

3334
resolve(compilation);
3435
} catch (err) {

0 commit comments

Comments
 (0)