Skip to content

Commit

Permalink
feat: angular package format (#1474)
Browse files Browse the repository at this point in the history
  • Loading branch information
yggg committed Jun 4, 2019
1 parent e117e50 commit 1cf1ba6
Show file tree
Hide file tree
Showing 154 changed files with 953 additions and 894 deletions.
1 change: 1 addition & 0 deletions DEV_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- add the package into bump-version.ts which bumps package version and its dependencies
- add the package external dependencies into rollup-config.ts which gives rollup capability build package correctly
- add the package into bundle.ts which build umd modules for our packages
- add the package into `JS_PACKAGES` in `scripts/gulp/tasks/config.ts` which used to add es2015 bundles for our packages
- add the package into packages-smoke application dependencies to verify it works properly in isolation.

# New Package Dependency Checklist
Expand Down
7 changes: 3 additions & 4 deletions docs/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
"baseUrl": ".",
"types": [],
"paths": {
"@nebular/theme": ["../src/framework/theme"],
"@nebular/theme/*": ["../src/framework/theme/*"],
"@nebular/auth": ["../src/framework/auth"],
"@nebular/security": ["../src/framework/security"]
"@nebular/theme": ["../src/framework/theme/public_api.ts"],
"@nebular/auth": ["../src/framework/auth/public_api.ts"],
"@nebular/security": ["../src/framework/security/public_api.ts"]
}
},
"exclude": [
Expand Down
53 changes: 18 additions & 35 deletions package-lock.json

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

27 changes: 11 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,28 @@
"build": "ng build",
"build:prod": "npm run build -- --prod",
"build:wp": "npm run build -- playground-wp --prod --aot",
"build:package": "npm-run-all -s clean:tmp:lib gulp build:ts build:schematics:package build:inline-resources build:bundle clean:tmp",
"build:ts": "tsc -p tsconfig.publish.json && ngc -p tsconfig.publish.json",
"build:schematics:package": "tsc -p tsconfig.schematics.publish.json",
"build:schematics:dev": "rimraf ./src/.lib && tsc -p tsconfig.schematics.json && npm run build:inline-schematics-resources",
"build:inline-schematics-resources": "gulp inline-schematics-resources",
"build:inline-resources": "gulp inline-resources",
"build:bundle": "gulp bundle",
"build:package": "npm-run-all -s clean:all \"gulp prepare-packages\" clean:tmp",
"build:rename:dev": "gulp bundle:rename-dev",
"build:schematics": "rimraf ./schematics/dist && tsc -p ./schematics/tsconfig.json && gulp copy-schematics",
"build:dev-schematics": "rimraf ./schematics/dist && gulp build-development-schematics",
"test": "ng test",
"test:wp": "npm run test -- playground-wp",
"test:watch": "ng test playground-wp --watch",
"test:coverage": "rimraf coverage && ng test playground --code-coverage --watch=false",
"test:schematics": "npm run build:schematics:dev && jasmine ./src/.lib/**/*.spec.js",
"test:schematics": "rimraf ./src/.lib && gulp build-packages-schematics-for-test && jasmine ./src/.lib/**/*.spec.js",
"lint": "ng lint playground --type-check",
"lint:styles": "stylelint ./src/framework/**/*.scss && stylelint ./docs/**/*.scss",
"lint:fix": "npm run lint -- --fix",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "ng e2e playground-e2e",
"e2e:wp": "ng e2e playground-wp-e2e",
"prepush": "npm run ci:lint",
"clean:tmp": "rimraf .ng_build .ng_compiled",
"clean:tmp:lib": "npm run clean:tmp && rimraf src/.lib",
"clean:tmp": "rimraf .ng_build .ng_compiled tsconfig-custom.publish.json tsconfig.build*",
"clean:lib": "rimraf src/.lib",
"clean:all": "npm-run-all -p clean:tmp clean:lib",
"ci:lint": "npm run lint && npm run lint:styles",
"ci:docs": "npm-run-all docs:prepare docs:build ",
"ci:docs": "npm-run-all docs:prepare docs:build",
"ci:dev-deploy": "npm run firebase use dev && npm run firebase deploy",
"ci:build": "npm-run-all build -- --prod --aot build:package build:wp",
"ci:build": "npm-run-all -s build:prod build:package build:wp",
"ci:test": "rimraf coverage && npm run build:package && npm run test:wp -- --code-coverage --watch=false && npm run test:schematics",
"ci:e2e": "npm-run-all build:package e2e:wp",
"version:bump": "gulp version",
Expand All @@ -73,7 +68,7 @@
"publish": "./scripts/publish.sh",
"update-packages-smoke-lock": "./scripts/update-packages-smoke-lock.sh",
"cli:firefox-fix": "rimraf node_modules/@angular-devkit/build-angular/node_modules/uglify-es && rimraf node_modules/@angular-devkit/build-angular/node_modules/uglifyjs-webpack-plugin",
"postinstall": "npm run cli:firefox-fix",
"postinstall": "npm-run-all -p cli:firefox-fix build:dev-schematics",
"gen:playground": "ng g .:playground",
"gen:playground-module": "ng g .:playground-module",
"gen:playground-components": "ng g .:playground-components"
Expand Down Expand Up @@ -165,15 +160,15 @@
"pump": "1.0.2",
"rimraf": "2.6.1",
"rollup-plugin-node-resolve": "3.0.0",
"run-sequence": "^1.2.2",
"stylelint": "7.13.0",
"through2": "^2.0.3",
"ts-node": "3.2.2",
"tslint": "5.8.0",
"tslint-language-service": "0.9.9",
"typedoc": "^0.12.0",
"typescript": "3.1.3",
"uglify-es": "3.2.2",
"uglifyjs-webpack-plugin": "1.1.5"
},
"schematics": "./schematics/dist/collection.json"
}
}
24 changes: 24 additions & 0 deletions packages-smoke/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
},
"production-2015": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"tsConfig": "./tsconfig.es2015.json"
}
}
},
Expand All @@ -79,6 +97,9 @@
"configurations": {
"production": {
"browserTarget": "packages-smoke:build:production"
},
"production-2015": {
"browserTarget": "packages-smoke:build:production-2015"
}
}
},
Expand Down Expand Up @@ -132,6 +153,9 @@
"configurations": {
"production": {
"devServerTarget": "packages-smoke:serve:production"
},
"production-2015": {
"devServerTarget": "packages-smoke:serve:production-2015"
}
}
},
Expand Down
6 changes: 6 additions & 0 deletions packages-smoke/tsconfig.es2015.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"target": "es2015"
}
}
14 changes: 7 additions & 7 deletions schematics/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"baseUrl": "tsconfig",
"baseUrl": ".",
"lib": [
"es2017",
"dom"
Expand All @@ -15,7 +15,10 @@
"noImplicitThis": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"rootDir": "./",
"rootDir": ".",
"rootDirs": [
"../src/framework/theme/schematics/util"
],
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"sourceMap": true,
Expand All @@ -27,13 +30,10 @@
]
},
"include": [
"./**/*",
"../src/.lib/theme/schematics/util",
"../node_modules/@angular/cdk/schematics/utils",
"../node_modules/@schematics/angular/utility"
"./**/*"
],
"exclude": [
"./*/files/**/*",
"./**/files/**/*",
"dist"
]
}
4 changes: 3 additions & 1 deletion scripts/ci/packages-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ packages_smoke() {
cp -r ../nebular/src/.lib/* node_modules/@nebular

echo "Verifying application build"
npm run build --prod --aot
npm run build -- --prod
npm run build -- --configuration=production-2015
npm run e2e
npm run e2e -- --configuration=production-2015

echo "Clean"
cd ..; rm -rf -- ${PROJECT}
Expand Down
15 changes: 7 additions & 8 deletions scripts/gulp/gulpfile.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { task } from 'gulp';

import './tasks/inline-resources/inline-resources';
import './tasks/bundle/bundle';
import './tasks/docs/docs';
import './tasks/copy-sources';
import './tasks/build/build';
import './tasks/build/resources';
import './tasks/build/compile/scss';
import './tasks/build/compile/typescript';
import './tasks/build/bundle/bundle';
import './tasks/build/bundle/bundles-paths';
import './tasks/bump-versions';

task('default', ['copy-sources']);
import './tasks/docs/docs';
55 changes: 55 additions & 0 deletions scripts/gulp/tasks/build/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { task, src, dest } from 'gulp';
import * as runSequence from 'run-sequence';

import { BUILD_DIR, SOURCE_DIR } from '../config';

task('prepare-packages', (done) => {
runSequence(
'copy-to-build-dir',
'build-js-packages',
// copy non js packages

'build-packages-schematics',

done,
);
});

task('copy-to-build-dir', () => {
return src(`${SOURCE_DIR}/**/*`).pipe(dest(BUILD_DIR));
});

task('build-js-packages', (done) => {
runSequence(
'compile-scss',
'compile-packages',
'copy-packages-resources',
'bundle',
'set-bundles-paths',
done,
);
});

task('build-packages-schematics', (done) => {
runSequence(
'compile-packages-schematics',
'copy-packages-schematics-resources',
done,
);
});

task('build-packages-schematics-for-test', (done) => {
runSequence(
'compile-packages-schematics-for-test',
'copy-packages-schematics-resources-for-test',
done,
);
});

task('build-development-schematics', (done) => {
runSequence(
'compile-development-schematics',
'copy-development-schematics-resources',
done,
);
});
Loading

0 comments on commit 1cf1ba6

Please sign in to comment.