Skip to content

Commit 854650e

Browse files
committed
fix(service-worker): fix manifest path separator
Fix #251
1 parent fef67a5 commit 854650e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

lib/broccoli/service-worker-manifest.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class DiffingSWManifest {
1616
this.options = options;
1717
this.firstBuild = true;
1818
}
19-
19+
2020
rebuild(diff) {
2121
var manifest = {};
2222
if (this.firstBuild) {
@@ -25,10 +25,10 @@ class DiffingSWManifest {
2525
// Read manifest from disk.
2626
manifest = this.readManifestFromCache();
2727
}
28-
28+
2929
// Remove manifest entries for files that are no longer present.
3030
diff.removedPaths.forEach((file) => delete manifest[file]);
31-
31+
3232
// Merge the lists of added and changed paths and update their hashes in the manifest.
3333
[]
3434
.concat(diff.addedPaths)
@@ -60,7 +60,7 @@ class DiffingSWManifest {
6060
var files = Object.keys(manifest).sort();
6161
var bundleHash = this.computeBundleHash(files, manifest);
6262
var contents = files
63-
.map((file) => `# sw.file.hash: ${this.computeFileHash(file)}\n/${file}`)
63+
.map((file) => `# sw.file.hash: ${this.computeFileHash(file)}\n${path.sep}${file}`)
6464
.join('\n');
6565
return `CACHE MANIFEST
6666
# sw.bundle: ng-cli
@@ -95,4 +95,4 @@ ${contents}
9595
}
9696

9797
Object.defineProperty(exports, "__esModule", { value: true });
98-
exports.default = diffingPlugin.wrapDiffingPlugin(DiffingSWManifest);
98+
exports.default = diffingPlugin.wrapDiffingPlugin(DiffingSWManifest);

tests/e2e/e2e_workflow.spec.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ describe('Basic end-to-end Workflow', function () {
7676
.readFileSync(manifestPath, {encoding: 'utf8'})
7777
.trim()
7878
.split('\n');
79-
79+
8080
// Check that a few critical files have been detected.
81-
expect(lines).to.include('/index.html');
82-
expect(lines).to.include('/thirdparty/libs.js');
81+
expect(lines).to.include(`${path.sep}index.html`);
82+
expect(lines).to.include(`${path.sep}thirdparty${path.sep}libs.js`);
8383
});
8484

8585
it('Perform `ng test` after initial build', function() {
@@ -193,20 +193,20 @@ describe('Basic end-to-end Workflow', function () {
193193
// sh.rm('-rf', './tmp'); // tmp.teardown takes too long
194194
});
195195
});
196-
196+
197197
it('Turn on `noImplicitAny` in tsconfig.json and rebuild', function (done) {
198198
this.timeout(420000);
199-
199+
200200
var configFilePath = path.join(process.cwd(), 'src', 'tsconfig.json');
201201
fs.readFile(configFilePath, 'utf8', function(err, data){
202-
202+
203203
var config = JSON.parse(data);
204204
config.compilerOptions.noImplicitAny = true;
205-
205+
206206
fs.writeFile(configFilePath, JSON.stringify(config), function(){
207207
//clear the dist folder
208208
sh.rm('-rf', path.join(process.cwd(), 'dist'));
209-
209+
210210
return ng([
211211
'build',
212212
'--silent'

0 commit comments

Comments
 (0)