Skip to content

Commit abeac51

Browse files
committed
Updated plugin system
1 parent 6a86dc2 commit abeac51

File tree

7 files changed

+144
-6
lines changed

7 files changed

+144
-6
lines changed

.vscode/pack-zip.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
const path = require('path');
2+
const fs = require('fs');
3+
const jszip = require('jszip');
4+
5+
const iconFile = path.join(__dirname, '../icon.png');
6+
const pluginJSON = path.join(__dirname, '../plugin.json');
7+
const distFolder = path.join(__dirname, '../dist');
8+
let readmeDotMd = path.join(__dirname, '../readme.md');
9+
10+
if (!fs.existsSync(readmeDotMd)) {
11+
readmeDotMd = path.join(__dirname, '../README.md');
12+
}
13+
14+
// create zip file of dist folder
15+
16+
const zip = new jszip();
17+
18+
zip.file('icon.png', fs.readFileSync(iconFile));
19+
zip.file('plugin.json', fs.readFileSync(pluginJSON));
20+
zip.file('readme.md', fs.readFileSync(readmeDotMd));
21+
22+
loadFile('', distFolder);
23+
24+
zip
25+
.generateNodeStream({ type: 'nodebuffer', streamFiles: true })
26+
.pipe(fs.createWriteStream(path.join(__dirname, '../dist.zip')))
27+
.on('finish', () => {
28+
console.log('dist.zip written.');
29+
});
30+
31+
function loadFile(root, folder) {
32+
const distFiles = fs.readdirSync(folder);
33+
distFiles.forEach((file) => {
34+
35+
const stat = fs.statSync(path.join(folder, file));
36+
37+
if (stat.isDirectory()) {
38+
zip.folder(file);
39+
loadFile(path.join(root, file), path.join(folder, file));
40+
return;
41+
}
42+
43+
if (!/LICENSE.txt/.test(file)) {
44+
zip.file(path.join(root, file), fs.readFileSync(path.join(folder, file)));
45+
}
46+
});
47+
}

dist.zip

316 KB
Binary file not shown.

dist/main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"author": "Ajit <me@ajitkumar.dev>",
88
"license": "MIT",
99
"dependencies": {
10-
"@deadlyjack/ajax": "^1.2.3"
10+
"@deadlyjack/ajax": "^1.2.3",
11+
"jszip": "^3.10.1"
1112
},
1213
"devDependencies": {
1314
"@babel/cli": "^7.18.10",
@@ -19,7 +20,8 @@
1920
"webpack-cli": "^4.10.0"
2021
},
2122
"scripts": {
22-
"build": "webpack"
23+
"build": "webpack",
24+
"build-release": "webpack --mode production"
2325
},
2426
"browserslist": [
2527
"> 0.25%, not dead"

src/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import plugin from '../plugin.json';
44
const pluginId = plugin.id;
55
const config = ace.require('ace/config');
66
const { snippetManager } = ace.require('ace/snippets');
7+
const appSettings = acode.require('settings');
78

89
class AcodeSnippets {
910
#snippetsLocation;

webpack.config.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const { exec } = require('child_process');
12
const path = require('path');
23

34
module.exports = (env, options) => {
@@ -31,7 +32,22 @@ module.exports = (env, options) => {
3132
module: {
3233
rules,
3334
},
34-
plugins: [],
35+
plugins: [
36+
{
37+
apply: (compiler) => {
38+
compiler.hooks.afterDone.tap('pack-zip', () => {
39+
// run pack-zip.js
40+
exec('node .vscode/pack-zip.js', (err, stdout, stderr) => {
41+
if (err) {
42+
console.error(err);
43+
return;
44+
}
45+
console.log(stdout);
46+
});
47+
});
48+
}
49+
}
50+
],
3551
};
3652

3753
return [main];

yarn.lock

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,11 @@ core-js-compat@^3.21.0, core-js-compat@^3.22.1:
15801580
browserslist "^4.20.3"
15811581
semver "7.0.0"
15821582

1583+
core-util-is@~1.0.0:
1584+
version "1.0.3"
1585+
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85"
1586+
integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==
1587+
15831588
cross-spawn@^7.0.3:
15841589
version "7.0.3"
15851590
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
@@ -1813,6 +1818,11 @@ has@^1.0.3:
18131818
dependencies:
18141819
function-bind "^1.1.1"
18151820

1821+
immediate@~3.0.5:
1822+
version "3.0.6"
1823+
resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b"
1824+
integrity sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==
1825+
18161826
import-local@^3.0.2:
18171827
version "3.1.0"
18181828
resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4"
@@ -1829,7 +1839,7 @@ inflight@^1.0.4:
18291839
once "^1.3.0"
18301840
wrappy "1"
18311841

1832-
inherits@2:
1842+
inherits@2, inherits@~2.0.3:
18331843
version "2.0.4"
18341844
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
18351845
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
@@ -1877,6 +1887,11 @@ is-plain-object@^2.0.4:
18771887
dependencies:
18781888
isobject "^3.0.1"
18791889

1890+
isarray@~1.0.0:
1891+
version "1.0.0"
1892+
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
1893+
integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==
1894+
18801895
isexe@^2.0.0:
18811896
version "2.0.0"
18821897
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
@@ -1926,11 +1941,28 @@ json5@^2.1.2, json5@^2.2.1:
19261941
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
19271942
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
19281943

1944+
jszip@^3.10.1:
1945+
version "3.10.1"
1946+
resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.10.1.tgz#34aee70eb18ea1faec2f589208a157d1feb091c2"
1947+
integrity sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==
1948+
dependencies:
1949+
lie "~3.3.0"
1950+
pako "~1.0.2"
1951+
readable-stream "~2.3.6"
1952+
setimmediate "^1.0.5"
1953+
19291954
kind-of@^6.0.2:
19301955
version "6.0.3"
19311956
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
19321957
integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==
19331958

1959+
lie@~3.3.0:
1960+
version "3.3.0"
1961+
resolved "https://registry.yarnpkg.com/lie/-/lie-3.3.0.tgz#dcf82dee545f46074daf200c7c1c5a08e0f40f6a"
1962+
integrity sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==
1963+
dependencies:
1964+
immediate "~3.0.5"
1965+
19341966
loader-runner@^4.2.0:
19351967
version "4.3.0"
19361968
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1"
@@ -2057,6 +2089,11 @@ p-try@^2.0.0:
20572089
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
20582090
integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
20592091

2092+
pako@~1.0.2:
2093+
version "1.0.11"
2094+
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf"
2095+
integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==
2096+
20602097
path-exists@^4.0.0:
20612098
version "4.0.0"
20622099
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
@@ -2099,6 +2136,11 @@ pkg-dir@^4.1.0, pkg-dir@^4.2.0:
20992136
dependencies:
21002137
find-up "^4.0.0"
21012138

2139+
process-nextick-args@~2.0.0:
2140+
version "2.0.1"
2141+
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
2142+
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
2143+
21022144
punycode@^2.1.0:
21032145
version "2.1.1"
21042146
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
@@ -2119,6 +2161,19 @@ raw-loader@^4.0.2:
21192161
loader-utils "^2.0.0"
21202162
schema-utils "^3.0.0"
21212163

2164+
readable-stream@~2.3.6:
2165+
version "2.3.7"
2166+
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57"
2167+
integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==
2168+
dependencies:
2169+
core-util-is "~1.0.0"
2170+
inherits "~2.0.3"
2171+
isarray "~1.0.0"
2172+
process-nextick-args "~2.0.0"
2173+
safe-buffer "~5.1.1"
2174+
string_decoder "~1.1.1"
2175+
util-deprecate "~1.0.1"
2176+
21222177
readdirp@~3.6.0:
21232178
version "3.6.0"
21242179
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7"
@@ -2219,7 +2274,7 @@ safe-buffer@^5.1.0:
22192274
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
22202275
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
22212276

2222-
safe-buffer@~5.1.1:
2277+
safe-buffer@~5.1.0, safe-buffer@~5.1.1:
22232278
version "5.1.2"
22242279
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
22252280
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
@@ -2264,6 +2319,11 @@ serialize-javascript@^6.0.0:
22642319
dependencies:
22652320
randombytes "^2.1.0"
22662321

2322+
setimmediate@^1.0.5:
2323+
version "1.0.5"
2324+
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
2325+
integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==
2326+
22672327
shallow-clone@^3.0.0:
22682328
version "3.0.1"
22692329
resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3"
@@ -2301,6 +2361,13 @@ source-map@^0.6.0:
23012361
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
23022362
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
23032363

2364+
string_decoder@~1.1.1:
2365+
version "1.1.1"
2366+
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
2367+
integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==
2368+
dependencies:
2369+
safe-buffer "~5.1.0"
2370+
23042371
supports-color@^5.3.0:
23052372
version "5.5.0"
23062373
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
@@ -2388,6 +2455,11 @@ uri-js@^4.2.2:
23882455
dependencies:
23892456
punycode "^2.1.0"
23902457

2458+
util-deprecate@~1.0.1:
2459+
version "1.0.2"
2460+
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
2461+
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
2462+
23912463
watchpack@^2.4.0:
23922464
version "2.4.0"
23932465
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.0.tgz#fa33032374962c78113f93c7f2fb4c54c9862a5d"

0 commit comments

Comments
 (0)