-
-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: project maintanance and typescript fix (#1247)
* chore(generate-loader): : moved ts files to src folder and compile to lib * chore(generate-plugin): : moved ts files to src folder and compile to lib * chore(generators): : moved ts files to src folder and compile to lib * chore(info): : moved ts files to src folder and compile to lib * chore(init): : moved ts files to src folder and compile to lib * chore(migrate): : moved ts files to src folder and compile to lib * chore(serve): : moved ts files to src folder and compile to lib * chore(webpack-scaffold): : moved ts files to src folder and compile to lib * chore(utils): : moved ts files to src folder and compile to lib * chore(package-utils): created new package for processes and packages * chore(logger): logger module * chore(webpack-cli): use new packages for better usability * tests: create test for typescript * chore: added git ignores and changes to package * chore: added git ignore files * chore: renamed file * fix(generators): fix typing * chore: added references * chore: added composite and root dir to typescript config * fix(webpack-cli): removed logger * chore(migrate): fixed tests * fix(utils): broken test
- Loading branch information
Showing
269 changed files
with
3,603 additions
and
3,284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*.js | ||
lib/ |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
{ | ||
"extends": "../../tsconfig.packages.json" | ||
} | ||
{ | ||
"extends": "../../tsconfig.packages.json", | ||
"compilerOptions": { | ||
"outDir": "./lib", | ||
"rootDir": "./src", | ||
"composite": true | ||
}, | ||
"include": ["./src"], | ||
"references": [ | ||
{"path": "../generators"} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*.js | ||
lib/ |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
{ | ||
"extends": "../../tsconfig.packages.json" | ||
} | ||
{ | ||
"extends": "../../tsconfig.packages.json", | ||
"compilerOptions": { | ||
"outDir": "./lib", | ||
"rootDir": "./src", | ||
"composite": true | ||
}, | ||
"include": ["./src"], | ||
"references": [{ "path": "../generators" }] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
!*.test.js | ||
!/**/*.test.js | ||
!/templates/*.js | ||
lib/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import mkdirp from 'mkdirp'; | ||
import path from 'path'; | ||
import Generator from 'yeoman-generator'; | ||
import { generatorCopy, generatorCopyTpl } from '@webpack-cli/utils'; | ||
|
||
/** | ||
* Creates a Yeoman Generator that generates a project conforming | ||
* to webpack-defaults. | ||
* | ||
* @param {Generator.Questions} prompts An array of Yeoman prompt objects | ||
* | ||
* @param {string} templateDir Absolute path to template directory | ||
* | ||
* @param {string[]} copyFiles An array of file paths (relative to `./templates`) | ||
* of files to be copied to the generated project. File paths should be of the | ||
* form `path/to/file.js.tpl`. | ||
* | ||
* @param {string[]} copyTemplateFiles An array of file paths (relative to | ||
* `./templates`) of files to be copied to the generated project. Template | ||
* file paths should be of the form `path/to/_file.js.tpl`. | ||
* | ||
* @param {Function} templateFn A function that is passed a generator instance and | ||
* returns an object containing data to be supplied to the template files. | ||
* | ||
* @returns {Generator} A class extending Generator | ||
*/ | ||
const addonGenerator = ( | ||
prompts: Generator.Questions, | ||
templateDir: string, | ||
copyFiles: string[], | ||
copyTemplateFiles: string[], | ||
templateFn: Function, | ||
): typeof Generator => { | ||
return class extends Generator { | ||
public props: Generator.Question; | ||
public copy: (value: string, index: number, array: string[]) => void; | ||
public copyTpl: (value: string, index: number, array: string[]) => void; | ||
|
||
public prompting(): Promise<void | {}> { | ||
return this.prompt(prompts).then((props: Generator.Question): void => { | ||
this.props = props; | ||
}); | ||
} | ||
|
||
public default(): void { | ||
const currentDirName = path.basename(this.destinationPath()); | ||
if (currentDirName !== this.props.name) { | ||
this.log(` | ||
Your project must be inside a folder named ${this.props.name} | ||
I will create this folder for you. | ||
`); | ||
mkdirp(this.props.name, (err: object): void => { | ||
if (err) console.error('Failed to create directory', err); | ||
}); | ||
const pathToProjectDir: string = this.destinationPath(this.props.name); | ||
this.destinationRoot(pathToProjectDir); | ||
} | ||
} | ||
|
||
public writing(): void { | ||
this.copy = generatorCopy(this, templateDir); | ||
this.copyTpl = generatorCopyTpl(this, templateDir, templateFn(this)); | ||
|
||
copyFiles.forEach(this.copy); | ||
copyTemplateFiles.forEach(this.copyTpl); | ||
} | ||
|
||
public install(): void { | ||
this.npmInstall(['webpack-defaults', 'bluebird'], { | ||
'save-dev': true, | ||
}); | ||
} | ||
|
||
public end(): void { | ||
this.spawnCommand('npm', ['run', 'defaults']); | ||
} | ||
}; | ||
}; | ||
|
||
export default addonGenerator; |
File renamed without changes.
Oops, something went wrong.