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

chore/upgrade greenwood v0.30.0 #71

Merged
merged 8 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/ci-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Install Chromium Library Dependencies
run: |
sh ./.github/workflows/chromium-lib-install.sh
- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/master.yml

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.12.1
18.20.2
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,26 @@ To add this plugin to an _existing_ Greenwood project (where `@greenwood/cli` ha
```sh
$ npm i greenwood-starter-presentation --save-dev --legacy-peer-deps
```
1. Add this and Greenwood's Import CSS plugin to your _greenwood.config.js_
1. Add this and Greenwood's Import Raw plugin to your _greenwood.config.js_
```js
import { greenwoodPluginImportCss } from '@greenwood/plugin-import-css';
import { greenwoodPluginImportCss } from '@greenwood/plugin-import-raw';
import { greenwoodThemeStarterPresentation } from 'greenwood-starter-presentation';

export default {
// ...

plugins: [
greenwoodPluginImportCss(),
greenwoodPluginImportRaw(),
greenwoodThemeStarterPresentation()
]

};
```
1. Make sure to add `type: "module"` to uour _package.json_
1. Make sure to add `type: "module"` to your _package.json_
1. Create a markdown file in your _src/pages_ directory called _index.md_ with these contents
```md
---
template: index
layout: index
---
```

Expand Down Expand Up @@ -105,14 +105,14 @@ When you are running the app, the following controls and behaviors are available
- Navigate left and right using the left and right arrow keys
- To exit presenter mode, hit the ESC key

### Slide Templates and Layouts
### Slide Layouts

To organize your slide content, this plugin provides the following template that can be specified in markdown file's frontmatter.
To organize your slide content, this plugin provides the following layouts that can be specified in a markdown file's frontmatter.

ex.
```md
---
template: theme-statement
layout: theme-statement
---

Lorum Ipsum all my content....
Expand All @@ -131,7 +131,7 @@ The supported structure for the above slides looks like this
#### Center Content
```md
---
template: theme-center-content
layout: theme-center-content
---

# What's the Deal...?
Expand All @@ -144,7 +144,7 @@ Lorum Ipsum
#### Outline
```md
---
template: theme-outline
layout: theme-outline
---

# My Talk Agenda
Expand All @@ -161,7 +161,7 @@ template: theme-outline
#### Statement
```md
---
template: theme-statement
layout: theme-statement
---

Spicy jalapeno bacon ipsum dolor.
Expand All @@ -172,7 +172,7 @@ Spicy jalapeno bacon ipsum dolor.
#### Title
```md
---
template: theme-title
layout: theme-title
---

# My Talk
Expand All @@ -186,7 +186,7 @@ template: theme-title
#### Top Title Image Left
```md
---
template: theme-top-title-image-left
layout: theme-top-title-image-left
---

# Thank You!
Expand All @@ -202,7 +202,7 @@ template: theme-top-title-image-left
#### Top Title
```md
---
template: theme-top-title
layout: theme-top-title
---

# Welcome To My Talk
Expand Down
11 changes: 7 additions & 4 deletions greenwood.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs';
import { greenwoodThemeStarterPresentation } from './index.js';
import path from 'path';
import { ResourceInterface } from '@greenwood/cli/src/lib/resource-interface.js';
import { greenwoodPluginImportCss } from '@greenwood/plugin-import-css';
import { greenwoodPluginImportRaw } from '@greenwood/plugin-import-raw';

const packageName = JSON.parse(fs.readFileSync(path.join(process.cwd(), './package.json'), 'utf-8')).name;

Expand All @@ -18,17 +18,20 @@ class MyThemePackDevelopmentResource extends ResourceInterface {
}

async resolve(url) {
const { pathname } = url;
const { pathname, searchParams } = url;
const params = searchParams.size > 0
? `?${searchParams.toString()}`
: '';
const { userWorkspace } = this.compilation.context;
const workspaceUrl = pathname.split(`/node_modules/${packageName}/dist/`)[1];

return new Request(new URL(`./${workspaceUrl}`, userWorkspace));
return new Request(new URL(`./${workspaceUrl}${params}`, userWorkspace));
}
}

export default {
plugins: [
greenwoodPluginImportCss(),
greenwoodPluginImportRaw(),
greenwoodThemeStarterPresentation({
__isDevelopment: true
}),
Expand Down
29 changes: 24 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,40 @@
import { ResourceInterface } from '@greenwood/cli/src/lib/resource-interface.js';
import fs from 'fs';

const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));

class GraphJsonResolverLoader extends ResourceInterface {
constructor(compilation) {
super(compilation);
}

shouldResolve(url) {
return url.pathname === '/graph.json' && process.env.__GWD_COMMAND__ === 'develop'; // eslint-disable-line no-underscore-dangle
}

resolve() {
return new Request(new URL('./graph.json', this.compilation.context.scratchDir));
}
}

const greenwoodThemeStarterPresentation = (options = {}) => [{
type: 'context',
name: `${packageJson.name}:context`,
provider: (compilation) => {
const templateLocation = options.__isDevelopment // eslint-disable-line no-underscore-dangle
? new URL('./layouts/', compilation.context.userWorkspace)
: new URL('./dist/layouts/', import.meta.url);
const layoutsLocation = options.__isDevelopment // eslint-disable-line no-underscore-dangle
? new URL('./templates/', compilation.context.userWorkspace)
: new URL('./dist/templates/', import.meta.url);

return {
templates: [
templateLocation
layouts: [
layoutsLocation
]
};
}
}, {
type: 'resource',
name: `${packageJson.name}:resource`,
provider: (compilation) => new GraphJsonResolverLoader(compilation)
}];

export {
Expand Down
Loading
Loading