Skip to content

Commit 55d4b02

Browse files
committed
Update: Add publisher's information
1 parent 3152e0a commit 55d4b02

File tree

8 files changed

+414
-123
lines changed

8 files changed

+414
-123
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Thumbs.db
1414

1515
# VSCode settings
1616
.vscode/
17+
.vscode-test/
1718

1819
# Build artifacts
1920
*.vsix

LICENSE

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# License
2+
3+
Copyright (c) 2024 univdev
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, subject to the following conditions:
6+
7+
1. The original source code of the Software must be used without modification. Distribution of modified source code is prohibited.
8+
9+
2. Any output or derivative work produced using the Software may be freely used, modified, and distributed, including for commercial purposes.
10+
11+
3. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12+
13+
4. Commercial use of the unmodified Software requires a separate agreement with the copyright holder.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

dist/extension.js

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,54 @@
1-
/******/ (() => { // webpackBootstrap
2-
/******/ "use strict";
3-
/******/
4-
/******/
5-
/******/ })()
6-
;
1+
"use strict";var U=Object.create;var i=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var D=(t,e)=>{for(var o in e)i(t,o,{get:e[o],enumerable:!0})},l=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of V(e))!A.call(t,s)&&s!==o&&i(t,s,{get:()=>e[s],enumerable:!(r=q(e,s))||r.enumerable});return t};var n=(t,e,o)=>(o=t!=null?U(W(t)):{},l(e||!t||!t.__esModule?i(o,"default",{value:t,enumerable:!0}):o,t)),z=t=>l(i({},"__esModule",{value:!0}),t);var K={};D(K,{activate:()=>J});module.exports=z(K);var c=n(require("vscode"));var h=n(require("vscode")),d=n(require("path")),a=n(require("fs"));var v=t=>`import { FC } from 'react';
2+
3+
export type I${t}Props = {
4+
5+
};
6+
7+
export const ${t}: FC<I${t}Props> = () => {
8+
return (
9+
10+
);
11+
};
12+
13+
export default ${t};
14+
`;var m=t=>`export * from './${t}';`;var y=t=>{if(t&&t.fsPath){let e=t.fsPath;h.window.showInputBox({prompt:"Enter React component name",placeHolder:"MyComponent"}).then(o=>{if(o){let r=d.join(e,o);a.mkdirSync(r);let s=v(o),x=m(o);a.writeFileSync(d.join(r,`${o}.tsx`),s),a.writeFileSync(d.join(r,"index.ts"),x)}})}};var C=n(require("vscode")),u=n(require("fs")),w=n(require("path"));var F=t=>`export const ${t} = () => {
15+
16+
};
17+
`;var P=t=>{let e=t.fsPath;C.window.showInputBox({prompt:"Enter React hook name",placeHolder:"MyHook (or useMyHook)"}).then(o=>{if(typeof o=="string"){let r=o;o.startsWith("use")===!1&&(r=`use${o}`),C.window.showInformationMessage(r);let s=F(r);u.writeFileSync(w.join(e,`${r}.ts`),s)}})};var H=n(require("vscode")),$=n(require("fs")),k=n(require("path"));var R=t=>`import { ComponentType } from 'react';
18+
19+
export type IComponentRequiredProps = {
20+
// Write required props.
21+
};
22+
23+
export function ${t}<P = IComponentRequiredProps>(Component: ComponentType<P>) {
24+
return function(props: P) {
25+
return (
26+
<Component { ...props as any } />
27+
);
28+
};
29+
};
30+
31+
export default ${t};
32+
`;var I=t=>{let e=t.fsPath;H.window.showInputBox({prompt:"Enter React hoc name",placeHolder:"withMyHOC"}).then(o=>{if(o){let r=R(o);$.writeFileSync(k.join(e,`${o}.hoc.tsx`),r)}})};var E=n(require("vscode")),p=n(require("fs")),f=n(require("path"));var g=t=>`import { FC } from "react";
33+
34+
export type ITestProviderProps = {
35+
// Enter provider props
36+
};
37+
38+
export const TestProvider: FC<ITestProviderProps> = () => {
39+
return (
40+
41+
);
42+
};
43+
44+
export default TestProvider;
45+
`;var j=t=>{let e=t.fsPath;E.window.showInputBox({prompt:"Enter React provider name",placeHolder:"MyProvider (Provider: use same name as context)"}).then(o=>{if(o){let r=`${o}.provider.tsx`,s=g(o),x=m(r);p.mkdirSync(f.join(e,o)),p.writeFileSync(f.join(e,o,r),s),p.writeFileSync(f.join(e,o,"index.ts"),x)}})};var M=n(require("vscode")),b=n(require("fs")),O=n(require("path"));var S=t=>`import { createContext } from "react";
46+
47+
export type I${t}ContextValue = {
48+
// Enter context props
49+
};
50+
51+
export const ${t}Context = createContext<I${t}ContextValue | undefined>(undefined);
52+
53+
export default ${t}Context;
54+
`;var T=t=>{let e=t.fsPath;M.window.showInputBox({prompt:"Enter React context name",placeHolder:"MyContext (A .context prefix is added to the filename.)"}).then(o=>{if(o){let r=S(o);b.writeFileSync(O.join(e,`${o}.context.ts`),r)}})};var B=t=>{G.forEach(e=>{t.subscriptions.push(e)})},G=[c.commands.registerCommand("vscode-react-developer-toolkit.createReactComponent",y),c.commands.registerCommand("vscode-react-developer-toolkit.createReactHOC",I),c.commands.registerCommand("vscode-react-developer-toolkit.createReactHook",P),c.commands.registerCommand("vscode-react-developer-toolkit.createReactProvider",j),c.commands.registerCommand("vscode-react-developer-toolkit.createReactContext",T)];function J(t){B(t)}0&&(module.exports={activate});

dist/extension.js.map

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

esbuild.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
const esbuild = require('esbuild');
2+
3+
const production = process.argv.includes('--production');
4+
const watch = process.argv.includes('--watch');
5+
6+
async function main() {
7+
const ctx = await esbuild.context({
8+
entryPoints: ['src/extension.ts'],
9+
bundle: true,
10+
format: 'cjs',
11+
minify: production,
12+
sourcemap: !production,
13+
sourcesContent: false,
14+
platform: 'node',
15+
outfile: 'dist/extension.js',
16+
external: ['vscode'],
17+
logLevel: 'silent',
18+
plugins: [
19+
/* add to the end of plugins array */
20+
esbuildProblemMatcherPlugin
21+
]
22+
});
23+
if (watch) {
24+
await ctx.watch();
25+
} else {
26+
await ctx.rebuild();
27+
await ctx.dispose();
28+
}
29+
}
30+
31+
/**
32+
* @type {import('esbuild').Plugin}
33+
*/
34+
const esbuildProblemMatcherPlugin = {
35+
name: 'esbuild-problem-matcher',
36+
37+
setup(build) {
38+
build.onStart(() => {
39+
console.log('[watch] build started');
40+
});
41+
build.onEnd(result => {
42+
result.errors.forEach(({ text, location }) => {
43+
console.error(`✘ [ERROR] ${text}`);
44+
console.error(` ${location.file}:${location.line}:${location.column}:`);
45+
});
46+
console.log('[watch] build finished');
47+
});
48+
}
49+
};
50+
51+
main().catch(e => {
52+
console.error(e);
53+
process.exit(1);
54+
});

images/icon.webp

142 KB
Binary file not shown.

package.json

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
{
22
"name": "vscode-react-developer-toolkit",
3-
"displayName": "vscode-react-developer-toolkit",
4-
"description": "",
3+
"displayName": "React Toolkit for Developers",
4+
"description": "Toolkit to perform tasks for React developers",
5+
"publisher": "univdev",
6+
"author": {
7+
"name": "univdev",
8+
"email": "[email protected]",
9+
"url": "https://github.com/univdev"
10+
},
11+
"icon": "images/icon.webp",
12+
"galleryBanner": {
13+
"color": "#C80000",
14+
"theme": "dark"
15+
},
16+
"homepage": "https://github.com/univdev/vscode-react-developer-toolkit/blob/master/README.md",
17+
"license": "SEE LICENSE IN LICENSE",
18+
"pricing": "Free",
519
"version": "0.0.1",
620
"engines": {
721
"vscode": "^1.94.0"
@@ -73,24 +87,32 @@
7387
]
7488
},
7589
"scripts": {
76-
"vscode:prepublish": "pnpm run compile",
77-
"compile": "tsc -p ./",
78-
"watch": "tsc -watch -p ./",
79-
"pretest": "pnpm run compile && pnpm run lint",
80-
"lint": "eslint src",
81-
"test": "vscode-test"
90+
"compile": "npm run check-types && node esbuild.js",
91+
"check-types": "tsc --noEmit",
92+
"watch": "npm-run-all -p watch:*",
93+
"watch:esbuild": "node esbuild.js --watch",
94+
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
95+
"vscode:prepublish": "npm run package",
96+
"package": "npm run check-types && node esbuild.js --production",
97+
"vsce:package": "pnpm vsce package --no-dependencies"
8298
},
8399
"devDependencies": {
84-
"@types/mocha": "^10.0.9",
85100
"@types/node": "20.x",
86-
"@types/sinon": "^17.0.3",
87101
"@types/vscode": "^1.94.0",
88102
"@typescript-eslint/eslint-plugin": "^8.10.0",
89103
"@typescript-eslint/parser": "^8.7.0",
90104
"@vscode/test-cli": "^0.0.10",
91105
"@vscode/test-electron": "^2.4.1",
106+
"esbuild": "^0.24.0",
92107
"eslint": "^9.13.0",
93-
"sinon": "^19.0.2",
94108
"typescript": "^5.6.3"
109+
},
110+
"repository": {
111+
"type": "git",
112+
"url": "https://github.com/univdev/vscode-react-developer-toolkit"
113+
},
114+
"bugs": {
115+
"url": "https://github.com/univdev/vscode-react-developer-toolkit/issues",
116+
"email": "[email protected]"
95117
}
96118
}

0 commit comments

Comments
 (0)