Skip to content

Commit

Permalink
refactor(module:version): add secondary entries (#3807)
Browse files Browse the repository at this point in the history
* refactor(module:version): add secondary entries

* chore: fix lint

* docs(universal): fix docs
  • Loading branch information
hsuanxyz authored and vthinkxie committed Jul 18, 2019
1 parent 0677540 commit ef9a9e3
Show file tree
Hide file tree
Showing 14 changed files with 112 additions and 84 deletions.
108 changes: 57 additions & 51 deletions components/ng-zorro-antd.module.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* @license
* Copyright Alibaba.com All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/

import { ModuleWithProviders, NgModule } from '@angular/core';

import { NzAffixModule } from 'ng-zorro-antd/affix';
Expand Down Expand Up @@ -83,15 +91,14 @@ export * from 'ng-zorro-antd/date-picker';
export * from 'ng-zorro-antd/descriptions';
export * from 'ng-zorro-antd/divider';
export * from 'ng-zorro-antd/drawer';
export * from 'ng-zorro-antd/drawer';
export * from 'ng-zorro-antd/dropdown';
export * from 'ng-zorro-antd/empty';
export * from 'ng-zorro-antd/form';
export * from 'ng-zorro-antd/grid';
export * from 'ng-zorro-antd/i18n';
export * from 'ng-zorro-antd/icon';
export * from 'ng-zorro-antd/input-number';
export * from 'ng-zorro-antd/input';
export * from 'ng-zorro-antd/input-number';
export * from 'ng-zorro-antd/layout';
export * from 'ng-zorro-antd/list';
export * from 'ng-zorro-antd/mention';
Expand All @@ -117,82 +124,81 @@ export * from 'ng-zorro-antd/table';
export * from 'ng-zorro-antd/tabs';
export * from 'ng-zorro-antd/tag';
export * from 'ng-zorro-antd/time-picker';
export * from 'ng-zorro-antd/time-picker';
export * from 'ng-zorro-antd/timeline';
export * from 'ng-zorro-antd/tooltip';
export * from 'ng-zorro-antd/transfer';
export * from 'ng-zorro-antd/tree-select';
export * from 'ng-zorro-antd/tree';
export * from 'ng-zorro-antd/tree-select';
export * from 'ng-zorro-antd/typography';
export * from 'ng-zorro-antd/upload';

export * from './version';
export * from 'ng-zorro-antd/version';

@NgModule({
exports: [
NzButtonModule,
NzCalendarModule,
NzGridModule,
NzSwitchModule,
NzSelectModule,
NzMenuModule,
NzMentionModule,
NzAnchorModule,
NzAffixModule,
NzDropDownModule,
NzLayoutModule,
NzBreadCrumbModule,
NzPaginationModule,
NzStepsModule,
NzInputModule,
NzCheckboxModule,
NzInputNumberModule,
NzSliderModule,
NzRateModule,
NzBadgeModule,
NzRadioModule,
NzAlertModule,
NzSpinModule,
NzPageHeaderModule,
NzProgressModule,
NzTabsModule,
NzIconModule,
NzCardModule,
NzAnchorModule,
NzAutocompleteModule,
NzAvatarModule,
NzTimelineModule,
NzTransButtonModule,
NzTransferModule,
NzBackTopModule,
NzBadgeModule,
NzButtonModule,
NzBreadCrumbModule,
NzCalendarModule,
NzCardModule,
NzCarouselModule,
NzCascaderModule,
NzCheckboxModule,
NzCollapseModule,
NzCommentModule,
NzTableModule,
NzDatePickerModule,
NzDescriptionsModule,
NzDividerModule,
NzDrawerModule,
NzDropDownModule,
NzEmptyModule,
NzFormModule,
NzListModule,
NzGridModule,
NzI18nModule,
NzUploadModule,
NzAutocompleteModule,
NzTagModule,
NzIconModule,
NzInputModule,
NzInputNumberModule,
NzLayoutModule,
NzListModule,
NzMentionModule,
NzMenuModule,
NzMessageModule,
NzModalModule,
NzNoAnimationModule,
NzNotificationModule,
NzPageHeaderModule,
NzPaginationModule,
NzPopconfirmModule,
NzPopoverModule,
NzProgressModule,
NzRadioModule,
NzRateModule,
NzSelectModule,
NzSkeletonModule,
NzSliderModule,
NzSpinModule,
NzStatisticModule,
NzStepsModule,
NzSwitchModule,
NzTableModule,
NzTabsModule,
NzTagModule,
NzTimePickerModule,
NzTimelineModule,
NzToolTipModule,
NzPopconfirmModule,
NzModalModule,
NzBackTopModule,
NzCascaderModule,
NzTransButtonModule,
NzTransferModule,
NzTreeModule,
NzTreeSelectModule,
NzTimePickerModule,
NzWaveModule,
NzNoAnimationModule,
NzSkeletonModule,
NzStatisticModule,
NzEmptyModule,
NzDescriptionsModule,
NzTypographyModule
NzTypographyModule,
NzUploadModule,
NzWaveModule
]
})
export class NgZorroAntdModule {
Expand Down
3 changes: 0 additions & 3 deletions components/version.ts

This file was deleted.

9 changes: 9 additions & 0 deletions components/version/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @license
* Copyright Alibaba.com All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/

export * from './public-api';
7 changes: 7 additions & 0 deletions components/version/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ngPackage": {
"lib": {
"entryFile": "public-api.ts"
}
}
}
9 changes: 9 additions & 0 deletions components/version/public-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @license
* Copyright Alibaba.com All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/

export * from './version';
11 changes: 11 additions & 0 deletions components/version/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @license
* Copyright Alibaba.com All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/

import { Version } from '@angular/core';

export const VERSION = new Version('8.0.3');
7 changes: 5 additions & 2 deletions docs/universal.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ order: 5
title: Server-side Rendering
---

<blockquote style="border-color: #faad14;"><p><strong>This guide assumes that you already know about <a href="https://angular.io/guide/universal">Server-side Rendering(SSR)</a>.</strong></p></blockquote>
<blockquote style="border-color: #faad14;">
<p><strong>This guide assumes that you already know about <a href="https://angular.io/guide/universal">Server-side Rendering(SSR)</a>.</strong></p>
<p>You can also start your project with <a href="https://angular.cn/guide/universal" target="_blank">NG-ZORRO/ng-zorro-universal-starter</a>.</p>
</blockquote>

This guide is based on the popular [Express](https://expressjs.com/) framework.

Expand Down Expand Up @@ -112,4 +115,4 @@ app.listen(PORT, () => {

```bash
$ npm run build:ssr && npm run serve:ssr # Running http://localhost:4000/
```
```
5 changes: 4 additions & 1 deletion docs/universal.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ order: 5
title: 服务端渲染
---

<blockquote style="border-color: #faad14;"><p><strong>本指南假设你已了解关于 <a href="https://angular.cn/guide/universal">Angular Universal:服务端渲染</a> 的相关知识。</strong></p></blockquote>
<blockquote style="border-color: #faad14;">
<p><strong>本指南假设你已了解关于 <a href="https://angular.cn/guide/universal" target="_blank">Angular Universal:服务端渲染</a> 的相关知识。</strong></p>
<p>你也可以使用 <a href="https://angular.cn/guide/universal" target="_blank">NG-ZORRO/ng-zorro-universal-starter</a> 开始你的项目。</p>
</blockquote>

本指南 Web 服务器是基于常见的 [Express](https://expressjs.com/) 框架。

Expand Down
13 changes: 2 additions & 11 deletions schematics/ng-update/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import { Rule } from '@angular-devkit/schematics';
import { createUpgradeRule, TargetVersion, UpgradeTSLintConfig } from '@angular/cdk/schematics';
import { createUpgradeRule, TargetVersion } from '@angular/cdk/schematics';
import chalk from 'chalk';
import { sync as globSync } from 'glob';
import { materialUpgradeData } from './upgrade-data';

const ruleDirectories = globSync('upgrade-rules/**/', { cwd: __dirname, absolute: true });

/** TSLint upgrade configuration that will be passed to the CDK ng-update rule. */
const tslintUpgradeConfig: UpgradeTSLintConfig = {
upgradeData: materialUpgradeData,
extraRuleDirectories: ruleDirectories
};

/** Entry point for the migration schematics with target of NG-ZORRO v7 */
export function updateToV7(): Rule {
return createUpgradeRule(TargetVersion.V7, tslintUpgradeConfig);
return createUpgradeRule(TargetVersion.V7, [], materialUpgradeData, postUpdate);
}

/** Post-update schematic to be called when update is finished. */
Expand Down
11 changes: 1 addition & 10 deletions scripts/release/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,9 @@ function getRemoteUrl(remote: string): string {
function bumpVersion(): void {
log.info('Updating version number...');

const appComponentPath = path.join(buildConfig.scriptsDir, 'site/_site/doc/app/app.component.ts');
const codeBoxPath = path.join(buildConfig.scriptsDir, 'site/_site/doc/app/share/nz-codebox/stack-blitz.ts');
const packageJsonPath = path.join(buildConfig.componentsDir, 'package.json');
const packageJson = fs.readJsonSync(packageJsonPath);
const zorroVersionPath = path.join(buildConfig.componentsDir, 'version.ts');
const zorroVersionPath = path.join(buildConfig.componentsDir, 'version', 'version.ts');
const currentVersion = packageJson.version;
let versionNumberValid = false;
let version;
Expand All @@ -125,13 +123,6 @@ function bumpVersion(): void {
}

fs.writeJsonSync(packageJsonPath, {...packageJson, version: version}, {spaces: 2});
fs.writeFileSync(appComponentPath,
fs.readFileSync(appComponentPath, 'utf-8')
.replace(/currentVersion = '.+';/g, `currentVersion = '${version}';`)
);
fs.writeFileSync(codeBoxPath,
fs.readFileSync(codeBoxPath, 'utf-8').replace(/'ng-zorro-antd'\s*: '.+'/g, `'ng-zorro-antd': '^${version}'`)
);
fs.writeFileSync(zorroVersionPath,
fs.readFileSync(zorroVersionPath, 'utf-8')
.replace(/Version\('.+'\);/g, `Version('${version}');`)
Expand Down
4 changes: 2 additions & 2 deletions scripts/site/_site/doc/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Platform } from '@angular/cdk/platform';
import { AfterViewInit, Component, ElementRef, HostListener, NgZone, OnInit, ViewChild } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { NavigationEnd, Router } from '@angular/router';
import { en_US, zh_CN, NzI18nService, NzMessageService } from 'ng-zorro-antd';
import { en_US, zh_CN, NzI18nService, NzMessageService, VERSION } from 'ng-zorro-antd';
import { fromEvent } from 'rxjs';
import { debounceTime, map, startWith } from 'rxjs/operators';
import { environment } from '../environments/environment';
Expand Down Expand Up @@ -45,7 +45,7 @@ export class AppComponent implements OnInit, AfterViewInit {

language = 'zh';
oldVersionList = [ '0.5.x', '0.6.x', '0.7.x', '1.8.x', '7.5.x' ];
currentVersion = '8.0.3';
currentVersion = VERSION.full;

@ViewChild('searchInput', { static: false }) searchInput: ElementRef<HTMLInputElement>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '@angular/core';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
import sdk from '@stackblitz/sdk';
import { VERSION } from 'ng-zorro-antd'
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { environment } from '../../../environments/environment';
Expand Down Expand Up @@ -113,7 +114,7 @@ export class NzCodeBoxComponent implements OnInit, OnDestroy {
}

openOnStackBlitz() {
sdk.openProject(stackBlitzConfiguration(this.nzComponentName, this.nzRawCode, this.nzSelector));
sdk.openProject(stackBlitzConfiguration(this.nzComponentName, this.nzRawCode, this.nzSelector, VERSION.full));
}

check() {
Expand Down
4 changes: 2 additions & 2 deletions scripts/site/_site/doc/app/share/nz-codebox/stack-blitz.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const stackBlitzConfiguration = (componentName: string, appComponentCode: string, selector: string) => {
export const stackBlitzConfiguration = (componentName: string, appComponentCode: string, selector: string, version: string) => {
const mainCode = `import './polyfills';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
Expand Down Expand Up @@ -258,7 +258,7 @@ export class AppModule { }`;
'@angular/animations' : '^8.0.0',
'@ant-design/icons-angular' : '^8.0.0',
'date-fns' : '^1.30.1',
'ng-zorro-antd': '^8.0.3'
'ng-zorro-antd': `^${version}`
},
tags : [ 'stackblitz', 'sdk' ]
};
Expand Down
2 changes: 1 addition & 1 deletion scripts/site/generate-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function generate(target) {
}
}
const componentDirPath = path.join(rootPath, componentName);
if (componentName === 'style' || componentName === 'core' || componentName === 'locale' || componentName === 'i18n') {
if (componentName === 'style' || componentName === 'core' || componentName === 'locale' || componentName === 'i18n' || componentName === 'version') {
return;
}
if (fs.statSync(componentDirPath).isDirectory()) {
Expand Down

0 comments on commit ef9a9e3

Please sign in to comment.