From 8e0bdd6040ed9c2781e0ec6e68ad70adcbf68f5d Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 22 Feb 2018 16:20:14 -0800 Subject: [PATCH] Split package-json specific logic out of javascript extension --- build/npm/postinstall.js | 1 + extensions/javascript/package.json | 29 +------------- extensions/package-json/.vscode/launch.json | 29 ++++++++++++++ extensions/package-json/.vscode/tasks.json | 30 +++++++++++++++ extensions/package-json/.vscodeignore | 3 ++ extensions/package-json/package.json | 38 +++++++++++++++++++ extensions/package-json/package.nls.json | 4 ++ .../src/features/bowerJSONContribution.ts | 0 .../src/features/jsonContributions.ts | 0 .../src/features/markedTextUtil.ts | 0 .../src/features/packageJSONContribution.ts | 0 .../src/javascriptMain.ts | 0 .../src/typings/ref.d.ts | 0 .../tags-language-configuration.json | 27 +++++++++++++ .../tsconfig.json | 0 .../{javascript => package-json}/yarn.lock | 22 +++++------ 16 files changed, 143 insertions(+), 40 deletions(-) create mode 100644 extensions/package-json/.vscode/launch.json create mode 100644 extensions/package-json/.vscode/tasks.json create mode 100644 extensions/package-json/.vscodeignore create mode 100644 extensions/package-json/package.json create mode 100644 extensions/package-json/package.nls.json rename extensions/{javascript => package-json}/src/features/bowerJSONContribution.ts (100%) rename extensions/{javascript => package-json}/src/features/jsonContributions.ts (100%) rename extensions/{javascript => package-json}/src/features/markedTextUtil.ts (100%) rename extensions/{javascript => package-json}/src/features/packageJSONContribution.ts (100%) rename extensions/{javascript => package-json}/src/javascriptMain.ts (100%) rename extensions/{javascript => package-json}/src/typings/ref.d.ts (100%) create mode 100644 extensions/package-json/tags-language-configuration.json rename extensions/{javascript => package-json}/tsconfig.json (100%) rename extensions/{javascript => package-json}/yarn.lock (81%) diff --git a/build/npm/postinstall.js b/build/npm/postinstall.js index 5a2eb75d6b4..ee92a224ed6 100644 --- a/build/npm/postinstall.js +++ b/build/npm/postinstall.js @@ -32,6 +32,7 @@ const extensions = [ 'typescript', 'php', 'javascript', + 'package-json', 'css', 'html', 'git', diff --git a/extensions/javascript/package.json b/extensions/javascript/package.json index 8b79f8c4fa6..a1c56c2f380 100644 --- a/extensions/javascript/package.json +++ b/extensions/javascript/package.json @@ -1,26 +1,12 @@ { "name": "javascript", - "displayName": "%displayname%", + "displayName": "%displayName%", "description": "%description%", "version": "0.1.0", "publisher": "vscode", "engines": { "vscode": "0.10.x" }, - "activationEvents": [ - "onLanguage:javascript", - "onLanguage:json" - ], - "main": "./out/javascriptMain", - "dependencies": { - "jsonc-parser": "^1.0.0", - "request-light": "^0.2.2", - "vscode-nls": "^3.2.1" - }, - "scripts": { - "compile": "gulp compile-extension:javascript", - "watch": "gulp watch-extension:javascript" - }, "contributes": { "languages": [ { @@ -101,14 +87,6 @@ } ], "jsonValidation": [ - { - "fileMatch": "package.json", - "url": "https://schemastore.azurewebsites.net/schemas/json/package.json" - }, - { - "fileMatch": "bower.json", - "url": "https://schemastore.azurewebsites.net/schemas/json/bower.json" - }, { "fileMatch": ".bowerrc", "url": "https://schemastore.azurewebsites.net/schemas/json/bowerrc.json" @@ -138,8 +116,5 @@ "url": "./schemas/jsconfig.schema.json" } ] - }, - "devDependencies": { - "@types/node": "8.0.33" } -} +} \ No newline at end of file diff --git a/extensions/package-json/.vscode/launch.json b/extensions/package-json/.vscode/launch.json new file mode 100644 index 00000000000..da4bc0f01e1 --- /dev/null +++ b/extensions/package-json/.vscode/launch.json @@ -0,0 +1,29 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Extension", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}" + ], + "stopOnEntry": false, + "sourceMaps": true, + "outDir": "${workspaceFolder}/out", + "preLaunchTask": "npm" + }, + { + "name": "Launch Tests", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": ["--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/out/test" ], + "stopOnEntry": false, + "sourceMaps": true, + "outDir": "${workspaceFolder}/out/test", + "preLaunchTask": "npm" + } + ] +} \ No newline at end of file diff --git a/extensions/package-json/.vscode/tasks.json b/extensions/package-json/.vscode/tasks.json new file mode 100644 index 00000000000..9e5593ade83 --- /dev/null +++ b/extensions/package-json/.vscode/tasks.json @@ -0,0 +1,30 @@ +// Available variables which can be used inside of strings. +// ${workspaceFolder}: the root folder of the team +// ${file}: the current opened file +// ${fileBasename}: the current opened file's basename +// ${fileDirname}: the current opened file's dirname +// ${fileExtname}: the current opened file's extension +// ${cwd}: the current working directory of the spawned process + +// A task runner that calls a custom npm script that compiles the extension. +{ + "version": "0.1.0", + + // we want to run npm + "command": "npm", + + // the command is a shell script + "isShellCommand": true, + + // show the output window only if unrecognized errors occur. + "showOutput": "silent", + + // we run the custom script "compile" as defined in package.json + "args": ["run", "compile"], + + // The tsc compiler is started in watching mode + "isWatching": true, + + // use the standard tsc in watch mode problem matcher to find compile problems in the output. + "problemMatcher": "$tsc-watch" +} \ No newline at end of file diff --git a/extensions/package-json/.vscodeignore b/extensions/package-json/.vscodeignore new file mode 100644 index 00000000000..e467ddc2e7a --- /dev/null +++ b/extensions/package-json/.vscodeignore @@ -0,0 +1,3 @@ +test/** +src/**/*.ts +tsconfig.json \ No newline at end of file diff --git a/extensions/package-json/package.json b/extensions/package-json/package.json new file mode 100644 index 00000000000..472ca5da4cc --- /dev/null +++ b/extensions/package-json/package.json @@ -0,0 +1,38 @@ +{ + "name": "package-json", + "displayName": "%displayName%", + "description": "%description%", + "version": "0.1.0", + "publisher": "vscode", + "engines": { + "vscode": "0.10.x" + }, + "activationEvents": [ + "onLanguage:json" + ], + "main": "./out/javascriptMain", + "dependencies": { + "jsonc-parser": "^1.0.0", + "request-light": "^0.2.2", + "vscode-nls": "^3.2.1" + }, + "scripts": { + "compile": "gulp compile-extension:package-json", + "watch": "gulp watch-extension:package-json" + }, + "contributes": { + "jsonValidation": [ + { + "fileMatch": "package.json", + "url": "https://schemastore.azurewebsites.net/schemas/json/package.json" + }, + { + "fileMatch": "bower.json", + "url": "https://schemastore.azurewebsites.net/schemas/json/bower.json" + } + ] + }, + "devDependencies": { + "@types/node": "8.0.33" + } +} diff --git a/extensions/package-json/package.nls.json b/extensions/package-json/package.nls.json new file mode 100644 index 00000000000..be508152006 --- /dev/null +++ b/extensions/package-json/package.nls.json @@ -0,0 +1,4 @@ +{ + "displayName": "Package.json Support", + "description": "Adds package.json editing features." +} \ No newline at end of file diff --git a/extensions/javascript/src/features/bowerJSONContribution.ts b/extensions/package-json/src/features/bowerJSONContribution.ts similarity index 100% rename from extensions/javascript/src/features/bowerJSONContribution.ts rename to extensions/package-json/src/features/bowerJSONContribution.ts diff --git a/extensions/javascript/src/features/jsonContributions.ts b/extensions/package-json/src/features/jsonContributions.ts similarity index 100% rename from extensions/javascript/src/features/jsonContributions.ts rename to extensions/package-json/src/features/jsonContributions.ts diff --git a/extensions/javascript/src/features/markedTextUtil.ts b/extensions/package-json/src/features/markedTextUtil.ts similarity index 100% rename from extensions/javascript/src/features/markedTextUtil.ts rename to extensions/package-json/src/features/markedTextUtil.ts diff --git a/extensions/javascript/src/features/packageJSONContribution.ts b/extensions/package-json/src/features/packageJSONContribution.ts similarity index 100% rename from extensions/javascript/src/features/packageJSONContribution.ts rename to extensions/package-json/src/features/packageJSONContribution.ts diff --git a/extensions/javascript/src/javascriptMain.ts b/extensions/package-json/src/javascriptMain.ts similarity index 100% rename from extensions/javascript/src/javascriptMain.ts rename to extensions/package-json/src/javascriptMain.ts diff --git a/extensions/javascript/src/typings/ref.d.ts b/extensions/package-json/src/typings/ref.d.ts similarity index 100% rename from extensions/javascript/src/typings/ref.d.ts rename to extensions/package-json/src/typings/ref.d.ts diff --git a/extensions/package-json/tags-language-configuration.json b/extensions/package-json/tags-language-configuration.json new file mode 100644 index 00000000000..fa04cf1756f --- /dev/null +++ b/extensions/package-json/tags-language-configuration.json @@ -0,0 +1,27 @@ +{ + "comments": { + "blockComment": [ "{/*", "*/}" ] + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["<", ">"] + ], + "autoClosingPairs": [ + { "open": "{", "close": "}" }, + { "open": "[", "close": "]" }, + { "open": "(", "close": ")" }, + { "open": "'", "close": "'", "notIn": ["string", "comment"] }, + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "/**", "close": " */", "notIn": ["string"] } + ], + "surroundingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["<", ">"], + ["'", "'"], + ["\"", "\""] + ] +} \ No newline at end of file diff --git a/extensions/javascript/tsconfig.json b/extensions/package-json/tsconfig.json similarity index 100% rename from extensions/javascript/tsconfig.json rename to extensions/package-json/tsconfig.json diff --git a/extensions/javascript/yarn.lock b/extensions/package-json/yarn.lock similarity index 81% rename from extensions/javascript/yarn.lock rename to extensions/package-json/yarn.lock index bab69ccbd1f..60e2e3ed126 100644 --- a/extensions/javascript/yarn.lock +++ b/extensions/package-json/yarn.lock @@ -7,16 +7,16 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.33.tgz#1126e94374014e54478092830704f6ea89df04cd" agent-base@4, agent-base@^4.1.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.1.2.tgz#80fa6cde440f4dcf9af2617cf246099b5d99f0c8" + version "4.2.0" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.0.tgz#9838b5c3392b962bad031e6a4c5e1024abec45ce" dependencies: es6-promisify "^5.0.0" debug@2: - version "2.2.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: - ms "0.7.1" + ms "2.0.0" debug@^3.1.0: version "3.1.0" @@ -25,8 +25,8 @@ debug@^3.1.0: ms "2.0.0" es6-promise@^4.0.3: - version "4.1.1" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.1.1.tgz#8811e90915d9a0dba36274f0b242dbda78f9c92a" + version "4.2.4" + resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.4.tgz#dc4221c2b16518760bd8c39a52d8f356fc00ed29" es6-promisify@^5.0.0: version "5.0.0" @@ -49,12 +49,8 @@ https-proxy-agent@2.1.1: debug "^3.1.0" jsonc-parser@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-1.0.0.tgz#ddcc864ae708e60a7a6dd36daea00172fa8d9272" - -ms@0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" + version "1.0.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-1.0.1.tgz#7f8f296414e6e7c4a33b9e4914fc8c47e4421675" ms@2.0.0: version "2.0.0" -- GitLab