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

Fix typos #1002

Merged
merged 1 commit into from
Dec 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
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@

### 1.2.0

- Added a `custom.scss` file to the default theme to allow for simple theme customizations to easily get ohter CSS updates.
- Added a `custom.scss` file to the default theme to allow for simple theme customizations to easily get other CSS updates.
- Added a `logoMaxHeightPx` option to set the logo's `max-height` property.
- Added `scrollPaddingTopPx` option to set the `scroll-padding-top` property for when there's a Nav bar situation.

Expand Down Expand Up @@ -212,7 +212,7 @@
### 1.0.8

- Add support for query name strategies. https://github.com/anvilco/spectaql/pull/282
- Bug fix: support examples from metatdata for Scalars. https://github.com/anvilco/spectaql/pull/283
- Bug fix: support examples from metadata for Scalars. https://github.com/anvilco/spectaql/pull/283
- Bug fix: `themeDir` from CLI support. https://github.com/anvilco/spectaql/pull/284
- Bug fix: Reference interpolation. https://github.com/anvilco/spectaql/pull/285

Expand Down Expand Up @@ -240,7 +240,7 @@ Some notable additions/enhancements to `1.0.0` are:
- When used in a `node` project, there are a few more exports now:
- `run`: same as the default export that will build everything if you pass it sane options.
- `parseCliOptions`: used to parse the CLI arguments into sane arguments to be passed to `run`.
- `loadData`: bascially does all the processing that SpectaQL would do with gathering and processing the data right up to the point where SpectaQL would start to generate the HTML, etc.
- `loadData`: basically does all the processing that SpectaQL would do with gathering and processing the data right up to the point where SpectaQL would start to generate the HTML, etc.
- `buildSchemas`: Does a bit less than `loadData` in that it will take the provided options and return an augmented Introspection Query Response as well as a GraphQL Schema instance.
- Choose from several built-in "themes", tweak the default theme, or completely change things up with your own theme! See the [/examples/themes/README.md][themes-readme] for more.

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Using SpectaQL to generate your documentation has a number of benefits, such as:
- Will automatically generate documentation for all Types, Fields, Queries, Mutations, Arguments and Subscriptions by default.
- Supports blacklisting entire areas (e.g. "don't show Mutations") and 1-off blacklisting.
- Supports providing examples via static metadata, or dynamically via a custom generator plugin that you control.
- Supports (beta) dynamic grouping and arranging of data via a custom data arrangment plugin that you control.
- Supports (beta) dynamic grouping and arranging of data via a custom data arrangement plugin that you control.
- Supports light tweaking or complete customization of CSS, JS and HTML output via themes.
- Supports markdown just about everywhere you can provide text.
- Live preview mode while developing.
Expand Down Expand Up @@ -159,7 +159,7 @@ SpectaQL supports 3 ways to include metadata to be used during processing:
2. Provide a standalone JSON file containing your metadata to be "woven" into your introspection query results by SpectaQL. SpectaQL uses the `addMetadata` method from [our Apollo Plugin](https://www.npmjs.com/package/@anvilco/apollo-server-plugin-introspection-metadata) under the hood, so please see the documentation there or [this example](https://github.com/anvilco/spectaql/blob/main/examples/data/metadata.json) file to understand its format.
3. If you are providing your schema information via an SDL file or files, leverage the [SpectaQL Directive](#the-spectaql-directive) feature to provide your metadata in your SDL through directives. See the [SpectaQL Directive](#the-spectaql-directive) for more information.

**NOTE**: Another way to ensure that things are not documented is to pass your GraphQL Instrospection Results through [Microfiber][microfiber] and perform the removal of any Types, Fields, Queries etc before they even reach SpectaQL. Just a thought.
**NOTE**: Another way to ensure that things are not documented is to pass your GraphQL Introspection Results through [Microfiber][microfiber] and perform the removal of any Types, Fields, Queries etc before they even reach SpectaQL. Just a thought.

## The SpectaQL Directive
If you are providing your schema information via an SDL file or files, you can leverage the `@spectaql` directive and pass any of the supported `metadata` options to the `options` argument of that directive. This is a useful approach for those who are taking an "SDL-first" development approach. See the `spectaqlDirective` option in the [`config-example.yml`](https://github.com/anvilco/spectaql/blob/main/config-example.yml) file for more information on how to enable and implement this approach.
Expand Down Expand Up @@ -214,7 +214,7 @@ SpectaQL ships with 3 included themes that can be specified via the `themeDir` o
- `basic`: Outputs the same HTML structure as the `default` theme, but with minimal CSS styling.
- `spectaql`: Outputs the same HTML structure as the `default` theme, but with some CSS enhancements.

In addition to those built-in themes, you can specify a path to a custom theme directory to the `themeDir` option. Your custom theme directory will be overlayed on top of the default theme directory, and therefore can include as much or as little overridden or additional files as necessary to obtain your desired output.
In addition to those built-in themes, you can specify a path to a custom theme directory to the `themeDir` option. Your custom theme directory will be overlaid on top of the default theme directory, and therefore can include as much or as little overridden or additional files as necessary to obtain your desired output.

See [/examples/themes/README.md][themes-readme] for more information on how you can customize SpectaQL's output with themes.

Expand Down
4 changes: 2 additions & 2 deletions dev/build-e2e.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let tarballName = await execSync(
tarballName = getTarballNameFromOutput(tarballName.toString())

// Rename the thing
const orginalPath = path.join(e2eDir, tarballName)
const originalPath = path.join(e2eDir, tarballName)
const newPath = path.join(e2eDir, 'spectaql.tgz')

await execSync(`mv ${orginalPath} ${newPath}`)
await execSync(`mv ${originalPath} ${newPath}`)
12 changes: 6 additions & 6 deletions examples/themes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ SpectaQL's theming system is a powerful way to tweak or augment the default them

### Overview

Any custom theme that you use will be "overlayed" on top of SpectaQL's [default theme directory][default-theme-dir] and structure. This means that your theme gets all the templates, javascripts, CSS and helpers included in the default theme "for free".
Any custom theme that you use will be "overlaid" on top of SpectaQL's [default theme directory][default-theme-dir] and structure. This means that your theme gets all the templates, javascripts, CSS and helpers included in the default theme "for free".

Any files that your theme includes will be added on top of the default theme's structure. This means you can:

- Override existing files to modify their behavior
- Include new files to be considered or included during the build process
- Both!

The "theme" system works on a directory structure convention. Here's how that stucture looks:
The "theme" system works on a directory structure convention. Here's how that structure looks:

```js
your-theme-dir/
Expand Down Expand Up @@ -55,7 +55,7 @@ An example or replacing the whole theme:

```scss
// mytheme/stylesheets/main.scss
// This will replace the deafult theme
// This will replace the default theme

// You can (but don't have to!) import structural styles from base and
// syntax highlighting from the spectaql default theme
Expand Down Expand Up @@ -86,13 +86,13 @@ You can override syntax highlighting styles by specifying a `syntax-highlighting

### `views`

SpectaQL uses [Handlebars][handlebars] as its templating engine - please read up on their docs if you'd like to alter this area. Any `.hbs` files that you add to this folder will be overlayed on top of the default theme's directory.
SpectaQL uses [Handlebars][handlebars] as its templating engine - please read up on their docs if you'd like to alter this area. Any `.hbs` files that you add to this folder will be overlaid on top of the default theme's directory.

SpectaQL will look for the the `main.hbs` file in the resulting `views` directory as the entry point for Handlebars. If your theme provides a `main.hbs` file, that will overwrite the default one and be used to direct the HBS -> HTML build.

If you only want to tweak and/or add certain partials, you can do so by only including those customized or additional files in your theme. They will be overlayed on top of the default theme directory in a supplemental manner.
If you only want to tweak and/or add certain partials, you can do so by only including those customized or additional files in your theme. They will be overlaid on top of the default theme directory in a supplemental manner.

SpectaQL also supports running a theme in "embeddable" mode to produce output that can be embeded into an existing HTML page. In "embeddable" mode, the `embedded.hbs` file will be used as the entry point for Handlebars. Depending on the changes you've made, if you want your theme to support "embeddable" mode properly you may need to customize the `embedded.hbs` file in your theme.
SpectaQL also supports running a theme in "embeddable" mode to produce output that can be embedded into an existing HTML page. In "embeddable" mode, the `embedded.hbs` file will be used as the entry point for Handlebars. Depending on the changes you've made, if you want your theme to support "embeddable" mode properly you may need to customize the `embedded.hbs` file in your theme.

### `helpers`

Expand Down
4 changes: 2 additions & 2 deletions src/lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ hljs.configure({

hljs.registerLanguage('graphql', hljsGraphqlLang)

// Create a custom renderer for highlight.js compatability
// Create a custom renderer for highlight.js compatibility
const mdRenderer = new marked.Renderer()
mdRenderer.code = highlight

Expand All @@ -43,7 +43,7 @@ const QUOTE_TAG_REGEX = new RegExp(QUOTE_TAG, 'g')
const QUOTE_HTML = '"'
const QUOTE_HTML_REGEX = new RegExp(QUOTE_HTML, 'g')

// Map Scalar types to example data to use fro them
// Map Scalar types to example data to use from them
const SCALAR_TO_EXAMPLE = {
String: ['abc123', 'xyz789'],
Int: [123, 987],
Expand Down
2 changes: 1 addition & 1 deletion src/lib/gruntConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ module.exports = function (grunt, options, spectaqlData) {

// https://www.npmjs.com/package/grunt-compile-handlebars
// Compile the Handlebars templates as HTML into the target directory
// Everyting has been copied intermediately to the cache directory
// Everything has been copied intermediately to the cache directory
// so that custom stuff can be combined with standard stuff
'compile-handlebars': {
compile: {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/interpolation.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ export function substituteEnv(valueIn) {
} else {
const keyParts = parts[2].split(':-')
const key = keyParts[0]
const defautValue = keyParts[1] || ''
const defaultValue = keyParts[1] || ''

replacePart = parts[0].substring(prefix.length)
value = Object.prototype.hasOwnProperty.call(process.env, key)
? process.env[key]
: defautValue
: defaultValue

// If the value is found, remove nested expansions.
if (keyParts.length > 1 && value) {
Expand Down
30 changes: 15 additions & 15 deletions src/spectaql/generate-graphql-example-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import {
lowerCase,
} from './utils'

const QUERY_NAME_STATEGY_NONE = 'none'
const QUERY_NAME_STATEGY_CAPITALIZE_FIRST = 'capitalizeFirst'
const QUERY_NAME_STATEGY_CAPITALIZE = 'capitalize'
const QUERY_NAME_STATEGY_CAMELCASE = 'camelCase'
const QUERY_NAME_STATEGY_SNAKECASE = 'snakeCase'
const QUERY_NAME_STATEGY_UPPERCASE = 'upperCase'
const QUERY_NAME_STATEGY_LOWERCASE = 'lowerCase'
const QUERY_NAME_STRATEGY_NONE = 'none'
const QUERY_NAME_STRATEGY_CAPITALIZE_FIRST = 'capitalizeFirst'
const QUERY_NAME_STRATEGY_CAPITALIZE = 'capitalize'
const QUERY_NAME_STRATEGY_CAMELCASE = 'camelCase'
const QUERY_NAME_STRATEGY_SNAKECASE = 'snakeCase'
const QUERY_NAME_STRATEGY_UPPERCASE = 'upperCase'
const QUERY_NAME_STRATEGY_LOWERCASE = 'lowerCase'

// Create a sane/friendly indentation of args based on how many there are, and the depth
function friendlyArgsString({ args, depth }) {
Expand Down Expand Up @@ -76,19 +76,19 @@ export function generateQuery({
const cleanedQuery = queryResult.query.replace(/ : [\w![\]]+/g, '')

let queryName = field.name
if (!queryNameStrategy || queryNameStrategy === QUERY_NAME_STATEGY_NONE) {
if (!queryNameStrategy || queryNameStrategy === QUERY_NAME_STRATEGY_NONE) {
// no op
} else if (queryNameStrategy === QUERY_NAME_STATEGY_CAPITALIZE_FIRST) {
} else if (queryNameStrategy === QUERY_NAME_STRATEGY_CAPITALIZE_FIRST) {
queryName = capitalizeFirstLetter(queryName)
} else if (queryNameStrategy === QUERY_NAME_STATEGY_CAPITALIZE) {
} else if (queryNameStrategy === QUERY_NAME_STRATEGY_CAPITALIZE) {
queryName = capitalize(queryName)
} else if (queryNameStrategy === QUERY_NAME_STATEGY_CAMELCASE) {
} else if (queryNameStrategy === QUERY_NAME_STRATEGY_CAMELCASE) {
queryName = camelCase(queryName)
} else if (queryNameStrategy === QUERY_NAME_STATEGY_SNAKECASE) {
} else if (queryNameStrategy === QUERY_NAME_STRATEGY_SNAKECASE) {
queryName = snakeCase(queryName)
} else if (queryNameStrategy === QUERY_NAME_STATEGY_UPPERCASE) {
} else if (queryNameStrategy === QUERY_NAME_STRATEGY_UPPERCASE) {
queryName = upperCase(queryName)
} else if (queryNameStrategy === QUERY_NAME_STATEGY_LOWERCASE) {
} else if (queryNameStrategy === QUERY_NAME_STRATEGY_LOWERCASE) {
queryName = lowerCase(queryName)
}

Expand All @@ -115,7 +115,7 @@ export function generateQuery({
}

return {
query, // The Query/Mutation sring/markdown
query, // The Query/Mutation string/markdown
variables, // The Variables
response, // The Response
}
Expand Down
2 changes: 1 addition & 1 deletion src/spectaql/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ async function run(opts) {
]
if (!customDataArrangerSuffixThatExists.endsWith('.mjs')) {
messages.push(
'You can try renaming your file with an "mjs" extension, or seting "type"="module" in your package.json'
'You can try renaming your file with an "mjs" extension, or setting "type"="module" in your package.json'
)
} else {
messages.push('Try setting "type"="module" in your package.json')
Expand Down
12 changes: 6 additions & 6 deletions src/themes/default/helpers/indefiniteArticle.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ module.exports = function (phrase, _options) {
else return 'an'

var l_word = word.toLowerCase()
// Specific start of words that should be preceeded by 'an'
// Specific start of words that should be preceded by 'an'
var alt_cases = ['honest', 'hour', 'hono']
for (var i in alt_cases) {
if (l_word.indexOf(alt_cases[i]) == 0) return 'an'
}

// Single letter word which should be preceeded by 'an'
// Single letter word which should be preceded by 'an'
if (l_word.length == 1) {
if ('aedhilmnorsx'.indexOf(l_word) >= 0) return 'an'
else return 'a'
}

// Capital words which should likely be preceeded by 'an'
// Capital words which should likely be preceded by 'an'
if (
word.match(
/(?!FJO|[HLMNS]Y.|RY[EO]|SQU|(F[LR]?|[HL]|MN?|N|RH?|S[CHKLMNPTVW]?|X(YL)?)[AEIOU])[FHLMNRSX][A-Z]/
Expand All @@ -30,7 +30,7 @@ module.exports = function (phrase, _options) {
return 'an'
}

// Special cases where a word that begins with a vowel should be preceeded by 'a'
// Special cases where a word that begins with a vowel should be preceded by 'a'
const regexes = [
/^e[uw]/,
/^onc?e\b/,
Expand All @@ -49,10 +49,10 @@ module.exports = function (phrase, _options) {
else return 'a'
}

// Basic method of words that begin with a vowel being preceeded by 'an'
// Basic method of words that begin with a vowel being preceded by 'an'
if ('aeiou'.indexOf(l_word[0]) >= 0) return 'an'

// Instances where y follwed by specific letters is preceeded by 'an'
// Instances where y followed by specific letters is preceded by 'an'
if (l_word.match(/^y(b[lor]|cl[ea]|fere|gg|p[ios]|rou|tt)/)) return 'an'

return 'a'
Expand Down
2 changes: 1 addition & 1 deletion src/themes/default/helpers/md.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { markdown } from '../../../lib/common'
* @param {string} `value` the markdown-formatted text
* @param {boolean} `options.hash.stripParagraph` the marked-md-renderer wraps generated HTML in a <p>-tag by default.
* If this options is set to true, the <p>-tag is stripped.
* @returns {Handlebars.SafeString} a Handlebars-SafeString containing the provieded
* @returns {Handlebars.SafeString} a Handlebars-SafeString containing the provided
* markdown, rendered as HTML.
*/
module.exports = function (value, options) {
Expand Down
2 changes: 1 addition & 1 deletion src/themes/default/stylesheets/custom.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The default theme will put nothing in here, but it will be imported in
// "main.scss", allowing users to specify it in their custom theme to adjust the
// deafult theme without losing updates to the "core" SCSS.
// default theme without losing updates to the "core" SCSS.

// You can override variables and styles in your custom.scss file. All support
// variables are shown below.
Expand Down
2 changes: 1 addition & 1 deletion test/src/spectaql/augmenters.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ describe('augmenters', function () {
.to.be.an('object')
.that.does.have.any.keys('example')

// No top-level examples, even if ther was something in the metadata for them
// No top-level examples, even if there was something in the metadata for them
expect($.introspectionManipulator.getType({ name: 'Query' }))
.to.be.an('object')
.that.does.not.have.any.keys('example')
Expand Down
Loading