Skip to content

Commit

Permalink
Added legacy support to build plugin into /web directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
srm985 committed Mar 26, 2019
1 parent 1b2536f commit 1035601
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/plugin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/plugin.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions gulp.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = () => ({
},
directories: {
distDirectory: './dist',
legacyWebDirectory: './web',
rootDirectory: './',
srcDirectory: './src',
tasksDirectory: './tasks'
Expand All @@ -42,12 +43,14 @@ module.exports = () => ({
buildEnvironment: 'BUILD_ENVIRONMENT',
injectedEnvironment: 'INJECTED_ENVIRONMENT'
},
legacyBundleName: 'axure-redline-plugin',
packageJSON: './package.json',
tasks: {
bumpVersion: 'bump-version',
bundle: 'bundle',
cleanDist: 'clean',
generatePlugin: 'generate-plugin',
legacySupport: 'legacy-support',
lintCSS: 'lint-css',
lintJS: 'lint-js',
serveInject: 'serve-inject',
Expand Down
6 changes: 5 additions & 1 deletion tasks/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const {
},
tasks: {
bundle,
generatePlugin
generatePlugin,
legacySupport
},
webpackConfig
} = require('../gulp.config.js')();
Expand All @@ -34,6 +35,9 @@ gulp.task(bundle, (callback) => {
browserSync.reload();
} else {
gulp.start(generatePlugin);

// Because our jsDelivr scripts using @latest still point to /web/axure-redline-plugin.js
gulp.start(legacySupport);
}

if (environment === production) {
Expand Down
4 changes: 3 additions & 1 deletion tasks/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const gulp = require('gulp');

const {
directories: {
distDirectory
distDirectory,
legacyWebDirectory
},
tasks: {
cleanDist
Expand All @@ -12,4 +13,5 @@ const {

gulp.task(cleanDist, () => {
del.sync([`${distDirectory}/**`, `!${distDirectory}`]);
del.sync([`${legacyWebDirectory}/**`, `!${legacyWebDirectory}`]);
});
18 changes: 18 additions & 0 deletions tasks/legacy-support.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const gulp = require('gulp');
const rename = require('gulp-rename');

const {
bundleName,
directories: {
distDirectory,
legacyWebDirectory
},
legacyBundleName,
tasks: {
legacySupport
}
} = require('../gulp.config.js')();

gulp.task(legacySupport, () => gulp.src(`${distDirectory}/${bundleName}.js`)
.pipe(rename(`${legacyBundleName}.js`))
.pipe(gulp.dest(`${legacyWebDirectory}`)));
69 changes: 69 additions & 0 deletions web/axure-redline-plugin.js

Large diffs are not rendered by default.

0 comments on commit 1035601

Please sign in to comment.