Skip to content

Commit 2d639fb

Browse files
committed
build: copy READMEs into package dist folders
1 parent 1205c96 commit 2d639fb

File tree

7 files changed

+44
-6
lines changed

7 files changed

+44
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"build": "npm run lint && npm run scripts && npm run packagejson && npm run copyassets",
2424
"lint": "tslint -c tslint.json 'packages/**/*.ts'",
2525
"packagejson": "node ./scripts/create-package-json.js",
26-
"copyassets": "cp -R assets/release/* dist/core && cp LICENSE dist/core",
26+
"copyassets": "node ./scripts/copy-package-assets.js",
2727
"scripts": "npm run ngc:esm && npm run bundle",
2828
"bundle": "npm run bundle:umd:core",
2929
"bundle:umd:core": "rollup -c rollup.core.config.js",

assets/release/README.md renamed to packages/core/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
Angular Google Maps (AGM) - Angular 2+ Google Maps components
1+
Angular Google Maps (AGM) Core - Angular 2+ Google Maps components
22
=========
33

4+
@agm/core contains solutions for the Google Maps JavaScript Core API.
5+
46
The sources for this package are in the [angular-google-maps](https://github.com/SebastianM/angular-google-maps) repository. Please file issues and pull requests against that repo.
57

68
This package contains different sources for different users:

packages/snazzy-info-window/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Angular Google Maps (AGM) Core - Angular 2+ Google Maps components
2+
=========
3+
4+
@agm/snazzy-info-window is an extension for the @agm/core package that provides solutions for styleable/customizable info windows with the help of ['Snazzy Info Window'](https://github.com/atmist/snazzy-info-window).
5+
6+
The sources for this package are in the [angular-google-maps](https://github.com/SebastianM/angular-google-maps) repository. Please file issues and pull requests against that repo.
7+
8+
This package contains different sources for different users:
9+
10+
1. The files located in the root dirare ES5 based with ES2015 modules.
11+
1. Files with the name pattern *.umd.js are UMD bundled modules for fast load times during development.
12+
13+
License: See LICENSE file in this folder.

packages/snazzy-info-window/package.tpl.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "@agm/snazzy-info-window",
3-
"version": "1.0.0-beta.1",
3+
"version": "INSERT_HERE_VIA_BUILD_PROCESS",
4+
"private": true,
45
"description": "Angular Google Maps (AGM) package for Snazzy Info Window support",
56
"repository": {
67
"type": "git",

scripts/copy-package-assets.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const fs = require('fs');
2+
const packages = require('./packages');
3+
4+
packages.forEach(pkgName => {
5+
console.log(`Copy asstets for ${pkgName}`);
6+
const readmeFile = `./packages/${pkgName}/README.md`;
7+
if (fs.existsSync(readmeFile)) {
8+
fs.writeFileSync(`dist/${pkgName}/README.md`, fs.readFileSync(readmeFile));
9+
}
10+
11+
fs.writeFileSync(`dist/${pkgName}/LICENSE`, fs.readFileSync('LICENSE'));
12+
});

scripts/create-package-json.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
*/
44
const fs = require('fs');
55
const path = require('path');
6+
const packages = require('./packages');
67

7-
const pkgNames = ['core', 'snazzy-info-window'];
8-
9-
pkgNames.forEach(function(pkgName) {
8+
packages.forEach(function(pkgName) {
109
let basePkgJson;
1110
if (fs.existsSync(`./packages/${pkgName}/package.tpl.json`)) {
1211
basePkgJson = JSON.parse(fs.readFileSync(`./packages/${pkgName}/package.tpl.json`, 'utf8'));
@@ -22,7 +21,11 @@ pkgNames.forEach(function(pkgName) {
2221

2322
// remove devDependencies (as there are important for the sourcecode only)
2423
delete basePkgJson.devDependencies;
24+
25+
// remove the private option
26+
delete basePkgJson.private;
2527

28+
// remove dependencies for safety reasons as we use peerDependencies
2629
basePkgJson.dependencies = {};
2730

2831
const filepath = path.join(__dirname, `../dist/${pkgName}/package.json`);

scripts/packages.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// NPM packages (without the org name) that we publish
2+
const packages = [
3+
'core',
4+
'snazzy-info-window'
5+
];
6+
7+
module.exports = packages;

0 commit comments

Comments
 (0)