-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to a monorepo structure (#2909)
- Loading branch information
1 parent
a70a928
commit 5bdca9d
Showing
2,304 changed files
with
37,152 additions
and
25,869 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
"use strict"; | ||
// This file should be committed to your repository! It wraps Nx and ensures | ||
// that your local installation matches nx.json. | ||
// See: https://nx.dev/more-concepts/nx-and-the-wrapper for more info. | ||
|
||
|
||
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const cp = require('child_process'); | ||
const installationPath = path.join(__dirname, 'installation', 'package.json'); | ||
function matchesCurrentNxInstall(nxJsonInstallation) { | ||
try { | ||
const currentInstallation = require(installationPath); | ||
if (currentInstallation.devDependencies['nx'] !== | ||
nxJsonInstallation.version || | ||
require(path.join(path.dirname(installationPath), 'node_modules', 'nx', 'package.json')).version !== nxJsonInstallation.version) { | ||
return false; | ||
} | ||
for (const [plugin, desiredVersion] of Object.entries(nxJsonInstallation.plugins || {})) { | ||
if (currentInstallation.devDependencies[plugin] !== desiredVersion) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
catch { | ||
return false; | ||
} | ||
} | ||
function ensureDir(p) { | ||
if (!fs.existsSync(p)) { | ||
fs.mkdirSync(p, { recursive: true }); | ||
} | ||
} | ||
function ensureUpToDateInstallation() { | ||
const nxJsonPath = path.join(__dirname, '..', 'nx.json'); | ||
let nxJson; | ||
try { | ||
nxJson = require(nxJsonPath); | ||
} | ||
catch { | ||
console.error('[NX]: nx.json is required when running the nx wrapper. See https://nx.dev/more-concepts/nx-and-the-wrapper'); | ||
process.exit(1); | ||
} | ||
try { | ||
ensureDir(path.join(__dirname, 'installation')); | ||
if (!matchesCurrentNxInstall(nxJson.installation)) { | ||
fs.writeFileSync(installationPath, JSON.stringify({ | ||
name: 'nx-installation', | ||
devDependencies: { | ||
nx: nxJson.installation.version, | ||
...nxJson.installation.plugins, | ||
}, | ||
})); | ||
cp.execSync('npm i', { | ||
cwd: path.dirname(installationPath), | ||
stdio: 'inherit', | ||
}); | ||
} | ||
} | ||
catch (e) { | ||
const messageLines = [ | ||
'[NX]: Nx wrapper failed to synchronize installation.', | ||
]; | ||
if (e instanceof Error) { | ||
messageLines.push(''); | ||
messageLines.push(e.message); | ||
messageLines.push(e.stack); | ||
} | ||
else { | ||
messageLines.push(e.toString()); | ||
} | ||
console.error(messageLines.join('\n')); | ||
process.exit(1); | ||
} | ||
} | ||
if (!process.env.NX_WRAPPER_SKIP_INSTALL) { | ||
ensureUpToDateInstallation(); | ||
} | ||
|
||
require('./installation/node_modules/nx/bin/nx'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This file is automatically generated by @yarnpkg/sdks. | ||
# Manual changes might be lost! | ||
|
||
integrations: | ||
- vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env node | ||
|
||
const {existsSync} = require(`fs`); | ||
const {createRequire} = require(`module`); | ||
const {resolve} = require(`path`); | ||
|
||
const relPnpApiPath = "../../../../.pnp.cjs"; | ||
|
||
const absPnpApiPath = resolve(__dirname, relPnpApiPath); | ||
const absRequire = createRequire(absPnpApiPath); | ||
|
||
if (existsSync(absPnpApiPath)) { | ||
if (!process.versions.pnp) { | ||
// Setup the environment to be able to require typescript/bin/tsc | ||
require(absPnpApiPath).setup(); | ||
} | ||
} | ||
|
||
// Defer to the real typescript/bin/tsc your application uses | ||
module.exports = absRequire(`typescript/bin/tsc`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env node | ||
|
||
const {existsSync} = require(`fs`); | ||
const {createRequire} = require(`module`); | ||
const {resolve} = require(`path`); | ||
|
||
const relPnpApiPath = "../../../../.pnp.cjs"; | ||
|
||
const absPnpApiPath = resolve(__dirname, relPnpApiPath); | ||
const absRequire = createRequire(absPnpApiPath); | ||
|
||
if (existsSync(absPnpApiPath)) { | ||
if (!process.versions.pnp) { | ||
// Setup the environment to be able to require typescript/bin/tsserver | ||
require(absPnpApiPath).setup(); | ||
} | ||
} | ||
|
||
// Defer to the real typescript/bin/tsserver your application uses | ||
module.exports = absRequire(`typescript/bin/tsserver`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env node | ||
|
||
const {existsSync} = require(`fs`); | ||
const {createRequire} = require(`module`); | ||
const {resolve} = require(`path`); | ||
|
||
const relPnpApiPath = "../../../../.pnp.cjs"; | ||
|
||
const absPnpApiPath = resolve(__dirname, relPnpApiPath); | ||
const absRequire = createRequire(absPnpApiPath); | ||
|
||
if (existsSync(absPnpApiPath)) { | ||
if (!process.versions.pnp) { | ||
// Setup the environment to be able to require typescript/lib/tsc.js | ||
require(absPnpApiPath).setup(); | ||
} | ||
} | ||
|
||
// Defer to the real typescript/lib/tsc.js your application uses | ||
module.exports = absRequire(`typescript/lib/tsc.js`); |
Oops, something went wrong.