Closed nartc closed 4 years ago
@nartc I like this idea. However, due to the nature on how typescript finds its dependencies, it is very difficult to automate. If you can provide a solution, we would warmly accept the PR for that. One major issue is that I don't know what plugins are used. To know this, I would have to make an AST from the config.ts and traverse it for external resources. Then for each of those resources, you have to look up if its a JS that can be used as-is, or a TS that needs to be compiled.
You can't just put a list inside the config.ts, because the config needs to be compiled before it can be read, and the plugins are needed to compile the config.ts.
Also, there is this thing, that you might want to do something special in your TS, so it needs a special tsconfig.json for one plugin, and another for another plugin.
And these are only the initial hurdles.
To make a long story short, we kind of have to build yet another build tool. We currently have no bandwidth for this. For this reason, I'm going to close this issue as wont fix. Not because I don't think its a good idea, but because we can't do it short or mid-term.
@nartc a solution I found is:
include: ["plugins/plugin.ts"]
to ./scully/tsconfig.json
scully.[project].config.ts
, import './scully/plugins/plugin';
@nartc @fabioemoutinho This is an old issue. Also, it is "fixed" a long time ago.
Scully does compile the config, and also pe-compiles everything in the ./scully
folder by default now. If you need anything outside of that folder, add it to the ./scully/tsconfig.json
and Scully will make sure it will be compiled.
(you might want to add the resulting .js
files to the gitIgnore tho!)
@nartc @fabioemoutinho This is an old issue. Also, it is "fixed" a long time ago. Scully does compile the config, and also pe-compiles everything in the
./scully
folder by default now. If you need anything outside of that folder, add it to the./scully/tsconfig.json
and Scully will make sure it will be compiled. (you might want to add the resulting.js
files to the gitIgnore tho!)
For me it only compiles the plugin.ts if I specifically add it to tsconfig (when running npx scully).
Edit: the reason for this behavior is that I had other files in the include
property, it looks like when this is the case, you have to add every file in include array.
"If no 'files' or 'include' property is present in a tsconfig.json, the compiler defaults to including all files in the containing directory and subdirectories except those specified by 'exclude'. When a 'files' property is specified, only those files and those specified by 'include' are included.",
As a reference, my include in ./scully/tsconfig.json
ended up like this:
"include": ["./**/*", "../src/environments/environment.prod.ts"],
🧩 Feature request
Description
Currently, custom plugins need to be written in JavaScript for them to work out of the box. Custom plugins written in TypeScript needs to be
transpiled
to JavaScript before runningnpm run scully
.Since Scully now comes with
### Describe the solution you'd like Extend `scully` to take in options of `pluginsPath` (for lack of better names) and extend `compileTsIfNeeded()`to consider transpiling `plugins`.scully.<proj_name>.config.ts
, there is a need to be able to write custom plugins in TypeScript without much effort.Describe alternatives you've considered
Run
tsc
onpluginsPath
manually before runningscully