Skip to content

Commit

Permalink
updated to rngs-io spec
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbes7878 committed Nov 22, 2024
1 parent 9fc7de6 commit 45faa8e
Show file tree
Hide file tree
Showing 43 changed files with 10,255 additions and 8,369 deletions.
25 changes: 14 additions & 11 deletions .bluprintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"bluprint": "^0.6.3",
"name": "Graphics Kit (SvelteKit)",
"name": "Graphics Kit",
"category": "Graphics rigs",
"actions": [{
"action": "prompt",
Expand All @@ -17,7 +17,8 @@
".github/PULL_REQUEST_TEMPLATE.md",
"test/*",
"CONTRIBUTING.md",
"README.md"
"README.md",
"rngs-io.json"
]
}, {
"action": "move",
Expand All @@ -34,18 +35,20 @@
["git", ["init"]],
["git", ["add", "."]],
["git", ["commit", "-m", "initial"]],
["yarn"],
["pnpm", ["install"]],
["npx", ["lefthook", "install"]],
["yarn", ["startup:check-creds"]],
["yarn", ["startup:create-repo"]],
["yarn", ["startup:archie-doc"]],
["yarn", ["startup:ai-templates"]]
["pnpm", ["startup:check-creds"]],
["pnpm", ["startup:create-repo"]],
[
"npx",
[
"rngs-io stories new --name 'page-en' --template cltmvzj5m0000lc089jz22aet --syncPath 'locales/en/content.json'"
]
],
["pnpm", ["startup:ai-templates"]]
]
}, {
"action": "log",
"msg": "\n\n🏁 Finished creating your project, {cyan {{ projectName }}}!\n\nRun {green yarn start} to begin developing.\n"
}, {
"action": "log",
"msg": "📦 Graphics components have a new home. Check out what's new at:\n{cyan https://reuters-graphics.github.io/graphics-components/}\n"
"msg": "\n\n🏁 Finished creating your project, {cyan {{ projectName }}}!\n\nRun {green pnpm start} to begin developing.\n"
}]
}
53 changes: 0 additions & 53 deletions .eslintrc.cjs

This file was deleted.

51 changes: 34 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Created by https://www.toptal.com/developers/gitignore/api/node,macos,linux
# Edit at https://www.toptal.com/developers/gitignore?templates=node,macos,linux

Expand Down Expand Up @@ -46,6 +45,10 @@ Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Node ###
# Logs
logs
Expand All @@ -54,6 +57,7 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
Expand Down Expand Up @@ -90,8 +94,8 @@ build/Release
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo
Expand Down Expand Up @@ -120,30 +124,25 @@ typings/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
# dotenv environment variable files
.env
.env.test
.env*.local
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Storybook build outputs
.out
.storybook-out
storybook-static

# rollup.js default build output
dist/

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
Expand All @@ -153,6 +152,12 @@ dist/
# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

Expand All @@ -168,9 +173,21 @@ dist/
# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# Temporary folders
tmp/
temp/
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

# End of https://www.toptal.com/developers/gitignore/api/node,macos,linux

Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
16 changes: 0 additions & 16 deletions .prettierrc

This file was deleted.

10 changes: 10 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { svelte as svelteConfig } from '@reuters-graphics/yaks-prettier';

/**
* @type {import("prettier").Config}
*/
const config = {
...svelteConfig,
};

export default config;
15 changes: 12 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
{
"i18n-ally.localesPaths": ["locales"],
"i18n-ally.keystyle": "nested",
"eslint.validate": ["javascript", "svelte"],
"eslint.validate": ["javascript", "typescript", "svelte"],
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"npm.packageManager": "pnpm",
"npm.scriptExplorerAction": "run",
"npm.enableRunFromFolder": true,
"npm.scriptExplorerExclude": [
"build.*",
"publish.*",
"startup.*",
"stories:autolink",
"knip",
"test"
],
"liveshare.launcherClient": "visualStudioCode",
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
Expand Down
2 changes: 0 additions & 2 deletions .yarnrc.yml

This file was deleted.

20 changes: 10 additions & 10 deletions PROJECT_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ Graphics created with [bluprint_graphics-kit](https://github.com/reuters-graphic

Develop your project.

```
yarn start
```console
pnpm start
```

Build and publish preview pages to AWS.

```
yarn preview
```console
pnpm preview
```

Build and upload your project to RNGS server.
Build and upload your project to Sphinx Graphics Server.

```
yarn upload
```console
pnpm upload
```

🍻 Publish your project in the RNGS server.
🍻 Publish your project in the Sphinx Graphics Server.

```
yarn pub
```console
pnpm pub
```

Read more in the [development docs](https://reuters-graphics.github.io/docs_graphics-kit/).
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
![](https://graphics.thomsonreuters.com/style-assets/images/logos/reuters-graphics-logo/svg/graphics-logo-color-dark.svg)
# The Graphics Kit

# bluprint_graphics-kit

A rig for graphics and newsapps.
A rig for Reuters graphics and newsapps.

Built with:

<a href="https://kit.svelte.dev/" target="_blank">
<img src="https://kit.svelte.dev/images/svelte-kit-horizontal.svg" height="40" />
<a href="https://svelte.dev/docs/kit/" target="_blank">
<img src="https://raw.githubusercontent.com/sveltejs/branding/refs/heads/master/svelte-horizontal.svg" height="40" />
</a>

## Quickstart
Expand All @@ -16,13 +14,13 @@ This rig is best used with [bluprint](https://github.com/reuters-graphics/blupri

If you haven't already, add this bluprint to your CLI.

```
```console
bluprint add reuters-graphics/bluprint_graphics-kit
```

Make a new directory and use the bluprint.

```
```console
mkdir my-project && cd my-project
bluprint start
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import fs from 'fs';
import glob from 'glob';
import { glob } from 'glob';
import { normalizePath } from 'vite';
import path from 'path';
import type { ViteDevServer } from 'vite';

const getPkgRoot = () => {
const PKG_PATH = path.join(process.cwd(), 'package.json');
Expand All @@ -22,7 +23,7 @@ export default function svelteKitPagesPlugin({

const PAGES_DIR = path.join(getPkgRoot(), pages);

let FOUND_PAGES = [];
let FOUND_PAGES: string[] = [];

// Gets paths to pages
const getPagePaths = () => {
Expand All @@ -34,15 +35,15 @@ export default function svelteKitPagesPlugin({
// Remove Svelte-specific extensions
const pagePaths = pages.map((embed) => {
const pagePath = path.join(base, embed.replace('.svelte', ''));
return /\+page$/.test(pagePath)
? pagePath.replace(/\+page$/, '')
return /\+page$/.test(pagePath) ?
pagePath.replace(/\+page$/, '')
: pagePath;
});
// Return as virtual module
return `export default ['${pagePaths.join("', '")}'];`;
};

const reloadModule = (server) => {
const reloadModule = (server: ViteDevServer) => {
const plugin = server.moduleGraph.getModuleById(RESOLVED_VIRTUAL_MODULE_ID);
if (!plugin) return;
server.moduleGraph.invalidateModule(plugin);
Expand All @@ -51,15 +52,15 @@ export default function svelteKitPagesPlugin({
return {
name: 'svelte-kit-pages-plugin',

resolveId(id) {
resolveId(id: string) {
if (id === VIRTUAL_MODULE_ID) return RESOLVED_VIRTUAL_MODULE_ID;
},

load(id) {
load(id: string) {
if (id === RESOLVED_VIRTUAL_MODULE_ID) return getPagePaths();
},

configureServer(server) {
configureServer(server: ViteDevServer) {
server.watcher.add(normalizePath(PAGES_DIR));
server.watcher.on('unlink', (f) => {
const file = normalizePath(f);
Expand Down
Loading

0 comments on commit 45faa8e

Please sign in to comment.