Load the theme into the test-website

This commit is contained in:
Manuel Thalmann 2019-10-07 17:50:06 +02:00
parent f734303a26
commit 84ada4d843
12 changed files with 179 additions and 36 deletions

3
.gitignore vendored
View file

@ -89,3 +89,6 @@ vendor/
/css/ /css/
/templates/ /templates/
/assets/ /assets/
# Test-theme
/test/website/themes/mantra

View file

@ -35,6 +35,16 @@ export class Settings
*/ */
private libraryPath = "javascript"; private libraryPath = "javascript";
/**
* The path to the test-directory.
*/
private testPath = "test";
/**
* The path to the test-website.
*/
private testWebsitePath = "website";
/** /**
* Initializes a new instance of the `Settings` class. * Initializes a new instance of the `Settings` class.
* *
@ -123,4 +133,32 @@ export class Settings
{ {
return this.RootPath(this.libraryPath, ...path); return this.RootPath(this.libraryPath, ...path);
} }
/**
* Creates a path relative to the test-directory.
*
* @param path
* The path to join.
*
* @returns
* The joined path.
*/
public TestPath(...path: string[])
{
return this.RootPath(this.testPath, ...path);
}
/**
* Creates a path relative to the test-website.
*
* @param path
* The path to join.
*
* @returns
* The joined path.
*/
public TestWebsitePath(...path: string[])
{
return this.TestPath(this.testWebsitePath, ...path);
}
} }

View file

@ -6,7 +6,7 @@ import { TaskFunction } from "gulp";
declare global declare global
{ {
// tslint:disable-next-line: completed-docs // tslint:disable-next-line: completed-docs
interface Function extends TaskFunction interface Function extends Partial<TaskFunction>
{ } { }
} }

View file

@ -4,6 +4,7 @@
// List of extensions which should be recommended for users of this workspace. // List of extensions which should be recommended for users of this workspace.
"recommendations": [ "recommendations": [
"adrianhumphreys.silverstripe",
"ms-vscode.vscode-typescript-tslint-plugin", "ms-vscode.vscode-typescript-tslint-plugin",
"ms-vscode-remote.remote-containers" "ms-vscode-remote.remote-containers"
], ],

View file

@ -53,7 +53,9 @@
"extra": { "extra": {
"scripts-dev": { "scripts-dev": {
"post-install-cmd": [ "post-install-cmd": [
"npm install" "npm install",
"@initialize",
"composer --working-dir=./test/website install"
] ]
} }
} }

2
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "22068a23fc6b360469aeccc3a344ead6", "content-hash": "848468c4f4ad00ed3629fa3cbf2bea5b",
"packages": [], "packages": [],
"packages-dev": [ "packages-dev": [
{ {

View file

@ -1,7 +1,8 @@
import browserify = require("browserify"); import browserify = require("browserify");
import log = require("fancy-log"); import log = require("fancy-log");
import gulp = require("gulp"); import FileSystem = require("fs-extra");
import { TaskFunction } from "gulp"; import { TaskFunction } from "gulp";
import gulp = require("gulp");
import gulpIf = require("gulp-if"); import gulpIf = require("gulp-if");
import terser = require("gulp-terser"); import terser = require("gulp-terser");
import merge = require("merge-stream"); import merge = require("merge-stream");
@ -78,9 +79,28 @@ let settings = new Settings(options["target"]);
/** /**
* Initializes the project. * Initializes the project.
*/ */
export function Initialize(done: () => void) export async function Initialize()
{ {
done(); let directories = [
"javascript",
"css",
"templates",
"assets"
];
let themePath = settings.TestWebsitePath("themes", Path.basename(settings.RootPath()));
for (let directory of directories)
{
await FileSystem.emptyDir(settings.RootPath(directory));
}
if (await FileSystem.pathExists(themePath))
{
await FileSystem.remove(themePath);
}
await require("create-symlink")(settings.RootPath(), themePath, { type: "junction" });
} }
Initialize.description = "Initializes the project."; Initialize.description = "Initializes the project.";
@ -132,7 +152,7 @@ export async function Build()
log.info(watchStartMessage); log.info(watchStartMessage);
} }
Library(); await Library();
} }
/** /**

83
package-lock.json generated
View file

@ -66,6 +66,15 @@
"integrity": "sha512-31Dt9JaGfHretvwVxCBrCFL5iC9MQ3zOXpu+8C4qzW0cxc5rJJVGxB5c/vZ+wmeTk/JjPz/D0gv8BZ+Ip6iCqQ==", "integrity": "sha512-31Dt9JaGfHretvwVxCBrCFL5iC9MQ3zOXpu+8C4qzW0cxc5rJJVGxB5c/vZ+wmeTk/JjPz/D0gv8BZ+Ip6iCqQ==",
"dev": true "dev": true
}, },
"@types/fs-extra": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.0.0.tgz",
"integrity": "sha512-bCtL5v9zdbQW86yexOlXWTEGvLNqWxMFyi7gQA7Gcthbezr2cPSOb8SkESVKA937QD5cIwOFLDFt0MQoXOEr9Q==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/glob": { "@types/glob": {
"version": "7.1.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz",
@ -1220,6 +1229,17 @@
"sha.js": "^2.4.8" "sha.js": "^2.4.8"
} }
}, },
"create-symlink": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/create-symlink/-/create-symlink-1.0.0.tgz",
"integrity": "sha1-QNOKcRdnMiNFdi+Q+NBs8nJiAdc=",
"dev": true,
"requires": {
"graceful-fs": "^4.1.11",
"inspect-with-kind": "^1.0.0",
"is-plain-obj": "^1.1.0"
}
},
"crypto-browserify": { "crypto-browserify": {
"version": "3.12.0", "version": "3.12.0",
"resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz",
@ -1817,6 +1837,17 @@
"map-cache": "^0.2.2" "map-cache": "^0.2.2"
} }
}, },
"fs-extra": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
"integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
"dev": true,
"requires": {
"graceful-fs": "^4.2.0",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
}
},
"fs-mkdirp-stream": { "fs-mkdirp-stream": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz",
@ -2780,6 +2811,15 @@
"xtend": "^4.0.0" "xtend": "^4.0.0"
} }
}, },
"inspect-with-kind": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/inspect-with-kind/-/inspect-with-kind-1.0.5.tgz",
"integrity": "sha512-MAQUJuIo7Xqk8EVNP+6d3CKq9c80hi4tjIbIAT6lmGW9W6WzlHiu9PS8uSuUYU+Do+j1baiFp3H25XEVxDIG2g==",
"dev": true,
"requires": {
"kind-of": "^6.0.2"
}
},
"interpret": { "interpret": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz",
@ -2938,6 +2978,12 @@
} }
} }
}, },
"is-plain-obj": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
"integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=",
"dev": true
},
"is-plain-object": { "is-plain-object": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
@ -3038,6 +3084,15 @@
"integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
"dev": true "dev": true
}, },
"jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
"dev": true,
"requires": {
"graceful-fs": "^4.1.6"
}
},
"jsonify": { "jsonify": {
"version": "0.0.0", "version": "0.0.0",
"resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
@ -3136,6 +3191,14 @@
"pify": "^2.0.0", "pify": "^2.0.0",
"pinkie-promise": "^2.0.0", "pinkie-promise": "^2.0.0",
"strip-bom": "^2.0.0" "strip-bom": "^2.0.0"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
} }
}, },
"lodash.memoize": { "lodash.memoize": {
@ -3720,6 +3783,14 @@
"graceful-fs": "^4.1.2", "graceful-fs": "^4.1.2",
"pify": "^2.0.0", "pify": "^2.0.0",
"pinkie-promise": "^2.0.0" "pinkie-promise": "^2.0.0"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
} }
}, },
"pbkdf2": { "pbkdf2": {
@ -3735,12 +3806,6 @@
"sha.js": "^2.4.8" "sha.js": "^2.4.8"
} }
}, },
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
},
"pinkie": { "pinkie": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
@ -4891,6 +4956,12 @@
"through2-filter": "^3.0.0" "through2-filter": "^3.0.0"
} }
}, },
"universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
"dev": true
},
"unset-value": { "unset-value": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz",

View file

@ -10,6 +10,7 @@
"@types/bootstrap": "^4.3.1", "@types/bootstrap": "^4.3.1",
"@types/browserify": "^12.0.36", "@types/browserify": "^12.0.36",
"@types/fancy-log": "^1.3.1", "@types/fancy-log": "^1.3.1",
"@types/fs-extra": "^8.0.0",
"@types/gulp": "^4.0.6", "@types/gulp": "^4.0.6",
"@types/gulp-if": "0.0.33", "@types/gulp-if": "0.0.33",
"@types/gulp-terser": "^1.2.0", "@types/gulp-terser": "^1.2.0",
@ -23,7 +24,9 @@
"@types/watchify": "^3.7.4", "@types/watchify": "^3.7.4",
"bootstrap": "^4.3.1", "bootstrap": "^4.3.1",
"browserify": "^16.5.0", "browserify": "^16.5.0",
"create-symlink": "^1.0.0",
"fancy-log": "^1.3.3", "fancy-log": "^1.3.3",
"fs-extra": "^8.1.0",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-if": "^3.0.0", "gulp-if": "^3.0.0",
"gulp-terser": "^1.2.0", "gulp-terser": "^1.2.0",

View file

@ -3,6 +3,6 @@ Name: mytheme
--- ---
SilverStripe\View\SSViewer: SilverStripe\View\SSViewer:
themes: themes:
- 'mantra'
- '$public' - '$public'
- 'simple'
- '$default' - '$default'

View file

@ -12,6 +12,11 @@
"phpunit/phpunit": "^5.7" "phpunit/phpunit": "^5.7"
}, },
"extra": { "extra": {
"expose": [
"themes/mantra/assets",
"themes/mantra/css",
"themes/mantra/javascript"
],
"resources-dir": "_resources", "resources-dir": "_resources",
"project-files-installed": [ "project-files-installed": [
"app/.htaccess", "app/.htaccess",

View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "7ff31cbd9aa5ee75c9624d2bb8c3bc5f", "content-hash": "0ab3e4aaf71526993c3dbb3ea6179605",
"packages": [ "packages": [
{ {
"name": "bramus/ansi-php", "name": "bramus/ansi-php",
@ -2216,16 +2216,16 @@
}, },
{ {
"name": "symfony/cache", "name": "symfony/cache",
"version": "v3.4.31", "version": "v3.4.32",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/cache.git", "url": "https://github.com/symfony/cache.git",
"reference": "6a9cc3ed7f61c6c2bc042d0594cdb807b6fea62c" "reference": "5c7bd827617fcb9b13e04e423c31c0fb0bcf0160"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/cache/zipball/6a9cc3ed7f61c6c2bc042d0594cdb807b6fea62c", "url": "https://api.github.com/repos/symfony/cache/zipball/5c7bd827617fcb9b13e04e423c31c0fb0bcf0160",
"reference": "6a9cc3ed7f61c6c2bc042d0594cdb807b6fea62c", "reference": "5c7bd827617fcb9b13e04e423c31c0fb0bcf0160",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2282,20 +2282,20 @@
"caching", "caching",
"psr6" "psr6"
], ],
"time": "2019-08-26T07:52:58+00:00" "time": "2019-09-29T21:19:44+00:00"
}, },
{ {
"name": "symfony/config", "name": "symfony/config",
"version": "v3.4.31", "version": "v3.4.32",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/config.git", "url": "https://github.com/symfony/config.git",
"reference": "24a60c0d7ad98a0fa5d1f892e9286095a389404f" "reference": "717ad66b5257e9752ae3c5722b5810bb4c40b236"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/24a60c0d7ad98a0fa5d1f892e9286095a389404f", "url": "https://api.github.com/repos/symfony/config/zipball/717ad66b5257e9752ae3c5722b5810bb4c40b236",
"reference": "24a60c0d7ad98a0fa5d1f892e9286095a389404f", "reference": "717ad66b5257e9752ae3c5722b5810bb4c40b236",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2346,11 +2346,11 @@
], ],
"description": "Symfony Config Component", "description": "Symfony Config Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2019-08-26T07:52:57+00:00" "time": "2019-09-19T15:32:51+00:00"
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v4.3.4", "version": "v4.3.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
@ -2400,16 +2400,16 @@
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v3.4.31", "version": "v3.4.32",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
"reference": "1fcad80b440abcd1451767349906b6f9d3961d37" "reference": "2b6a666d6ff7fb65d10b97d817c8e7930944afb9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/1fcad80b440abcd1451767349906b6f9d3961d37", "url": "https://api.github.com/repos/symfony/finder/zipball/2b6a666d6ff7fb65d10b97d817c8e7930944afb9",
"reference": "1fcad80b440abcd1451767349906b6f9d3961d37", "reference": "2b6a666d6ff7fb65d10b97d817c8e7930944afb9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2445,7 +2445,7 @@
], ],
"description": "Symfony Finder Component", "description": "Symfony Finder Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2019-08-14T09:39:58+00:00" "time": "2019-09-01T21:32:23+00:00"
}, },
{ {
"name": "symfony/polyfill-apcu", "name": "symfony/polyfill-apcu",
@ -2686,16 +2686,16 @@
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v3.4.31", "version": "v3.4.32",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "3dc414b7db30695bae671a1d86013d03f4ae9834" "reference": "768f817446da74a776a31eea335540f9dcb53942"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/3dc414b7db30695bae671a1d86013d03f4ae9834", "url": "https://api.github.com/repos/symfony/yaml/zipball/768f817446da74a776a31eea335540f9dcb53942",
"reference": "3dc414b7db30695bae671a1d86013d03f4ae9834", "reference": "768f817446da74a776a31eea335540f9dcb53942",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2741,7 +2741,7 @@
], ],
"description": "Symfony Yaml Component", "description": "Symfony Yaml Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2019-08-20T13:31:17+00:00" "time": "2019-09-10T10:38:46+00:00"
}, },
{ {
"name": "webonyx/graphql-php", "name": "webonyx/graphql-php",