Skip to content

Commit

Permalink
chore: remove sandbox (#1730)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk authored Dec 9, 2023
1 parent 33a4952 commit 1869b59
Show file tree
Hide file tree
Showing 9 changed files with 883 additions and 1,220 deletions.
21 changes: 10 additions & 11 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,7 @@
"date-fns",
"extend",
"aos"
],
"server": "src/main.server.ts",
"prerender": {
"routesFile": "scripts/site/route-paths.txt"
},
"ssr": {
"entry": "src/server.ts"
}
]
},
"configurations": {
"production": {
Expand All @@ -100,13 +93,19 @@
}
],
"outputHashing": "all",
"serviceWorker": "ngsw-config.json"
"serviceWorker": "ngsw-config.json",
"server": "src/main.server.ts",
"prerender": {
"routesFile": "scripts/site/route-paths.txt"
},
"ssr": {
"entry": "src/server.ts"
}
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true,
"ssr": false
"sourceMap": true
}
},
"defaultConfiguration": "production"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"@ng-util/monaco-editor": "^17.0.0",
"isutf8": "^4.0.0",
"@github/hotkey": "^2.3.0",
"ng-antd-color-picker": "^0.0.2"
"ng-antd-color-picker": "^1.1.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.0.0",
Expand Down
33 changes: 8 additions & 25 deletions src/app/core/code/code.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ export class CodeService {
includeCli: boolean;
}): Record<string, string | Record<string, string>> {
const ngCoreVersion = pkg.dependencies['@angular/core'];
const mainVersion = ngCoreVersion.substring(1).split('.').shift();
// const mainVersion = ngCoreVersion.substring(1).split('.').shift();
const res = packageJSON as Record<string, NzSafeAny>;
[
'ng-zorro-antd',
'ng-antd-color-picker',
'date-fns',
'@delon/theme',
'@delon/abc',
'@delon/chart',
Expand All @@ -56,33 +55,17 @@ export class CodeService {
'@delon/mock',
'@delon/form',
'@delon/util',
'ajv',
'ajv-formats',
...dependencies
].forEach(k => (res.dependencies[k] = '*'));
if (includeCli) {
devDependencies = [
...devDependencies,
'ng-alain',
'ng-alain-plugin-theme',
'@angular/cli',
'@angular/compiler-cli',
'@angular-devkit/build-angular'
];
}
devDependencies.forEach(k => (res.devDependencies[k] = '*'));

const fullLibs: Record<string, string> = { ...pkg.dependencies, ...pkg.devDependencies };
['dependencies', 'devDependencies'].forEach(type => {
Object.keys(res[type]).forEach(key => {
res[type][key] = key.startsWith('@delon') ? `~${pkg.version}` : fullLibs[key] || '*';
res[type][key] = key.startsWith('@delon') || key === 'ng-alain' ? `~${pkg.version}` : fullLibs[key] || '*';
});
});
res.dependencies['@angular/core'] = ngCoreVersion;
['@angular/cdk', '@ant-design/icons-angular', 'ngx-countdown'].forEach(type => {
res.dependencies[type] = mainVersion;
});
// res.dependencies['core-js'] = `~3.8.3`;
if (!includeCli) res;

return res;
Expand Down Expand Up @@ -116,7 +99,7 @@ export class CodeService {
html: [
`<base href="/">`,
`<${selector}>loading</${selector}>`,
`<div id="VERSION" style="position: fixed; bottom: 8px; right: 8px; z-index: 8888;"></div>`
`<div id="VERSION" style="position: fixed; bottom: 8px; right: 8px; z-index: 8888;font-size: 11px; color: #aaa;"></div>`
].join('\n')
};
}
Expand Down Expand Up @@ -147,7 +130,6 @@ export class CodeService {
const json = deepCopy(angularJSON);
json.projects.demo.architect.build.options.styles.splice(0, 0, this.themePath);
const packageJson = this.genPackage({ dependencies: [], devDependencies: [], includeCli: false });
packageJson.name = 'NG-ALAIN';
packageJson.description = title;
sdk.openProject(
{
Expand Down Expand Up @@ -185,7 +167,7 @@ export class CodeService {
template: 'node'
},
{
openFile: `src/app/app.component.ts`
openFile: `src/app/app.config.ts,src/app/app.component.ts`
}
);
}
Expand All @@ -197,7 +179,7 @@ export class CodeService {
const json = deepCopy(angularJSON);
json.projects.demo.architect.build.options.styles.splice(0, 0, this.themePath);
const packageJson = this.genPackage({ dependencies: [], devDependencies: [], includeCli });
packageJson.name = 'NG-ALAIN';
// packageJson.name = 'NG-ALAIN';
packageJson.description = title;
const files: {
[key: string]: {
Expand Down Expand Up @@ -267,8 +249,9 @@ export class CodeService {
};
});
const parameters = getParameters({
files
});
files,
environment: 'server'
} as NzSafeAny);

const form = this.document.createElement('form');
const parametersInput = this.document.createElement('input');
Expand Down
60 changes: 29 additions & 31 deletions src/app/core/code/files/package.json.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,43 @@
export default {
name: 'ng-alain',
description: '',
tags: ['NG-ALAIN'],
version: '0.0.0',
scripts: {
ng: 'ng',
start: 'ng serve',
build: 'ng build',
test: 'ng test',
lint: 'ng lint',
e2e: 'ng e2e'
build: 'ng build'
},
private: true,
dependencies: {
rxjs: '7.8.1',
tslib: '2.6.2',
'zone.js': '0.14.2',
'@angular/core': '17.0.6',
'@angular/forms': '17.0.6',
'@angular/common': '17.0.6',
'@angular/router': '17.0.6',
'@angular/compiler': '17.0.6',
'@angular/animations': '17.0.6',
'@angular/platform-browser': '17.0.6'
rxjs: '~7.8.0',
tslib: '^2.3.0',
'zone.js': '~0.14.2',
'@angular/core': '^17.0.0',
'@angular/forms': '^17.0.0',
'@angular/common': '^17.0.0',
'@angular/router': '^17.0.0',
'@angular/compiler': '^17.0.0',
'@angular/animations': '^17.0.0',
'@angular/platform-browser': '^17.0.0',
'@delon/theme': '~17.0.3',
'@delon/abc': '~17.0.3',
'@delon/chart': '~17.0.3',
'@delon/acl': '~17.0.3',
'@delon/auth': '~17.0.3',
'@delon/cache': '~17.0.3',
'@delon/mock': '~17.0.3',
'@delon/form': '~17.0.3',
'@delon/util': '~17.0.3',
'ng-antd-color-picker': '^0.0.2'
},
devDependencies: {
'@angular-devkit/build-angular': '~0.1100.4',
'@angular/cli': '~11.0.4',
'@angular/compiler-cli': '~11.0.4',
'@types/jasmine': '~3.6.0',
'@types/node': '^12.11.1',
codelyzer: '^6.0.0',
'jasmine-core': '~3.6.0',
'jasmine-spec-reporter': '~5.0.0',
karma: '~5.1.0',
'karma-chrome-launcher': '~3.1.0',
'karma-coverage': '~2.0.3',
'karma-jasmine': '~4.0.0',
'karma-jasmine-html-reporter': '^1.5.0',
protractor: '~7.0.0',
'ts-node': '~8.3.0',
tslint: '~6.1.0',
typescript: '~4.0.2'
'@angular-devkit/build-angular': '^17.0.0',
'@angular/cli': '^17.0.0',
'@angular/compiler-cli': '^17.0.0',
'@types/node': '^18.18.0',
'ts-node': '~10.9.1',
typescript: '~5.2.2',
'ng-alain': '~17.0.3'
}
};
1 change: 1 addition & 0 deletions src/app/core/code/files/sandbox.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default {
'sandbox.config.json': JSON.stringify({ template: 'node' }, null, 2),
'.codesandbox/tasks.json': `{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
Expand Down
26 changes: 13 additions & 13 deletions src/app/routes/form-pages/validator/validator.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ import { NzToolTipModule } from 'ng-zorro-antd/tooltip';

import { AppService, CodeService, I18NService } from '@core';

const stackBlitzTpl = `
import { Component } from '@angular/core';
import { SFSchema } from '@delon/form';
const stackBlitzTpl = `import { Component, inject } from '@angular/core';
import { DelonFormModule, SFLayout, SFSchema, SFUISchema } from '@delon/form';
import { NzMessageService } from 'ng-zorro-antd/message';
@Component({
Expand All @@ -31,25 +30,26 @@ import { NzMessageService } from 'ng-zorro-antd/message';
(formSubmit)="submit($event)"
(formChange)="change($event)"
(formError)="error($event)"></sf>
\`
\`,
standalone: true,
imports: [DelonFormModule]
})
export class DemoComponent {
schema = {schema};
formData = {formData};
ui = {ui};
layout = '{layout}';
constructor(private msg: NzMessageService) { }
private readonly msg = inject(NzMessageService);
schema: SFSchema = {schema};
formData: Record<string, any> = {formData};
ui: SFUISchema = {ui};
layout: SFLayout = '{layout}';
submit(value: any) {
submit(value: any): void {
this.msg.success(JSON.stringify(value));
}
change(value: any) {
change(value: any): void {
console.log('formChange', value);
}
error(value: any) {
error(value: any): void {
console.log('formError', value);
}
}`;
Expand Down
34 changes: 18 additions & 16 deletions src/app/shared/components/code-box/code-box.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,24 @@
<div class="code-box-description" [innerHTML]="item.summary"></div>
}
<div class="code-box-actions">
<i
nz-tooltip
[nzTooltipTitle]="codeSandboxTpl"
(click)="openOnlineIDE('CodeSandbox', true)"
nz-icon
nzType="code-sandbox"
class="code-box-code-icon"
></i>
<ng-template #codeSandboxTpl>
{{ 'app.demo.code-sandbox' | i18n }}
@if (false) {
(
<a (click)="openOnlineIDE('CodeSandbox', true)">{{ 'app.demo.code-sandbox-cli' | i18n }}</a>
)
}
</ng-template>
@if (false) {
<i
nz-tooltip
[nzTooltipTitle]="codeSandboxTpl"
(click)="openOnlineIDE('CodeSandbox', true)"
nz-icon
nzType="code-sandbox"
class="code-box-code-icon"
></i>
<ng-template #codeSandboxTpl>
{{ 'app.demo.code-sandbox' | i18n }}
@if (false) {
(
<a (click)="openOnlineIDE('CodeSandbox', true)">{{ 'app.demo.code-sandbox-cli' | i18n }}</a>
)
}
</ng-template>
}
<i
nz-tooltip
[nzTooltipTitle]="'app.demo.stackblitz' | i18n"
Expand Down
Loading

0 comments on commit 1869b59

Please sign in to comment.