Skip to content
This repository has been archived by the owner on Mar 12, 2022. It is now read-only.

Updating plugin to use proper webpack 4 apis #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
44 changes: 44 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@Library(['pureconnect-builds', 'devops-buildtools']) _

Map config = [ emails: '[email protected]' ];
pipeline {
agent {
label 'linux && node10'
}

stages {
stage('Bootstrap') {
steps {
sh 'npm ci'
}
}
stage('Build') {
steps {
sh 'npm run build'
}
}
stage('Test') {
steps {
sh 'npm run test'
}
}
stage('Publish') {
steps {
echo 'Publish to artifactory'
publishNpmPackage()
}
}
}
post {
success {
script {
postBuild.success(config)
}
}
failure {
script {
postBuild.failure(config)
}
}
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@stencil/webpack",
"name": "@pureconnect/stencil-webpack",
"version": "0.0.6",
"license": "MIT",
"main": "dist/index.js",
Expand All @@ -22,7 +22,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/ionic-team/stencil-webpack.git"
"url": "git+https://github.com/GenesysPureConnect/stencil-webpack.git"
},
"author": "Ionic Team",
"homepage": "https://stenciljs.com/",
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ class StencilPlugin {
private fs: FS;

apply(compiler: any) {
compiler.plugin('emit', (compilation: Complication, callback: Function) => {
compiler.hooks.emit.tapAsync('StencilPlugin',
(compilation: Complication, callback: Function) => {
this.fs = compiler.inputFileSystem;
this.inspectModules(compilation.assets, compilation.modules).then(() => {
callback();
Expand Down
6 changes: 2 additions & 4 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ describe('plugin', () => {
const plugin = new Plugin({
collections: 'node_modules/tool-components/toolcomponents'
});
sinon.spy(mockCompiler, 'plugin');
var callback = sinon.spy(mockCompiler.hooks.emit, 'tapAsync');
plugin.apply(mockCompiler);
expect(mockCompiler.plugin.calledOnce).to.be.true;
expect(mockCompiler.plugin.calledWith('emit')).to.be.true;
expect(callback.called).to.true
});

});
10 changes: 8 additions & 2 deletions test/mock-compiler.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
module.exports = class {
plugin() {}
module.exports = function() {
return {
hooks: {
emit: {
tapAsync: () => {}
}
}
}
}