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.
- package/README.md +34 -57
- 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/
|
|
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/
|
|
11
|
-
<img src="https://img.shields.io/david/dev/itw-creative-works/
|
|
12
|
-
<img src="https://img.shields.io/bundlephobia/min/
|
|
13
|
-
<img src="https://img.shields.io/codeclimate/maintainability-percentage/itw-creative-works/
|
|
14
|
-
<img src="https://img.shields.io/npm/dm/
|
|
15
|
-
<img src="https://img.shields.io/node/v/
|
|
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/
|
|
18
|
-
<img src="https://img.shields.io/github/contributors/itw-creative-works/
|
|
19
|
-
<img src="https://img.shields.io/github/last-commit/itw-creative-works/
|
|
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/
|
|
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>
|
|
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
|
|
28
|
+
## Install Prepare Package
|
|
29
29
|
### Install via npm
|
|
30
|
-
Install with npm if you plan to use **
|
|
30
|
+
Install with npm if you plan to use **Prepare Package** in a Node.js project.
|
|
31
31
|
```shell
|
|
32
|
-
npm install
|
|
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
|
-
*
|
|
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
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
|
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!)
|