Skip to content

Commit

Permalink
Merge pull request #1 in TINYMCE/generator-tinymce from TINY-3689 to …
Browse files Browse the repository at this point in the history
…master

* commit '4c43814576e5dd0eb582c4fca3b09ea7a3085635':
  TINY-3689: Switched to using yarn and fixed tsc compile error
  TINY-3689: Updated the plugin generator to include the new structure so that Plugin doesn't have import side effects
  • Loading branch information
lnewson committed Jun 17, 2019
2 parents 0055864 + 4c43814 commit cddb869
Show file tree
Hide file tree
Showing 10 changed files with 4,186 additions and 5,798 deletions.
5,782 changes: 0 additions & 5,782 deletions package-lock.json

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-tinymce",
"version": "1.2.1",
"version": "1.3.0",
"description": "Bootstrap your TinyMCE plugin",
"author": "Ephox Corporation",
"homepage": "https://github.com/tinymce/generator-tinymce",
Expand Down Expand Up @@ -46,7 +46,7 @@
"repository": "tinymce/generator-tinymce",
"scripts": {
"build": "gulp",
"prepublishOnly": "npm run build",
"prepublishOnly": "yarn run build",
"test": "gulp test",
"watch": "gulp watch"
},
Expand Down
6 changes: 3 additions & 3 deletions src/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = class PluginGenerator extends Generator {
{
name: 'description',
message: 'Add a description',
type: 'string',
type: 'input' as 'input',
default: ''
}
];
Expand Down Expand Up @@ -88,8 +88,8 @@ module.exports = class PluginGenerator extends Generator {

this.installDependencies({
bower: false,
yarn: false,
npm: true
yarn: true,
npm: false
});
}
};
1 change: 1 addition & 0 deletions src/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = class TypeScript extends Generator {
copy('changelog.txt', 'changelog.txt');
copy('src/demo/html/index.html', 'src/demo/html/index.html', { name });
copy('src/demo/ts/Demo.ts', 'src/demo/ts/Demo.ts', { name });
copy('src/main/ts/Main.ts', 'src/main/ts/Main.ts', { name });
copy('src/main/ts/Plugin.ts', 'src/main/ts/Plugin.ts', { name });
copy('src/main/ts/core/AddTwo.ts', 'src/main/ts/core/AddTwo.ts');
copy('src/test/ts/browser/PluginTest.ts', 'src/test/ts/browser/PluginTest.ts', { name });
Expand Down
5 changes: 1 addition & 4 deletions src/plugin/templates/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const swag = require('@ephox/swag');
module.exports = function(grunt) {
var packageData = grunt.file.readJSON('package.json');
var BUILD_VERSION = packageData.version + '-' + (process.env.BUILD_NUMBER ? process.env.BUILD_NUMBER : '0');
const libPluginPath = 'lib/main/ts/Plugin.js';
const libPluginPath = 'lib/main/ts/Main.js';
const scratchPluginPath = 'scratch/compiled/plugin.js';
const scratchPluginMinPath = 'scratch/compiled/plugin.min.js';
const tsDemoSourceFile = path.resolve('src/demo/ts/Demo.ts');
Expand All @@ -33,10 +33,7 @@ module.exports = function(grunt) {
rollup: {
options: {
treeshake: true,
name: 'plugin',
format: 'iife',
banner: '(function () {',
footer: 'plugin();})();',
onwarn: swag.onwarn,
plugins: [
swag.nodeResolve({
Expand Down
9 changes: 9 additions & 0 deletions src/plugin/templates/src/main/ts/Main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Plugin from './Plugin';

Plugin();

/*******
* DO NOT EXPORT ANYTHING
*
* IF YOU DO ROLLUP WILL LEAVE A `<%= name %>` GLOBAL ON THE PAGE
*******/
7 changes: 3 additions & 4 deletions src/plugin/templates/src/main/ts/Plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const setup = (editor, url) => {
});
};

tinymce.PluginManager.add('<%= name %>', setup);

// tslint:disable-next-line:no-empty
export default () => {};
export default () => {
tinymce.PluginManager.add('<%= name %>', setup);
};
2 changes: 1 addition & 1 deletion src/plugin/templates/src/test/ts/atomic/AddTwoTest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { UnitTest, assert } from '@ephox/bedrock';
import { addTwo } from 'src/main/ts/core/AddTwo';
import { addTwo } from '../../../main/ts/core/AddTwo';

// This is an example of an atomic test, that is a test of some functionality separated from the editor.
UnitTest.test('atomic.AddTwoTest', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/ts/templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Welcome stranger! This is a repo containing the <%= camelName %> TinyMCE plugin.

## The development server

By running the `npm start` command you start the development server and open a browser window with an instance of TinyMCE with your plugin added to it. This window will reload automatically whenever a change is detected in the `index.html` file in the `static` folder or in one of the TypeScript files in the `src` directory.
By running the `yarn start` command you start the development server and open a browser window with an instance of TinyMCE with your plugin added to it. This window will reload automatically whenever a change is detected in the `index.html` file in the `static` folder or in one of the TypeScript files in the `src` directory.

## The production build

By running the `npm run build` command Webpack will create a `dist` directory with a child directory with the name of your plugin (<%= name %>) containing three files:
By running the `yarn run build` command Webpack will create a `dist` directory with a child directory with the name of your plugin (<%= name %>) containing three files:

* `plugin.js` - the bundled plugin
* `plugin.min.js` - the bundles, uglified and minified plugin
Expand Down
Loading

0 comments on commit cddb869

Please sign in to comment.