Skip to content

Commit ba173d0

Browse files
committed
fix: package issue.
1 parent e1c3618 commit ba173d0

7 files changed

+90
-27
lines changed

.vscodeignore

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
.vscode
2-
node_modules
3-
out/
4-
src/
5-
tsconfig.json
6-
webpack.config.js
7-
webviews/
8-
.gitignore
9-
.editorconfig
10-
.prettierignore
11-
.prettierrc.js
12-
yarn.lock
1+
*
2+
*/**
3+
**/*/.DS_Store
4+
5+
!node_modules/**/*
6+
7+
!out/**/*
8+
!assets/**/*
9+
10+
!package.json
11+
!README.md

package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "coding-plugin",
3+
"displayName": "CODING Merge Requests & Releases",
34
"description": "Coding plugin for VS Code.",
4-
"version": "0.2.0",
5+
"version": "0.2.1",
56
"publisher": "coding-net",
67
"license": "MIT",
78
"engines": {
@@ -120,14 +121,15 @@
120121
"postinstall": "cd src/typings && npx vscode-dts master && npx vscode-dts dev master",
121122
"vscode:prepublish": "npm run compile",
122123
"compile": "npm-run-all -p compile:*",
124+
"#compile:extension": "webpack --mode production --config webpack.config.extension.js",
123125
"compile:extension": "tsc -p ./src",
124-
"compile:webviews": "webpack --config webpack.config.js",
126+
"compile:webviews": "webpack --config webpack.config.webview.js",
125127
"watch": "npm-run-all -p watch:*",
126128
"watch:extension": "tsc -watch -p ./src",
127129
"watch:webviews": "webpack --watch --mode development",
128130
"lint": "eslint . --ext .ts,.tsx",
129-
"package": "npx vsce package",
130-
"release": "npx vsce publish"
131+
"package": "npx vsce package --yarn",
132+
"release": "npx vsce publish --yarn"
131133
},
132134
"babel": {
133135
"plugins": [
@@ -140,7 +142,7 @@
140142
"dependencies": {
141143
"@risingstack/react-easy-state": "^6.3.0",
142144
"dayjs": "^1.9.6",
143-
"got": "^11.7.0",
145+
"got": "^11.8.1",
144146
"keytar": "^7.0.0",
145147
"module-alias": "^2.2.2",
146148
"nanoid": "^3.1.16",

src/codingServer.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import { IRepoInfo, ISessionData, TokenType } from 'src/typings/commonTypes';
2424
import { keychain } from 'src/common/keychain';
2525
import Logger from 'src/common/logger';
2626

27+
// @ts-ignore
28+
import * as pkgInfo from '../package.json';
29+
2730
const AUTH_SERVER = `https://x5p7m.csb.app`;
2831
const ClientId = `ff768664c96d04235b1cc4af1e3b37a8`;
2932
const ClientSecret = `d29ebb32cab8b5f0a643b5da7dcad8d1469312c7`;
@@ -113,7 +116,7 @@ export class CodingServer {
113116

114117
public async startOAuth(team: string, scopes: string) {
115118
const state = nanoid();
116-
const { name, publisher } = require('../package.json');
119+
const { name, publisher } = pkgInfo;
117120
const callbackUri = await vscode.env.asExternalUri(
118121
vscode.Uri.parse(`${vscode.env.uriScheme}://${publisher}.${name}/on-did-authenticate`),
119122
);

src/tsconfig.json

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"compilerOptions": {
33
"module": "commonjs",
44
"target": "es2019",
5+
"moduleResolution": "Node",
6+
"resolveJsonModule": true,
57
"lib": ["es2019", "dom", "es2020"],
68
"outDir": "../out",
79
"sourceMap": true,

webpack.config.extension.js

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
//@ts-check
7+
8+
'use strict';
9+
10+
const path = require('path');
11+
12+
/**@type {import('webpack').Configuration}*/
13+
const config = {
14+
target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
15+
16+
entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
17+
output: {
18+
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
19+
path: path.resolve(__dirname, 'out'),
20+
filename: 'extension.js',
21+
libraryTarget: 'commonjs2',
22+
devtoolModuleFilenameTemplate: '../[resource-path]',
23+
},
24+
devtool: 'source-map',
25+
externals: {
26+
vscode: 'commonjs vscode', // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
27+
got: 'got',
28+
keytar: 'keytar',
29+
},
30+
resolve: {
31+
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
32+
extensions: ['.ts', '.js'],
33+
alias: {
34+
src: path.resolve(__dirname, 'src'),
35+
},
36+
},
37+
module: {
38+
rules: [
39+
{
40+
test: /\.ts$/,
41+
exclude: /node_modules/,
42+
use: [
43+
{
44+
loader: 'ts-loader',
45+
options: {
46+
compilerOptions: {
47+
module: 'es6', // override `tsconfig.json` so that TypeScript emits native JavaScript modules.
48+
},
49+
},
50+
},
51+
],
52+
},
53+
],
54+
},
55+
};
56+
57+
module.exports = config;
File renamed without changes.

yarn.lock

+9-9
Original file line numberDiff line numberDiff line change
@@ -1238,10 +1238,10 @@
12381238
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-2.1.1.tgz#ceff6a28a5b4867c2dd4a1ba513de278ccbe8bb1"
12391239
integrity sha512-/aPsuoj/1Dw/kzhkgz+ES6TxG0zfTMGLwuK2ZG00k/iJzYHTLCE8mVU8EPqEOp/lmxPoq1C1C9RYToRKb2KEfg==
12401240

1241-
"@sindresorhus/is@^3.1.1":
1242-
version "3.1.2"
1243-
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-3.1.2.tgz#548650de521b344e3781fbdb0ece4aa6f729afb8"
1244-
integrity sha512-JiX9vxoKMmu8Y3Zr2RVathBL1Cdu4Nt4MuNWemt1Nc06A0RAin9c5FArkhGsyMBWfCu4zj+9b+GxtjAnE4qqLQ==
1241+
"@sindresorhus/is@^4.0.0":
1242+
version "4.0.0"
1243+
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.0.0.tgz#2ff674e9611b45b528896d820d3d7a812de2f0e4"
1244+
integrity sha512-FyD2meJpDPjyNQejSjvnhpgI/azsQkA4lGbuu5BQZfjvJ9cbRZXzeWL2HceCekW4lixO9JPesIIQkSoLjeJHNQ==
12451245

12461246
"@svgr/babel-plugin-add-jsx-attribute@^5.4.0":
12471247
version "5.4.0"
@@ -4023,12 +4023,12 @@ got@^10.7.0:
40234023
to-readable-stream "^2.0.0"
40244024
type-fest "^0.10.0"
40254025

4026-
got@^11.7.0:
4027-
version "11.7.0"
4028-
resolved "https://registry.yarnpkg.com/got/-/got-11.7.0.tgz#a386360305571a74548872e674932b4ef70d3b24"
4029-
integrity sha512-7en2XwH2MEqOsrK0xaKhbWibBoZqy+f1RSUoIeF1BLcnf+pyQdDsljWMfmOh+QKJwuvDIiKx38GtPh5wFdGGjg==
4026+
got@^11.8.1:
4027+
version "11.8.1"
4028+
resolved "https://registry.yarnpkg.com/got/-/got-11.8.1.tgz#df04adfaf2e782babb3daabc79139feec2f7e85d"
4029+
integrity sha512-9aYdZL+6nHmvJwHALLwKSUZ0hMwGaJGYv3hoPLPgnT8BoBXm1SjnZeky+91tfwJaDzun2s4RsBRy48IEYv2q2Q==
40304030
dependencies:
4031-
"@sindresorhus/is" "^3.1.1"
4031+
"@sindresorhus/is" "^4.0.0"
40324032
"@szmarczak/http-timer" "^4.0.5"
40334033
"@types/cacheable-request" "^6.0.1"
40344034
"@types/responselike" "^1.0.0"

0 commit comments

Comments
 (0)