From b4f84750b6e86e66ad02469b5cf35d9cf53306ad Mon Sep 17 00:00:00 2001 From: Pokey Rule <755842+pokey@users.noreply.github.com> Date: Wed, 6 Jul 2022 15:06:19 +0100 Subject: [PATCH 1/9] Cheatsheet nx html generation --- .github/workflows/deploy.yaml | 6 + .gitignore | 2 +- cursorless-nx/.eslintrc.json | 35 + cursorless-nx/.gitignore | 39 + cursorless-nx/.prettierignore | 4 + cursorless-nx/.prettierrc | 3 + cursorless-nx/.vscode/extensions.json | 8 + cursorless-nx/README.md | 90 + cursorless-nx/apps/.gitkeep | 0 .../apps/cheatsheet-local-e2e/.eslintrc.json | 17 + .../apps/cheatsheet-local-e2e/cypress.json | 12 + .../apps/cheatsheet-local-e2e/project.json | 28 + .../src/fixtures/example.json | 4 + .../src/integration/app.spec.ts | 13 + .../src/support/app.po.ts | 1 + .../src/support/commands.ts | 33 + .../cheatsheet-local-e2e/src/support/index.ts | 17 + .../apps/cheatsheet-local-e2e/tsconfig.json | 10 + cursorless-nx/apps/cheatsheet-local/.babelrc | 11 + .../apps/cheatsheet-local/.browserslistrc | 16 + .../apps/cheatsheet-local/.eslintrc.json | 18 + .../cheatsheet-local/custom-webpack.config.js | 23 + .../apps/cheatsheet-local/jest.config.ts | 10 + .../apps/cheatsheet-local/postcss.config.js | 10 + .../apps/cheatsheet-local/project.json | 85 + .../cheatsheet-local/src/app/app.module.scss | 1 + .../cheatsheet-local/src/app/app.spec.tsx | 17 + .../apps/cheatsheet-local/src/app/app.tsx | 22 + .../cheatsheet-local/src/app/nx-welcome.tsx | 820 + .../apps/cheatsheet-local/src/assets/.gitkeep | 0 .../src/environments/environment.prod.ts | 3 + .../src/environments/environment.ts | 6 + .../apps/cheatsheet-local/src/favicon.ico | Bin 0 -> 15086 bytes .../apps/cheatsheet-local/src/index.html | 14 + .../apps/cheatsheet-local/src/main.tsx | 13 + .../apps/cheatsheet-local/src/polyfills.ts | 7 + .../apps/cheatsheet-local/src/styles.scss | 4 + .../apps/cheatsheet-local/stats.json | 0 .../apps/cheatsheet-local/tailwind.config.js | 14 + .../apps/cheatsheet-local/tsconfig.app.json | 23 + .../apps/cheatsheet-local/tsconfig.json | 25 + .../apps/cheatsheet-local/tsconfig.spec.json | 24 + cursorless-nx/babel.config.json | 3 + cursorless-nx/jest.config.ts | 5 + cursorless-nx/jest.preset.js | 3 + cursorless-nx/libs/.gitkeep | 0 cursorless-nx/libs/cheatsheet/.babelrc | 12 + cursorless-nx/libs/cheatsheet/.eslintrc.json | 18 + cursorless-nx/libs/cheatsheet/README.md | 7 + cursorless-nx/libs/cheatsheet/jest.config.ts | 9 + cursorless-nx/libs/cheatsheet/project.json | 23 + cursorless-nx/libs/cheatsheet/src/index.ts | 2 + .../cheatsheet/src/lib/CheatsheetInfo.tsx | 18 + .../cheatsheet/src/lib/cheatsheet.module.scss | 7 + .../cheatsheet/src/lib/cheatsheet.spec.tsx | 10 + .../libs/cheatsheet/src/lib/cheatsheet.tsx | 77 + .../cheatsheet/src/lib/cheatsheetLegend.tsx | 35 + .../components/CheatsheetLegendComponent.tsx | 56 + .../components/CheatsheetListComponent.tsx | 64 + .../components/CheatsheetNotesComponent.tsx | 24 + .../src/lib/components/SmartLink.tsx | 29 + .../src/lib/data/cheatsheet/defaults.json | 1278 + .../src/lib/hooks/useIsHighlighted.ts | 15 + cursorless-nx/libs/cheatsheet/tsconfig.json | 25 + .../libs/cheatsheet/tsconfig.lib.json | 23 + .../libs/cheatsheet/tsconfig.spec.json | 20 + cursorless-nx/migrations.json | 68 + cursorless-nx/nx.json | 45 + cursorless-nx/package-lock.json | 35419 ++++++++++++++++ cursorless-nx/package.json | 63 + cursorless-nx/tools/generators/.gitkeep | 0 cursorless-nx/tools/tsconfig.tools.json | 12 + cursorless-nx/tsconfig.base.json | 23 + cursorless-nx/workspace.json | 9 + tsconfig.json | 8 +- 75 files changed, 38896 insertions(+), 2 deletions(-) create mode 100644 cursorless-nx/.eslintrc.json create mode 100644 cursorless-nx/.gitignore create mode 100644 cursorless-nx/.prettierignore create mode 100644 cursorless-nx/.prettierrc create mode 100644 cursorless-nx/.vscode/extensions.json create mode 100644 cursorless-nx/README.md create mode 100644 cursorless-nx/apps/.gitkeep create mode 100644 cursorless-nx/apps/cheatsheet-local-e2e/.eslintrc.json create mode 100644 cursorless-nx/apps/cheatsheet-local-e2e/cypress.json create mode 100644 cursorless-nx/apps/cheatsheet-local-e2e/project.json create mode 100644 cursorless-nx/apps/cheatsheet-local-e2e/src/fixtures/example.json create mode 100644 cursorless-nx/apps/cheatsheet-local-e2e/src/integration/app.spec.ts create mode 100644 cursorless-nx/apps/cheatsheet-local-e2e/src/support/app.po.ts create mode 100644 cursorless-nx/apps/cheatsheet-local-e2e/src/support/commands.ts create mode 100644 cursorless-nx/apps/cheatsheet-local-e2e/src/support/index.ts create mode 100644 cursorless-nx/apps/cheatsheet-local-e2e/tsconfig.json create mode 100644 cursorless-nx/apps/cheatsheet-local/.babelrc create mode 100644 cursorless-nx/apps/cheatsheet-local/.browserslistrc create mode 100644 cursorless-nx/apps/cheatsheet-local/.eslintrc.json create mode 100644 cursorless-nx/apps/cheatsheet-local/custom-webpack.config.js create mode 100644 cursorless-nx/apps/cheatsheet-local/jest.config.ts create mode 100644 cursorless-nx/apps/cheatsheet-local/postcss.config.js create mode 100644 cursorless-nx/apps/cheatsheet-local/project.json create mode 100644 cursorless-nx/apps/cheatsheet-local/src/app/app.module.scss create mode 100644 cursorless-nx/apps/cheatsheet-local/src/app/app.spec.tsx create mode 100644 cursorless-nx/apps/cheatsheet-local/src/app/app.tsx create mode 100644 cursorless-nx/apps/cheatsheet-local/src/app/nx-welcome.tsx create mode 100644 cursorless-nx/apps/cheatsheet-local/src/assets/.gitkeep create mode 100644 cursorless-nx/apps/cheatsheet-local/src/environments/environment.prod.ts create mode 100644 cursorless-nx/apps/cheatsheet-local/src/environments/environment.ts create mode 100644 cursorless-nx/apps/cheatsheet-local/src/favicon.ico create mode 100644 cursorless-nx/apps/cheatsheet-local/src/index.html create mode 100644 cursorless-nx/apps/cheatsheet-local/src/main.tsx create mode 100644 cursorless-nx/apps/cheatsheet-local/src/polyfills.ts create mode 100644 cursorless-nx/apps/cheatsheet-local/src/styles.scss create mode 100644 cursorless-nx/apps/cheatsheet-local/stats.json create mode 100644 cursorless-nx/apps/cheatsheet-local/tailwind.config.js create mode 100644 cursorless-nx/apps/cheatsheet-local/tsconfig.app.json create mode 100644 cursorless-nx/apps/cheatsheet-local/tsconfig.json create mode 100644 cursorless-nx/apps/cheatsheet-local/tsconfig.spec.json create mode 100644 cursorless-nx/babel.config.json create mode 100644 cursorless-nx/jest.config.ts create mode 100644 cursorless-nx/jest.preset.js create mode 100644 cursorless-nx/libs/.gitkeep create mode 100644 cursorless-nx/libs/cheatsheet/.babelrc create mode 100644 cursorless-nx/libs/cheatsheet/.eslintrc.json create mode 100644 cursorless-nx/libs/cheatsheet/README.md create mode 100644 cursorless-nx/libs/cheatsheet/jest.config.ts create mode 100644 cursorless-nx/libs/cheatsheet/project.json create mode 100644 cursorless-nx/libs/cheatsheet/src/index.ts create mode 100644 cursorless-nx/libs/cheatsheet/src/lib/CheatsheetInfo.tsx create mode 100644 cursorless-nx/libs/cheatsheet/src/lib/cheatsheet.module.scss create mode 100644 cursorless-nx/libs/cheatsheet/src/lib/cheatsheet.spec.tsx create mode 100644 cursorless-nx/libs/cheatsheet/src/lib/cheatsheet.tsx create mode 100644 cursorless-nx/libs/cheatsheet/src/lib/cheatsheetLegend.tsx create mode 100644 cursorless-nx/libs/cheatsheet/src/lib/components/CheatsheetLegendComponent.tsx create mode 100644 cursorless-nx/libs/cheatsheet/src/lib/components/CheatsheetListComponent.tsx create mode 100644 cursorless-nx/libs/cheatsheet/src/lib/components/CheatsheetNotesComponent.tsx create mode 100644 cursorless-nx/libs/cheatsheet/src/lib/components/SmartLink.tsx create mode 100644 cursorless-nx/libs/cheatsheet/src/lib/data/cheatsheet/defaults.json create mode 100644 cursorless-nx/libs/cheatsheet/src/lib/hooks/useIsHighlighted.ts create mode 100644 cursorless-nx/libs/cheatsheet/tsconfig.json create mode 100644 cursorless-nx/libs/cheatsheet/tsconfig.lib.json create mode 100644 cursorless-nx/libs/cheatsheet/tsconfig.spec.json create mode 100644 cursorless-nx/migrations.json create mode 100644 cursorless-nx/nx.json create mode 100644 cursorless-nx/package-lock.json create mode 100644 cursorless-nx/package.json create mode 100644 cursorless-nx/tools/generators/.gitkeep create mode 100644 cursorless-nx/tools/tsconfig.tools.json create mode 100644 cursorless-nx/tsconfig.base.json create mode 100644 cursorless-nx/workspace.json diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index e699dc5e57..25db8ccc9d 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -22,6 +22,12 @@ jobs: - run: yarn install --frozen-lockfile - run: yarn run compile - run: yarn run prepare-for-extension-publish + - name: Initialize cursorless-nx subdir + run: npm install + working-directory: cursorless-nx + - name: Build cheatsheet html + run: nx build cheatsheet-local + working-directory: cursorless-nx - name: Publish to Open VSX Registry uses: HaaLeo/publish-vscode-extension@v1 id: publishToOpenVSX diff --git a/.gitignore b/.gitignore index 5cf8d1026b..d82ea583f8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ dist node_modules .vscode-test/ *.vsix -package-lock.json +/package-lock.json *.DS_Store # TypeDoc output diff --git a/cursorless-nx/.eslintrc.json b/cursorless-nx/.eslintrc.json new file mode 100644 index 0000000000..7c7781db1c --- /dev/null +++ b/cursorless-nx/.eslintrc.json @@ -0,0 +1,35 @@ +{ + "root": true, + "ignorePatterns": ["**/*"], + "plugins": ["@nrwl/nx"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": { + "@nrwl/nx/enforce-module-boundaries": [ + "error", + { + "enforceBuildableLibDependency": true, + "allow": [], + "depConstraints": [ + { + "sourceTag": "*", + "onlyDependOnLibsWithTags": ["*"] + } + ] + } + ] + } + }, + { + "files": ["*.ts", "*.tsx"], + "extends": ["plugin:@nrwl/nx/typescript"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "extends": ["plugin:@nrwl/nx/javascript"], + "rules": {} + } + ] +} diff --git a/cursorless-nx/.gitignore b/cursorless-nx/.gitignore new file mode 100644 index 0000000000..f5a5e0b5a2 --- /dev/null +++ b/cursorless-nx/.gitignore @@ -0,0 +1,39 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. + +# compiled output +/dist +/tmp +/out-tsc + +# dependencies +node_modules + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +# misc +/.sass-cache +/connect.lock +/coverage +/libpeerconnection.log +npm-debug.log +yarn-error.log +testem.log +/typings + +# System Files +.DS_Store +Thumbs.db diff --git a/cursorless-nx/.prettierignore b/cursorless-nx/.prettierignore new file mode 100644 index 0000000000..d0b804da2a --- /dev/null +++ b/cursorless-nx/.prettierignore @@ -0,0 +1,4 @@ +# Add files here to ignore them from prettier formatting + +/dist +/coverage diff --git a/cursorless-nx/.prettierrc b/cursorless-nx/.prettierrc new file mode 100644 index 0000000000..544138be45 --- /dev/null +++ b/cursorless-nx/.prettierrc @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} diff --git a/cursorless-nx/.vscode/extensions.json b/cursorless-nx/.vscode/extensions.json new file mode 100644 index 0000000000..9b64338e91 --- /dev/null +++ b/cursorless-nx/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "nrwl.angular-console", + "esbenp.prettier-vscode", + "firsttris.vscode-jest-runner", + "dbaeumer.vscode-eslint" + ] +} diff --git a/cursorless-nx/README.md b/cursorless-nx/README.md new file mode 100644 index 0000000000..60889cc24b --- /dev/null +++ b/cursorless-nx/README.md @@ -0,0 +1,90 @@ +# Cursorless + +This project was generated using [Nx](https://nx.dev). + +

+ +🔎 **Smart, Fast and Extensible Build System** + +## Adding capabilities to your workspace + +Nx supports many plugins which add capabilities for developing different types of applications and different tools. + +These capabilities include generating applications, libraries, etc as well as the devtools to test, and build projects as well. + +Below are our core plugins: + +- [React](https://reactjs.org) + - `npm install --save-dev @nrwl/react` +- Web (no framework frontends) + - `npm install --save-dev @nrwl/web` +- [Angular](https://angular.io) + - `npm install --save-dev @nrwl/angular` +- [Nest](https://nestjs.com) + - `npm install --save-dev @nrwl/nest` +- [Express](https://expressjs.com) + - `npm install --save-dev @nrwl/express` +- [Node](https://nodejs.org) + - `npm install --save-dev @nrwl/node` + +There are also many [community plugins](https://nx.dev/community) you could add. + +## Generate an application + +Run `nx g @nrwl/react:app my-app` to generate an application. + +> You can use any of the plugins above to generate applications as well. + +When using Nx, you can create multiple applications and libraries in the same workspace. + +## Generate a library + +Run `nx g @nrwl/react:lib my-lib` to generate a library. + +> You can also use any of the plugins above to generate libraries as well. + +Libraries are shareable across libraries and applications. They can be imported from `@cursorless/mylib`. + +## Development server + +Run `nx serve my-app` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files. + +## Code scaffolding + +Run `nx g @nrwl/react:component my-component --project=my-app` to generate a new component. + +## Build + +Run `nx build my-app` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. + +## Running unit tests + +Run `nx test my-app` to execute the unit tests via [Jest](https://jestjs.io). + +Run `nx affected:test` to execute the unit tests affected by a change. + +## Running end-to-end tests + +Run `nx e2e my-app` to execute the end-to-end tests via [Cypress](https://www.cypress.io). + +Run `nx affected:e2e` to execute the end-to-end tests affected by a change. + +## Understand your workspace + +Run `nx graph` to see a diagram of the dependencies of your projects. + +## Further help + +Visit the [Nx Documentation](https://nx.dev) to learn more. + +## ☁ Nx Cloud + +### Distributed Computation Caching & Distributed Task Execution + +

+ +Nx Cloud pairs with Nx in order to enable you to build and test code more rapidly, by up to 10 times. Even teams that are new to Nx can connect to Nx Cloud and start saving time instantly. + +Teams using Nx gain the advantage of building full-stack applications with their preferred framework alongside Nx’s advanced code generation and project dependency graph, plus a unified experience for both frontend and backend developers. + +Visit [Nx Cloud](https://nx.app/) to learn more. diff --git a/cursorless-nx/apps/.gitkeep b/cursorless-nx/apps/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cursorless-nx/apps/cheatsheet-local-e2e/.eslintrc.json b/cursorless-nx/apps/cheatsheet-local-e2e/.eslintrc.json new file mode 100644 index 0000000000..0c7e38a623 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local-e2e/.eslintrc.json @@ -0,0 +1,17 @@ +{ + "extends": ["plugin:cypress/recommended", "../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["src/plugins/index.js"], + "rules": { + "@typescript-eslint/no-var-requires": "off", + "no-undef": "off" + } + } + ] +} diff --git a/cursorless-nx/apps/cheatsheet-local-e2e/cypress.json b/cursorless-nx/apps/cheatsheet-local-e2e/cypress.json new file mode 100644 index 0000000000..0727832a9d --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local-e2e/cypress.json @@ -0,0 +1,12 @@ +{ + "fileServerFolder": ".", + "fixturesFolder": "./src/fixtures", + "integrationFolder": "./src/integration", + "modifyObstructiveCode": false, + "supportFile": "./src/support/index.ts", + "pluginsFile": false, + "video": true, + "videosFolder": "../../dist/cypress/apps/cheatsheet-local-e2e/videos", + "screenshotsFolder": "../../dist/cypress/apps/cheatsheet-local-e2e/screenshots", + "chromeWebSecurity": false +} diff --git a/cursorless-nx/apps/cheatsheet-local-e2e/project.json b/cursorless-nx/apps/cheatsheet-local-e2e/project.json new file mode 100644 index 0000000000..f422c2f781 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local-e2e/project.json @@ -0,0 +1,28 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "apps/cheatsheet-local-e2e/src", + "projectType": "application", + "targets": { + "e2e": { + "executor": "@nrwl/cypress:cypress", + "options": { + "cypressConfig": "apps/cheatsheet-local-e2e/cypress.json", + "devServerTarget": "cheatsheet-local:serve:development" + }, + "configurations": { + "production": { + "devServerTarget": "cheatsheet-local:serve:production" + } + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["apps/cheatsheet-local-e2e/**/*.{js,ts}"] + } + } + }, + "tags": [], + "implicitDependencies": ["cheatsheet-local"] +} diff --git a/cursorless-nx/apps/cheatsheet-local-e2e/src/fixtures/example.json b/cursorless-nx/apps/cheatsheet-local-e2e/src/fixtures/example.json new file mode 100644 index 0000000000..a081b851b2 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local-e2e/src/fixtures/example.json @@ -0,0 +1,4 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io" +} diff --git a/cursorless-nx/apps/cheatsheet-local-e2e/src/integration/app.spec.ts b/cursorless-nx/apps/cheatsheet-local-e2e/src/integration/app.spec.ts new file mode 100644 index 0000000000..ffecbe0a85 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local-e2e/src/integration/app.spec.ts @@ -0,0 +1,13 @@ +import { getGreeting } from '../support/app.po'; + +describe('cheatsheet-local', () => { + beforeEach(() => cy.visit('/')); + + it('should display welcome message', () => { + // Custom command example, see `../support/commands.ts` file + cy.login('my-email@something.com', 'myPassword'); + + // Function helper example, see `../support/app.po.ts` file + getGreeting().contains('Welcome cheatsheet-local'); + }); +}); diff --git a/cursorless-nx/apps/cheatsheet-local-e2e/src/support/app.po.ts b/cursorless-nx/apps/cheatsheet-local-e2e/src/support/app.po.ts new file mode 100644 index 0000000000..3293424696 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local-e2e/src/support/app.po.ts @@ -0,0 +1 @@ +export const getGreeting = () => cy.get('h1'); diff --git a/cursorless-nx/apps/cheatsheet-local-e2e/src/support/commands.ts b/cursorless-nx/apps/cheatsheet-local-e2e/src/support/commands.ts new file mode 100644 index 0000000000..310f1fa0e0 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local-e2e/src/support/commands.ts @@ -0,0 +1,33 @@ +// *********************************************** +// This example commands.js shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** + +// eslint-disable-next-line @typescript-eslint/no-namespace +declare namespace Cypress { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + interface Chainable { + login(email: string, password: string): void; + } +} +// +// -- This is a parent command -- +Cypress.Commands.add('login', (email, password) => { + console.log('Custom command example: Login', email, password); +}); +// +// -- This is a child command -- +// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) diff --git a/cursorless-nx/apps/cheatsheet-local-e2e/src/support/index.ts b/cursorless-nx/apps/cheatsheet-local-e2e/src/support/index.ts new file mode 100644 index 0000000000..3d469a6b6c --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local-e2e/src/support/index.ts @@ -0,0 +1,17 @@ +// *********************************************************** +// This example support/index.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands'; diff --git a/cursorless-nx/apps/cheatsheet-local-e2e/tsconfig.json b/cursorless-nx/apps/cheatsheet-local-e2e/tsconfig.json new file mode 100644 index 0000000000..cb630f21b7 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local-e2e/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "sourceMap": false, + "outDir": "../../dist/out-tsc", + "allowJs": true, + "types": ["cypress", "node"] + }, + "include": ["src/**/*.ts", "src/**/*.js"] +} diff --git a/cursorless-nx/apps/cheatsheet-local/.babelrc b/cursorless-nx/apps/cheatsheet-local/.babelrc new file mode 100644 index 0000000000..61641ec8ac --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local/.babelrc @@ -0,0 +1,11 @@ +{ + "presets": [ + [ + "@nrwl/react/babel", + { + "runtime": "automatic" + } + ] + ], + "plugins": [] +} diff --git a/cursorless-nx/apps/cheatsheet-local/.browserslistrc b/cursorless-nx/apps/cheatsheet-local/.browserslistrc new file mode 100644 index 0000000000..83f282df36 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local/.browserslistrc @@ -0,0 +1,16 @@ +# This file is used by: +# 1. autoprefixer to adjust CSS to support the below specified browsers +# 2. babel preset-env to adjust included polyfills +# +# For additional information regarding the format and rule options, please see: +# https://github.com/browserslist/browserslist#queries +# +# If you need to support different browsers in production, you may tweak the list below. + +last 1 Chrome version +last 1 Firefox version +last 2 Edge major versions +last 2 Safari major version +last 2 iOS major versions +Firefox ESR +not IE 9-11 # For IE 9-11 support, remove 'not'. diff --git a/cursorless-nx/apps/cheatsheet-local/.eslintrc.json b/cursorless-nx/apps/cheatsheet-local/.eslintrc.json new file mode 100644 index 0000000000..a6b84a9375 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/cursorless-nx/apps/cheatsheet-local/custom-webpack.config.js b/cursorless-nx/apps/cheatsheet-local/custom-webpack.config.js new file mode 100644 index 0000000000..bb7ebec354 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local/custom-webpack.config.js @@ -0,0 +1,23 @@ +const { merge } = require('webpack-merge'); +const nrwlConfig = require('@nrwl/react/plugins/webpack.js'); // require the main @nrwl/react/plugins/webpack configuration function. + +var HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); + +module.exports = (config, context) => { + nrwlConfig(config); // first call it so that it @nrwl/react plugin adds its configs, + + return merge(config, { + output: { + publicPath: '/', + }, + plugins: [ + new HtmlWebpackPlugin({ + inject: 'body', + template: 'src/index.html', + inlineSource: '.(js|css)$', // embed all javascript and css inline + }), + new HtmlWebpackInlineSourcePlugin(HtmlWebpackPlugin), + ], + }); +}; diff --git a/cursorless-nx/apps/cheatsheet-local/jest.config.ts b/cursorless-nx/apps/cheatsheet-local/jest.config.ts new file mode 100644 index 0000000000..9aa5d99886 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local/jest.config.ts @@ -0,0 +1,10 @@ +export default { + displayName: 'cheatsheet-local', + preset: '../../jest.preset.js', + transform: { + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest', + '^.+\\.[tj]sx?$': 'babel-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../../coverage/apps/cheatsheet-local', +}; diff --git a/cursorless-nx/apps/cheatsheet-local/postcss.config.js b/cursorless-nx/apps/cheatsheet-local/postcss.config.js new file mode 100644 index 0000000000..cbdd9c22c4 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local/postcss.config.js @@ -0,0 +1,10 @@ +const { join } = require('path'); + +module.exports = { + plugins: { + tailwindcss: { + config: join(__dirname, 'tailwind.config.js'), + }, + autoprefixer: {}, + }, +}; diff --git a/cursorless-nx/apps/cheatsheet-local/project.json b/cursorless-nx/apps/cheatsheet-local/project.json new file mode 100644 index 0000000000..e3d65248df --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local/project.json @@ -0,0 +1,85 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "apps/cheatsheet-local/src", + "projectType": "application", + "targets": { + "build": { + "executor": "@nrwl/web:webpack", + "outputs": ["{options.outputPath}"], + "defaultConfiguration": "production", + "options": { + "compiler": "babel", + "outputPath": "../dist/assets/cheatsheet-local", + "index": "apps/cheatsheet-local/src/index.html", + "baseHref": "/", + "main": "apps/cheatsheet-local/src/main.tsx", + "polyfills": "apps/cheatsheet-local/src/polyfills.ts", + "tsConfig": "apps/cheatsheet-local/tsconfig.app.json", + "assets": [ + "apps/cheatsheet-local/src/favicon.ico", + "apps/cheatsheet-local/src/assets" + ], + "styles": ["apps/cheatsheet-local/src/styles.scss"], + "scripts": [] + }, + "configurations": { + "development": { + "extractLicenses": false, + "optimization": false, + "sourceMap": true, + "webpackConfig": "@nrwl/react/plugins/webpack", + "vendorChunk": true + }, + "production": { + "fileReplacements": [ + { + "replace": "apps/cheatsheet-local/src/environments/environment.ts", + "with": "apps/cheatsheet-local/src/environments/environment.prod.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "extractLicenses": true, + "vendorChunk": false, + "generateIndexHtml": false, + "webpackConfig": "apps/cheatsheet-local/custom-webpack.config.js" + } + } + }, + "serve": { + "executor": "@nrwl/web:dev-server", + "defaultConfiguration": "development", + "options": { + "buildTarget": "cheatsheet-local:build", + "hmr": true + }, + "configurations": { + "development": { + "buildTarget": "cheatsheet-local:build:development" + }, + "production": { + "buildTarget": "cheatsheet-local:build:production", + "hmr": false + } + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["apps/cheatsheet-local/**/*.{ts,tsx,js,jsx}"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/apps/cheatsheet-local"], + "options": { + "jestConfig": "apps/cheatsheet-local/jest.config.ts", + "passWithNoTests": true + } + } + }, + "tags": [] +} diff --git a/cursorless-nx/apps/cheatsheet-local/src/app/app.module.scss b/cursorless-nx/apps/cheatsheet-local/src/app/app.module.scss new file mode 100644 index 0000000000..7b88fbabf8 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local/src/app/app.module.scss @@ -0,0 +1 @@ +/* Your styles goes here. */ diff --git a/cursorless-nx/apps/cheatsheet-local/src/app/app.spec.tsx b/cursorless-nx/apps/cheatsheet-local/src/app/app.spec.tsx new file mode 100644 index 0000000000..da5a882a14 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local/src/app/app.spec.tsx @@ -0,0 +1,17 @@ +import { render } from '@testing-library/react'; + +import App from './app'; + +describe('App', () => { + it('should render successfully', () => { + const { baseElement } = render(); + + expect(baseElement).toBeTruthy(); + }); + + it('should have a greeting as the title', () => { + const { getByText } = render(); + + expect(getByText(/Welcome cheatsheet-local/gi)).toBeTruthy(); + }); +}); diff --git a/cursorless-nx/apps/cheatsheet-local/src/app/app.tsx b/cursorless-nx/apps/cheatsheet-local/src/app/app.tsx new file mode 100644 index 0000000000..36a37e02ad --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local/src/app/app.tsx @@ -0,0 +1,22 @@ +import { CheatsheetPage, CheatsheetInfo } from '@cursorless/cheatsheet'; +import { environment } from '../environments/environment'; + +/** + * The data describing the cheatsheet spoken forms. + * + * In production, we rely on a hack where we inject the user's actual + * cheatsheet json into a script tag that places the object on the `document` + * + * In development, we require the default cheatsheet json so we have something + * to look at. We should figure out how to properly respect nx module + * boundaries and use @cursorless/cheatsheet + */ +const cheatsheetData: CheatsheetInfo = environment.production + ? (document as unknown as { cheatsheetData: CheatsheetInfo }).cheatsheetData + : require('libs/cheatsheet/src/lib/data/cheatsheet/defaults.json'); + +export function App() { + return ; +} + +export default App; diff --git a/cursorless-nx/apps/cheatsheet-local/src/app/nx-welcome.tsx b/cursorless-nx/apps/cheatsheet-local/src/app/nx-welcome.tsx new file mode 100644 index 0000000000..6278272a11 --- /dev/null +++ b/cursorless-nx/apps/cheatsheet-local/src/app/nx-welcome.tsx @@ -0,0 +1,820 @@ +/* + * * * * * * * * * * * * * * * * * * * * * * * * * * * * + This is a starter component and can be deleted. + * * * * * * * * * * * * * * * * * * * * * * * * * * * * + Delete this file and get started with your project! + * * * * * * * * * * * * * * * * * * * * * * * * * * * * + */ +export function NxWelcome({ title }: { title: string }) { + return ( + <> +