diff --git a/.vscodeignore b/.vscodeignore index 3d7a835e..b15571b4 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -1,13 +1,26 @@ +## Common +.gitignore + +## Docs +DEV.md + +## VSCode .vscode/** .vscode-test/** vsc-extension-quickstart.md -.gitignore -build/test/** +*.vsix + +## Dev Folders src/** +web-app/** +.env +.prettierrc.js +jest.config.js + +## TypeScript **/tsconfig.json **/tslint.json -**/*.map **/*.ts -web-app/** -typings/** -*.vsix \ No newline at end of file + +## Tests +build/test/** \ No newline at end of file diff --git a/DEV.md b/DEV.md new file mode 100644 index 00000000..1c20810f --- /dev/null +++ b/DEV.md @@ -0,0 +1,64 @@ +# Setup + +## Development + +Run the postgres db and api server. + +Setup the extension environmental variables. + +/src/.env + +``` +LOG=true #show hide debugging logs +``` + +Setup the web app environmental variables. + +/web-app/.env.local + +``` +REACT_APP_DEBUG=true # show/hide web debugger +REACT_APP_GQL_URI=http://localhost:4000/graphql +``` + +Run `npm run build`. Press F5 to open a new development window. + +Open the tutorial using `cmd+shift+p` on mac, and select the action `coderoad.start`. + +## Supported Programming Languages + +To support a new programming language, the test runner needs to support a format called TAP (https://testanything.org/). + +Some test frameworks can be modified to use tap, see a list of TAP reporters: https://github.com/sindresorhus/awesome-tap#reporters. + +### JavaScript + +##### Jest + +```json +{ + "scripts": { + "test": "jest" + }, + "devDependencies": { + "jest-tap-reporter": "1.9.0" + }, + "jest": { + "reporters": ["jest-tap-reporter"] + } +} +``` + +## Install Extension Demo + +1. Copy the `CodeRoad.vsix` file locally +2. Select the extensions logo from the left hand panel +3. In the top right of the panel, select the three dots “more” dropdown. + 1. Choose “Install from VSIX…” + 2. Select the `CodeRoad.vsix` file and press “Install” +4. Reload the VSCode editor (Ctrl/Cmd + Shift + P, run "Reload Window") +5. Open up a new folder directory in VSCode and run the extension `coderoad:start` + +## Known Issues + +There are no known issues at this time. diff --git a/README.md b/README.md index 6cf30bdb..9753e55b 100644 --- a/README.md +++ b/README.md @@ -12,66 +12,7 @@ Requires: - Git - Node 10+ -## Development +## Run -Run the postgres db and api server. - -Setup the extension environmental variables. - -/src/.env - -``` -LOG=true #show hide debugging logs -``` - -Setup the web app environmental variables. - -/web-app/.env.local - -``` -REACT_APP_DEBUG=true # show/hide web debugger -REACT_APP_GQL_URI=http://localhost:4000/graphql -REACT_APP_GQL_AUTH_TOKEN={YOUR_API_AUTH_TOKEN} -``` - -Run `npm run build`. Press F5 to open a new development window. - -Open the tutorial using `cmd+shift+p` on mac, and select the action `coderoad.start`. - -## Extension Settings - -Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. - -For example: - -This extension contributes the following settings: - -- `coderoad.start`: starts the extension - -## Supported Programming Languages - -To support a new programming language, the test runner needs to support a format called TAP (https://testanything.org/). - -Some test frameworks can be modified to use tap, see a list of TAP reporters: https://github.com/sindresorhus/awesome-tap#reporters. - -### JavaScript - -##### Jest - -```json -{ - "scripts": { - "test": "jest" - }, - "devDependencies": { - "jest-tap-reporter": "1.9.0" - }, - "jest": { - "reporters": ["jest-tap-reporter"] - } -} -``` - -## Known Issues - -There are no known issues at this time. +1. Open the command prompt: `cmd/ctrl + shift + p` +2. Search for and run `coderoad:start` diff --git a/package-lock.json b/package-lock.json index da164da1..648f7004 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,6 +45,7 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/@types/chokidar/-/chokidar-2.1.3.tgz", "integrity": "sha512-6qK3xoLLAhQVTucQGHTySwOVA1crHRXnJeLwqK6KIFkkKa2aoMFXh+WEi8PotxDtvN6MQJLyYN9ag9P6NLV81w==", + "dev": true, "requires": { "chokidar": "*" } diff --git a/package.json b/package.json index 018a4fb3..4357bbbb 100644 --- a/package.json +++ b/package.json @@ -17,10 +17,10 @@ }, "main": "./build/extension.js", "scripts": { - "build": "rm -rf build && concurrently \"npm run build:ext\" \"npm run build:web\"", - "build:ext": "npm run compile", + "build": "rm -rf build && npm run build:ext && npm run build:web", + "build:ext": "tsc -p ./", "build:web": "cd web-app && npm run build", - "compile": "tsc -p ./", + "postbuild:web": "cp -R ./web-app/build/ ./build/", "postinstall": "node ./node_modules/vscode/bin/install", "lint": "eslint src/**/*ts", "machine": "node ./out/state/index.js", @@ -31,12 +31,13 @@ "watch": "tsc -watch -p ./" }, "dependencies": { - "@types/chokidar": "^2.1.3", "chokidar": "^3.3.0", + "dotenv": "^8.2.0", "jsdom": "^15.2.1" }, "devDependencies": { "@types/assert": "^1.4.3", + "@types/chokidar": "^2.1.3", "@types/dotenv": "^8.2.0", "@types/glob": "^7.1.1", "@types/jest": "^24.0.25", @@ -44,15 +45,9 @@ "@types/node": "^13.1.6", "@typescript-eslint/eslint-plugin": "^2.15.0", "@typescript-eslint/parser": "^2.15.0", - "assert": "^2.0.0", - "concurrently": "^5.0.1", - "dotenv": "^8.2.0", "eslint": "^6.8.0", "eslint-config-prettier": "^6.9.0", "eslint-plugin-prettier": "^3.1.2", - "glob": "^7.1.6", - "graphql": "^14.5.8", - "mocha": "^6.2.2", "prettier": "^1.19.1", "ts-jest": "^24.3.0", "typescript": "^3.7.4", diff --git a/src/environment.ts b/src/environment.ts index 8e9c75d0..200e2a8a 100644 --- a/src/environment.ts +++ b/src/environment.ts @@ -7,7 +7,7 @@ interface Environment { } const environment: Environment = { - LOG: (process.env.LOG || '').toLowerCase() === 'test', + LOG: (process.env.LOG || '').toLowerCase() === 'true', } export default environment diff --git a/tsconfig.json b/tsconfig.json index 61ff47cf..07e13f13 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,30 +1,29 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es2018", - "outDir": "build", - "lib": ["es2018", "dom"], - "sourceMap": true, - "rootDir": "src", - "baseUrl": "src", - "strict": true /* enable all strict type-checking options */, - /* Additional Checks */ - "forceConsistentCasingInFileNames": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noImplicitAny": true, - "strictNullChecks": true, - "suppressImplicitAnyIndexErrors": true, - "noUnusedLocals": false, - "experimentalDecorators": true, - "emitDecoratorMetadata": true, - "paths": { - "typings": ["../typings/index.d.ts"], - "typings/graphql": ["../typings/graphql.d.ts"], - "@api": ["services/api/index"], - "@gql/*": ["services/api/gql/*"] - }, - "allowJs": true - }, - "exclude": ["node_modules", ".vscode-test", "build", "resources", "web-app", "*.js", "*.test.ts"] + "compilerOptions": { + "module": "commonjs", + "target": "es2018", + "outDir": "build", + "lib": ["es2018", "dom"], + "sourceMap": true, + "rootDir": "src", + "baseUrl": "src", + "strict": true /* enable all strict type-checking options */, + /* Additional Checks */ + "forceConsistentCasingInFileNames": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noImplicitAny": true, + "strictNullChecks": true, + "suppressImplicitAnyIndexErrors": true, + "noUnusedLocals": false, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "paths": { + "typings": ["../typings/index.d.ts"], + "typings/graphql": ["../typings/graphql.d.ts"] + }, + "allowJs": true, + "removeComments": true + }, + "exclude": ["node_modules", ".vscode-test", "build", "resources", "web-app", "*.js", "*.test.ts"] } diff --git a/web-app/package.json b/web-app/package.json index 12a0770e..f3d8e505 100644 --- a/web-app/package.json +++ b/web-app/package.json @@ -4,7 +4,6 @@ "private": true, "scripts": { "build": "react-app-rewired build", - "postbuild": "cp -R ./build/ ../build/", "build-storybook": "build-storybook", "start": "react-app-rewired start", "storybook": "start-storybook -p 6006", diff --git a/web-app/src/environment.ts b/web-app/src/environment.ts index 46a2b61f..f7ffcf7a 100644 --- a/web-app/src/environment.ts +++ b/web-app/src/environment.ts @@ -1,15 +1,10 @@ -interface Environment { - GQL_URI: string - DEBUG: boolean -} - // validate .env -const requiredKeys = ['REACT_APP_GQL_URI'] -for (const required of requiredKeys) { - if (!process.env[required]) { - throw new Error(`Missing Environmental Variables: ${required}`) - } -} +// const requiredKeys = ['REACT_APP_GQL_URI'] +// for (const required of requiredKeys) { +// if (!process.env[required]) { +// throw new Error(`Missing Environmental Variables: ${required}`) +// } +// } -export const GQL_URI = process.env.REACT_APP_GQL_URI || '' -export const DEBUG = (process.env.REACT_APP_DEBUG || '').toLowerCase() === 'true' +export const GQL_URI: string = process.env.REACT_APP_GQL_URI || 'https://33mf420q4m.execute-api.us-west-2.amazonaws.com/stage/api-stage' +export const DEBUG: boolean = (process.env.REACT_APP_DEBUG || '').toLowerCase() === 'true' diff --git a/web-app/tsconfig.json b/web-app/tsconfig.json index 821dc39c..2c273883 100644 --- a/web-app/tsconfig.json +++ b/web-app/tsconfig.json @@ -1,6 +1,12 @@ { "extends": "./tsconfig.paths.json", "compilerOptions": { + "rootDirs": [ + "src", + "stories" + ], + "baseUrl": "src", + "outDir": "build", "target": "es2018", "lib": [ "dom", @@ -18,7 +24,8 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "preserve" + "jsx": "preserve", + "sourceMap": true }, "include": [ "src" diff --git a/web-app/tsconfig.paths.json b/web-app/tsconfig.paths.json index 84b379a9..886c8bff 100644 --- a/web-app/tsconfig.paths.json +++ b/web-app/tsconfig.paths.json @@ -1,12 +1,10 @@ { - "compilerOptions": { - "baseUrl": "src", - "rootDirs": ["src", "stories"], - "paths": { - "typings": ["../../typings/index.d.ts"], - "typings/graphql": ["../../typings/graphql.d.ts"] - }, - "allowSyntheticDefaultImports": true - }, - "exclude": ["node_modules", "build", "scripts", "jest", "public"] + "compilerOptions": { + "paths": { + "typings": ["../../typings/index.d.ts"], + "typings/graphql": ["../../typings/graphql.d.ts"] + }, + "allowSyntheticDefaultImports": true + }, + "exclude": ["node_modules", "build", "scripts", "jest", "public"] }