Skip to content

Commit

Permalink
build: upgrade coc-helper, esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
weirongxu committed Aug 9, 2021
1 parent bc4c278 commit b25b97a
Show file tree
Hide file tree
Showing 9 changed files with 1,244 additions and 2,286 deletions.
22 changes: 22 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
exports.build = (production) => {
require('esbuild')
.build({
platform: 'node',
target: 'node10.12',
mainFields: ['main', 'module'],
minify: production,
sourcemap: !production,
entryPoints: ['./src/index.ts'],
bundle: true,
external: ['coc.nvim'],
outfile: 'lib/index.js',
})
// eslint-disable-next-line no-console
.catch(console.error);
};

if (require.main === module) {
exports.build(true);
// eslint-disable-next-line no-console
console.log('build done');
}
39 changes: 21 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
"lib"
],
"scripts": {
"lint": "eslint src --ext ts",
"clean": "rimraf lib",
"dev": "webpack --mode development --watch",
"build": "webpack --mode production",
"dev": "node watch.js",
"build:check-type": "tsc --noEmit",
"build:pack": "node build.js",
"build": "run-s build:check-type build:pack",
"prepare": "npm-run-all clean build",
"lint": "eslint src --ext js,ts",
"unittest": "jest --runInBand --detectOpenHandles --forceExit",
"test": "npm-run-all lint unittest"
"test": "run-s lint unittest"
},
"prettier": {
"singleQuote": true,
Expand All @@ -35,25 +37,22 @@
"semi": true
},
"devDependencies": {
"@types/jest": "^26.0.23",
"@types/node": "^15.0.3",
"@typescript-eslint/eslint-plugin": "^4.23.0",
"@typescript-eslint/parser": "^4.23.0",
"coc-helper": "^0.9.4",
"@types/jest": "^26.0.24",
"@types/node": "^16.4.13",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"chokidar": "^3.5.2",
"coc.nvim": "0.0.81-next.0",
"eslint": "^7.26.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"jest": "^26.6.3",
"jest": "^27.0.6",
"npm-run-all": "^4.1.5",
"prettier": "^2.3.0",
"prettier": "^2.3.2",
"rimraf": "^3.0.2",
"ts-jest": "^26.5.6",
"ts-loader": "^9.1.2",
"type-fest": "^1.1.1",
"typescript": "^4.2.4",
"webpack": "^5.37.0",
"webpack-cli": "^4.7.0"
"ts-jest": "^27.0.4",
"type-fest": "^2.0.0",
"typescript": "^4.3.5"
},
"activationEvents": [
"*"
Expand Down Expand Up @@ -113,5 +112,9 @@
"title": "floatinput coc command"
}
]
},
"dependencies": {
"coc-helper": "^0.11.1",
"esbuild": "^0.12.19"
}
}
2 changes: 1 addition & 1 deletion src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ export const vimEvents = new HelperVimEvents<{
},
logger,
{
name: 'FloatinputStatus',
name: 'Floatinput',
},
);
2 changes: 1 addition & 1 deletion src/getchar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const getcharEvent = new HelperEventEmitter<{
export const getcharModule = VimModule.create('getchar', (m) => {
const activated = m.var('activated', '0');

m.registerInit((context) => {
m.registerInit('register getchar', (context) => {
context.subscriptions.push(
commands.registerCommand(
'floatinput.inputchar',
Expand Down
4 changes: 1 addition & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ export async function activate(

const { subscriptions } = context;

await activateHelper(context, {
events: true,
});
await activateHelper(context);

const input = new StringInput();

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
"sourceMap": true,
"outDir": "lib",
"strict": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"moduleResolution": "node",
"noImplicitAny": false,
"esModuleInterop": true
},
"include": ["src"]
"include": ["."]
}
1 change: 1 addition & 0 deletions tsconfig.prod.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["src"],
"exclude": ["**/*.test.ts"]
}
12 changes: 12 additions & 0 deletions watch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const chokidar = require('chokidar');
const { build } = require('./build.js');

chokidar
.watch('./src/**/*.{ts,json}', {
ignoreInitial: true,
})
.on('all', (event, path) => {
// eslint-disable-next-line no-console
console.log(path, event);
build(false);
});
Loading

0 comments on commit b25b97a

Please sign in to comment.