Skip to content

Commit 9590a55

Browse files
Jami LurockJami Lurock
Jami Lurock
authored and
Jami Lurock
committed
make compatible with Angular 14
1 parent a171a71 commit 9590a55

File tree

10 files changed

+24723
-9733
lines changed

10 files changed

+24723
-9733
lines changed

examples/cli-example/package-lock.json

Lines changed: 17331 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/cli-example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@angular/platform-browser": "^14.0.0",
3030
"@angular/platform-browser-dynamic": "^14.0.0",
3131
"@angular/router": "^14.0.0",
32+
"@angular/service-worker": "^14.0.0",
3233
"rxjs": "~7.5.0",
3334
"tslib": "^2.3.0",
3435
"zone.js": "~0.11.4"
@@ -38,7 +39,6 @@
3839
"@angular/cli": "^14.0.0",
3940
"@angular/compiler-cli": "^14.0.0",
4041
"@types/jasmine": "~4.0.0",
41-
"angular-playground": "^9.0.1",
4242
"jasmine-core": "~4.1.1",
4343
"karma": "~6.3.0",
4444
"karma-chrome-launcher": "~3.1.0",

examples/cli-example/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"node_modules/@types"
1616
],
1717
"lib": [
18-
"es2018",
18+
"es2020",
1919
"dom"
2020
],
2121
"paths": {

package-lock.json

Lines changed: 7179 additions & 9523 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
"typings": "dist/playground/angular-playground.d.ts",
66
"module": "dist/playground/fesm2015/angular-playground.mjs",
77
"es2015": "dist/playground/fesm2015/angular-playground.mjs",
8-
"esm2020": "dist/playground/esm2020/angular-playground.mjs",
98
"fesm2015": "dist/playground/fesm2015/angular-playground.mjs",
109
"fesm2020": "dist/playground/fesm2020/angular-playground.mjs",
10+
"esm2020": "dist/playground/esm2020/angular-playground.mjs",
11+
"es2020": "dist/playground/fesm2020/angular-playground.mjs",
1112
"sideEffects": false,
1213
"bin": {
1314
"angular-playground": "dist/bin/index.js"
@@ -68,22 +69,22 @@
6869
"migrations": "./dist/schematics/migrations/migrations.json"
6970
},
7071
"peerDependencies": {
71-
"@angular/common": ">=13.0.0",
72-
"@angular/compiler": ">=13.0.0",
73-
"@angular/core": ">=13.0.0",
74-
"@angular/forms": ">=13.0.0",
75-
"@angular/platform-browser": ">=13.0.0",
76-
"@angular/platform-browser-dynamic": ">=13.0.0",
72+
"@angular/common": ">=14.0.0",
73+
"@angular/compiler": ">=14.0.0",
74+
"@angular/core": ">=14.0.0",
75+
"@angular/forms": ">=14.0.0",
76+
"@angular/platform-browser": ">=14.0.0",
77+
"@angular/platform-browser-dynamic": ">=14.0.0",
7778
"tslib": ">=2.3.0",
78-
"rxjs": ">=7.4.0",
79+
"rxjs": ">=7.5.0",
7980
"zone.js": ">=0.11.4"
8081
},
8182
"dependencies": {
82-
"@angular-devkit/core": "^13.0.0",
83-
"@angular-devkit/schematics": "^13.0.0",
83+
"@angular-devkit/core": "^14.0.0",
84+
"@angular-devkit/schematics": "^14.0.0",
8485
"@jest/core": "^27.0.6",
8586
"@jest/types": "^27.0.6",
86-
"@schematics/angular": "^13.0.0",
87+
"@schematics/angular": "^14.0.0",
8788
"async": "^3.2.0",
8889
"chalk": "^4.1.1",
8990
"commander": "^7.2.0",
@@ -95,24 +96,24 @@
9596
"puppeteer": "^13.1.2"
9697
},
9798
"devDependencies": {
98-
"@angular-devkit/build-angular": "13.0.0",
99-
"@angular/cli": "13.0.0",
100-
"@angular/common": "13.0.0",
101-
"@angular/compiler": "13.0.0",
102-
"@angular/compiler-cli": "13.0.0",
103-
"@angular/core": "13.0.0",
104-
"@angular/forms": "13.0.0",
105-
"@angular/language-service": "13.0.0",
106-
"@angular/platform-browser": "13.0.0",
107-
"@angular/platform-browser-dynamic": "13.0.0",
99+
"@angular-devkit/build-angular": "14.0.0",
100+
"@angular/cli": "14.0.0",
101+
"@angular/common": "14.0.0",
102+
"@angular/compiler": "14.0.0",
103+
"@angular/compiler-cli": "14.0.0",
104+
"@angular/core": "14.0.0",
105+
"@angular/forms": "14.0.0",
106+
"@angular/language-service": "14.0.0",
107+
"@angular/platform-browser": "14.0.0",
108+
"@angular/platform-browser-dynamic": "14.0.0",
108109
"@types/jest": "^27.0.0",
109110
"@types/node": "^15.3.0",
110111
"@types/puppeteer": "^5.4.3",
111-
"ng-packagr": "13.0.0",
112-
"rxjs": "~7.4.0",
112+
"ng-packagr": "14.0.0",
113+
"rxjs": "~7.5.0",
113114
"ts-jest": "^27.0.4",
114115
"tslib": "^2.3.0",
115-
"typescript": "~4.4.3",
116+
"typescript": "~4.7.2",
116117
"zone.js": "~0.11.4"
117118
}
118119
}

projects/cli/src/build-angular-cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function buildAngularCli(appName: string, enableServiceWorker: bool
1313
const options = Number.isInteger(+maxBuffer) ? { maxBuffer: +maxBuffer } : {};
1414
// Cannot build w/ AOT due to runtime compiler dependency
1515
const flags = [
16-
'--prod',
16+
`-c=production`,
1717
'--aot=false',
1818
`--base-href=${baseHref}`,
1919
`--service-worker=${enableServiceWorker}`,

projects/cli/src/serve-angular-cli.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ export async function serveAngularCli(config: Config) {
2323

2424
function configureArguments(config: Config): string[] {
2525
let args = [config.angularCliPath, 'serve', config.angularAppName];
26-
const publicHost = `${config.angularCliHost}:${config.angularCliPort}`;
2726

2827
if (!config.angularAppName) {
2928
throw new Error(`Please provide Playground's appName in your angular-playground.json file.`);
3029
}
3130
args.push(`--host=${config.angularCliHost}`);
3231
args.push(`--port=${config.angularCliPort}`);
3332
// need to set webpack.devServer.public via ng serve --publicHost flag (https://stackoverflow.com/a/43621275)
34-
args.push(`--publicHost=${publicHost}`);
3533

3634
if (config.angularCliAdditionalArgs) {
3735
args = args.concat(config.angularCliAdditionalArgs);

projects/schematics/src/migrations/7.0.0/index.ts

Lines changed: 61 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -25,71 +25,72 @@ export default function migration(options: any): Rule {
2525
}
2626

2727
function updateAppInWorkspaceFile(
28-
options: { stylesExtension: string },
29-
workspace: workspaces.WorkspaceDefinition,
28+
options: {stylesExtension: string},
3029
project: workspaces.ProjectDefinition, name: string): Rule {
3130

32-
const projectRoot = normalize(project.root);
33-
const projectRootParts = projectRoot.split('/');
34-
const sourceRoot = getSourceRoot(project.sourceRoot);
35-
const sourceRootParts = sourceRoot.split('/');
31+
return updateWorkspace((workspace) => {
32+
const projectRoot = normalize(project.root);
33+
const projectRootParts = projectRoot.split('/');
34+
const sourceRoot = getSourceRoot(project.sourceRoot);
35+
const sourceRootParts = sourceRoot.split('/');
3636

37-
workspace.projects.delete(name);
38-
workspace.projects.add({
39-
name,
40-
root: projectRoot,
41-
sourceRoot,
42-
projectType: 'application',
43-
targets:
44-
{
45-
build: {
46-
builder: Builders.Browser,
47-
options: {
48-
outputPath: constructPath(['dist', 'playground']),
49-
index: constructPath([...sourceRootParts, 'index.html']),
50-
main: constructPath([...sourceRootParts, 'main.playground.ts']),
51-
polyfills: constructPath([...sourceRootParts, 'polyfills.ts']),
52-
tsConfig: constructPath([...projectRootParts, `tsconfig.playground.json`]),
53-
aot: false,
54-
assets: [
55-
constructPath([...sourceRootParts, 'favicon.ico']),
56-
constructPath([...sourceRootParts, 'assets']),
57-
],
58-
styles: [
59-
constructPath([...sourceRootParts, `styles.${options.stylesExtension}`]),
60-
],
61-
scripts: [],
62-
},
63-
configurations: {
64-
production: {
65-
fileReplacements: [
66-
{
67-
replace: constructPath([...sourceRootParts, 'environments', 'environment.ts']),
68-
with: constructPath([...sourceRootParts, 'environments', 'environment.prod.ts']),
37+
workspace.projects.delete(name);
38+
workspace.projects.add({
39+
name,
40+
root: projectRoot,
41+
sourceRoot,
42+
projectType: 'application',
43+
targets:
44+
{
45+
build: {
46+
builder: Builders.Browser,
47+
options: {
48+
outputPath: constructPath(['dist', 'playground']),
49+
index: constructPath([...sourceRootParts, 'index.html']),
50+
main: constructPath([...sourceRootParts, 'main.playground.ts']),
51+
polyfills: constructPath([...sourceRootParts, 'polyfills.ts']),
52+
tsConfig: constructPath([...projectRootParts, `tsconfig.playground.json`]),
53+
aot: false,
54+
assets: [
55+
constructPath([...sourceRootParts, 'favicon.ico']),
56+
constructPath([...sourceRootParts, 'assets']),
57+
],
58+
styles: [
59+
constructPath([...sourceRootParts, `styles.${options.stylesExtension}`]),
60+
],
61+
scripts: [],
62+
},
63+
configurations: {
64+
production: {
65+
fileReplacements: [
66+
{
67+
replace: constructPath([...sourceRootParts, 'environments', 'environment.ts']),
68+
with: constructPath([...sourceRootParts, 'environments', 'environment.prod.ts']),
69+
},
70+
],
71+
optimization: true,
72+
outputHashing: 'all',
73+
sourceMap: false,
74+
extractCss: true,
75+
namedChunks: false,
76+
extractLicenses: true,
77+
vendorChunk: false,
78+
buildOptimizer: true,
6979
},
70-
],
71-
optimization: true,
72-
outputHashing: 'all',
73-
sourceMap: false,
74-
extractCss: true,
75-
namedChunks: false,
76-
extractLicenses: true,
77-
vendorChunk: false,
78-
buildOptimizer: true,
80+
},
7981
},
80-
},
81-
},
82-
serve: {
83-
builder: Builders.DevServer,
84-
options: {
85-
browserTarget: 'playground:build',
86-
port: 4201
87-
},
88-
}
89-
}
82+
serve: {
83+
builder: Builders.DevServer,
84+
options: {
85+
browserTarget: 'playground:build',
86+
port: 4201
87+
},
88+
}
89+
}
90+
});
91+
9092
});
9193

92-
return updateWorkspace(workspace);
9394
}
9495

9596
function configure(options: any): Rule {
@@ -110,7 +111,7 @@ function configure(options: any): Rule {
110111
&& isJsonArray(buildTarget.options.styles)
111112
) {
112113
const mainStyle = buildTarget.options.styles
113-
.find((path: string | { input: string }) => typeof path === 'string'
114+
.find((path: string | {input: string}) => typeof path === 'string'
114115
? path.includes('/styles.')
115116
: path.input.includes('/styles.'));
116117
if (mainStyle) {
@@ -121,7 +122,7 @@ function configure(options: any): Rule {
121122
}
122123

123124
return chain([
124-
updateAppInWorkspaceFile({stylesExtension}, workspace, project, 'playground'),
125+
updateAppInWorkspaceFile({stylesExtension}, project, 'playground'),
125126
]);
126127
};
127128
}

0 commit comments

Comments
 (0)