Skip to content

Commit

Permalink
fix(package): @types/angular should not be a peer dependency
Browse files Browse the repository at this point in the history
Commit also re-introduces linklocal to install demo-apps
dependencies as symlinks
  • Loading branch information
ccrowhurstram committed Oct 8, 2016
2 parents cf13b0a + fb7cb41 commit 8da2b55
Show file tree
Hide file tree
Showing 17 changed files with 62 additions and 102 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,13 @@ e2e/**/*.js.map
e2e/**/*.d.ts
!e2e/**/global.d.ts
!e2e/protractor*.js
demo-apps/ts-webpack/src/**/*.js
demo-apps/ts-webpack/src/**/*.js.map
demo-apps/ts-webpack/src/**/*.d.ts
!demo-apps/es5/index.js
!demo-apps/es6-systemjs/index.js
test/**/*.d.ts
test/**/*.js.map
test/**/*.js
!test/index.js
!test/index.d.ts
# redundant webpack build artifacts produced by ExtractTextPlugin
bundles
build
build-stats.json
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.vscode/
.idea/
.temp/
# redundant webpack build artifacts produced by ExtractTextPlugin
bundles/styles.*
demo-apps/
demo-site/
Expand Down
25 changes: 14 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
sudo: false
language: node_js
node_js:
- node

cache:
directories:
- node_modules
notifications:
email: false
addons:
sauce_connect: true

env:
global:
- secure: gnwapHmalQ00mis28sRZQwmrkOWU7CyIyU3iKc1bixgGKZu6dhMUwQt2WA8HDkOLgSxSCSMigtzwuPvkxH6CRLbMnYwCDkCHZS9SvjrOLX+jZkORbSKRJUjlkRS3cjkY9AzKOYAOngAN07j0iqvsKx6UtdtEvA4QVM/ToQzVfi0=
- secure: J9OuScEujGDV/JKBvOz7pgh/hzA6QEqJKo8wtQprsSuUnP1zdUvlRV+oKuGXAGnfsFlr/aw+7+djz4QbqITQeQDJaQ4Ui4/M8dfDp4kLKGH6U8obrnX79IERjgKZubs17dW+NcbIt6pNzJavOdLlvAZiQtQMcdXbHI+Xa0PoTHs=

before_install:
- npm install -g karma-cli

install:
- npm prune && npm install
- npm run setup:demo-apps
- npm run setup:ci

before_script:
- npm run build:all
- npm run build:demo-apps
- '[ "${TRAVIS_PULL_REQUEST}" = "true" ] || npm run e2e-server:ci'

script:
- npm test
- '[ "${TRAVIS_PULL_REQUEST}" = "true" ] || npm run e2e:ci'

after_success: cat out/coverage/*/lcov.info | ./node_modules/coveralls/bin/coveralls.js
after_success:
- cat out/coverage/*/lcov.info | ./node_modules/coveralls/bin/coveralls.js
- npm run semantic-release

cache:
directories:
- node_modules
branches:
except:
- "/^v\\d+\\.\\d+\\.\\d+$/"
3 changes: 1 addition & 2 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ machine:

dependencies:
pre:
- npm install -g karma-cli
- npm prune && npm install
- npm run build
- npm run setup:ci && npm run build:demo-apps
cache_directories:
- node_modules

Expand Down
31 changes: 0 additions & 31 deletions demo-apps/es5/npm-shrinkwrap.json

This file was deleted.

10 changes: 4 additions & 6 deletions demo-apps/es5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,23 @@
"private": true,
"scripts": {
"_linklocal": "node ../../node_modules/linklocal/bin/linklocal.js",
"build:lib": "cd ../../ && npm run build",
"build": "echo \"Nothing to build\"",
"clean": "echo \"Nothing to clean\"",
"postinstall": "npm run linklocal",
"preinstall-dep": "npm run unlinklocal",
"install-dep": "npm install",
"postinstall-dep": "npm run linklocal",
"linklocal": "npm run _linklocal && npm prune",
"server": "node ../../node_modules/http-server/bin/http-server -c-1 -o",
"setup:local": "node ../../node_modules/npm-run-all/bin/npm-run-all --parallel build:lib linklocal",
"start": "npm run server",
"start": "node ../../node_modules/http-server/bin/http-server -c-1 -o",
"unlinklocal": "npm run _linklocal -- unlink && npm i",
"preuninstall-dep": "npm run unlinklocal",
"uninstall-dep": "npm uninstall",
"postuninstall-dep": "npm run linklocal"
},
"keywords": [],
"dependencies": {
"angular": "1.5.8",
"bootstrap": "3.3.7",
"angular": "file:../../node_modules/angular",
"bootstrap": "file:../../node_modules/bootstrap",
"ng-table": "file:../../"
}
}
6 changes: 2 additions & 4 deletions demo-apps/es6-systemjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@
"private": true,
"scripts": {
"_linklocal": "node ../../node_modules/linklocal/bin/linklocal.js",
"build:lib": "cd ../../ && npm run build",
"build": "echo \"Nothing to build\"",
"clean": "echo \"Nothing to clean\"",
"postinstall": "npm run linklocal",
"preinstall-dep": "npm run unlinklocal",
"install-dep": "npm install",
"postinstall-dep": "npm run linklocal",
"linklocal": "npm run _linklocal && npm prune",
"server": "node ../../node_modules/http-server/bin/http-server -c-1 -o",
"setup:local": "node ../../node_modules/npm-run-all/bin/npm-run-all --parallel build:lib linklocal",
"start": "npm run server",
"start": "node ../../node_modules/http-server/bin/http-server -c-1 -o",
"unlinklocal": "npm run _linklocal -- unlink && npm i",
"preuninstall-dep": "npm run unlinklocal",
"uninstall-dep": "npm uninstall",
Expand Down
7 changes: 3 additions & 4 deletions demo-apps/es6-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@
"private": true,
"scripts": {
"_linklocal": "node ../../node_modules/linklocal/bin/linklocal.js",
"build:lib": "cd ../../ && npm run tsc",
"prebuild": "npm run clean",
"build": "node ../../node_modules/webpack/bin/webpack.js --env.debug",
"prebuild:prod": "npm run clean",
"build:prod": "node ../../node_modules/webpack/bin/webpack.js --env.prod",
"clean": "node ../../node_modules/shx/lib/cli.js rm -rf build build-stats.json",
"postinstall": "npm run linklocal",
"preinstall-dep": "npm run unlinklocal",
"install-dep": "npm install",
"postinstall-dep": "npm run linklocal",
"linklocal": "npm run _linklocal && npm prune",
"setup:local": "node ../../node_modules/npm-run-all/bin/npm-run-all --parallel build:lib linklocal",
"server": "node ../../node_modules/http-server/bin/http-server build -c-1 -o",
"serve": "node ../../node_modules/http-server/bin/http-server build -c-1 -o",
"start": "node ../../node_modules/webpack-dev-server/bin/webpack-dev-server.js --env.debug",
"stats": "node ../../node_modules/webpack/bin/webpack.js --env.prod --profile --json > build-stats.json",
"unlinklocal": "npm run _linklocal -- unlink && npm i",
Expand All @@ -33,4 +32,4 @@
"bootstrap-css-only": "file:../../node_modules/bootstrap-css-only",
"ng-table": "file:../../"
}
}
}
4 changes: 1 addition & 3 deletions demo-apps/es6-webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ module.exports = (env = { prod: false, debug: false, port: 8080, host: 'localhos
parts.inlineHtmlTemplates(),
parts.inlineNgTableHtmlTemplates(),
parts.useHtmlPlugin(),
parts.forEnvironment(),
// this is only required because we using symlinks
parts.resolveLibraryPeerDependencies()
parts.forEnvironment()
);
}
4 changes: 4 additions & 0 deletions demo-apps/ts-webpack/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src/**/*.js
src/**/*.js.map
src/**/*.d.ts
!src/global.d.ts
10 changes: 4 additions & 6 deletions demo-apps/ts-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,19 @@
"private": true,
"scripts": {
"_linklocal": "node ../../node_modules/linklocal/bin/linklocal.js",
"build:lib": "cd ../../ && npm run tsc",
"prebuild": "npm run clean",
"build": "node ../../node_modules/webpack/bin/webpack.js --env.debug",
"prebuild:prod": "npm run clean",
"build:prod": "node ../../node_modules/webpack/bin/webpack.js --progress --env.prod",
"clean": "node ../../node_modules/shx/lib/cli.js rm -rf build build-stats.json",
"clean": "node ../../node_modules/shx/lib/cli.js rm -rf build build-stats.json src/**/*.js src/**/*.js.map",
"postinstall": "npm run linklocal",
"preinstall-dep": "npm run unlinklocal",
"install-dep": "npm install",
"postinstall-dep": "npm run linklocal",
"linklocal": "npm run _linklocal && npm prune",
"setup:local": "node ../../node_modules/npm-run-all/bin/npm-run-all --parallel build:lib linklocal",
"server": "node ../../node_modules/http-server/bin/http-server build -c-1 -o",
"serve": "node ../../node_modules/http-server/bin/http-server build -c-1 -o",
"start": "node ../../node_modules/webpack-dev-server/bin/webpack-dev-server.js --progress --env.debug",
"stats": "node ../../node_modules/webpack/bin/webpack.js --env.prod --profile --json > build-stats.json",
"tsc": "node ../../node_modules/typescript/lib/typescript.js",
"unlinklocal": "npm run _linklocal -- unlink && npm i",
"preuninstall-dep": "npm run unlinklocal",
"uninstall-dep": "npm uninstall",
Expand All @@ -34,4 +32,4 @@
"bootstrap-css-only": "file:../../node_modules/bootstrap-css-only",
"ng-table": "file:../.."
}
}
}
7 changes: 7 additions & 0 deletions demo-apps/ts-webpack/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// fake the nodejs require function so that we can add 'require' calls for html files;
// these calls to 'require' will then be converted by webpack ngtemplate-loader
// note that I would have prefered to use standard es2015 import for these
// html files but that would have meant using typescript 2 feature of implicit
// ambient modules which in turn would have meant turning off noImplicitAny checks
// which is a VERY bad idea
declare function require(path: string): any;
5 changes: 1 addition & 4 deletions demo-apps/ts-webpack/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
"removeComments": false,
"noImplicitAny": true,
"noImplicitReturns": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"../../node_modules/@types"
]
"suppressImplicitAnyIndexErrors": true
},
"exclude": ["node_modules"],
"awesomeTypescriptLoaderOptions": {
Expand Down
4 changes: 1 addition & 3 deletions demo-apps/ts-webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ module.exports = (env = { prod: false, debug: false, port: 8080, host: 'localhos
parts.inlineHtmlTemplates(),
parts.inlineNgTableHtmlTemplates(),
parts.useHtmlPlugin(),
parts.forEnvironment(),
// this is only required because we using symlinks
parts.resolveLibraryPeerDependencies()
parts.forEnvironment()
);
}
2 changes: 1 addition & 1 deletion npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 18 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-table",
"version": "2.0.0",
"version": "0.0.0-semantic-release",
"author": "Vitalii Savchuk <[email protected]>",
"license": "BSD",
"repository": {
Expand All @@ -10,6 +10,15 @@
"main": "bundles/ng-table.js",
"module": "index.js",
"typings": "index.d.ts",
"release": {
"branch": "typescript",
"fallbackTags": {
"next": "latest"
}
},
"publishConfig": {
"tag": "next"
},
"devDependencies": {
"@types/angular-mocks": "^1.5.4",
"@types/jasmine": "^2.2.33",
Expand Down Expand Up @@ -57,6 +66,7 @@
"protractor-jasmine2-screenshot-reporter": "^0.3.2",
"resolve-url-loader": "^1.6.0",
"sass-loader": "^4.0.0",
"semantic-release": "^4.3.5",
"shx": "^0.1.4",
"style-loader": "^0.13.1",
"systemjs": "^0.19.36",
Expand All @@ -71,7 +81,7 @@
"webpack-validator": "^2.2.7"
},
"scripts": {
"build:all": "npm-run-all --parallel build tsc --serial build:demo-apps",
"build:all": "npm-run-all --parallel build:full tsc --serial build:demo-apps",
"build:demo-apps": "shx ls -d demo-apps/*/ | bulk -c \"npm run build\"",
"build": "webpack --progress --profile --env.debug",
"build:prod": "webpack --progress --profile --env.prod",
Expand All @@ -87,9 +97,12 @@
"e2e": "protractor e2e/protractor.config.js",
"e2e:ci": "protractor e2e/protractor-travis.config",
"poste2e": "node ./scripts/open-e2e-report",
"presetup:demo-apps": "shx ls -d demo-apps/*/ | bulk -c \"npm install\"",
"setup:demo-apps": "shx ls -d demo-apps/*/ | bulk -c \"npm run linklocal\"",
"setup": "npm-run-all --parallel setup:demo-apps update-webdriver",
"install:demo-apps": "shx ls -d demo-apps/*/ | bulk -c \"npm install\"",
"link:demo-apps": "shx ls -d demo-apps/*/ | bulk -c \"npm run linklocal\"",
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
"_setup:common": "npm-run-all --parallel build tsc --serial install:demo-apps",
"setup:ci": "npm run _setup:common",
"setup": "npm-run-all --parallel _setup:common update-webdriver",
"shrinkwrap:demo-apps": "shx ls -d demo-apps/*/ | bulk -c \"npm shrinkwrap --dev\"",
"test": "karma start --single-run --no-auto-watch",
"test:debug": "karma start --no-single-run --no-auto-watch",
Expand Down
18 changes: 0 additions & 18 deletions scripts/webpack/appParts.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ function createAppParts(rootDir, env = {}) {
inlineHtmlTemplates,
inlineNgTableHtmlTemplates,
isDevServer,
resolveLibraryPeerDependencies,
sass,
useHtmlPlugin
});
Expand Down Expand Up @@ -197,23 +196,6 @@ function createAppParts(rootDir, env = {}) {
};
}


/**
* override the webpack resolution logic but only for peer dependencies defined by ng-table.
* This is necessary because the standard resolve breaks down when using symlinks
*/
function resolveLibraryPeerDependencies() {
const ngTablePkgPath = path.join(rootDir, 'node_modules', 'ng-table', 'package');
const ngTablePkg = require(ngTablePkgPath);
const alias = Object.keys(ngTablePkg.peerDependencies).reduce((acc, name) => {
acc[name] = path.join(rootDir, 'node_modules', name);
return acc;
}, {});
return {
resolve: { alias }
};
}

function sass(excludeFiles) {
excludeFiles = excludeFiles || [];
// note: would like to use sourcemaps in a deployed website (ie outside of dev-server)
Expand Down

0 comments on commit 8da2b55

Please sign in to comment.