Skip to content

Package for sharing #76

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

Merged
merged 7 commits into from
Jan 19, 2020
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
25 changes: 19 additions & 6 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -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

## Tests
build/test/**
64 changes: 64 additions & 0 deletions DEV.md
Original file line number Diff line number Diff line change
@@ -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.
65 changes: 3 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 5 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -31,28 +31,23 @@
"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",
"@types/jsdom": "^12.2.4",
"@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",
Expand Down
2 changes: 1 addition & 1 deletion src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface Environment {
}

const environment: Environment = {
LOG: (process.env.LOG || '').toLowerCase() === 'test',
LOG: (process.env.LOG || '').toLowerCase() === 'true',
}

export default environment
55 changes: 27 additions & 28 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"]
}
1 change: 0 additions & 1 deletion web-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
21 changes: 8 additions & 13 deletions web-app/src/environment.ts
Original file line number Diff line number Diff line change
@@ -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'
9 changes: 8 additions & 1 deletion web-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"extends": "./tsconfig.paths.json",
"compilerOptions": {
"rootDirs": [
"src",
"stories"
],
"baseUrl": "src",
"outDir": "build",
"target": "es2018",
"lib": [
"dom",
Expand All @@ -18,7 +24,8 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve"
"jsx": "preserve",
"sourceMap": true
},
"include": [
"src"
Expand Down
18 changes: 8 additions & 10 deletions web-app/tsconfig.paths.json
Original file line number Diff line number Diff line change
@@ -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"]
}