-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: apply Angular package format and ng-packagr
#167
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const singleSpaAngularWebpack = require('single-spa-angular/lib/webpack').default; | ||
|
||
module.exports = config => { | ||
config = singleSpaAngularWebpack(config); | ||
config.output.library = 'shop'; | ||
return config; | ||
}; |
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,28 +1,54 @@ | ||||||
{ | ||||||
"name": "single-spa-angular", | ||||||
"version": "3.3.0", | ||||||
"description": "Helpers for building single-spa applications which use Angular 2", | ||||||
"main": "lib/browser-lib/single-spa-angular.js", | ||||||
"schematics": "./schematics.json", | ||||||
"version": "0.0.0", | ||||||
"description": "Helpers for building single-spa applications which use Angular 2+", | ||||||
"repository": { | ||||||
"type": "git", | ||||||
"url": "git+https://github.com/single-spa/single-spa-angular.git" | ||||||
}, | ||||||
"keywords": [ | ||||||
"single-spa", | ||||||
"angular" | ||||||
], | ||||||
"author": "Joel Denning", | ||||||
"maintainers": [ | ||||||
"Joel Denning", | ||||||
"Artur Androsovych" | ||||||
], | ||||||
"license": "Apache-2.0", | ||||||
"bugs": { | ||||||
"url": "https://github.com/single-spa/single-spa-angular/issues" | ||||||
}, | ||||||
"homepage": "https://github.com/single-spa/single-spa-angular#readme", | ||||||
"private": true, | ||||||
"scripts": { | ||||||
"prepublishOnly": "yarn build && yarn test", | ||||||
"build": "yarn clean && yarn build:webpack && yarn parcel && yarn spa && yarn :copy-schematic-files", | ||||||
"clean": "rimraf lib parcel", | ||||||
"test": "jest", | ||||||
"clean": "rimraf lib pacel", | ||||||
"build": "run-s clean build:single-spa-angular build:webpack build:schematics", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do these all need to be sequential? Couldn't all the builds occur after the clean?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Umm, yes. Basically |
||||||
"test": "yarn clean && yarn jest", | ||||||
"lint": "eslint ./src/**/*.ts", | ||||||
":copy-schematic-files": "cpx \"src/**/_files/**/**\" lib", | ||||||
"parcel": "ngc -p tsconfig.parcel.json", | ||||||
"spa": "tsc -p tsconfig.spa.json", | ||||||
"build:webpack": "tsc -p tsconfig.node.json", | ||||||
"// - SINGLE-SPA-ANGULAR": "Scripts for building single-spa-angular", | ||||||
"build:single-spa-angular": "yarn ts-node tools/build", | ||||||
"// - WEBPACK": "Scripts for building Webpack config transformer", | ||||||
"prebuild:webpack": "rimraf lib/lib", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is there a lib/lib directory? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. webpack is emitted there There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why then is the import for webpack at There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This question is the main one I'm waiting on before reviewing again to approve/merge ^ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The content of the lib folder is copied into node_modules/single-spa-angular folder |
||||||
"build:webpack": "tsc -p tsconfig.webpack.json", | ||||||
"// - SCHEMATICS": "Scripts for building schematics and copying its files", | ||||||
"prebuild:schematics": "rimraf lib/schematics", | ||||||
"build:schematics": "tsc -p tsconfig.schematics.json && run-s copy:schematics:*", | ||||||
"copy:schematics:json": "cpx schematics/schematics.json lib/schematics", | ||||||
"copy:schematics:schema": "cpx \"schematics/ng-add/schema*\" lib/schematics/ng-add", | ||||||
"copy:schematics:files": "cpx \"schematics/ng-add/_files/**/**\" lib/schematics/ng-add/_files", | ||||||
"format": "prettier './**/*' --write", | ||||||
"// - INTEGRATION INSTALLS": "Install packages for integration apps", | ||||||
"install:integration:shop": "yarn --cwd integration/shop install", | ||||||
"install:integration:portal": "yarn --cwd integration/portal install", | ||||||
"install:integration": "yarn install:integration:shop && yarn install:integration:portal", | ||||||
"install:integration": "run-s install:integration:shop install:integration:portal", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why sequential? Couldn't they run concurrently?
Suggested change
|
||||||
"// - INTEGRATION BUILDS": "Build apps that are required for E2E testing #requires yarn install:integration", | ||||||
"build:integration:shop": "yarn --cwd integration/shop build:single-spa", | ||||||
"build:integration:portal": "yarn --cwd integration/portal build:prod", | ||||||
"build:integration": "yarn build:integration:shop && yarn build:integration:portal", | ||||||
"build:integration": "run-s build:integration:shop build:integration:portal", | ||||||
"// - APPS": "Serve apps that are required for E2E testing #requires yarn build:integration", | ||||||
"start:integration": "concurrently -n w: yarn:start:integration:*", | ||||||
"start:integration:shop": "yarn serve integration/shop/dist -s -l 4200 --cors", | ||||||
|
@@ -36,32 +62,6 @@ | |||||
"test:ci": "jest --runInBand", | ||||||
"test:ci:integration": "yarn start-test start:integration 8080 cy:run" | ||||||
}, | ||||||
"repository": { | ||||||
"type": "git", | ||||||
"url": "git+https://github.com/single-spa/single-spa-angular.git" | ||||||
}, | ||||||
"keywords": [ | ||||||
"single-spa", | ||||||
"angular" | ||||||
], | ||||||
"author": "Joel Denning", | ||||||
"license": "Apache-2.0", | ||||||
"bugs": { | ||||||
"url": "https://github.com/single-spa/single-spa-angular/issues" | ||||||
}, | ||||||
"homepage": "https://github.com/single-spa/single-spa-angular#readme", | ||||||
"peerDependencies": { | ||||||
"@angular-devkit/architect": ">=0.10.0", | ||||||
"@angular-devkit/build-angular": ">=0.10.0", | ||||||
"@angular-devkit/core": ">=0.10.0", | ||||||
"@angular/compiler": ">=2", | ||||||
"@angular/compiler-cli": ">=2", | ||||||
"@angular/core": ">=2", | ||||||
"rxjs": ">=6.0.0", | ||||||
"single-spa": ">=4.0.0", | ||||||
"webpack": ">=4.6.0", | ||||||
"webpack-merge": "^4.2.1" | ||||||
}, | ||||||
"devDependencies": { | ||||||
"@angular-builders/custom-webpack": "~9.1.0", | ||||||
"@angular-devkit/architect": "~0.901.0", | ||||||
|
@@ -94,12 +94,15 @@ | |||||
"husky": "^4.2.5", | ||||||
"jest": "^24.5.0", | ||||||
"lint-staged": "^10.1.3", | ||||||
"ng-packagr": "^9.1.0", | ||||||
"npm-run-all": "^4.1.5", | ||||||
"prettier": "^2.0.4", | ||||||
"rimraf": "^2.6.2", | ||||||
"rxjs": "~6.5.5", | ||||||
"serve": "^11.3.0", | ||||||
"start-server-and-test": "^1.10.11", | ||||||
"ts-jest": "^24.0.0", | ||||||
"tsickle": "^0.38.1", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's a part of ng-packagr, it adds jsdoc annotations for the closure compiler. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it's part of ng-packagr, then why do we need to install it separately from ng-packagr? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because it's not a peer dependency of ng-packagr, but it does require that package (I wasn't the author of such solution 🙂 ) |
||||||
"tslib": "^1.11.1", | ||||||
"typescript": "3.7.5", | ||||||
"zone.js": "~0.10.3" | ||||||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
const singleSpaAngularWebpack = require('single-spa-angular/lib/webpack').default; | ||
|
||
module.exports = (angularWebpackConfig, options) => { | ||
const singleSpaWebpackConfig = singleSpaAngularWebpack(angularWebpackConfig, options); | ||
module.exports = config => { | ||
const singleSpaWebpackConfig = singleSpaAngularWebpack(config); | ||
|
||
// Feel free to modify this webpack config however you'd like to | ||
return singleSpaWebpackConfig; | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json", | ||
"schematics": { | ||
"ng-add": { | ||
"description": "Adds single-spa-angular to application", | ||
"schema": "./ng-add/schema.json", | ||
"factory": "./ng-add" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** | ||
* The public api for consumers of single-spa-angular | ||
*/ | ||
export * from './src/public_api'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"$schema": "../node_modules/ng-packagr/ng-package.schema.json", | ||
"name": "single-spa-angular", | ||
"version": "3.3.0", | ||
"description": "Helpers for building single-spa applications which use Angular 2", | ||
"schematics": "./schematics/schematics.json", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/single-spa/single-spa-angular.git" | ||
}, | ||
"keywords": [ | ||
"single-spa", | ||
"angular" | ||
], | ||
"author": "Joel Denning", | ||
"maintainers": [ | ||
"Joel Denning", | ||
"Artur Androsovych" | ||
], | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/single-spa/single-spa-angular/issues" | ||
}, | ||
"homepage": "https://github.com/single-spa/single-spa-angular#readme", | ||
"sideEffects": false, | ||
"peerDependencies": { | ||
"@angular/core": ">=9", | ||
"single-spa": ">=4.0.0" | ||
}, | ||
"ngPackage": { | ||
"lib": { | ||
"umdId": "single-spa-angular", | ||
"flatModuleFile": "single-spa-angular", | ||
"entryFile": "index.ts" | ||
}, | ||
"dest": "../lib" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { singleSpaAngular } from './single-spa-angular'; | ||
export { getSingleSpaExtraProviders } from './extra-providers'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this now 0.0.0 because the repo has been converted to a monorepo with multiple package.jsons?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/ng-packagr/ng-packagr/blob/master/docs/DESIGN.md#folder-layout
Not monorepo. Basically the root package.json we use for such stuff as scripts, dependencies and husky/prettier.
There is another
package.json
inside thesrc
folder that is taken by ng-packagr. ng-packagr automatically adds webpack fields likemain/module/es2015/esm5
andtypings
field.