prepare-package 0.0.1 → 0.0.2

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.
Files changed (2) hide show
  1. package/README.md +34 -57
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -5,78 +5,55 @@
5
5
  </p>
6
6
 
7
7
  <p align="center">
8
- <img src="https://img.shields.io/github/package-json/v/itw-creative-works/promo-server.svg">
8
+ <img src="https://img.shields.io/github/package-json/v/itw-creative-works/prepare-package.svg">
9
9
  <br>
10
- <img src="https://img.shields.io/david/itw-creative-works/promo-server.svg">
11
- <img src="https://img.shields.io/david/dev/itw-creative-works/promo-server.svg">
12
- <img src="https://img.shields.io/bundlephobia/min/promo-server.svg">
13
- <img src="https://img.shields.io/codeclimate/maintainability-percentage/itw-creative-works/promo-server.svg">
14
- <img src="https://img.shields.io/npm/dm/promo-server.svg">
15
- <img src="https://img.shields.io/node/v/promo-server.svg">
10
+ <img src="https://img.shields.io/david/itw-creative-works/prepare-package.svg">
11
+ <img src="https://img.shields.io/david/dev/itw-creative-works/prepare-package.svg">
12
+ <img src="https://img.shields.io/bundlephobia/min/prepare-package.svg">
13
+ <img src="https://img.shields.io/codeclimate/maintainability-percentage/itw-creative-works/prepare-package.svg">
14
+ <img src="https://img.shields.io/npm/dm/prepare-package.svg">
15
+ <img src="https://img.shields.io/node/v/prepare-package.svg">
16
16
  <img src="https://img.shields.io/website/https/itwcreativeworks.com.svg">
17
- <img src="https://img.shields.io/github/license/itw-creative-works/promo-server.svg">
18
- <img src="https://img.shields.io/github/contributors/itw-creative-works/promo-server.svg">
19
- <img src="https://img.shields.io/github/last-commit/itw-creative-works/promo-server.svg">
17
+ <img src="https://img.shields.io/github/license/itw-creative-works/prepare-package.svg">
18
+ <img src="https://img.shields.io/github/contributors/itw-creative-works/prepare-package.svg">
19
+ <img src="https://img.shields.io/github/last-commit/itw-creative-works/prepare-package.svg">
20
20
  <br>
21
21
  <br>
22
- <a href="https://itwcreativeworks.com">Site</a> | <a href="https://www.npmjs.com/package/promo-server">NPM Module</a> | <a href="https://github.com/itw-creative-works/promo-server">GitHub Repo</a>
22
+ <a href="https://itwcreativeworks.com">Site</a> | <a href="https://www.npmjs.com/package/prepare-package">NPM Module</a> | <a href="https://github.com/itw-creative-works/prepare-package">GitHub Repo</a>
23
23
  <br>
24
24
  <br>
25
- <strong>Promo Server</strong> is an NPM module for backend and frontend developers that exposes promotion utilities for ITW Creative Works.
25
+ <strong>Prepare Package</strong> is a drop-in replacement NPM module that prepares your package before distribution.
26
26
  </p>
27
27
 
28
- ## Install Promo Server
28
+ ## Install Prepare Package
29
29
  ### Install via npm
30
- Install with npm if you plan to use **Promo Server** in a Node.js project or in the browser.
30
+ Install with npm if you plan to use **Prepare Package** in a Node.js project.
31
31
  ```shell
32
- npm install promo-server
33
- ```
34
- If you plan to use `promo-server` in a browser environment, you will probably need to use [Webpack](https://www.npmjs.com/package/webpack), [Browserify](https://www.npmjs.com/package/browserify), or a similar service to compile it.
35
-
36
- ```js
37
- const promoserver = new (require('promo-server'))();
38
- ```
39
-
40
- ### Install via CDN
41
- Install with CDN if you plan to use **Promo Server** only in a browser environment.
42
- ```html
43
- <script src="https://cdn.jsdelivr.net/npm/promo-server@latest/dist/index.min.js"></script>
44
- <script type="text/javascript">
45
- var promoserver = new PromoServer(); // The script above exposes the global variable 'PromoServer'
46
- </script>
32
+ npm install prepare-package --save-dev
47
33
  ```
48
34
 
49
35
  ## Features
50
- * Useful **promo management** for ITW Creative Works
36
+ * Copy files from `src` to `dist`
37
+ * Replace tags in your main file, `index.js`
38
+ * `{version}` => `package.version`
51
39
 
52
40
  ## Example Setup
53
- After installing via npm, simply `require` the library and begin enjoying the promo handler.
54
- ```js
55
- const promoserver = new (require('promo-server'))({
56
- app: 'example', // <any string>
57
- platform: 'web', // web | electron | extension
58
- log: true, // true | false
59
- firebase: firebase // reference to firebase (one will be implied if not provided)
60
- });
61
- ```
62
- ## Usage
63
- ### promoserver.handle(fn)
64
-
65
- Set up a handler for new promo updates that will call `fn` when there is a promo update
66
- ```js
67
- promoserver.handle(function (payload) {
68
- console.log('Payload', payload);
69
- });
70
- ```
71
-
72
- ### promoserver.setUser(user)
73
-
74
- Set the current user so things like `user.plan.id` can be considered for the handler
75
- ```js
76
- promoserver.setUser({});
41
+ After installing via npm, simply put this in your `package.json` in the `scripts` key
42
+ ```json
43
+ "main": "dist/index.js",
44
+ "scripts": {
45
+ "prepare": "node -e 'require(`prepare-package`)'"
46
+ },
47
+ "preparePackage": {
48
+ "input": "src",
49
+ "output": "dist",
50
+ "replace": {}
51
+ },
77
52
  ```
53
+ * `preparePackage` is not required but you can provide it to customize the process.
54
+ * `preparePackage.input`: The dir to copy **from**.
55
+ * `preparePackage.out`: The dir to copy **to**.
56
+ * `main`: The file to copy and use as your main file. Tags like `{version}` are replaced in this file.
78
57
 
79
58
  ## Final Words
80
- If you are still having difficulty, we would love for you to post a question to [the Promo Server issues page](https://github.com/itw-creative-works/promo-server/issues). It is much easier to answer questions that include your code and relevant files! So if you can provide them, we'd be extremely grateful (and more likely to help you find the answer!)
81
-
82
- Ask us to have your project listed! :)
59
+ If you are still having difficulty, we would love for you to post a question to [the Prepare Package issues page](https://github.com/itw-creative-works/prepare-package/issues). It is much easier to answer questions that include your code and relevant files! So if you can provide them, we'd be extremely grateful (and more likely to help you find the answer!)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prepare-package",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Prepare a Node.js package before being published",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {