Skip to content
This repository has been archived by the owner on Dec 14, 2019. It is now read-only.

Commit

Permalink
Merge pull request #178 from Pageworks/develop
Browse files Browse the repository at this point in the history
Papertrain v0.2.1
  • Loading branch information
Kyle Andrews committed Jun 17, 2019
2 parents 4b3a404 + ab83ec4 commit 8de000d
Show file tree
Hide file tree
Showing 11 changed files with 280 additions and 243 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,15 @@
## 0.2.1 - 2010-06-17

### Added

- Adds: better NPM package code splitting for Webpack [#177](https://github.com/Pageworks/papertrain/issues/177)
- Adds: adds base path config to the generator script [#176](https://github.com/Pageworks/papertrain/issues/176)
- Adds: the `beforeDestroy()` method returns a promise and doesn't remove the Node until the promise resolves [#175](https://github.com/Pageworks/papertrain/issues/175)

### Fixed

- Fixes: the default element normalization only effects elements within the custom `<page-view>` element

## 0.2.0 - 2019-06-10

### Added
Expand Down
4 changes: 0 additions & 4 deletions build-tools/generator/files/script.js
Expand Up @@ -21,10 +21,6 @@ export class REPLACE_ME extends Module{
afterMount(){

}

beforeDestroy(){

}
}

// Adds module to the global Modules object
Expand Down
4 changes: 0 additions & 4 deletions build-tools/generator/files/script.ts
Expand Up @@ -21,10 +21,6 @@ export class REPLACE_ME extends Module{
afterMount(){

}

beforeDestroy(){

}
}

// Adds module to the global Modules object
Expand Down
14 changes: 8 additions & 6 deletions build-tools/generator/generate.js
Expand Up @@ -11,6 +11,8 @@ const spinner = ora();
// =====================[ BEGIN CONFIG ]=====================

const HTMLFileType = 'twig';
const basePath = 'templates';


// ======================[ END CONFIG ]======================

Expand Down Expand Up @@ -93,22 +95,22 @@ function getUserInput(){

switch(generationType){
case 'Global':
defaultPath = 'templates/_lib/globals'
defaultPath = `${ basePath }/_lib/globals`
break;
case 'Object':
defaultPath = 'templates/_lib/objects'
defaultPath = `${ basePath }/_lib/objects`
break;
case 'Component':
defaultPath = 'templates/_lib/components'
defaultPath = `${ basePath }/_lib/components`
break;
case 'Template':
defaultPath = 'templates/'
defaultPath = `${ basePath }/`
break;
case 'Macro':
defaultPath = 'templates/_macros'
defaultPath = `${ basePath }/_macros`
break;
default:
defaultPath = 'templates/'
defaultPath = `${ basePath }/`
break;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "papertrain",
"description": "Papertrain: a Craft CMS toolkit",
"version": "0.2.0",
"version": "0.2.1",
"author": "Pageworks",
"license": "MIT",
"repository": {
Expand Down
2 changes: 2 additions & 0 deletions templates/_layouts/base.twig
Expand Up @@ -231,6 +231,7 @@
{% include "_layouts/global-javascript.twig" %}

{% spaceless %}
<page-view>
{# Page Transition Animation #}
<div class="c-transition">
<div class="c-transition_primary"></div>
Expand All @@ -239,6 +240,7 @@
<main role="main" class="js-pjax">
{% block content %}{% endblock %}
</main>
</page-view>
{% endspaceless %}

{% set applicationPaths = craft.papertrain.getAssetPaths(['application']) %}
Expand Down
24 changes: 17 additions & 7 deletions utils/scripts/Application.ts
Expand Up @@ -119,13 +119,23 @@ export class Application{
const index = this.modules.indexOf(module);

/** Fire the before destroy event */
module.beforeDestroy();

/** Fire the destroy event */
module.destroy();

/** Splice the module from the array */
this.modules.splice(index, 1);
module.beforeDestroy().then(() => {
/** Fire the destroy event */
module.destroy();

/** Splice the module from the array */
this.modules.splice(index, 1);
})
.catch(e => {
if(Env.isDebug){
console.error('Something went wrong while destroying a module', e);
}
/** Fire the destroy event */
module.destroy();

/** Splice the module from the array */
this.modules.splice(index, 1);
});
}
});
}else{
Expand Down
4 changes: 3 additions & 1 deletion utils/scripts/Module.ts
Expand Up @@ -67,7 +67,9 @@ export class Module {
* Called by the runtime application before the module is destroyed.
* Used to remove event listeners and end infinite callbacks.
*/
public beforeDestroy():void{}
public beforeDestroy():Promise<unknown>{
return Promise.resolve();
}

/** Called by the runtime application when the module needs to be destroyed. */
public destroy():void{
Expand Down

0 comments on commit 8de000d

Please sign in to comment.