Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rfc/issue 185 Transforms API (pt. 1) #422

Merged
merged 82 commits into from
Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from 80 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
46f048a
basic unbundled rendering of home page
thescientist13 Sep 16, 2020
f0804fe
got livereload working for all files
thescientist13 Sep 16, 2020
2e9456e
JSON support
thescientist13 Sep 17, 2020
aaa25a6
import CSS support
thescientist13 Sep 17, 2020
d2fbece
disable eslint complexity
thescientist13 Sep 17, 2020
10fcc2b
header working
thescientist13 Sep 17, 2020
4e9b020
ading banner and stylinh and fixed binary image loading
thescientist13 Sep 17, 2020
1e29db9
integrated evergreen deps
thescientist13 Sep 18, 2020
3631d06
fully restored the home page in develop mode
thescientist13 Sep 18, 2020
8a18552
wip getting serialization working
thescientist13 Sep 18, 2020
770178b
wip getting serialization working
thescientist13 Sep 18, 2020
af86832
clean up and refactor, serialize WIP
thescientist13 Sep 18, 2020
1beeb5f
upgrade puppeteer to latest
thescientist13 Sep 18, 2020
6930472
a bit hacky but home page is now being built for production
thescientist13 Sep 18, 2020
4702f6d
render header navigation from graph
thescientist13 Sep 25, 2020
6bd752a
page template working for site in development
thescientist13 Sep 29, 2020
a6bda80
all pages working in develop
thescientist13 Sep 29, 2020
c67559b
all pages serializing for prod
thescientist13 Sep 29, 2020
25c8392
sort header and shelf
thescientist13 Sep 30, 2020
d7dba58
shelf expansion and table of contents
thescientist13 Sep 30, 2020
4c743fc
label fallback handling
thescientist13 Sep 30, 2020
db2f97c
fix index page rendering
thescientist13 Sep 30, 2020
f27b3bd
clean up logging
thescientist13 Sep 30, 2020
f605dda
favicon support
thescientist13 Sep 30, 2020
61dd7eb
refactor server lifecycle to use compilation and expose devServer
thescientist13 Oct 1, 2020
b879792
built in serve command
thescientist13 Oct 1, 2020
396ca5c
serve docs
thescientist13 Oct 1, 2020
59b0b72
add support for app templates
thescientist13 Oct 3, 2020
bdc68de
pretty URLs
thescientist13 Oct 6, 2020
0b588a1
shelf working WIP
thescientist13 Oct 6, 2020
adbcffb
quick styling tweak for side nav
thescientist13 Oct 8, 2020
44a5451
copy assets and graph.json in copy lifecycle
thescientist13 Oct 11, 2020
698988a
basic support for css files
thescientist13 Oct 11, 2020
e7f12a6
fix copy error for nested folders
thescientist13 Oct 11, 2020
1729b94
call rollup from JS API
thescientist13 Oct 11, 2020
7b65990
rollup configuration sourced from compilation
thescientist13 Oct 11, 2020
f2ad06e
make sure to await Promise.all
thescientist13 Oct 15, 2020
f8a159b
Rfc/issue 355 organize serve lifecycle (#419)
hutchgrant Oct 15, 2020
4cf32de
linting
thescientist13 Oct 16, 2020
dd3cfa4
renable default tests and limited smoke tests
thescientist13 Oct 17, 2020
d9e92a2
disable all tests enable subset of tests
thescientist13 Oct 17, 2020
2219c6b
task: add custom transforms API from koa context
hutchgrant Oct 19, 2020
0ad031e
fix: remove redundant line
hutchgrant Oct 19, 2020
8c0c784
fix: more descriptive var
hutchgrant Oct 19, 2020
b59b6dc
meta specs
thescientist13 Oct 20, 2020
1d60732
Merge branch 'rfc/issue-355-no-bundle-development' of github.com:Proj…
hutchgrant Oct 20, 2020
c11cf17
fix: merge conflict
hutchgrant Oct 20, 2020
0cf35cb
enable custom title case
thescientist13 Oct 21, 2020
b7a1812
enable custom workspace spec
thescientist13 Oct 22, 2020
8c972da
track missing dev dep
thescientist13 Oct 22, 2020
c186ced
enabled workspace assets test case
thescientist13 Oct 23, 2020
5129a2f
fix link closing slash
thescientist13 Oct 23, 2020
d00edd9
content-outlet refactor
thescientist13 Oct 23, 2020
bbf1293
enabled getting started test case
thescientist13 Oct 23, 2020
6b58605
enable nested directory test case
thescientist13 Oct 24, 2020
e6851c5
enable app template case
thescientist13 Oct 24, 2020
cbe7bff
enable page template spec
thescientist13 Oct 24, 2020
c16e0cf
enable user directory mapping case
thescientist13 Oct 24, 2020
1280a34
update comments
thescientist13 Oct 24, 2020
ef55f9a
task: standardize transforms
hutchgrant Oct 30, 2020
3ed28e3
fix: prod render
hutchgrant Oct 30, 2020
6849dd9
task: adding disabled markdown transform
hutchgrant Oct 30, 2020
fc6f47b
fix: cleanup class names
hutchgrant Oct 30, 2020
fd0a571
fix: cleanup class names
hutchgrant Oct 30, 2020
02ce6ac
got code markdown rendering and added support for custom plugins from…
thescientist13 Nov 1, 2020
71e325d
markdown plugins working including prism
thescientist13 Nov 1, 2020
0d64e43
default markdown specs
thescientist13 Nov 2, 2020
e5683d1
enable all tests
thescientist13 Nov 2, 2020
fbfa261
rename markdown case
thescientist13 Nov 3, 2020
a28de1f
syntax highlighting markdown spec
thescientist13 Nov 3, 2020
c73ab95
fix: transform fixes
hutchgrant Nov 3, 2020
d4bd739
task: add markdown and json transforms
hutchgrant Nov 3, 2020
f7af5d1
fix: header rendering, comment out eve-container temp
hutchgrant Nov 4, 2020
de040a6
fix: cleanup
hutchgrant Nov 4, 2020
a9b4788
Merge branch 'rfc/issue-355-no-bundle-development' of github.com:Proj…
hutchgrant Nov 4, 2020
6fdf53d
fix: remove node_module seperate transform, instead use js/css with p…
hutchgrant Nov 5, 2020
5f9aba3
task: remove old transforms
hutchgrant Nov 5, 2020
cc61085
fix: immutability of compilation object
hutchgrant Nov 11, 2020
080cae1
fix: tests, page-templates, defaults
hutchgrant Nov 11, 2020
9b2eeec
fix: cleanup
hutchgrant Nov 11, 2020
a610b43
Merge branch 'release/0.10.0' of github.com:ProjectEvergreen/greenwoo…
hutchgrant Nov 12, 2020
210568f
fix: remove outdated transforms
hutchgrant Nov 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const path = require('path');
// const path = require('path');

module.exports = {
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
babelOptions: {
configFile: path.join(__dirname, './packages/cli/src/config/babel.config.js')
}
sourceType: 'module'
// TODO should we use this?
// babelOptions: {
// configFile: path.join(__dirname, './packages/cli/src/config/babel.config.js')
// }
},
env: {
browser: true,
Expand Down
3 changes: 2 additions & 1 deletion .mocharc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = require('path');

module.exports = {
spec: path.join(__dirname, 'packages/**/test/**/**/**/*.spec.js'),
// TODO spec: path.join(__dirname, 'packages/**/test/**/**/**/*.spec.js'),
spec: path.join(__dirname, 'packages/**/test/cases/**/**/*.spec.js'),
timeout: 30000
};
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ Then in your _package.json_, you can run the CLI like so:
"scripts": {
"build": "greenwood build",
"start": "greenwood develop",
"eject": "greenwood eject",
"serve": "greenwood serve",
"eject": "greenwood eject"
}
```

- `npm run build`: generates a static build of your project
- `npm start`: starts a local development server for your project
- `npm run eject`: ejects configurations to your working directory for additional customizations
- `greenwood build`: Generates a production build of your project
- `greenwood develop`: Starts a local development server for your project
- `greenwood serve`: Generates a production build of the project and serves it locally on a simple web server.
- `greenwood eject`: Ejects configurations to your working directory for additional customizations.

## Documentation
All of our documentation is on our [website](https://www.greenwoodjs.io/) (which itself is built by Greenwood!). See our website documentation to learn more about:
Expand Down
24 changes: 13 additions & 11 deletions greenwood.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');
const pluginGoogleAnalytics = require('./packages/plugin-google-analytics/src/index');
const pluginPolyfills = require('./packages/plugin-polyfills/src/index');
// const pluginGoogleAnalytics = require('./packages/plugin-google-analytics/src/index');
// const pluginPolyfills = require('./packages/plugin-polyfills/src/index');

const META_DESCRIPTION = 'A modern and performant static site generator supporting Web Component based development';
const FAVICON_HREF = '/assets/favicon.ico';
Expand All @@ -20,17 +20,19 @@ module.exports = {
{ rel: 'icon', href: FAVICON_HREF },
{ name: 'google-site-verification', content: '4rYd8k5aFD0jDnN0CCFgUXNe4eakLP4NnA18mNnK5P0' }
],
plugins: [
...pluginGoogleAnalytics({
analyticsId: 'UA-147204327-1'
}),
...pluginPolyfills()
],
// TODO
// plugins: [
// ...pluginGoogleAnalytics({
// analyticsId: 'UA-147204327-1'
// }),
// ...pluginPolyfills()
// ],
markdown: {
plugins: [
require('rehype-slug'),
require('rehype-autolink-headings'),
require('remark-github')
'@mapbox/rehype-prism',
'rehype-autolink-headings',
'rehype-slug',
'remark-github'
]
}
};
4 changes: 2 additions & 2 deletions nyc.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module.exports = {
all: true,

include: [
'packages/cli/src/commands/*.js',
'packages/cli/src/data/*.js',
'packages/cli/src/lib/*.js',
'packages/cli/src/lifecycles/*.js',
'packages/cli/src/tasks/*.js',
'packages/plugin-*/src/*.js'
],

Expand All @@ -17,7 +17,7 @@ module.exports = {
'text-summary'
],

checkCoverage: true,
checkCoverage: false, // TODO renable

statements: 85,
branches: 75,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
"clean:deps": "rimraf **/node_modules/**",
"lint": "ls-lint && eslint \"*.js\" \"./packages/**/**/*.js\" \"./test/*.js\" \"./www/**/**/*.js\"",
"build": "node . build",
"serve": "yarn build && cd ./public && ws",
"serve": "node . serve",
"develop": "node . develop",
"test": "export BROWSERSLIST_IGNORE_OLD_DATA=true && nyc mocha",
"test:tdd": "yarn test --watch"
},
"devDependencies": {
"@ls-lint/ls-lint": "^1.9.2",
"babel-eslint": "^10.0.3",
"chai": "^4.2.0",
"eslint": "^6.8.0",
"glob-promise": "^3.4.0",
"jsdom": "^14.0.0",
"lerna": "^3.16.4",
"mocha": "^6.1.4",
Expand Down
67 changes: 23 additions & 44 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,54 +25,33 @@
"access": "public"
},
"dependencies": {
"@babel/core": "^7.8.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.8.3",
"@babel/preset-env": "^7.10.4",
"@babel/runtime": "^7.8.3",
"@webcomponents/webcomponentsjs": "^2.3.0",
"apollo-cache-inmemory": "^1.6.3",
"apollo-client": "^2.6.4",
"apollo-link-http": "^1.5.16",
"apollo-server": "^2.9.12",
"babel-loader": "^8.0.5",
"chalk": "^2.4.2",
"colors": "^1.3.3",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@webcomponents/webcomponentsjs": "^2.4.4",
"acorn": "^8.0.1",
"acorn-walk": "^8.0.0",
"commander": "^2.20.0",
"copy-webpack-plugin": "^5.0.3",
"core-js": "^3.4.1",
"css-loader": "^2.1.1",
"css-to-string-loader": "^0.1.3",
"cssnano": "^4.1.10",
"file-loader": "^3.0.1",
"filewatcher-webpack-plugin": "^1.2.0",
"front-matter": "^3.0.1",
"fs-extra": "^8.1.0",
"graphql": "^14.5.8",
"graphql-tag": "^2.10.1",
"html-webpack-plugin": "^3.2.0",
"lit-element": "^2.0.1",
"lit-redux-router": "^0.9.3",
"local-web-server": "^2.6.1",
"es-module-shims": "^0.5.2",
"front-matter": "^4.0.2",
"htmlparser2": "^4.1.0",
"koa": "^2.13.0",
"livereload": "^0.9.1",
"markdown-toc": "^1.2.0",
"node-fetch": "^2.6.0",
"postcss-loader": "^3.0.0",
"postcss-nested": "^4.1.2",
"postcss-preset-env": "^6.7.0",
"puppeteer": "^1.20.0",
"pwa-helpers": "^0.9.1",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"style-loader": "^0.23.1",
"wc-markdown-loader": "~0.2.0",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.2.1",
"webpack-manifest-plugin": "^2.0.4",
"webpack-merge": "^4.2.1"
"node-html-parser": "^1.2.21",
"puppeteer": "^5.3.0",
"rehype-stringify": "^8.0.0",
"remark-frontmatter": "^2.0.0",
"remark-parse": "^8.0.3",
"remark-rehype": "^7.0.0",
"rollup": "^2.26.5",
"rollup-plugin-ignore-import": "^1.3.2",
"rollup-plugin-multi-input": "^1.1.1",
"rollup-plugin-postcss": "^3.1.5",
"rollup-plugin-terser": "^7.0.0",
"unified": "^9.2.0"
},
"devDependencies": {
"glob-promise": "^3.4.0",
"@mapbox/rehype-prism": "^0.5.0",
"rehype-autolink-headings": "^4.0.0",
"rehype-slug": "^3.0.0"
}
Expand Down
33 changes: 33 additions & 0 deletions packages/cli/src/commands/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const bundleCompilation = require('../lifecycles/bundle');
const copyAssets = require('../lifecycles/copy');
const fs = require('fs');
const generateCompilation = require('../lifecycles/compile');
const serializeCompilation = require('../lifecycles/serialize');
const { devServer } = require('../lifecycles/serve');

module.exports = runProductionBuild = async () => {

return new Promise(async (resolve, reject) => {

try {
const compilation = await generateCompilation();
const port = compilation.config.devServer.port;
const outputDir = compilation.context.outputDir;

devServer(compilation).listen(port);

if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir);
}

await serializeCompilation(compilation);
await bundleCompilation(compilation);
await copyAssets(compilation);

resolve();
} catch (err) {
reject(err);
}
});

};
30 changes: 30 additions & 0 deletions packages/cli/src/commands/develop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const generateCompilation = require('../lifecycles/compile');
const livereload = require('livereload');
const { devServer } = require('../lifecycles/serve');

module.exports = runDevServer = async () => {

return new Promise(async (resolve, reject) => {

try {
const compilation = await generateCompilation();
const { port } = compilation.config.devServer;
const { userWorkspace } = compilation.context;

devServer(compilation).listen(port, () => {
console.info(`Started local development at localhost:${port}`);
const liveReloadServer = livereload.createServer({
exts: ['html', 'css', 'js', 'md'],
applyCSSLive: false // https://github.com/napcs/node-livereload/issues/33#issuecomment-693707006
});

liveReloadServer.watch(userWorkspace, () => {
console.info(`Now watching directory "${userWorkspace}" for changes.`);
});
});
} catch (err) {
reject(err);
}

});
};
File renamed without changes.
20 changes: 20 additions & 0 deletions packages/cli/src/commands/serve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const generateCompilation = require('../lifecycles/compile');
const { prodServer } = require('../lifecycles/serve');

module.exports = runProdServer = async () => {

return new Promise(async (resolve, reject) => {

try {
const compilation = await generateCompilation();
const port = 8080;

prodServer(compilation).listen(port, () => {
console.info(`Started production test server at localhost:${port}`);
});
} catch (err) {
reject(err);
}

});
};
10 changes: 5 additions & 5 deletions packages/cli/src/config/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
plugins: {
'postcss-preset-env': {}, // stage 2+
'postcss-nested': {},
'cssnano': {}
}
// plugins: {
// 'postcss-preset-env': {}, // stage 2+
// 'postcss-nested': {},
// 'cssnano': {}
// }
};
Loading