@netlify/build-info
Advanced tools
Comparing version 7.14.1 to 7.14.2
@@ -107,5 +107,11 @@ import { NPM_BUILD_SCRIPTS, NPM_DEV_SCRIPTS } from '../get-commands.js'; | ||
if (pattern) { | ||
const framework = this.project.frameworks?.get(packagePath)?.[0]; | ||
let frameworkDist = ''; | ||
// for next we still want to get the .next directory on the framework dist path | ||
if (framework?.id === 'next') { | ||
frameworkDist = framework.build.directory; | ||
} | ||
return this.project.fs.join(pattern | ||
.replace('{workspaceRoot}/', '') | ||
.replace(/\{(.+)\}/g, (_match, group) => getProperty({ ...target, projectRoot: packagePath }, group))); | ||
.replace(/\{(.+)\}/g, (_match, group) => getProperty({ ...target, projectRoot: packagePath }, group)), frameworkDist); | ||
} | ||
@@ -112,0 +118,0 @@ } |
@@ -41,4 +41,13 @@ import type { PackageJson } from 'read-pkg'; | ||
category: Category; | ||
/** | ||
* If this is set, at least ONE of these must exist, anywhere in the project | ||
*/ | ||
configFiles: string[]; | ||
/** | ||
* If this is set, at least ONE of these must be present in the `package.json` `dependencies|devDependencies` | ||
*/ | ||
npmDependencies: string[]; | ||
/** | ||
* if this is set, NONE of these must be present in the `package.json` `dependencies|devDependencies` | ||
*/ | ||
excludedNpmDependencies?: string[]; | ||
@@ -153,6 +162,6 @@ version?: SemVer; | ||
/** detect if the framework config file is located somewhere up the tree */ | ||
private detectConfigFile; | ||
protected detectConfigFile(configFiles: string[]): Promise<Detection | undefined>; | ||
/** | ||
* Checks if the project is using a specific framework: | ||
* - if `npmDependencies` is set, one of them must be present in then `package.json` `dependencies|devDependencies` | ||
* - if `npmDependencies` is set, one of them must be present in the `package.json` `dependencies|devDependencies` | ||
* - if `excludedNpmDependencies` is set, none of them must be present in the `package.json` `dependencies|devDependencies` | ||
@@ -159,0 +168,0 @@ * - if `configFiles` is set, one of the files must exist |
@@ -149,5 +149,5 @@ import { coerce, parse } from 'semver'; | ||
/** detect if the framework config file is located somewhere up the tree */ | ||
async detectConfigFile() { | ||
if (this.configFiles?.length) { | ||
const config = await this.project.fs.findUp(this.configFiles, { | ||
async detectConfigFile(configFiles) { | ||
if (configFiles.length) { | ||
const config = await this.project.fs.findUp(configFiles, { | ||
cwd: this.path || this.project.baseDirectory, | ||
@@ -168,3 +168,3 @@ stopAt: this.project.root, | ||
* Checks if the project is using a specific framework: | ||
* - if `npmDependencies` is set, one of them must be present in then `package.json` `dependencies|devDependencies` | ||
* - if `npmDependencies` is set, one of them must be present in the `package.json` `dependencies|devDependencies` | ||
* - if `excludedNpmDependencies` is set, none of them must be present in the `package.json` `dependencies|devDependencies` | ||
@@ -179,3 +179,3 @@ * - if `configFiles` is set, one of the files must exist | ||
const npm = await this.detectNpmDependency(); | ||
const config = await this.detectConfigFile(); | ||
const config = await this.detectConfigFile(this.configFiles ?? []); | ||
this.detected = mergeDetections([npm, config]); | ||
@@ -182,0 +182,0 @@ if (this.detected) { |
@@ -1,2 +0,2 @@ | ||
import { BaseFramework, Category, Framework } from './framework.js'; | ||
import { BaseFramework, Category, DetectedFramework, Framework } from './framework.js'; | ||
export declare class Hydrogen extends BaseFramework implements Framework { | ||
@@ -7,13 +7,2 @@ readonly id = "hydrogen"; | ||
category: Category; | ||
dev: { | ||
command: string; | ||
port: number; | ||
pollingStrategies: { | ||
name: string; | ||
}[]; | ||
}; | ||
build: { | ||
command: string; | ||
directory: string; | ||
}; | ||
logo: { | ||
@@ -24,2 +13,3 @@ default: string; | ||
}; | ||
detect(): Promise<DetectedFramework | undefined>; | ||
} |
import { BaseFramework, Category } from './framework.js'; | ||
const CLASSIC_COMPILER_CONFIG_FILES = ['remix.config.js']; | ||
const CLASSIC_COMPILER_DEV = { | ||
command: 'remix dev --manual -c "netlify dev"', | ||
}; | ||
const CLASSIC_COMPILER_BUILD = { | ||
command: 'remix build', | ||
directory: 'public', | ||
}; | ||
const VITE_CONFIG_FILES = [ | ||
'vite.config.js', | ||
'vite.config.mjs', | ||
'vite.config.cjs', | ||
'vite.config.ts', | ||
'vite.config.mts', | ||
'vite.config.cts', | ||
]; | ||
const VITE_DEV = { | ||
command: 'shopify hydrogen dev', | ||
port: 5173, | ||
}; | ||
const VITE_BUILD = { | ||
// This should be `shopify hydrogen build` but we use this as a workaround for | ||
// https://github.com/Shopify/hydrogen/issues/2496 and https://github.com/Shopify/hydrogen/issues/2497. | ||
command: 'remix vite:build', | ||
directory: 'dist/client', | ||
}; | ||
export class Hydrogen extends BaseFramework { | ||
@@ -7,11 +33,2 @@ id = 'hydrogen'; | ||
category = Category.SSG; | ||
dev = { | ||
command: 'vite', | ||
port: 3000, | ||
pollingStrategies: [{ name: 'TCP' }], | ||
}; | ||
build = { | ||
command: 'npm run build', | ||
directory: 'dist/client', | ||
}; | ||
logo = { | ||
@@ -22,3 +39,24 @@ default: '/logos/hydrogen/default.svg', | ||
}; | ||
async detect() { | ||
await super.detect(); | ||
if (this.detected) { | ||
const viteDetection = await this.detectConfigFile(VITE_CONFIG_FILES); | ||
if (viteDetection) { | ||
this.detected = viteDetection; | ||
this.dev = VITE_DEV; | ||
this.build = VITE_BUILD; | ||
return this; | ||
} | ||
const classicCompilerDetection = await this.detectConfigFile(CLASSIC_COMPILER_CONFIG_FILES); | ||
if (classicCompilerDetection) { | ||
this.detected = classicCompilerDetection; | ||
this.dev = CLASSIC_COMPILER_DEV; | ||
this.build = CLASSIC_COMPILER_BUILD; | ||
return this; | ||
} | ||
// If neither config file exists, it can't be a valid Hydrogen site for Netlify anyway. | ||
return; | ||
} | ||
} | ||
} | ||
//# sourceMappingURL=hydrogen.js.map |
@@ -1,2 +0,2 @@ | ||
import { BaseFramework, Category, Framework } from './framework.js'; | ||
import { BaseFramework, Category, DetectedFramework, Framework } from './framework.js'; | ||
export declare class Remix extends BaseFramework implements Framework { | ||
@@ -6,11 +6,4 @@ readonly id = "remix"; | ||
npmDependencies: string[]; | ||
configFiles: string[]; | ||
excludedNpmDependencies: string[]; | ||
category: Category; | ||
dev: { | ||
command: string; | ||
}; | ||
build: { | ||
command: string; | ||
directory: string; | ||
}; | ||
logo: { | ||
@@ -21,2 +14,3 @@ default: string; | ||
}; | ||
detect(): Promise<DetectedFramework | undefined>; | ||
} |
import { BaseFramework, Category } from './framework.js'; | ||
const CLASSIC_COMPILER_CONFIG_FILES = ['remix.config.js']; | ||
const CLASSIC_COMPILER_DEV = { | ||
command: 'remix watch', | ||
}; | ||
const CLASSIC_COMPILER_BUILD = { | ||
command: 'remix build', | ||
directory: 'public', | ||
}; | ||
const VITE_CONFIG_FILES = [ | ||
'vite.config.js', | ||
'vite.config.mjs', | ||
'vite.config.cjs', | ||
'vite.config.ts', | ||
'vite.config.mts', | ||
'vite.config.cts', | ||
]; | ||
const VITE_DEV = { | ||
command: 'remix vite:dev', | ||
port: 5173, | ||
}; | ||
const VITE_BUILD = { | ||
command: 'remix vite:build', | ||
directory: 'build/client', | ||
}; | ||
export class Remix extends BaseFramework { | ||
id = 'remix'; | ||
name = 'Remix'; | ||
npmDependencies = ['remix', '@remix-run/netlify', '@remix-run/netlify-edge']; | ||
configFiles = ['remix.config.js']; | ||
npmDependencies = [ | ||
'@remix-run/react', | ||
'@remix-run/dev', | ||
'@remix-run/server-runtime', | ||
'@netlify/remix-adapter', | ||
'@netlify/remix-edge-adapter', | ||
'@netlify/remix-runtime', | ||
// Deprecated package name (deprecated in 1.6, removed in 2.0) | ||
'remix', | ||
// Deprecated Netlify packages | ||
'@remix-run/netlify', | ||
'@remix-run/netlify-edge', | ||
]; | ||
excludedNpmDependencies = ['@shopify/hydrogen']; | ||
category = Category.SSG; | ||
dev = { | ||
command: 'remix watch', | ||
}; | ||
build = { | ||
command: 'remix build', | ||
directory: 'public', | ||
}; | ||
logo = { | ||
@@ -20,3 +49,24 @@ default: '/logos/remix/default.svg', | ||
}; | ||
async detect() { | ||
await super.detect(); | ||
if (this.detected) { | ||
const viteDetection = await this.detectConfigFile(VITE_CONFIG_FILES); | ||
if (viteDetection) { | ||
this.detected = viteDetection; | ||
this.dev = VITE_DEV; | ||
this.build = VITE_BUILD; | ||
return this; | ||
} | ||
const classicCompilerDetection = await this.detectConfigFile(CLASSIC_COMPILER_CONFIG_FILES); | ||
if (classicCompilerDetection) { | ||
this.detected = classicCompilerDetection; | ||
this.dev = CLASSIC_COMPILER_DEV; | ||
this.build = CLASSIC_COMPILER_BUILD; | ||
return this; | ||
} | ||
// If neither config file exists, it can't be a valid Remix site for Netlify anyway. | ||
return; | ||
} | ||
} | ||
} | ||
//# sourceMappingURL=remix.js.map |
@@ -7,2 +7,5 @@ import { BaseFramework, Category } from './framework.js'; | ||
excludedNpmDependencies = [ | ||
'@remix-run/react', | ||
'@remix-run/dev', | ||
'@remix-run/server-runtime', | ||
'@shopify/hydrogen', | ||
@@ -9,0 +12,0 @@ '@builder.io/qwik', |
{ | ||
"name": "@netlify/build-info", | ||
"version": "7.14.1", | ||
"version": "7.14.2", | ||
"description": "Build info utility", | ||
@@ -76,3 +76,3 @@ "type": "module", | ||
}, | ||
"gitHead": "0f0dfefdc7df94b4083dbb827751d015cb2c8c88" | ||
"gitHead": "e1756a3a7b6a91e5da6fdedf528acfd85c19b66f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
326546
6002