packitup 0.1.1 → 0.2.0

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
@@ -15,8 +15,6 @@
15
15
  ### install
16
16
  ```bash
17
17
  npm install packitup
18
- cd node_modules/packitup
19
- npm run install
20
18
  ```
21
19
 
22
20
  ```bash
package/dist/packitup.js CHANGED
@@ -252,6 +252,10 @@ function parseArgs() {
252
252
  options[key] = true;
253
253
  return;
254
254
  }
255
+ if (this.curr.startsWith('-')) {
256
+ options[this.curr.slice(1)] = true;
257
+ return;
258
+ }
255
259
  positional.push(this.curr);
256
260
  this.next();
257
261
  }
@@ -309,13 +313,18 @@ async function main() {
309
313
  }
310
314
 
311
315
  console.log(`🚀 Starting pack: ${input} → ${output}`);
312
-
313
316
  outputBundle({
314
317
  sourcePath: input,
315
318
  projectName: options.name,
316
319
  distPath: output,
317
320
  umdFile: options.umd,
318
321
  esmFile: options.esm,
322
+ move: options.move? pth => {
323
+ if (options['move-from'] && pth.startsWith(options['move-from'])) {
324
+ return pth.replace(options['move-from'], options['move-to'] || options['move-from']);
325
+ }
326
+ return pth;
327
+ } : void 0,
319
328
  dontExport: (options['dont-export'] ?? '').split(' '),
320
329
  esmTemplate: options['esm-template']
321
330
  });
package/dist/packitup.mjs CHANGED
@@ -252,6 +252,10 @@ function parseArgs() {
252
252
  options[key] = true;
253
253
  return;
254
254
  }
255
+ if (this.curr.startsWith('-')) {
256
+ options[this.curr.slice(1)] = true;
257
+ return;
258
+ }
255
259
  positional.push(this.curr);
256
260
  this.next();
257
261
  }
@@ -309,13 +313,18 @@ async function main() {
309
313
  }
310
314
 
311
315
  console.log(`🚀 Starting pack: ${input} → ${output}`);
312
-
313
316
  outputBundle({
314
317
  sourcePath: input,
315
318
  projectName: options.name,
316
319
  distPath: output,
317
320
  umdFile: options.umd,
318
321
  esmFile: options.esm,
322
+ move: options.move? pth => {
323
+ if (options['move-from'] && pth.startsWith(options['move-from'])) {
324
+ return pth.replace(options['move-from'], options['move-to'] || options['move-from']);
325
+ }
326
+ return pth;
327
+ } : void 0,
319
328
  dontExport: (options['dont-export'] ?? '').split(' '),
320
329
  esmTemplate: options['esm-template']
321
330
  });
package/install.js CHANGED
@@ -4,7 +4,7 @@ require.main === module && (() => {
4
4
  const path = require('path');
5
5
  const fs = require('fs');
6
6
  const process = require('process');
7
- const pathDir = process.env.PATH.split(path.delimiter)[0];
7
+ const pathDir = process.env.PATH.split(path.delimiter).find(pth => !pth.includes('/.bin'));
8
8
  if (!pathDir) throw new Error('Your command catalog has been stolen.');
9
9
  const packitup = fs.readFileSync('./dist/packitup.js', 'utf8');
10
10
  const shebang = '#!/usr/bin/env node';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "packitup",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "A JavaScript packager with a complete module system. Currently supports CommonJS modules and can export to ES modules.",
5
5
  "keywords": [
6
6
  "javascript",