Skip to content

Commit

Permalink
Merge pull request #303 from stone-lyl/feat-move-ext
Browse files Browse the repository at this point in the history
feat: move ext-ds to monorepo packags/vscode-extension
  • Loading branch information
stone-lyl authored Sep 26, 2024
2 parents 04899da + f7e3181 commit 49782e4
Show file tree
Hide file tree
Showing 43 changed files with 3,101 additions and 32 deletions.
67 changes: 60 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,73 @@
# and uncomment the following lines
.pnp.*


node_modules
.env
.turbo
.idea

notes
notes.*

packages/private

.env.local
.env

# Cypress artifacts
cypress/screenshots/
cypress/videos/

# Node.js
node_modules/
npm-debug.log
yarn-error.log

# Build output
dist/
build/
out/
tmp/
temp/

# Environment variables
.env
.env.local
.env.*.local

# IDEs and editors
.vscode/*
!.vscode/settings.json
!.vscode/launch.json
!.vscode/tasks.json
!.vscode/extensions.json


.vscode-test/
.idea/
*.sublime-project
*.sublime-workspace
*.swp

# Logs
logs/
*.log

# OS generated files
.DS_Store
Thumbs.db

# Coverage reports
coverage/
*.lcov

# Package files
package-lock.json
yarn.lock

# TypeScript
*.tsbuildinfo

# SASS
.sass-cache/

# Other
*.bak
*.tmp
*.orig
*.swp
*.swo
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"amodio.tsl-problem-matcher",
"ms-vscode.extension-test-runner"
]
}
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/packages/vscode-extension"
],
"outFiles": [
"${workspaceFolder}/packages/vscode-extension/dist/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false, // set this to true to hide the "out" folder with the compiled JS files
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
},
"search.exclude": {
"out": true, // set this to false to include "out" folder in search results
"dist": true // set this to false to include "dist" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
}
20 changes: 20 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "ext:dev",
"problemMatcher": "$ts-webpack-watch",
"isBackground": true,
"presentation": {
"reveal": "never",
"group": "watchers"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"packages/nodejs",
"packages/openai",
"packages/hubspot",
"packages/vscode-extension",
"packages/private/*"
],
"scripts": {
Expand All @@ -16,6 +17,7 @@
"tn": "yarn workspace @data-story/nodejs run tinker",
"tui": "yarn workspace @data-story/ui run tinker",
"dev": "echo _____RUNNING_ROOT_DEV_____ && yarn kill && yarn build && turbo dev --parallel",
"ext:dev": "turbo run ext:dev --parallel",
"watch:server": "yarn workspace @data-story/nodejs run watch:server",
"kill": "kill-port 3000 3300",
"build": "turbo build",
Expand Down
1 change: 0 additions & 1 deletion packages/nodejs/src/server/messageHandlers/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
InputObserverController,
type ReportCallback
} from '@data-story/core';

import { type InputObserver } from '@data-story/core'

export type RunMessage = {
Expand Down
7 changes: 4 additions & 3 deletions packages/ui/src/components/DataStory/modals/runForm.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import * as store from '../store/store';

function mountRunModal(): void {
cy.mount(
<DataStoryCanvasProvider>
{/*<RunModal showModal={true} setShowModal={(show) => show}/>*/}
</DataStoryCanvasProvider>
<></>
// <DataStoryCanvasProvider>
// {/*<RunModal showModal={true} setShowModal={(show) => show}/>*/}
// </DataStoryCanvasProvider>
)
}

Expand Down
5 changes: 5 additions & 0 deletions packages/vscode-extension/.vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from '@vscode/test-cli';

export default defineConfig({
files: 'out/test/**/*.test.js',
});
14 changes: 14 additions & 0 deletions packages/vscode-extension/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.vscode/**
.vscode-test/**
out/**
node_modules/**
src/**
.gitignore
.yarnrc
webpack.config.js
vsc-extension-quickstart.md
**/tsconfig.json
**/eslint.config.mjs
**/*.map
**/*.ts
**/.vscode-test.*
1 change: 1 addition & 0 deletions packages/vscode-extension/.yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--ignore-engines true
1 change: 1 addition & 0 deletions packages/vscode-extension/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
9 changes: 9 additions & 0 deletions packages/vscode-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

All notable changes to the "ds-ext" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [Unreleased]

- Initial release
8 changes: 8 additions & 0 deletions packages/vscode-extension/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Development Installation
* clone repo
* in root, also run `yarn`
* open repo with VS Code
* In "Run and Debug" tab, click "Run Extension"
* This opens a new instance of VS Code
* With the new instance, open a directory
* Create a *.diagram.json file (must have a content)
31 changes: 31 additions & 0 deletions packages/vscode-extension/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";

export default [{
files: ["**/*.ts"],
}, {
plugins: {
"@typescript-eslint": typescriptEslint,
},
globals: {
acquireVsCodeApi: "readonly" // Add this line to define acquireVsCodeApi as a global variable
},

languageOptions: {
parser: tsParser,
ecmaVersion: 2022,
sourceType: "module",
},

rules: {
"@typescript-eslint/naming-convention": ["warn", {
selector: "import",
format: ["camelCase", "PascalCase"],
}],

curly: "warn",
eqeqeq: "warn",
"no-throw-literal": "warn",
semi: "warn",
},
}];
14 changes: 14 additions & 0 deletions packages/vscode-extension/language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"comments": {
"lineComment": "//",
"blockComment": ["/*", "*/"]
},
"brackets": [
["{", "}"],
["[", "]"]
],
"autoClosingPairs": [
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" }
]
}
115 changes: 115 additions & 0 deletions packages/vscode-extension/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"name": "@data-story/vscode-extension",
"displayName": "ds-ext",
"description": "",
"version": "0.0.1",
"publisher": "ajthinking",
"engines": {
"vscode": "^1.93.0"
},
"categories": [
"Other"
],
"activationEvents": [
"onCommand:ds-ext.showReactApp",
"onCommand:ds-ext.openAsJson"
],
"main": "./dist/extension.js",
"contributes": {
"commands": [
{
"command": "ds-ext.showReactApp",
"title": "Show React App"
},
{
"command": "ds-ext.openAsJson",
"title": "Open raw, diagram JSON"
}
],
"languages": [
{
"id": "diagramJson",
"aliases": [
"Diagram JSON"
],
"extensions": [
".diagram.json"
],
"configuration": "./language-configuration.json"
}
],
"customEditors": [
{
"viewType": "ds-ext.diagramEditor",
"displayName": "Diagram Editor",
"selector": [
{
"filenamePattern": "*.diagram.json"
}
]
}
],
"iconThemes": [
{
"id": "diagramFileIconTheme",
"label": "Diagram File Icon Theme",
"path": "./themes/file-icon-theme.json"
}
],
"viewsContainers": {
"activitybar": [
{
"id": "dataStoryViewContainer",
"title": "DataStory",
"icon": "./themes/icon.png"
}
]
},
"views": {
"dataStoryViewContainer": [
{
"id": "nodeDetailsView",
"name": "Node Details"
}
]
}
},
"scripts": {
"vscode:prepublish": "yarn run package",
"build": "webpack && vite build",
"watch:extension": "webpack --watch",
"watch:app": "vite build -w",
"package": "webpack --mode production --devtool hidden-source-map",
"compile-tests": "tsc -p . --outDir out",
"watch-tests": "tsc -p . -w --outDir out",
"pretest": "yarn run compile-tests && yarn run build && yarn run lint",
"lint": "eslint src",
"test": "vscode-test"
},
"devDependencies": {
"@types/mocha": "^10.0.7",
"@types/node": "20.x",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/vscode": "^1.93.0",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.3.0",
"@vitejs/plugin-react": "^4.3.1",
"@vscode/test-cli": "^0.0.10",
"@vscode/test-electron": "^2.4.1",
"autoprefixer": "^10.4.20",
"eslint": "^9.9.1",
"postcss": "^8.4.47",
"typescript": "^5.5.4",
"vite": "^5.4.7",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@data-story/core": "^0.0.92",
"@data-story/ui": "^0.0.92",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"ts-loader": "^9.5.1"
}
}
Loading

0 comments on commit 49782e4

Please sign in to comment.