Skip to content

Commit

Permalink
build: copy READMEs into package dist folders
Browse files Browse the repository at this point in the history
  • Loading branch information
sebholstein committed Jun 21, 2017
1 parent ae7973a commit e5024b7
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"build": "npm run lint && npm run scripts && npm run packagejson && npm run copyassets",
"lint": "tslint -c tslint.json 'packages/**/*.ts'",
"packagejson": "node ./scripts/create-package-json.js",
"copyassets": "cp -R assets/release/* dist/core && cp LICENSE dist/core",
"copyassets": "node ./scripts/copy-package-assets.js",
"scripts": "npm run ngc:esm && npm run bundle",
"bundle": "npm run bundle:umd:core",
"bundle:umd:core": "rollup -c rollup.core.config.js",
Expand Down
4 changes: 3 additions & 1 deletion assets/release/README.md → packages/core/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Angular Google Maps (AGM) - Angular 2+ Google Maps components
Angular Google Maps (AGM) Core - Angular 2+ Google Maps components
=========

@agm/core contains solutions for the Google Maps JavaScript Core API.

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.

This package contains different sources for different users:
Expand Down
13 changes: 13 additions & 0 deletions packages/snazzy-info-window/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Angular Google Maps (AGM) Core - Angular 2+ Google Maps components
=========

@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).

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.

This package contains different sources for different users:

1. The files located in the root dirare ES5 based with ES2015 modules.
1. Files with the name pattern *.umd.js are UMD bundled modules for fast load times during development.

License: See LICENSE file in this folder.
3 changes: 2 additions & 1 deletion packages/snazzy-info-window/package.tpl.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@agm/snazzy-info-window",
"version": "1.0.0-beta.1",
"version": "INSERT_HERE_VIA_BUILD_PROCESS",
"private": true,
"description": "Angular Google Maps (AGM) package for Snazzy Info Window support",
"repository": {
"type": "git",
Expand Down
12 changes: 12 additions & 0 deletions scripts/copy-package-assets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const fs = require('fs');
const packages = require('./packages');

packages.forEach(pkgName => {
console.log(`Copy asstets for ${pkgName}`);
const readmeFile = `./packages/${pkgName}/README.md`;
if (fs.existsSync(readmeFile)) {
fs.writeFileSync(`dist/${pkgName}/README.md`, fs.readFileSync(readmeFile));
}

fs.writeFileSync(`dist/${pkgName}/LICENSE`, fs.readFileSync('LICENSE'));
});
9 changes: 6 additions & 3 deletions scripts/create-package-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
*/
const fs = require('fs');
const path = require('path');
const packages = require('./packages');

const pkgNames = ['core', 'snazzy-info-window'];

pkgNames.forEach(function(pkgName) {
packages.forEach(function(pkgName) {
let basePkgJson;
if (fs.existsSync(`./packages/${pkgName}/package.tpl.json`)) {
basePkgJson = JSON.parse(fs.readFileSync(`./packages/${pkgName}/package.tpl.json`, 'utf8'));
Expand All @@ -22,7 +21,11 @@ pkgNames.forEach(function(pkgName) {

// remove devDependencies (as there are important for the sourcecode only)
delete basePkgJson.devDependencies;

// remove the private option
delete basePkgJson.private;

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

const filepath = path.join(__dirname, `../dist/${pkgName}/package.json`);
Expand Down
7 changes: 7 additions & 0 deletions scripts/packages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// NPM packages (without the org name) that we publish
const packages = [
'core',
'snazzy-info-window'
];

module.exports = packages;

0 comments on commit e5024b7

Please sign in to comment.