Skip to content

fix: adapt publish directory based on builder #94

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

Merged
merged 9 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
test
README.md
tests/fixtures
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,4 @@ Temporary Items
.netlify/functions
.netlify/functions-serve
.netlify/functions-internal
.angular
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"pretest:fixtures": "run-s pretest:fixtures:*",
"pretest:fixtures:non-angular-project": "cd tests/fixtures/non-angular-project && npm ci",
"pretest:fixtures:missing-angular-deps": "cd tests/fixtures/missing-angular-deps && npm ci",
"pretest:fixtures:application-builder": "cd tests/fixtures/application-builder && npm ci",
"pretest:fixtures:browser-builder": "cd tests/fixtures/browser-builder && npm ci",
"pretest": "run-s pretest:*",
"test": "node --test"
},
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/fixOutputDir.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const fixOutputDir = async function ({ failBuild, failPlugin, siteRoot, PUBLISH_

const { outputPath } = project.architect.build.options

const correctPublishDir = join(outputPath, 'browser')
const isApplicationBuilder = project.architect.build.builder.endsWith(':application')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you checked this with nx workspaces as well? 🤔

const correctPublishDir = isApplicationBuilder ? join(outputPath, 'browser') : outputPath
if (correctPublishDir === PUBLISH_DIR) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/validateAngularVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const validateAngularVersion = async function (root) {
}

const { version } = await readJSON(packagePath)
if (!satisfies(version, '^17.0.0-rc')) {
if (!satisfies(version, '^17.0.0-rc', { includePrerelease: true })) {
console.warn(`This site does not seem to be using Angular 17.`)
return false
}
Expand Down
62 changes: 62 additions & 0 deletions tests/fixtures/application-builder/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"test-browser-dir": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/test-browser-dir",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
}
}
}
},
"cli": {
"analytics": false
}
}
6 changes: 6 additions & 0 deletions tests/fixtures/application-builder/netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build]
command="npm run build"
ignore="exit 1" ## always build, there might be changes in the plugin

[[plugins]]
package="@netlify/angular-runtime"
Loading