-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Actually fix node_modules in mocha tests, fix custom-outputpaths test
- Loading branch information
Showing
6 changed files
with
77 additions
and
47 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,47 @@ | ||
/** | ||
* Fix nested packages not using workspace version | ||
* ember-cli-addon-tests will link ember-cli-fastboot and run npm install in the test apps, | ||
* the installation will install fastboot from npm registry rather than workspace version | ||
* | ||
*/ | ||
|
||
import path from 'path'; | ||
import fs from 'fs-extra'; | ||
import { fileURLToPath } from 'url'; | ||
import chalk from 'chalk'; | ||
const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
|
||
const packagesDir = path.resolve(__dirname, '../../packages'); | ||
const nodeModulesDir = path.resolve(__dirname, 'node_modules'); | ||
|
||
// eslint-disable-next-line no-undef | ||
const shouldRestore = process.argv[2]; | ||
if (shouldRestore === '--help' || shouldRestore === '-h') { | ||
console.log(`Usage: node fix-node-modules.mjs [arguments] | ||
Options: | ||
-h, --help print this message | ||
-r, --restore restore node_modules by removing symlinks`); | ||
} else if (shouldRestore === '-r' || shouldRestore === '--restore') { | ||
run(true); | ||
} else { | ||
run(false); | ||
} | ||
|
||
function run(shouldRestore) { | ||
['fastboot', 'fastboot-express-middleware'].forEach((packageName) => { | ||
const nodeModulesPackageDir = path.join(nodeModulesDir, packageName); | ||
const workspacesPackageDir = path.resolve(packagesDir, packageName); | ||
if (fs.existsSync(nodeModulesPackageDir)) { | ||
console.log(chalk.blue(`remove ${nodeModulesPackageDir}`)); | ||
fs.removeSync(nodeModulesPackageDir); | ||
} | ||
if (!shouldRestore) { | ||
console.log( | ||
chalk.green( | ||
`symlink ${nodeModulesPackageDir} -> ${workspacesPackageDir}` | ||
) | ||
); | ||
fs.symlinkSync(workspacesPackageDir, nodeModulesPackageDir, 'dir'); | ||
} | ||
}); | ||
} |
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
26 changes: 26 additions & 0 deletions
26
packages/ember-cli-fastboot/test/fixtures/customized-outputpaths/app/index.html
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,26 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<title>Customized Output Paths</title> | ||
<meta name="description" content=""> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
{{content-for "head"}} | ||
|
||
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css"> | ||
<link integrity="" rel="stylesheet" href="{{rootURL}}some-assets/pth/app.css"> | ||
|
||
{{content-for "head-footer"}} | ||
</head> | ||
<body> | ||
{{content-for "body"}} | ||
|
||
<script src="{{rootURL}}some-assets/path/lib.js"></script> | ||
<script src="{{rootURL}}some-assets/path/app-file.js"></script> | ||
|
||
{{content-for "body-footer"}} | ||
</body> | ||
</html> | ||
|
This file was deleted.
Oops, something went wrong.
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