Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 2 additions & 6 deletions aio/tools/examples/example-boilerplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,9 @@ const ANGULAR_PACKAGES = [
'platform-browser-dynamic',
'platform-server',
'router',
'tsc-wrapped',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did someone move the tsc-wrapped folder?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ahah!
619e625

'upgrade',
];
const ANGULAR_TOOLS_PACKAGES_PATH = path.resolve(ANGULAR_DIST_PATH, 'tools', '@angular');
const ANGULAR_TOOLS_PACKAGES = [
'tsc-wrapped'
];

const EXAMPLE_CONFIG_FILENAME = 'example-config.json';

Expand All @@ -63,7 +60,6 @@ class ExampleBoilerPlate {
// Replace the Angular packages with those from the dist folder, if necessary
if (useLocal) {
ANGULAR_PACKAGES.forEach(packageName => this.overridePackage(ANGULAR_PACKAGES_PATH, packageName));
ANGULAR_TOOLS_PACKAGES.forEach(packageName => this.overridePackage(ANGULAR_TOOLS_PACKAGES_PATH, packageName));
}

// Get all the examples folders, indicated by those that contain a `example-config.json` file
Expand Down Expand Up @@ -111,7 +107,7 @@ class ExampleBoilerPlate {
const sourceFolder = path.resolve(basePath, packageName);
const destinationFolder = path.resolve(SHARED_NODE_MODULES_PATH, '@angular', packageName);
shelljs.rm('-rf', destinationFolder);
fs.ensureSymlinkSync(sourceFolder, destinationFolder);
fs.copySync(sourceFolder, destinationFolder);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why this change?
Does it not work on Windows?
The idea of symlinking meant that you didn't need to keep running add-boilerplate all the time, while working on the source.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I can't try on Windows, but it didn't work on Ubuntu either. I was getting errors from files in dist/packages-dist/... that it couldn't find @angular/core for example. Seems like the double symlinking (packages-dist --> shared/node_modules --> /node_modules) threw it off.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe we could get by, by copying the symlinks (instead of re-symlinking) from shared/node_modules/@angular if in local mode.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh, that wouldn't actually work, because we symlink to the shared/node_modules/ directory as a whole 😞

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So, I confirmed the symlinking fails on Travis too, so it was not a local issue in my Ubuntu VM.
Sticking with copying (and having to re-add the boilerplate if you re-build Angular packages).

}

getFoldersContaining(basePath, filename, ignore) {
Expand Down
9 changes: 5 additions & 4 deletions aio/tools/examples/example-boilerplate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ describe('example-boilerplate tool', () => {
exampleBoilerPlate.add(true);
expect(exampleBoilerPlate.overridePackage).toHaveBeenCalledTimes(numberOfAngularPackages + numberOfAngularToolsPackages);
// for example
expect(exampleBoilerPlate.overridePackage).toHaveBeenCalledWith(path.resolve(__dirname, '../../../dist/packages-dist'), 'common');
expect(exampleBoilerPlate.overridePackage).toHaveBeenCalledWith(path.resolve(__dirname, '../../../dist/packages-dist'), 'core');
expect(exampleBoilerPlate.overridePackage).toHaveBeenCalledWith(path.resolve(__dirname, '../../../dist/tools/@angular'), 'tsc-wrapped');
expect(exampleBoilerPlate.overridePackage).toHaveBeenCalledWith(path.resolve(__dirname, '../../../dist/packages-dist'), 'tsc-wrapped');
});

it('should process all the example folders', () => {
Expand Down Expand Up @@ -90,17 +91,17 @@ describe('example-boilerplate tool', () => {
describe('overridePackage', () => {
beforeEach(() => {
spyOn(shelljs, 'rm');
spyOn(fs, 'ensureSymlinkSync');
spyOn(fs, 'copySync');
});

it('should remove the original package from the shared node_modules folder', () => {
exampleBoilerPlate.overridePackage('base/path', 'somePackage');
expect(shelljs.rm).toHaveBeenCalledWith('-rf', path.resolve(__dirname, 'shared/node_modules/@angular/somePackage'));
});

it('should symlink the source folder to the shared node_modules folder', () => {
it('should copy the source folder to the shared node_modules folder', () => {
exampleBoilerPlate.overridePackage('base/path', 'somePackage');
expect(fs.ensureSymlinkSync).toHaveBeenCalledWith(path.resolve('base/path/somePackage'), path.resolve(__dirname, 'shared/node_modules/@angular/somePackage'));
expect(fs.copySync).toHaveBeenCalledWith(path.resolve('base/path/somePackage'), path.resolve(__dirname, 'shared/node_modules/@angular/somePackage'));
});
});

Expand Down
2 changes: 1 addition & 1 deletion aio/tools/examples/run-example-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function runE2e() {
if (argv.setup) {
// Run setup.
console.log('runE2e: copy boilerplate');
const spawnInfo = spawnExt('yarn', ['boilerplate:add', argv.local ? '-- --local': ''], { cwd: AIO_PATH });
const spawnInfo = spawnExt('yarn', ['boilerplate:add', '--', argv.local ? '--local' : ''], { cwd: AIO_PATH });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good spot.

promise = spawnInfo.promise
.then(() => {
console.log('runE2e: update webdriver');
Expand Down
2 changes: 1 addition & 1 deletion aio/tools/examples/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "^1.2.0",
"@angular/cli": "^1.2.7",
"@types/angular": "^1.5.16",
"@types/angular-animate": "^1.5.5",
"@types/angular-cookies": "^1.4.2",
Expand Down
Loading