kirbyup 0.8.0 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,11 +19,8 @@ You can also install it globally.
19
19
  ```json
20
20
  {
21
21
  "scripts": {
22
- "dev": "kirbyup src/index.js --watch",
23
- "build": "kirbyup src/index.js"
24
- },
25
- "devDependencies": {
26
- "kirbyup": "^0.8.0"
22
+ "dev": "npx -y kirbyup src/index.js --watch",
23
+ "build": "npx -y kirbyup src/index.js"
27
24
  }
28
25
  }
29
26
  ```
@@ -63,7 +60,7 @@ The final panel plugin will be bundled, minified, and written into the current d
63
60
  ## Credits
64
61
 
65
62
  - [Vite](https://vitejs.dev) by Evan You and all of its contributors.
66
- - [EGOIST](https://github.com/egoist) for his work on [tsup](https://github.com/egoist/tsup), which this CLI was forked from.
63
+ - [EGOIST](https://github.com/egoist) for his inspirational work on [tsup](https://github.com/egoist/tsup).
67
64
 
68
65
  ## License
69
66
 
package/dist/cli.d.ts CHANGED
@@ -1 +1 @@
1
-
1
+ #!/usr/bin/env node
package/dist/cli.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -55,35 +56,21 @@ var name, version;
55
56
  var init_package = __esm({
56
57
  "package.json"() {
57
58
  name = "kirbyup";
58
- version = "0.8.0";
59
+ version = "0.9.3";
59
60
  }
60
61
  });
61
62
 
62
63
  // src/errors.ts
63
64
  function handleError(error) {
64
- if (error.loc) {
65
- console.error(import_chalk.default.bold(import_chalk.default.red(`Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}`)));
66
- }
67
- if (error.frame) {
65
+ if (error instanceof PrettyError) {
68
66
  console.error(import_chalk.default.red(error.message));
69
- console.error(import_chalk.default.dim(error.frame));
70
- } else {
71
- if (error instanceof PrettyError) {
72
- console.error(import_chalk.default.red(error.message));
73
- } else {
74
- console.error(import_chalk.default.red(error.stack));
75
- }
76
67
  }
77
68
  process.exitCode = 1;
78
- if (!import_worker_threads.isMainThread && import_worker_threads.parentPort) {
79
- import_worker_threads.parentPort.postMessage("has-error");
80
- }
81
69
  }
82
- var import_worker_threads, import_chalk, PrettyError;
70
+ var import_chalk, PrettyError;
83
71
  var init_errors = __esm({
84
72
  "src/errors.ts"() {
85
73
  init_cjs_shims();
86
- import_worker_threads = __toModule(require("worker_threads"));
87
74
  import_chalk = __toModule(require("chalk"));
88
75
  PrettyError = class extends Error {
89
76
  constructor(message) {
@@ -165,7 +152,6 @@ __export(src_exports, {
165
152
  });
166
153
  async function runViteBuild(options) {
167
154
  let result;
168
- const fileName = "index";
169
155
  const currentDir = process.cwd();
170
156
  try {
171
157
  result = await (0, import_vite.build)({
@@ -173,16 +159,17 @@ async function runViteBuild(options) {
173
159
  build: {
174
160
  lib: {
175
161
  entry: (0, import_path.resolve)(currentDir, options.entry),
176
- formats: ["es"],
177
- fileName
162
+ formats: ["iife"],
163
+ name: "kirbyupExport",
164
+ fileName: () => outFile
178
165
  },
166
+ minify: !options.watch,
179
167
  outDir: currentDir,
180
168
  emptyOutDir: false,
181
169
  rollupOptions: {
182
170
  external: ["vue"],
183
171
  output: {
184
- entryFileNames: "[name].js",
185
- assetFileNames: `${fileName}.[ext]`,
172
+ assetFileNames: "index.[ext]",
186
173
  globals: {
187
174
  vue: "Vue"
188
175
  }
@@ -214,7 +201,7 @@ async function build(_options) {
214
201
  const { watch } = await import("chokidar");
215
202
  const ignored = [
216
203
  "**/{.git,node_modules}/**",
217
- "index.js"
204
+ outFile
218
205
  ];
219
206
  const watchPaths = typeof options.watch === "boolean" ? (0, import_path.dirname)(options.entry) : Array.isArray(options.watch) ? options.watch.filter((path) => typeof path === "string") : options.watch;
220
207
  log(`Watching for changes in ${Array.isArray(watchPaths) ? watchPaths.map((v) => '"' + v + '"').join(" | ") : '"' + watchPaths + '"'}`);
@@ -224,14 +211,14 @@ async function build(_options) {
224
211
  ignored
225
212
  });
226
213
  watcher.on("all", async (type, file) => {
227
- log(`Change detected: ${type} ${file}`);
214
+ log(`${type} ${import_chalk3.default.gray(file)}`);
228
215
  debouncedBuild();
229
216
  });
230
217
  };
231
218
  await runViteBuild(options);
232
219
  startWatcher();
233
220
  }
234
- var import_path, import_fs, import_vite, import_vite_plugin_vue2, normalizeOptions;
221
+ var import_path, import_fs, import_vite, import_vite_plugin_vue2, import_chalk3, outFile, normalizeOptions;
235
222
  var init_src = __esm({
236
223
  "src/index.ts"() {
237
224
  init_cjs_shims();
@@ -243,6 +230,8 @@ var init_src = __esm({
243
230
  init_utils();
244
231
  init_log();
245
232
  init_package();
233
+ import_chalk3 = __toModule(require("chalk"));
234
+ outFile = "index.js";
246
235
  normalizeOptions = async (options) => {
247
236
  if (!options.entry) {
248
237
  throw new PrettyError(`No input file, try "${name} <path/to/file.js>"`);
package/dist/index.js CHANGED
@@ -41,7 +41,6 @@ var import_vite = __toModule(require("vite"));
41
41
  var import_vite_plugin_vue2 = __toModule(require("vite-plugin-vue2"));
42
42
 
43
43
  // src/errors.ts
44
- var import_worker_threads = __toModule(require("worker_threads"));
45
44
  var import_chalk = __toModule(require("chalk"));
46
45
  var PrettyError = class extends Error {
47
46
  constructor(message) {
@@ -55,23 +54,10 @@ var PrettyError = class extends Error {
55
54
  }
56
55
  };
57
56
  function handleError(error) {
58
- if (error.loc) {
59
- console.error(import_chalk.default.bold(import_chalk.default.red(`Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}`)));
60
- }
61
- if (error.frame) {
57
+ if (error instanceof PrettyError) {
62
58
  console.error(import_chalk.default.red(error.message));
63
- console.error(import_chalk.default.dim(error.frame));
64
- } else {
65
- if (error instanceof PrettyError) {
66
- console.error(import_chalk.default.red(error.message));
67
- } else {
68
- console.error(import_chalk.default.red(error.stack));
69
- }
70
59
  }
71
60
  process.exitCode = 1;
72
- if (!import_worker_threads.isMainThread && import_worker_threads.parentPort) {
73
- import_worker_threads.parentPort.postMessage("has-error");
74
- }
75
61
  }
76
62
 
77
63
  // src/utils.ts
@@ -105,7 +91,7 @@ var import_chalk2 = __toModule(require("chalk"));
105
91
 
106
92
  // package.json
107
93
  var name = "kirbyup";
108
- var version = "0.8.0";
94
+ var version = "0.9.3";
109
95
 
110
96
  // src/log.ts
111
97
  var colorMap = new Map([
@@ -127,9 +113,10 @@ function log(message, type = "info") {
127
113
  }
128
114
 
129
115
  // src/index.ts
116
+ var import_chalk3 = __toModule(require("chalk"));
117
+ var outFile = "index.js";
130
118
  async function runViteBuild(options) {
131
119
  let result;
132
- const fileName = "index";
133
120
  const currentDir = process.cwd();
134
121
  try {
135
122
  result = await (0, import_vite.build)({
@@ -137,16 +124,17 @@ async function runViteBuild(options) {
137
124
  build: {
138
125
  lib: {
139
126
  entry: (0, import_path.resolve)(currentDir, options.entry),
140
- formats: ["es"],
141
- fileName
127
+ formats: ["iife"],
128
+ name: "kirbyupExport",
129
+ fileName: () => outFile
142
130
  },
131
+ minify: !options.watch,
143
132
  outDir: currentDir,
144
133
  emptyOutDir: false,
145
134
  rollupOptions: {
146
135
  external: ["vue"],
147
136
  output: {
148
- entryFileNames: "[name].js",
149
- assetFileNames: `${fileName}.[ext]`,
137
+ assetFileNames: "index.[ext]",
150
138
  globals: {
151
139
  vue: "Vue"
152
140
  }
@@ -187,7 +175,7 @@ async function build(_options) {
187
175
  const { watch } = await import("chokidar");
188
176
  const ignored = [
189
177
  "**/{.git,node_modules}/**",
190
- "index.js"
178
+ outFile
191
179
  ];
192
180
  const watchPaths = typeof options.watch === "boolean" ? (0, import_path.dirname)(options.entry) : Array.isArray(options.watch) ? options.watch.filter((path) => typeof path === "string") : options.watch;
193
181
  log(`Watching for changes in ${Array.isArray(watchPaths) ? watchPaths.map((v) => '"' + v + '"').join(" | ") : '"' + watchPaths + '"'}`);
@@ -197,7 +185,7 @@ async function build(_options) {
197
185
  ignored
198
186
  });
199
187
  watcher.on("all", async (type, file) => {
200
- log(`Change detected: ${type} ${file}`);
188
+ log(`${type} ${import_chalk3.default.gray(file)}`);
201
189
  debouncedBuild();
202
190
  });
203
191
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kirbyup",
3
- "version": "0.8.0",
3
+ "version": "0.9.3",
4
4
  "description": "Zero-config bundler for Kirby Panel plugins",
5
5
  "files": [
6
6
  "dist"
@@ -33,21 +33,32 @@
33
33
  "homepage": "https://github.com/johannschopplich/kirbyup#readme",
34
34
  "scripts": {
35
35
  "build": "tsup src/cli.ts src/index.ts --target node14 --clean --dts",
36
- "prepublishOnly": "npm run build"
36
+ "test": "jest",
37
+ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
38
+ "release": "node scripts/release.js"
37
39
  },
38
40
  "dependencies": {
39
41
  "cac": "^6.7.3",
40
42
  "chalk": "^4.1.2",
41
43
  "chokidar": "^3.5.2",
42
- "sass": "^1.41.1",
44
+ "sass": "^1.42.1",
43
45
  "vite": "^2.5.10",
44
46
  "vite-plugin-vue2": "^1.8.2",
45
47
  "vue": "^2.6.14"
46
48
  },
47
49
  "devDependencies": {
48
- "@types/node": "^16.9.4",
50
+ "@types/fs-extra": "^9.0.13",
51
+ "@types/jest": "^27.0.2",
52
+ "@types/node": "^16.9.6",
53
+ "conventional-changelog-cli": "^2.1.1",
54
+ "enquirer": "^2.3.6",
55
+ "execa": "^5.1.1",
56
+ "fast-glob": "^3.2.7",
57
+ "fs-extra": "^10.0.0",
58
+ "jest": "^27.2.1",
49
59
  "prettier": "^2.4.1",
50
60
  "ts-essentials": "^8.1.0",
61
+ "ts-jest": "^27.0.5",
51
62
  "tsup": "^5.1.0",
52
63
  "typescript": "^4.4.3"
53
64
  }