-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
76 changed files
with
8,615 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
displayName: 'docusaurus-e2e', | ||
preset: '../../jest.preset.js', | ||
coverageDirectory: '../../coverage/apps/docusaurus-e2e', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "docusaurus-e2e", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"projectType": "application", | ||
"sourceRoot": "e2e/docusaurus-e2e/src", | ||
"targets": { | ||
"e2e": { | ||
"executor": "@nx/jest:jest", | ||
"options": { | ||
"jestConfig": "e2e/docusaurus-e2e/jest.config.ts", | ||
"runInBand": true, | ||
"passWithNoTests": false | ||
}, | ||
"dependsOn": ["docusaurus:build"] | ||
} | ||
}, | ||
"tags": [], | ||
"implicitDependencies": ["docusaurus"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ensureNxProject, installDeps } from '../../utils/workspace' | ||
import { runNxCommandAsync } from '../../utils/run-nx-command-async' | ||
import { checkFilesExist, rmDist } from '@nx/plugin/testing' | ||
|
||
describe('(e2e) docusaurus', () => { | ||
beforeAll(() => ensureNxProject([ | ||
'@nx-extend/core:dist/packages/core', | ||
'@nx-extend/docusaurus:dist/packages/docusaurus' | ||
])) | ||
|
||
const appName = 'test-docusaurus' | ||
|
||
it('should be able to generate', async () => { | ||
await runNxCommandAsync(`generate @nx-extend/docusaurus:app ${appName}`) | ||
installDeps() | ||
|
||
expect(() => checkFilesExist( | ||
`${appName}/docusaurus.config.ts` | ||
)).not.toThrow() | ||
}) | ||
|
||
it('should be able to build', async () => { | ||
rmDist() | ||
await runNxCommandAsync(`build ${appName}`) | ||
|
||
expect(() => checkFilesExist( | ||
`dist/${appName}/index.html`, | ||
`dist/${appName}/sitemap.xml` | ||
)).not.toThrow() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"types": ["node", "jest"] | ||
}, | ||
"include": [], | ||
"files": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"module": "commonjs", | ||
"types": ["jest", "node"] | ||
}, | ||
"include": ["**/*.spec.ts", "**/*.d.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
|
||
"files": [], | ||
"include": [], | ||
"references": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"extends": "../../.eslintrc.json", | ||
"ignorePatterns": [ | ||
"!**/*" | ||
], | ||
"rules": {}, | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"*.ts", | ||
"*.tsx", | ||
"*.js", | ||
"*.jsx" | ||
], | ||
"parserOptions": { | ||
"project": [ | ||
"packages/docusaurus/tsconfig.*?.json" | ||
] | ||
}, | ||
"rules": {} | ||
}, | ||
{ | ||
"files": [ | ||
"*.ts", | ||
"*.tsx" | ||
], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": [ | ||
"*.js", | ||
"*.jsx" | ||
], | ||
"rules": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Changelog | ||
|
||
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# @nx-extend/docusaurus | ||
|
||
<a href="https://www.npmjs.com/package/@nx-extend/docusaurus" rel="nofollow"> | ||
<img src="https://badgen.net/npm/v/@nx-extend/docusaurus" alt="@nx-extend/docusaurus NPM package"> | ||
</a> | ||
|
||
**Nx plugin for working with [docusaurus](https://docusaurus.io/)**. | ||
|
||
## This was originally build by [nx-plus](https://github.com/ZachJW34/nx-plus) | ||
|
||
## Contents | ||
|
||
- [Prerequisite](#prerequisite) | ||
- [Getting Started](#getting-started) | ||
- [Schematics (i.e. code generation)](#schematics-ie-code-generation) | ||
- [Builders (i.e. task runners)](#builders-ie-task-runners) | ||
- [Troubleshooting](#troubleshooting) | ||
|
||
## Getting Started | ||
|
||
### Install Plugin | ||
|
||
``` | ||
# npm | ||
npm install @extend/docusaurus --save-dev | ||
# yarn | ||
yarn add @extend/docusaurus --dev | ||
``` | ||
|
||
### Generate Your App | ||
|
||
``` | ||
nx g @nx-extend/docusaurus:app my-app | ||
``` | ||
|
||
### Serve Your App | ||
|
||
``` | ||
nx serve my-app | ||
``` | ||
|
||
## Schematics (i.e. code generation) | ||
|
||
### Application | ||
|
||
`nx g @nx-extend/docusaurus:app <name> [options]` | ||
|
||
| Arguments | Description | | ||
| --------- | --------------------- | | ||
| `<name>` | The name of your app. | | ||
|
||
| Options | Default | Description | | ||
| -------------- | ------- | ------------------------------------------ | | ||
| `--tags` | - | Tags to use for linting (comma-delimited). | | ||
| `--directory` | `apps` | A directory where the project is placed. | | ||
| `--skipFormat` | `false` | Skip formatting files. | | ||
|
||
## Builders (i.e. task runners) | ||
|
||
### Dev Server | ||
|
||
`nx serve <name> [options]` | ||
|
||
| Arguments | Description | | ||
| --------- | --------------------- | | ||
| `<name>` | The name of your app. | | ||
|
||
| Options | Default | Description | | ||
| ----------- | ----------- | ---------------------------------------------------- | | ||
| `--port` | `3000` | Use specified port. | | ||
| `--host` | `localhost` | Use specified host. | | ||
| `--hotOnly` | `false` | Do not fallback to page refresh if hot reload fails. | | ||
| `--open` | `false` | Open page in the browser. | | ||
|
||
### Browser | ||
|
||
`nx build <name> [options]` | ||
|
||
| Arguments | Description | | ||
| --------- | --------------------- | | ||
| `<name>` | The name of your app. | | ||
|
||
| Options | Default | Description | | ||
| ------------------ | ------- | ------------------------------------------------------------------------------ | | ||
| `--bundleAnalyzer` | `false` | Visualize size of webpack output files with an interactive zoomable treemap. | | ||
| `--outputPath` | - | The full path for the new output directory, relative to the current workspace. | | ||
| `--minify` | `true` | Build website minimizing JS bundles. | | ||
|
||
## Troubleshooting | ||
|
||
If you encounter this error while building a Docusaurus app, then you may need to add a `terser` resolution to your `package.json`. Note: this only works with Yarn and not npm. | ||
|
||
**Error:** | ||
|
||
``` | ||
Docusaurus user: you probably have this known error due to using a monorepo/workspace. | ||
We have a workaround for you, check https://github.com/facebook/docusaurus/issues/3515 | ||
``` | ||
|
||
**package.json:** | ||
|
||
``` | ||
{ | ||
// ... | ||
"resolutions": { | ||
"terser": "^4.0.0" | ||
} | ||
// ... | ||
} | ||
``` | ||
|
||
Once this has been updated, you should be able to run `yarn install` and then build your Docusaurus application. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"$schema": "https://json-schema.org/schema", | ||
"executors": { | ||
"browser": { | ||
"implementation": "./src/executors/browser/executor", | ||
"schema": "./src/executors/browser/schema.json", | ||
"description": "browser executor" | ||
}, | ||
"dev-server": { | ||
"implementation": "./src/executors/dev-server/executor", | ||
"schema": "./src/executors/dev-server/schema.json", | ||
"description": "serve executor" | ||
} | ||
}, | ||
"builders": { | ||
"build": { | ||
"implementation": "./src/executors/browser/compat", | ||
"schema": "./src/executors/browser/schema.json", | ||
"description": "browser builder" | ||
}, | ||
"dev-server": { | ||
"implementation": "./src/executors/dev-server/compat", | ||
"schema": "./src/executors/dev-server/schema.json", | ||
"description": "dev-server builder" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"$schema": "https://json-schema.org/schema", | ||
"name": "docusaurus", | ||
"version": "0.0.1", | ||
"generators": { | ||
"application": { | ||
"factory": "./src/generators/application/generator#applicationGenerator", | ||
"schema": "./src/generators/application/schema.json", | ||
"description": "application generator", | ||
"aliases": ["app"] | ||
} | ||
}, | ||
"schematics": { | ||
"application": { | ||
"factory": "./src/generators/application/generator#applicationSchematic", | ||
"schema": "./src/generators/application/schema.json", | ||
"description": "application schematic", | ||
"aliases": ["app"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* eslint-disable */ | ||
export default { | ||
displayName: 'docusaurus', | ||
preset: '../../jest.preset.js', | ||
globals: {}, | ||
transform: { | ||
'^.+\\.[tj]sx?$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }] | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], | ||
coverageDirectory: '../../coverage/packages/docusaurus', | ||
testEnvironment: 'node' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "@nx-extend/docusaurus", | ||
"version": "0.0.1", | ||
"keywords": [ | ||
"nx", | ||
"docusaurus" | ||
], | ||
"homepage": "https://github.com/TriPSs/nx-extend/blob/master/packages/docusaurus/README.md", | ||
"bugs": { | ||
"url": "https://github.com/tripss/nx-extend/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/tripss/nx-extend" | ||
}, | ||
"license": "MIT", | ||
"main": "src/index.js", | ||
"builders": "./executors.json", | ||
"generators": "./generators.json", | ||
"dependencies": { | ||
"@docusaurus/core": "3.4.0", | ||
"@docusaurus/preset-classic": "3.4.0", | ||
"@mdx-js/react": "^3.0.0", | ||
"clsx": "^2.0.0", | ||
"prism-react-renderer": "^2.3.0", | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0" | ||
}, | ||
"devDependencies": { | ||
"@docusaurus/module-type-aliases": "3.4.0", | ||
"@docusaurus/tsconfig": "3.4.0", | ||
"@docusaurus/types": "3.4.0", | ||
"typescript": "~5.2.2" | ||
} | ||
} |
Oops, something went wrong.